Changeset 118 in tspsg-svn for trunk/src/mainwindow.cpp
- Timestamp:
- May 2, 2010, 11:59:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r117 r118 68 68 connect(actionFilePrint, SIGNAL(triggered()), SLOT(actionFilePrintTriggered())); 69 69 #endif // QT_NO_PRINTER 70 #ifndef HANDHELD 71 connect(actionSettingsToolbarsConfigure, SIGNAL(triggered()), SLOT(actionSettingsToolbarsConfigureTriggered())); 72 #endif // HANDHELD 70 73 connect(actionSettingsPreferences, SIGNAL(triggered()), SLOT(actionSettingsPreferencesTriggered())); 71 74 #ifdef Q_OS_WIN32 … … 395 398 } 396 399 400 #ifndef HANDHELD 401 void MainWindow::actionSettingsToolbarsConfigureTriggered() 402 { 403 QtToolBarDialog dlg(this); 404 dlg.setToolBarManager(toolBarManager); 405 dlg.exec(); 406 QToolButton *tb = static_cast<QToolButton *>(toolBarMain->widgetForAction(actionFileSave)); 407 if (tb != NULL) { 408 tb->setMenu(menuFileSaveAs); 409 tb->setPopupMode(QToolButton::MenuButtonPopup); 410 tb->resize(tb->sizeHint()); 411 } 412 413 loadToolbarList(); 414 } 415 #endif // HANDHELD 416 397 417 #ifdef Q_OS_WIN32 398 418 void MainWindow::actionHelpCheck4UpdatesTriggered() … … 423 443 #else 424 444 title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b>"); 425 #endif // Q_OS_WINCE_WM && Q_OS_SYMBIAN445 #endif // HANDHELD 426 446 427 447 QString about; … … 825 845 826 846 // Saving Main Window state 847 #ifndef HANDHELD 827 848 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 828 849 settings->beginGroup("MainWindow"); 829 #ifndef HANDHELD830 850 settings->setValue("Geometry", saveGeometry()); 831 #endif // HANDHELD832 851 settings->setValue("State", saveState()); 852 settings->setValue("Toolbars", toolBarManager->saveState()); 833 853 settings->endGroup(); 834 854 } 855 #endif // HANDHELD 835 856 } else { 836 857 settings->remove("SettingsReset"); … … 1060 1081 } 1061 1082 1083 void MainWindow::loadToolbarList() 1084 { 1085 menuSettingsToolbars->clear(); 1086 #ifndef HANDHELD 1087 menuSettingsToolbars->insertAction(NULL, actionSettingsToolbarsConfigure); 1088 menuSettingsToolbars->addSeparator(); 1089 QList<QToolBar *> list = toolBarManager->toolBars(); 1090 foreach (QToolBar *t, list) { 1091 menuSettingsToolbars->insertAction(NULL, t->toggleViewAction()); 1092 } 1093 #else // HANDHELD 1094 menuSettingsToolbars->insertAction(NULL, toolBarMain->toggleViewAction()); 1095 #endif // HANDHELD 1096 } 1097 1062 1098 bool MainWindow::maybeSave() 1063 1099 { … … 1128 1164 1129 1165 loadStyleList(); 1130 1131 actionSettingsLanguageEnglish->setStatusTip(tr("Set application language to %1").arg("English")); 1166 loadToolbarList(); 1167 1168 #ifndef HANDHELD 1169 actionSettingsToolbarsConfigure->setText(tr("Configure...")); 1170 actionSettingsToolbarsConfigure->setToolTip(tr("Customize toolbars")); 1171 #endif // HANDHELD 1132 1172 1133 1173 #ifndef QT_NO_PRINTER 1134 actionFilePrintPreview->setText( QApplication::translate("MainWindow", "P&rint Preview...", 0, QApplication::UnicodeUTF8));1174 actionFilePrintPreview->setText(tr("P&rint Preview...")); 1135 1175 #ifndef QT_NO_TOOLTIP 1136 actionFilePrintPreview->setToolTip( QApplication::translate("MainWindow", "Preview solution results", 0, QApplication::UnicodeUTF8));1176 actionFilePrintPreview->setToolTip(tr("Preview solution results")); 1137 1177 #endif // QT_NO_TOOLTIP 1138 1178 #ifndef QT_NO_STATUSTIP 1139 actionFilePrintPreview->setStatusTip( QApplication::translate("MainWindow", "Preview current solution results before printing", 0, QApplication::UnicodeUTF8));1179 actionFilePrintPreview->setStatusTip(tr("Preview current solution results before printing")); 1140 1180 #endif // QT_NO_STATUSTIP 1141 1181 1142 actionFilePrint->setText( QApplication::translate("MainWindow", "&Print...", 0, QApplication::UnicodeUTF8));1182 actionFilePrint->setText(tr("&Print...")); 1143 1183 #ifndef QT_NO_TOOLTIP 1144 actionFilePrint->setToolTip( QApplication::translate("MainWindow", "Print solution", 0, QApplication::UnicodeUTF8));1184 actionFilePrint->setToolTip(tr("Print solution")); 1145 1185 #endif // QT_NO_TOOLTIP 1146 1186 #ifndef QT_NO_STATUSTIP 1147 actionFilePrint->setStatusTip( QApplication::translate("MainWindow", "Print current solution results", 0, QApplication::UnicodeUTF8));1187 actionFilePrint->setStatusTip(tr("Print current solution results")); 1148 1188 #endif // QT_NO_STATUSTIP 1149 actionFilePrint->setShortcut( QApplication::translate("MainWindow", "Ctrl+P", 0, QApplication::UnicodeUTF8));1189 actionFilePrint->setShortcut(tr("Ctrl+P")); 1150 1190 #endif // QT_NO_PRINTER 1151 1191 #ifdef Q_OS_WIN32 … … 1217 1257 //! \hack HACK: A little hack for toolbar icons to have a sane size. 1218 1258 #ifdef HANDHELD 1219 toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 1220 #endif // HANDHELD 1221 static_cast<QToolButton *>(toolBar->widgetForAction(actionFileSave))->setMenu(menuFileSaveAs); 1222 static_cast<QToolButton *>(toolBar->widgetForAction(actionFileSave))->setPopupMode(QToolButton::MenuButtonPopup); 1259 toolBarMain->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 1260 #endif // HANDHELD 1261 QToolButton *tb = static_cast<QToolButton *>(toolBarMain->widgetForAction(actionFileSave)); 1262 if (tb != NULL) { 1263 tb->setMenu(menuFileSaveAs); 1264 tb->setPopupMode(QToolButton::MenuButtonPopup); 1265 } 1223 1266 1224 1267 solutionText->document()->setDefaultFont(settings->value("Output/Font", QFont(DEF_FONT_FAMILY, DEF_FONT_SIZE)).value<QFont>()); … … 1240 1283 menuFile->insertSeparator(actionFileExit); 1241 1284 1242 toolBar ->insertAction(actionSettingsPreferences,actionFilePrint);1285 toolBarMain->insertAction(actionSettingsPreferences, actionFilePrint); 1243 1286 #endif // QT_NO_PRINTER 1244 1245 menuSettings->insertAction(actionSettingsPreferences, toolBar->toggleViewAction());1246 menuSettings->insertSeparator(actionSettingsPreferences);1247 1287 1248 1288 groupSettingsLanguageList = new QActionGroup(this); … … 1254 1294 actionSettingsStyleSystem->setData(true); 1255 1295 groupSettingsStyleList = new QActionGroup(this); 1296 1297 #ifndef HANDHELD 1298 actionSettingsToolbarsConfigure = new QAction(this); 1299 actionSettingsToolbarsConfigure->setIcon(QIcon(":/images/icons/configure-toolbars.png")); 1300 #endif // HANDHELD 1256 1301 1257 1302 #ifdef Q_OS_WIN32 … … 1265 1310 spinCities->setMaximum(MAX_NUM_CITIES); 1266 1311 1267 retranslateUi(false);1268 1269 #ifdef Q_OS_WIN321270 // Adding some eyecandy in Vista and 7 :-)1271 if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()) {1272 toggleTranclucency(true);1273 }1274 #endif // Q_OS_WIN321275 1276 1312 #ifndef HANDHELD 1277 1313 toolBarManager = new QtToolBarManager; 1278 1314 toolBarManager->setMainWindow(this); 1279 QString cat = toolBar ->windowTitle();1280 toolBarManager->addToolBar(toolBar , cat);1315 QString cat = toolBarMain->windowTitle(); 1316 toolBarManager->addToolBar(toolBarMain, cat); 1281 1317 #ifndef QT_NO_PRINTER 1282 1318 toolBarManager->addAction(actionFilePrintPreview, cat); … … 1285 1321 toolBarManager->addAction(actionHelpContextual, cat); 1286 1322 // toolBarManager->addAction(action, cat); 1287 #endif // HANDHELD 1323 toolBarManager->restoreState(settings->value("MainWindow/Toolbars").toByteArray()); 1324 #endif // HANDHELD 1325 1326 retranslateUi(false); 1327 1328 #ifdef Q_OS_WIN32 1329 // Adding some eyecandy in Vista and 7 :-) 1330 if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()) { 1331 toggleTranclucency(true); 1332 } 1333 #endif // Q_OS_WIN32 1288 1334 } 1289 1335 … … 1311 1357 #endif // Q_OS_WIN32 1312 1358 } 1313 1314 #ifndef HANDHELD1315 void MainWindow::on_actionSettingsToolbars_triggered()1316 {1317 QtToolBarDialog dlg(this);1318 dlg.setToolBarManager(toolBarManager);1319 dlg.exec();1320 }1321 #endif // HANDHELD
Note: See TracChangeset
for help on using the changeset viewer.