AlbumShaper  1.0a3
framing.cpp
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 //Systemwide includes
12 #include <qfile.h>
13 #include <q3textstream.h>
14 #include <qstringlist.h>
15 #include <qnamespace.h>
16 #include <qkeysequence.h>
17 
18 //Projectwide includes
19 #include "framing.h"
20 #include "helpWindow.h"
21 #include "../../config.h"
22 
23 //==============================================
25 {
26  return QString("%1/framing.html").arg(TEMP_DIR);
27 }
28 //==============================================
29 void Framing::generateHTML(Q3TextStream::Encoding type, QString charSet)
30 {
31  QString ctrlKey;
32 #if defined(Q_OS_MACX)
33  ctrlKey = "Command";
34 #else
35  ctrlKey = "Ctrl";
36 #endif
37 
38  //create/open html file
39  QFile file( filename() );
40  if(file.open(QIODevice::WriteOnly))
41  {
42  //-----
43  Q3TextStream stream;
44  stream.setEncoding( type );
45  stream.setDevice( &file );
46  //-----
47  stream << "<html><head>\n";
48  stream << "<meta http-equiv='Content-Type' content='text/html; charset=" << charSet << "'>\n";
49  stream << "</head><body>\n";
50  stream << "<table cellpadding='4'><tr>\n";
51  stream << "<td><img src='" << IMAGE_PATH << "helpImages/asHelpLogoSmall.png'></td>\n";
52  stream << "<td valign='middle'><font face='Arial, sans-serif' size='+3'>";
53  stream << HelpWindow::tr("Framing") << "</font></td>\n";
54  stream << "</tr></table>\n";
55 
56  stream << "<font face='Arial, sans-serif'>\n";
57  stream << "<table cellspacing='10' cellpadding='0'><tr><td>\n";
58 
59  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
60  stream << "<font size='+1'><b>" << HelpWindow::tr("Batch Effects:") << "</b></font>\n";
61  stream << "</td></tr></table>\n";
62 
63  stream << "<p align='justify'>\n";
64  stream << HelpWindow::tr("Album Shaper makes rotating your pictures a snap; in fact, you can rotate multiple pictures at once! Select one or more photos in a collection and click the <font color='red'>Rotate Right</font> or <font color='red'>Rotate Left</font> button. If you scanned a negative backwards and need a quick flip, or if you took that photo that is a little tilted, double click the photo or select it and switch to the <font color='red'>Edit</font> tab to use additional framing tools.") << "\n";
65 
66  stream << "</td></tr><tr><td>\n";
67 
68  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
69  stream << "<font size='+1'><b>" << HelpWindow::tr("Rotating & Flipping:") << "</b></font>\n";
70  stream << "</td></tr></table>\n";
71 
72  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
73  stream << "<p align='justify'>\n";
74  stream << HelpWindow::tr("Using the framing controls found at the bottom left of the photo editor, you can rotate, correct tilt, flip, and crop your photos. Rotate and flip operations require a single click.") << "\n";
75  stream << "</td><td valign='middle'>\n";
76  stream << "<img src='" << IMAGE_PATH << "helpImages/frameControls.png'>\n";
77  stream << "</td></tr></table>\n";
78 
79  stream << "</td></tr><tr><td>\n";
80 
81  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
82  stream << "<font size='+1'><b>" << HelpWindow::tr("Tilt Correction:") << "</b></font>\n";
83  stream << "</td></tr></table>\n";
84 
85  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
86  stream << "<img src='" << IMAGE_PATH << "helpImages/tiltCorrection.png'>\n";
87  stream << "</td><td valign='middle'>\n";
88  stream << "<p align='justify'>\n";
89  stream << HelpWindow::tr("You can correct tilt in images by identifying what should be a vertical or horizontal edge. Click the green tilt correction button, then click two places along what should be a vertical or horizontal edge. Album Shaper takes cares of the rest, figuring out how many degrees to rotate your image for you.") << "\n";
90  stream << "</td></tr></table>\n";
91 
92  stream << "</td></tr><tr><td>\n";
93 
94  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
95  stream << "<font size='+1'><b>" << HelpWindow::tr("Cropping:") << "</b></font>\n";
96  stream << "</td></tr></table>\n";
97 
98  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
99  stream << "<p align='justify'>\n";
100  stream << HelpWindow::tr("Cropping to preset size is easy. First, select the dimensions you are interested in from the aspect ratio menu. The largest portion of the photo that matches that size is automatically selected. Simply click and drag to move the selected region. You can scale the selection by holding Shift and clicking and dragging right and left to expand or shrink the selection about its center. To crop to the selected region, click the <font color='red'>crop</font> button.") << "\n";
101  stream << "</td><td valign='middle'>\n";
102  stream << "<img src='" << IMAGE_PATH << "helpImages/cropping5x7.png'>\n";
103  stream << "</td></tr></table>\n";
104 
105  stream << "</td></tr><tr><td>\n";
106 
107  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
108  stream << "<img src='" << IMAGE_PATH << "helpImages/dpiWarning.png'>\n";
109  stream << "</td><td valign='middle'>\n";
110  stream << "<p align='justify'>\n";
111  stream << HelpWindow::tr("Album Shaper takes the difficulties out of cropping and printing your photos. If you crop too small, you will get lower quality prints. If Album Shaper knows the dimensions you want, it passively lets you know if you are cropping too small by changing the color of the selection rectangle. If the selection rectangle turns red, you know the quality of your print will be lower. In such situations the target DPI (dots per inch) is printed next to the selected resolution.") << "\n";
112  stream << "</td></tr></table>\n";
113 
114  stream << "</td></tr><tr><td>\n";
115 
116  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
117  stream << "<p align='justify'>\n";
118  stream << HelpWindow::tr("In addition to cropping to standard print sizes, you can crop images to your current display resolution for creating desktop wallpapers, or even crop to a custom size by clicking and dragging out a selection. You can adjust the corners and edges of the selection independently by clicking and dragging as well.") << "\n";
119  stream << "<p>\n";
120  stream << QString(HelpWindow::tr("To rotate the selected region about its center, hold %1 and click the selected region.")).arg(ctrlKey) << "\n";
121  stream << "</td><td valign='middle'>\n";
122  stream << "<img src='" << IMAGE_PATH << "helpImages/customRotate.png'>\n";
123  stream << "</td></tr></table>\n";
124 
125  stream << "</font>\n";
126  stream << "</body></html>\n";
127  file.close();
128  }
129 }
130 //==============================================
QString TEMP_DIR
Definition: config.cpp:23
QString IMAGE_PATH
Definition: config.cpp:18
static void generateHTML(Q3TextStream::Encoding type, QString charSet)
generates the html file
Definition: framing.cpp:29
static QString filename()
returns the html filename
Definition: framing.cpp:24