AlbumShaper  1.0a3
importing.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 "importing.h"
20 #include "helpWindow.h"
21 #include "../../config.h"
22 
23 //==============================================
25 {
26  return QString("%1/importing.html").arg(TEMP_DIR);
27 }
28 //==============================================
29 void Importing::generateHTML(Q3TextStream::Encoding type, QString charSet)
30 {
31  QString finder = HelpWindow::tr("the desktop or the Finder");
32  QString exporer = HelpWindow::tr("the desktop or Windows Explorer");
33  QString desktop = HelpWindow::tr("the desktop");
34 
35  QString dragLocation;
36  QString ctrlKey;
37 #if defined(Q_OS_MACX)
38  dragLocation = finder;
39  ctrlKey = "Command";
40 #elif defined(Q_OS_WIN)
41  dragLocation = exporer;
42  ctrlKey = "Ctrl";
43 #else
44  dragLocation = desktop;
45  ctrlKey = "Ctrl";
46 #endif
47 
48  //create/open html file
49  QFile file( filename() );
50  if(file.open(QIODevice::WriteOnly))
51  {
52  //-----
53  Q3TextStream stream;
54  stream.setEncoding( type );
55  stream.setDevice( &file );
56  //-----
57  stream << "<html><head>\n";
58  stream << "<meta http-equiv='Content-Type' content='text/html; charset=" << charSet << "'>\n";
59  stream << "</head><body>\n";
60  stream << "<table cellpadding='4'><tr>\n";
61  stream << "<td><img src='" << IMAGE_PATH << "helpImages/asHelpLogoSmall.png'></td>\n";
62  stream << "<td valign='middle'><font face='Arial, sans-serif' size='+3'>";
63  stream << HelpWindow::tr("Importing & Organizing") << "</font></td>\n";
64  stream << "</tr></table>\n";
65 
66  stream << "<font face='Arial, sans-serif'>\n";
67  stream << "<table cellspacing='10' cellpadding='0'><tr><td>\n";
68 
69  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
70  stream << "<font size='+1'><b>" << HelpWindow::tr("Albums, Collections, and Photos:") << "</b></font>\n";
71  stream << "</td></tr></table>\n";
72 
73  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
74  stream << "<p align='justify'>\n";
75  stream << HelpWindow::tr("Album Shaper lets you organize your photos into albums much as one does with film and traditional prints. Since photo albums are often created for more complex or longer events, such as multi-day trips, an additional level of organization (collections) has been added. Photo albums contain one or more collections, each of which can contain as many photos as you choose.") << "\n";
76  stream << "</td></tr></table>\n";
77 
78  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
79  stream << "<font size='+1'><b>" << HelpWindow::tr("Importing:") <<"</b></font>\n";
80  stream << "</td></tr></table>\n";
81 
82  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
83  stream << "<p align='justify'>\n";
84  stream << HelpWindow::tr("When you start Album Shaper, you are presented an empty album that contains a single, empty collection. A list of the album collections is shown on the left, while the majority of the screen is used to show the photos in the currently selected collection.") << "\n";
85  stream << "</td><td valign='middle'>\n";
86  stream << "<img src='" << IMAGE_PATH << "helpImages/newAlbum.png'>\n";
87  stream << "</td></tr></table>\n";
88 
89  stream << "</td></tr><tr><td>\n";
90 
91  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
92  stream << "<img src='" << IMAGE_PATH << "helpImages/addRemoveButtons.png'>\n";
93  stream << "</td><td valign='middle'>\n";
94  stream << "<p align='justify'>\n";
95  stream << HelpWindow::tr("To add photos to your album, click the <font color='red'>Add Photo</font> button and select the photos you wish to insert. If you have already started labeling your photos by changing their filenames, check the <font color='red'>use filenames for descriptions</font> checkbox to automatically assign labels to your imported photos.") << "\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 << QString(HelpWindow::tr("Alternatively, you can import photos by dragging them from %1 and dropping them on the organize view. Album Shaper makes extensive use of drag and drop throughout the album creation process.")).arg(dragLocation) << "\n";
101  stream << "</td><td valign='middle'>\n";
102  stream << "<img src='" << IMAGE_PATH << "helpImages/addingPhotos.png'>\n";
103  stream << "</td></tr></table>\n";
104 
105  stream << "</td></tr><tr><td>\n";
106 
107  stream << "<table width='100%' cellpadding='4' cellspacing='0'><tr><td bgcolor='lightgray'>\n";
108  stream << "<font size='+1'><b>" << HelpWindow::tr("Organizing:") << "</b></font>\n";
109  stream << "</td></tr></table>\n";
110 
111  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
112  stream << "<img src='" << IMAGE_PATH << "helpImages/createCollection.png'>\n";
113  stream << "</td><td valign='middle'>\n";
114  stream << "<p align='justify'>\n";
115  stream << HelpWindow::tr("When imported, photos are always placed at the end of the currently selected collection. In order to create additional collections, click the <font color='red'>Create</font> button below the list of collections. The new collection will be automatically selected and ready for you to import photos. You can switch between collections by clicking a collection icon in this list.") << "\n";
116  stream << "</td></tr></table>\n";
117 
118  stream << "<table cellpadding='4' cellspacing='0'><tr><td valign='middle'>\n";
119  stream << "<p align='justify'>\n";
120  stream << QString(HelpWindow::tr("Photos can be rearranged within collections by selecting them, then dragging and dropping them on their intended placement. To select a range of photos, select the first photo, then, while holding the Shift key, select the last photo in a range. All photos in between should now be selected. You can add or remove photos individually from the selection by holding the %1 key while selecting photos.")).arg(ctrlKey) << "\n";
121 
122  stream << "<p align='justify'>\n";
123  stream << HelpWindow::tr("In addition to moving photos within collections, photos can also be moved from one collection to another, using drag and drop. Collections themselves can be reordered within the collections listing using drag and drop as well.") << "\n";
124 
125  stream << "</td><td valign='middle'>\n";
126  stream << "<img src='" << IMAGE_PATH << "helpImages/multipleCollections.png'>\n";
127  stream << "</td></tr></table>\n";
128 
129  stream << "<p align='justify'>\n";
130  stream << HelpWindow::tr("In order to remove one or more photos, simply select them and click the <font color='red'>Remove Photo</font> button. You can also remove entire collections at a time, using the <font color='red'>Delete</font> button at the bottom of the collections listing.") << "\n";
131 
132  stream << "</td></tr></table>\n";
133 
134  stream << "</td></tr>\n";
135  stream << "</table></font>\n";
136  stream << "</body></html>\n";
137  file.close();
138  }
139 }
140 //==============================================
QString TEMP_DIR
Definition: config.cpp:23
static void generateHTML(Q3TextStream::Encoding type, QString charSet)
generates the html file
Definition: importing.cpp:29
QString IMAGE_PATH
Definition: config.cpp:18
static QString filename()
returns the html filename
Definition: importing.cpp:24