AlbumShaper 1.0a3
help/shortcuts.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 "shortcuts.h"
20#include "helpWindow.h"
21#include "../../config.h"
22
23//==============================================
25{
26 return QString("%1/shortcuts.html").arg(TEMP_DIR);
27}
28//==============================================
29void Shortcuts::generateHTML(Q3TextStream::Encoding type, QString charSet)
30{
31 QString Control = "Ctrl";
32 QString ControlPlus = "Ctrl+";
33#if defined(Q_OS_MACX)
34 Control = (QString(QChar(0x2318)));
35 ControlPlus = Control;
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 //-----
51 stream << "<table cellpadding='4'><tr>\n";
52 stream << " <td><img src='" << IMAGE_PATH << "helpImages/asHelpLogoSmall.png'></td>\n";
53 stream << " <td valign='middle'><font face='Arial, sans-serif' size='+3'>";
54 stream << HelpWindow::tr("Keyboard Shortcuts") << "</font></td>\n";
55 stream << "</tr></table>\n";
56
57 stream << "<font face='Arial, sans-serif'>\n";
58 stream << "<table cellspacing='10' cellpadding='0'><tr><td>\n";
59
60 stream << "<table width='100%' cellpadding='4' cellspacing='0'>\n";
61 stream << "<tr><td width='50%' bgcolor='lightgray'><font size='+1'><b>" << HelpWindow::tr("Action") << "</font></b></td>\n";
62 stream << "<td width='50%' bgcolor='lightgray'><font size='+1'><b>" << HelpWindow::tr("Shortcut") << "</font></b></td></tr>\n";
63 stream << "<!-- -------------------------------------------------- -->\n";
64 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Opening &amp; Saving") << "</u></font></b></td></tr>\n";
65 stream << "<tr><td>" << HelpWindow::tr("New album") << "</td>\n";
66 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_N)) << "</td></tr>\n";
67 stream << "<tr><td>" << HelpWindow::tr("Open album") << "</td>\n";
68 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_O)) << "</td></tr>\n";
69 stream << "<tr><td>" << HelpWindow::tr("Open recent album") << "</td>\n";
70 stream << " <td>" << ControlPlus << "[1-9]" << "</td></tr>\n";
71 stream << "<tr><td>" << HelpWindow::tr("Save album") << "</td>\n";
72 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_S)) << "</td></tr>\n";
73 stream << "<tr><td>" << HelpWindow::tr("Save album as") << "</td>\n";
74 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_S)) << "</td></tr>\n";
75 stream << "<tr><td>" << HelpWindow::tr("Quit") << "</td>\n";
76 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_Q)) << "</td></tr>\n";
77 stream << "<!-- -------------------------------------------------- -->\n";
78 stream << "<tr><td colspan='2'><hr></td></tr>\n";
79 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Organizing") << "</u></font></b></td></tr>\n";
80 stream << "<tr><td>" << HelpWindow::tr("Move to the first photo in the collection") << "</td>\n";
81 stream << " <td> Home </td></tr>\n";
82 stream << "<tr><td>" << HelpWindow::tr("Move to the last photo in the collection") << "</td>\n";
83 stream << " <td> End </td></tr>\n";
84 stream << "<tr><td>" << HelpWindow::tr("Select all photos") << "</td>\n";
85 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
86 stream << "<tr><td>" << HelpWindow::tr("Deselect all photos") << "</td>\n";
87 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
88 stream << "<tr><td>" << HelpWindow::tr("Rotate selected photos right") << "</td>\n";
89 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_R)) << "</td></tr>\n";
90 stream << "<tr><td>" << HelpWindow::tr("Rotate selected photos left") << "</td>\n";
91 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_L)) << "</td></tr>\n";
92 stream << "<tr><td>" << HelpWindow::tr("Delete selected photos") << "</td>\n";
93 stream << " <td> Del </td></tr>\n";
94 stream << "<tr><td>" << HelpWindow::tr("Modify selected photo description") << "</td>\n";
95 stream << " <td> Enter </td></tr>\n";
96 stream << "<tr><td>" << HelpWindow::tr("Finish modifying selected photo description") << "</td>\n";
97 stream << " <td> Esc </td></tr>\n";
98 stream << "<tr><td>" << HelpWindow::tr("Edit first of selected photos") << "</td>\n";
99 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_E)) << "</td></tr>\n";
100 stream << "<!-- -------------------------------------------------- -->\n";
101 stream << "<tr><td colspan='2'><hr></td></tr>\n";
102 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Editing") << "</u></font></b></td></tr>\n";
103
104 stream << "<tr><td>" << HelpWindow::tr("Go to previous photo") << "</td>\n";
105 stream << " <td> PgUp </td></tr>\n";
106 stream << "<tr><td>" << HelpWindow::tr("Go to next photo") << "</td>\n";
107 stream << " <td> PgDown </td></tr>\n";
108 stream << "<tr><td>" << HelpWindow::tr("Go to first photo in the collection") << "</td>\n";
109 stream << " <td> Home </td></tr>\n";
110 stream << "<tr><td>" << HelpWindow::tr("Go to last photo in the collection") << "</td>\n";
111 stream << " <td> End </td></tr>\n";
112 stream << "<tr><td>" << HelpWindow::tr("Return to organizing") << "</td>\n";
113 stream << " <td> Esc </td></tr>\n";
114
115 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
116 stream << "<tr><td colspan='2'>&nbsp;</td></tr>\n";
117 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
118 stream << "<tr><td>" << HelpWindow::tr("Rotate photo right") << "</td>\n";
119 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_R)) << "</td></tr>\n";
120 stream << "<tr><td>" << HelpWindow::tr("Rotate photo left") << "</td>\n";
121 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_L)) << "</td></tr>\n";
122 stream << "<tr><td>" << HelpWindow::tr("Flip photo horizontally") << "</td>\n";
123 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_F)) << "</td></tr>\n";
124 stream << "<tr><td>" << HelpWindow::tr("Flip photo vertically") << "</td>\n";
125 stream << " <td>" << ((QString)QKeySequence(Qt::ALT + Qt::CTRL + Qt::Key_F)) << "</td></tr>\n";
126 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
127 stream << "<tr><td colspan='2'>&nbsp;</td></tr>\n";
128 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
129 stream << "<tr><td>" << HelpWindow::tr("Select all") << "</td>\n";
130 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
131 stream << "<tr><td>" << HelpWindow::tr("Deselect all") << "</td>\n";
132 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
133 stream << "<tr><td>" << HelpWindow::tr("Nudge selection left") << "</td>\n";
134 stream << " <td>&larr;</td></tr>\n";
135 stream << "<tr><td>" << HelpWindow::tr("Nudge selection right") << "</td>\n";
136 stream << " <td>&rarr;</td></tr>\n";
137 stream << "<tr><td>" << HelpWindow::tr("Nudge selection up") << "</td>\n";
138 stream << " <td>&uarr;</td></tr>\n";
139 stream << "<tr><td>" << HelpWindow::tr("Nudge selection down") << "</td>\n";
140 stream << " <td>&darr;</td></tr>\n";
141 stream << "<tr><td>" << HelpWindow::tr("Expand selection") << "</td>\n";
142 stream << " <td>" << ((QString)QKeySequence(Qt::Key_Plus,Qt::Key_Equal)) << "</td></tr>\n";
143 stream << "<tr><td>" << HelpWindow::tr("Shrink selection") << "</td>\n";
144 stream << " <td>" << ((QString)QKeySequence(Qt::Key_Minus,Qt::Key_Underscore)) << "</td></tr>\n";
145 stream << "<tr><td>" << HelpWindow::tr("Resize selection") << "</td>\n";
146 stream << " <td>" << HelpWindow::tr("Press and hold Shift, then Click and Drag Left / Right") << "</td></tr>\n";
147 stream << "<tr><td>" << HelpWindow::tr("Rotate selection") << "</td>\n";
148 stream << " <td>" << (QString(HelpWindow::tr("Press and hold %1, then Click selection"))
149 .arg( Control )) << "</td></tr>\n";
150 stream << "<!-- -------------------------------------------------- -->\n";
151 stream << "<tr><td colspan='2'><hr></td></tr>\n";
152 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Levels and Grain Editors") << "</u></font></b></td></tr>\n";
153
154 stream << "<tr><td>" << HelpWindow::tr("Show alternative") << "</td>\n";
155 stream << " <td>" << QString(HelpWindow::tr("Hold %1")).arg( Control ) << "</td></tr>\n";
156 stream << "<tr><td>" << HelpWindow::tr("Select entire luminosity/color range") << "</td>\n";
157 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
158 stream << "<tr><td>" << HelpWindow::tr("Apply") << "</td>\n";
159 stream << " <td> Enter </td></tr>\n";
160 stream << "<tr><td>" << HelpWindow::tr("Cancel") << "</td>\n";
161 stream << " <td> Esc </td></tr>\n";
162
163 stream << "<!-- -------------------------------------------------- -->\n";
164 stream << "<tr><td colspan='2'><hr></td></tr>\n";
165 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Miscellaneous") << "</u></font></b></td></tr>\n";
166 stream << "<tr><td>" << HelpWindow::tr("View album statistics") << "</td>\n";
167 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_I)) << "</td></tr>\n";
168 stream << "<tr><td>" << HelpWindow::tr("Album Shaper help") << "</td>\n";
169 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_Question)) << "</td></tr>\n";
170 stream << "<!-- -------------------------------------------------- -->\n";
171 stream << "</table>\n";
172
173 stream << "</td></tr>\n";
174 stream << "</table></font>\n";
175
176 stream << "</body></html>\n";
177 file.close();
178 }
179}
180//==============================================
static void generateHTML(Q3TextStream::Encoding type, QString charSet)
generates the shortcuts html file
static QString filename()
returns the shortcuts html filename
QString IMAGE_PATH
Definition config.cpp:18
QString TEMP_DIR
Definition config.cpp:23