00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <qfile.h>
00013 #include <qtextstream.h>
00014 #include <qstringlist.h>
00015 #include <qnamespace.h>
00016 #include <qkeysequence.h>
00017
00018
00019 #include "shortcuts.h"
00020 #include "helpWindow.h"
00021 #include "../../config.h"
00022
00023
00024 QString Shortcuts::filename()
00025 {
00026 return QString("%1/shortcuts.html").arg(TEMP_DIR);
00027 }
00028
00029 void Shortcuts::generateHTML(QTextStream::Encoding type, QString charSet)
00030 {
00031 QString Control = "Ctrl";
00032 QString ControlPlus = "Ctrl+";
00033 #if defined(Q_OS_MACX)
00034 Control = (QString(QChar(0x2318)));
00035 ControlPlus = Control;
00036 #endif
00037
00038
00039 QFile file( filename() );
00040 if(file.open(IO_WriteOnly))
00041 {
00042
00043 QTextStream stream;
00044 stream.setEncoding( type );
00045 stream.setDevice( &file );
00046
00047 stream << "<html><head>\n";
00048 stream << "<meta http-equiv='Content-Type' content='text/html; charset=" << charSet << "'>\n";
00049 stream << "</head><body>\n";
00050
00051 stream << "<table cellpadding='4'><tr>\n";
00052 stream << " <td><img src='" << IMAGE_PATH << "helpImages/asHelpLogoSmall.png'></td>\n";
00053 stream << " <td valign='middle'><font face='Arial, sans-serif' size='+3'>";
00054 stream << HelpWindow::tr("Keyboard Shortcuts") << "</font></td>\n";
00055 stream << "</tr></table>\n";
00056
00057 stream << "<font face='Arial, sans-serif'>\n";
00058 stream << "<table cellspacing='10' cellpadding='0'><tr><td>\n";
00059
00060 stream << "<table width='100%' cellpadding='4' cellspacing='0'>\n";
00061 stream << "<tr><td width='50%' bgcolor='lightgray'><font size='+1'><b>" << HelpWindow::tr("Action") << "</font></b></td>\n";
00062 stream << "<td width='50%' bgcolor='lightgray'><font size='+1'><b>" << HelpWindow::tr("Shortcut") << "</font></b></td></tr>\n";
00063 stream << "<!-- -------------------------------------------------- -->\n";
00064 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Opening & Saving") << "</u></font></b></td></tr>\n";
00065 stream << "<tr><td>" << HelpWindow::tr("New album") << "</td>\n";
00066 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_N)) << "</td></tr>\n";
00067 stream << "<tr><td>" << HelpWindow::tr("Open album") << "</td>\n";
00068 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_O)) << "</td></tr>\n";
00069 stream << "<tr><td>" << HelpWindow::tr("Open recent album") << "</td>\n";
00070 stream << " <td>" << ControlPlus << "[1-9]" << "</td></tr>\n";
00071 stream << "<tr><td>" << HelpWindow::tr("Save album") << "</td>\n";
00072 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_S)) << "</td></tr>\n";
00073 stream << "<tr><td>" << HelpWindow::tr("Save album as") << "</td>\n";
00074 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_S)) << "</td></tr>\n";
00075 stream << "<tr><td>" << HelpWindow::tr("Quit") << "</td>\n";
00076 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_Q)) << "</td></tr>\n";
00077 stream << "<!-- -------------------------------------------------- -->\n";
00078 stream << "<tr><td colspan='2'><hr></td></tr>\n";
00079 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Organizing") << "</u></font></b></td></tr>\n";
00080 stream << "<tr><td>" << HelpWindow::tr("Move to the first photo in the collection") << "</td>\n";
00081 stream << " <td> Home </td></tr>\n";
00082 stream << "<tr><td>" << HelpWindow::tr("Move to the last photo in the collection") << "</td>\n";
00083 stream << " <td> End </td></tr>\n";
00084 stream << "<tr><td>" << HelpWindow::tr("Select all photos") << "</td>\n";
00085 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
00086 stream << "<tr><td>" << HelpWindow::tr("Deselect all photos") << "</td>\n";
00087 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
00088 stream << "<tr><td>" << HelpWindow::tr("Rotate selected photos right") << "</td>\n";
00089 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_R)) << "</td></tr>\n";
00090 stream << "<tr><td>" << HelpWindow::tr("Rotate selected photos left") << "</td>\n";
00091 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_L)) << "</td></tr>\n";
00092 stream << "<tr><td>" << HelpWindow::tr("Delete selected photos") << "</td>\n";
00093 stream << " <td> Del </td></tr>\n";
00094 stream << "<tr><td>" << HelpWindow::tr("Modify selected photo description") << "</td>\n";
00095 stream << " <td> Enter </td></tr>\n";
00096 stream << "<tr><td>" << HelpWindow::tr("Finish modifying selected photo description") << "</td>\n";
00097 stream << " <td> Esc </td></tr>\n";
00098 stream << "<tr><td>" << HelpWindow::tr("Edit first of selected photos") << "</td>\n";
00099 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_E)) << "</td></tr>\n";
00100 stream << "<!-- -------------------------------------------------- -->\n";
00101 stream << "<tr><td colspan='2'><hr></td></tr>\n";
00102 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Editing") << "</u></font></b></td></tr>\n";
00103
00104 stream << "<tr><td>" << HelpWindow::tr("Go to previous photo") << "</td>\n";
00105 stream << " <td> PgUp </td></tr>\n";
00106 stream << "<tr><td>" << HelpWindow::tr("Go to next photo") << "</td>\n";
00107 stream << " <td> PgDown </td></tr>\n";
00108 stream << "<tr><td>" << HelpWindow::tr("Go to first photo in the collection") << "</td>\n";
00109 stream << " <td> Home </td></tr>\n";
00110 stream << "<tr><td>" << HelpWindow::tr("Go to last photo in the collection") << "</td>\n";
00111 stream << " <td> End </td></tr>\n";
00112 stream << "<tr><td>" << HelpWindow::tr("Return to organizing") << "</td>\n";
00113 stream << " <td> Esc </td></tr>\n";
00114
00115 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
00116 stream << "<tr><td colspan='2'> </td></tr>\n";
00117 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
00118 stream << "<tr><td>" << HelpWindow::tr("Rotate photo right") << "</td>\n";
00119 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_R)) << "</td></tr>\n";
00120 stream << "<tr><td>" << HelpWindow::tr("Rotate photo left") << "</td>\n";
00121 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_L)) << "</td></tr>\n";
00122 stream << "<tr><td>" << HelpWindow::tr("Flip photo horizontally") << "</td>\n";
00123 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_F)) << "</td></tr>\n";
00124 stream << "<tr><td>" << HelpWindow::tr("Flip photo vertically") << "</td>\n";
00125 stream << " <td>" << ((QString)QKeySequence(Qt::ALT + Qt::CTRL + Qt::Key_F)) << "</td></tr>\n";
00126 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
00127 stream << "<tr><td colspan='2'> </td></tr>\n";
00128 stream << "<!-- =-=-=-=-=-=-=-=-=-=-= -->\n";
00129 stream << "<tr><td>" << HelpWindow::tr("Select all") << "</td>\n";
00130 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
00131 stream << "<tr><td>" << HelpWindow::tr("Deselect all") << "</td>\n";
00132 stream << " <td>" << ((QString)QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
00133 stream << "<tr><td>" << HelpWindow::tr("Nudge selection left") << "</td>\n";
00134 stream << " <td>←</td></tr>\n";
00135 stream << "<tr><td>" << HelpWindow::tr("Nudge selection right") << "</td>\n";
00136 stream << " <td>→</td></tr>\n";
00137 stream << "<tr><td>" << HelpWindow::tr("Nudge selection up") << "</td>\n";
00138 stream << " <td>↑</td></tr>\n";
00139 stream << "<tr><td>" << HelpWindow::tr("Nudge selection down") << "</td>\n";
00140 stream << " <td>↓</td></tr>\n";
00141 stream << "<tr><td>" << HelpWindow::tr("Expand selection") << "</td>\n";
00142 stream << " <td>" << ((QString)QKeySequence(Qt::Key_Plus,Qt::Key_Equal)) << "</td></tr>\n";
00143 stream << "<tr><td>" << HelpWindow::tr("Shrink selection") << "</td>\n";
00144 stream << " <td>" << ((QString)QKeySequence(Qt::Key_Minus,Qt::Key_Underscore)) << "</td></tr>\n";
00145 stream << "<tr><td>" << HelpWindow::tr("Resize selection") << "</td>\n";
00146 stream << " <td>" << HelpWindow::tr("Press and hold Shift, then Click and Drag Left / Right") << "</td></tr>\n";
00147 stream << "<tr><td>" << HelpWindow::tr("Rotate selection") << "</td>\n";
00148 stream << " <td>" << (QString(HelpWindow::tr("Press and hold %1, then Click selection"))
00149 .arg( Control )) << "</td></tr>\n";
00150 stream << "<!-- -------------------------------------------------- -->\n";
00151 stream << "<tr><td colspan='2'><hr></td></tr>\n";
00152 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Levels and Grain Editors") << "</u></font></b></td></tr>\n";
00153
00154 stream << "<tr><td>" << HelpWindow::tr("Show alternative") << "</td>\n";
00155 stream << " <td>" << QString(HelpWindow::tr("Hold %1")).arg( Control ) << "</td></tr>\n";
00156 stream << "<tr><td>" << HelpWindow::tr("Select entire luminosity/color range") << "</td>\n";
00157 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_A)) << "</td></tr>\n";
00158 stream << "<tr><td>" << HelpWindow::tr("Apply") << "</td>\n";
00159 stream << " <td> Enter </td></tr>\n";
00160 stream << "<tr><td>" << HelpWindow::tr("Cancel") << "</td>\n";
00161 stream << " <td> Esc </td></tr>\n";
00162
00163 stream << "<!-- -------------------------------------------------- -->\n";
00164 stream << "<tr><td colspan='2'><hr></td></tr>\n";
00165 stream << "<tr><td colspan='2'><font size='+1'><b><u>" << HelpWindow::tr("Miscellaneous") << "</u></font></b></td></tr>\n";
00166 stream << "<tr><td>" << HelpWindow::tr("View album statistics") << "</td>\n";
00167 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_I)) << "</td></tr>\n";
00168 stream << "<tr><td>" << HelpWindow::tr("Album Shaper help") << "</td>\n";
00169 stream << " <td>" << ((QString)QKeySequence(Qt::CTRL + Qt::Key_Question)) << "</td></tr>\n";
00170 stream << "<!-- -------------------------------------------------- -->\n";
00171 stream << "</table>\n";
00172
00173 stream << "</td></tr>\n";
00174 stream << "</table></font>\n";
00175
00176 stream << "</body></html>\n";
00177 file.close();
00178 }
00179 }
00180