Changeset 89e5214692 in tspsg for src/mainwindow.cpp
- Timestamp:
- Sep 12, 2012, 6:50:04 PM (12 years ago)
- Branches:
- appveyor, imgbot, master, readme
- Children:
- 197f54a2b9
- Parents:
- f48433245d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
rf48433245d r89e5214692 24 24 #include "mainwindow.h" 25 25 26 #ifdef Q_ WS_WIN3226 #ifdef Q_OS_WIN32 27 27 # include "shobjidl.h" 28 28 #endif … … 80 80 #endif // QT_NO_PRINTER 81 81 82 #ifdef Q_ WS_WINCE_WM82 #ifdef Q_OS_WINCE_WM 83 83 currentGeometry = QApplication::desktop()->availableGeometry(0); 84 84 // We need to react to SIP show/hide and resize the window appropriately 85 85 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int))); 86 #endif // Q_ WS_WINCE_WM86 #endif // Q_OS_WINCE_WM 87 87 connect(actionFileNew, SIGNAL(triggered()), SLOT(actionFileNewTriggered())); 88 88 connect(actionFileOpen, SIGNAL(triggered()), SLOT(actionFileOpenTriggered())); … … 453 453 { 454 454 SettingsDialog sd(this); 455 #ifdef Q_ WS_S60455 #ifdef Q_OS_SYMBIAN 456 456 sd.setWindowState(Qt::WindowMaximized); 457 457 #endif … … 669 669 hb2->addWidget(bb); 670 670 671 #ifdef Q_ WS_WINCE_WM671 #ifdef Q_OS_WINCE_WM 672 672 vb->setMargin(3); 673 #endif // Q_ WS_WINCE_WM673 #endif // Q_OS_WINCE_WM 674 674 vb->addLayout(hb1); 675 675 #ifdef HANDHELD … … 714 714 #ifndef HANDHELD 715 715 dlg->resize(450, 350); 716 #elif defined(Q_ WS_S60)716 #elif defined(Q_OS_SYMBIAN) 717 717 dlg->setWindowState(Qt::WindowMaximized); 718 718 #endif … … 771 771 pd.show(); 772 772 773 #ifdef Q_ WS_WIN32773 #ifdef Q_OS_WIN32 774 774 HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID*)&tl); 775 775 if (SUCCEEDED(hr)) { … … 788 788 connect(&solver, SIGNAL(routePartFound(int)), &pd, SLOT(setValue(int))); 789 789 connect(&pd, SIGNAL(canceled()), &solver, SLOT(cancel())); 790 #ifdef Q_ WS_WIN32790 #ifdef Q_OS_WIN32 791 791 if (tl != NULL) 792 792 connect(&solver, SIGNAL(routePartFound(int)), SLOT(solverRoutePartFound(int))); 793 793 #endif 794 794 SStep *root = solver.solve(n, matrix); 795 #ifdef Q_ WS_WIN32795 #ifdef Q_OS_WIN32 796 796 if (tl != NULL) 797 797 disconnect(&solver, SIGNAL(routePartFound(int)), this, SLOT(solverRoutePartFound(int))); … … 802 802 pd.reset(); 803 803 if (!solver.wasCanceled()) { 804 #ifdef Q_ WS_WIN32804 #ifdef Q_OS_WIN32 805 805 if (tl != NULL) { 806 806 tl->SetProgressState(winId(), TBPF_ERROR); … … 814 814 pd.setCancelButton(NULL); 815 815 pd.show(); 816 #ifdef Q_ WS_WIN32816 #ifdef Q_OS_WIN32 817 817 if (tl != NULL) 818 818 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 829 829 #endif 830 830 pd.reset(); 831 #ifdef Q_ WS_WIN32831 #ifdef Q_OS_WIN32 832 832 if (tl != NULL) { 833 833 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 843 843 pd.setValue(0); 844 844 845 #ifdef Q_ WS_WIN32845 #ifdef Q_OS_WIN32 846 846 if (tl != NULL) 847 847 tl->SetProgressValue(winId(), spinCities->value(), spinCities->value() + solver.getTotalSteps() + 1); … … 860 860 // Font size in pixels = graph node radius / 2.75. 861 861 // See MainWindow::drawNode() for graph node radius calcualtion description. 862 #ifndef Q_ WS_S60862 #ifndef Q_OS_SYMBIAN 863 863 font.setPixelSize(logicalDpiX() * (settings->value("Output/GraphWidth", DEF_GRAPH_WIDTH).toReal() / CM_IN_INCH) / 4.5 / 2.75); 864 864 #else … … 913 913 pd.show(); 914 914 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); 915 #ifdef Q_ WS_WIN32915 #ifdef Q_OS_WIN32 916 916 if (tl != NULL) 917 917 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 927 927 solutionText->clear(); 928 928 toggleSolutionActions(false); 929 #ifdef Q_ WS_WIN32929 #ifdef Q_OS_WIN32 930 930 if (tl != NULL) { 931 931 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 937 937 } 938 938 pd.setValue(n); 939 #ifdef Q_ WS_WIN32939 #ifdef Q_OS_WIN32 940 940 if (tl != NULL) 941 941 tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1); … … 984 984 pb->setFormat(tr("Generating footer")); 985 985 pd.setValue(n); 986 #ifdef Q_ WS_WIN32986 #ifdef Q_OS_WIN32 987 987 if (tl != NULL) 988 988 tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1); … … 1047 1047 pd.setCancelButton(NULL); 1048 1048 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); 1049 #ifdef Q_ WS_WIN321049 #ifdef Q_OS_WIN32 1050 1050 if (tl != NULL) 1051 1051 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 1061 1061 toggleSolutionActions(); 1062 1062 tabWidget->setCurrentIndex(1); 1063 #ifdef Q_ WS_WIN321063 #ifdef Q_OS_WIN32 1064 1064 if (tl != NULL) { 1065 1065 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 1089 1089 } 1090 1090 1091 #ifdef Q_ WS_WINCE_WM1091 #ifdef Q_OS_WINCE_WM 1092 1092 void MainWindow::changeEvent(QEvent *ev) 1093 1093 { … … 1122 1122 } 1123 1123 } 1124 #endif // Q_ WS_WINCE_WM1124 #endif // Q_OS_WINCE_WM 1125 1125 1126 1126 void MainWindow::numCitiesChanged(int nCities) … … 1138 1138 #endif // QT_NO_PRINTER 1139 1139 1140 #ifdef Q_ WS_WIN321140 #ifdef Q_OS_WIN32 1141 1141 void MainWindow::solverRoutePartFound(int n) 1142 1142 { 1143 1143 tl->SetProgressValue(winId(), n, spinCities->value() * 2); 1144 1144 } 1145 #endif // Q_ WS_WIN321145 #endif // Q_OS_WIN32 1146 1146 1147 1147 void MainWindow::spinCitiesValueChanged(int n) … … 1160 1160 void MainWindow::check4Updates(bool silent) 1161 1161 { 1162 #ifdef Q_ WS_WIN321162 #ifdef Q_OS_WIN32 1163 1163 if (silent) 1164 1164 QProcess::startDetached("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\" -silentcheck"); … … 1221 1221 if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) 1222 1222 r *= HQ_FACTOR; 1223 #ifdef Q_ WS_S601223 #ifdef Q_OS_SYMBIAN 1224 1224 /*! \hack HACK: Solution graph on Symbian is visually larger than on 1225 1225 * Windows Mobile. This coefficient makes it about the same size. … … 1372 1372 hilight.setHsv(color.hue(), color.saturation(), color.value() / 2); 1373 1373 1374 #ifdef Q_ WS_S601374 #ifdef Q_OS_SYMBIAN 1375 1375 /*! 1376 1376 * \hack HACK: Fixing some weird behavior with default Symbian theme … … 1381 1381 solutionText->document()->setDefaultStyleSheet(QString("* {color: %1;}").arg(color.name())); 1382 1382 fmt_default.setForeground(QBrush(color)); 1383 #ifdef Q_ WS_S601383 #ifdef Q_OS_SYMBIAN 1384 1384 } 1385 1385 #endif … … 1549 1549 if (!isWindowModified()) 1550 1550 return true; 1551 #ifdef Q_ WS_S601551 #ifdef Q_OS_SYMBIAN 1552 1552 int res = QSMessageBox(this).exec(); 1553 1553 #else … … 1611 1611 } 1612 1612 1613 #ifdef Q_ WS_S601613 #ifdef Q_OS_SYMBIAN 1614 1614 void MainWindow::resizeEvent(QResizeEvent *ev) 1615 1615 { … … 1631 1631 QWidget::resizeEvent(ev); 1632 1632 } 1633 #endif // Q_ WS_S601633 #endif // Q_OS_SYMBIAN 1634 1634 1635 1635 void MainWindow::retranslateUi(bool all) … … 1692 1692 #endif // QT_NO_STATUSTIP 1693 1693 1694 #ifdef Q_ WS_S601694 #ifdef Q_OS_SYMBIAN 1695 1695 actionRightSoftKey->setText(tr("E&xit")); 1696 1696 #endif … … 1739 1739 Ui_MainWindow::setupUi(this); 1740 1740 1741 #ifdef Q_ WS_S601741 #ifdef Q_OS_SYMBIAN 1742 1742 setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint); 1743 #endif // Q_ WS_S601743 #endif // Q_OS_SYMBIAN 1744 1744 1745 1745 // File Menu … … 1793 1793 #endif // HANDHELD 1794 1794 1795 #ifdef Q_ WS_WINCE_WM1795 #ifdef Q_OS_WINCE_WM 1796 1796 menuBar()->setDefaultAction(menuFile->menuAction()); 1797 1797 … … 1804 1804 #else 1805 1805 setCentralWidget(tabWidget); 1806 #endif // Q_ WS_WINCE_WM1806 #endif // Q_OS_WINCE_WM 1807 1807 1808 1808 //! \hack HACK: A little hack for toolbar icons to have a sane size. 1809 1809 #if defined(HANDHELD) && !defined(Q_WS_MAEMO_5) 1810 #ifdef Q_ WS_S601810 #ifdef Q_OS_SYMBIAN 1811 1811 toolBarMain->setIconSize(QSize(logicalDpiX() / 5.2, logicalDpiY() / 5.2)); 1812 1812 #else 1813 1813 toolBarMain->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 1814 #endif // Q_ WS_S601814 #endif // Q_OS_SYMBIAN 1815 1815 #endif // HANDHELD && !Q_WS_MAEMO_5 1816 1816 QToolButton *tb = static_cast<QToolButton *>(toolBarMain->widgetForAction(actionFileSave)); … … 1898 1898 #endif // HANDHELD 1899 1899 1900 #ifdef Q_ WS_S601900 #ifdef Q_OS_SYMBIAN 1901 1901 // Replace Exit on the right soft key with our own exit action. 1902 1902 // This makes it translatable. … … 1951 1951 } 1952 1952 1953 #ifdef Q_ WS_S601953 #ifdef Q_OS_SYMBIAN 1954 1954 QSMessageBox::QSMessageBox(QWidget *parent) 1955 1955 : QMessageBox(parent) … … 1979 1979 done(QMessageBox::Discard); 1980 1980 } 1981 #endif // Q_ WS_S601981 #endif // Q_OS_SYMBIAN
Note: See TracChangeset
for help on using the changeset viewer.