Changeset 141 in tspsg-svn for trunk/src/mainwindow.cpp
- Timestamp:
- Oct 3, 2010, 2:01:00 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r140 r141 24 24 #include "mainwindow.h" 25 25 26 #ifdef Q_ OS_WIN3226 #ifdef Q_WS_WIN32 27 27 #include "shobjidl.h" 28 28 #endif … … 63 63 #endif // QT_NO_PRINTER 64 64 65 #ifdef Q_ OS_WINCE_WM65 #ifdef Q_WS_WINCE_WM 66 66 currentGeometry = QApplication::desktop()->availableGeometry(0); 67 67 // We need to react to SIP show/hide and resize the window appropriately 68 68 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int))); 69 #endif // Q_ OS_WINCE_WM69 #endif // Q_WS_WINCE_WM 70 70 connect(actionFileNew, SIGNAL(triggered()), SLOT(actionFileNewTriggered())); 71 71 connect(actionFileOpen, SIGNAL(triggered()), SLOT(actionFileOpenTriggered())); … … 372 372 void MainWindow::groupSettingsLanguageListTriggered(QAction *action) 373 373 { 374 #ifndef Q_WS_MAEMO_5 374 375 if (actionSettingsLanguageAutodetect->isChecked()) { 375 376 // We have language autodetection. It needs to be disabled to change language. … … 379 380 return; 380 381 } 382 #endif 381 383 bool untitled = (fileName == tr("Untitled") + ".tspt"); 382 384 if (loadLanguage(action->data().toString())) { … … 386 388 if (untitled) 387 389 setFileName(); 388 #ifdef Q_ OS_WIN32390 #ifdef Q_WS_WIN32 389 391 if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()) { 390 392 toggleStyle(labelVariant, true); … … 565 567 hb2->addWidget(bb); 566 568 567 #ifdef Q_ OS_WINCE_WM569 #ifdef Q_WS_WINCE_WM 568 570 vb->setMargin(3); 569 #endif // Q_ OS_WINCE_WM571 #endif // Q_WS_WINCE_WM 570 572 vb->addLayout(hb1); 571 573 #ifdef HANDHELD … … 600 602 connect(bb, SIGNAL(accepted()), dlg, SLOT(accept())); 601 603 602 #ifdef Q_ OS_WIN32604 #ifdef Q_WS_WIN32 603 605 // Adding some eyecandy in Vista and 7 :-) 604 606 if (QtWin::isCompositionEnabled()) { 605 607 QtWin::enableBlurBehindWindow(dlg, true); 606 608 } 607 #endif // Q_ OS_WIN32609 #endif // Q_WS_WIN32 608 610 609 611 dlg->resize(450, 350); … … 662 664 pd.show(); 663 665 664 #ifdef Q_ OS_WIN32666 #ifdef Q_WS_WIN32 665 667 HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID*)&tl); 666 668 if (SUCCEEDED(hr)) { … … 680 682 connect(&solver, SIGNAL(routePartFound(int)), &pd, SLOT(setValue(int))); 681 683 connect(&pd, SIGNAL(canceled()), &solver, SLOT(cancel())); 682 #ifdef Q_ OS_WIN32684 #ifdef Q_WS_WIN32 683 685 if (tl != NULL) 684 686 connect(&solver, SIGNAL(routePartFound(int)), SLOT(solverRoutePartFound(int))); 685 687 #endif 686 688 SStep *root = solver.solve(n, matrix); 687 #ifdef Q_ OS_WIN32689 #ifdef Q_WS_WIN32 688 690 if (tl != NULL) 689 691 disconnect(&solver, SIGNAL(routePartFound(int)), this, SLOT(solverRoutePartFound(int))); … … 694 696 pd.reset(); 695 697 if (!solver.wasCanceled()) { 696 #ifdef Q_ OS_WIN32698 #ifdef Q_WS_WIN32 697 699 if (tl != NULL) { 698 700 // tl->SetProgressValue(winId(), n, n * 2); … … 707 709 pd.setCancelButton(NULL); 708 710 pd.show(); 709 #ifdef Q_ OS_WIN32711 #ifdef Q_WS_WIN32 710 712 if (tl != NULL) 711 713 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 722 724 #endif 723 725 pd.reset(); 724 #ifdef Q_ OS_WIN32726 #ifdef Q_WS_WIN32 725 727 if (tl != NULL) { 726 728 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 736 738 pd.setValue(0); 737 739 738 #ifdef Q_ OS_WIN32740 #ifdef Q_WS_WIN32 739 741 if (tl != NULL) 740 742 tl->SetProgressValue(winId(), spinCities->value(), spinCities->value() + solver.getTotalSteps() + 1); … … 794 796 pd.show(); 795 797 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); 796 #ifdef Q_ OS_WIN32798 #ifdef Q_WS_WIN32 797 799 if (tl != NULL) 798 800 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 808 810 solutionText->clear(); 809 811 toggleSolutionActions(false); 810 #ifdef Q_ OS_WIN32812 #ifdef Q_WS_WIN32 811 813 if (tl != NULL) { 812 814 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 818 820 } 819 821 pd.setValue(n); 820 #ifdef Q_ OS_WIN32822 #ifdef Q_WS_WIN32 821 823 if (tl != NULL) 822 824 tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1); … … 864 866 pb->setFormat(tr("Generating footer")); 865 867 pd.setValue(n); 866 #ifdef Q_ OS_WIN32868 #ifdef Q_WS_WIN32 867 869 if (tl != NULL) 868 870 tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1); … … 926 928 pd.setCancelButton(NULL); 927 929 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); 928 #ifdef Q_ OS_WIN32930 #ifdef Q_WS_WIN32 929 931 if (tl != NULL) 930 932 tl->SetProgressState(winId(), TBPF_INDETERMINATE); … … 940 942 toggleSolutionActions(); 941 943 tabWidget->setCurrentIndex(1); 942 #ifdef Q_ OS_WIN32944 #ifdef Q_WS_WIN32 943 945 if (tl != NULL) { 944 946 tl->SetProgressState(winId(), TBPF_NOPROGRESS); … … 968 970 } 969 971 970 #ifdef Q_ OS_WINCE_WM972 #ifdef Q_WS_WINCE_WM 971 973 void MainWindow::changeEvent(QEvent *ev) 972 974 { … … 1001 1003 } 1002 1004 } 1003 #endif // Q_ OS_WINCE_WM1005 #endif // Q_WS_WINCE_WM 1004 1006 1005 1007 void MainWindow::numCitiesChanged(int nCities) … … 1017 1019 #endif // QT_NO_PRINTER 1018 1020 1019 #ifdef Q_ OS_WIN321021 #ifdef Q_WS_WIN32 1020 1022 void MainWindow::solverRoutePartFound(int n) 1021 1023 { 1022 #ifdef Q_ OS_WIN321024 #ifdef Q_WS_WIN32 1023 1025 tl->SetProgressValue(winId(), n, spinCities->value() * 2); 1024 1026 #else 1025 1027 Q_UNUSED(n); 1026 #endif // Q_ OS_WIN321027 } 1028 #endif // Q_ OS_WIN321028 #endif // Q_WS_WIN32 1029 } 1030 #endif // Q_WS_WIN32 1029 1031 1030 1032 void MainWindow::spinCitiesValueChanged(int n) … … 1043 1045 void MainWindow::check4Updates(bool silent) 1044 1046 { 1045 #ifdef Q_ OS_WIN321047 #ifdef Q_WS_WIN32 1046 1048 if (silent) 1047 1049 QProcess::startDetached("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\" -silentcheck"); … … 1260 1262 QString lng = lang; 1261 1263 if (lng.isEmpty()) { 1262 ad = settings->value("Language" , "").toString().isEmpty();1264 ad = settings->value("Language").toString().isEmpty(); 1263 1265 lng = settings->value("Language", QLocale::system().name()).toString(); 1264 1266 } … … 1334 1336 a->setCheckable(true); 1335 1337 a->setActionGroup(groupSettingsStyleList); 1336 if ((style == settings->value("Style").toString()) 1337 || QString(QApplication::style()->metaObject()->className()).contains(QRegExp(QString("^Q?%1(Style)?$").arg(QRegExp::escape(style)), Qt::CaseInsensitive))) { 1338 if ((style == settings->value("Stlye").toString()) 1339 #ifndef Q_WS_MAEMO_5 1340 || QString(QApplication::style()->metaObject()->className()).contains(QRegExp(QString("^Q?%1(Style)?$").arg(QRegExp::escape(style)), Qt::CaseInsensitive)) 1341 #endif 1342 ) { 1338 1343 a->setChecked(true); 1339 1344 } … … 1543 1548 #endif // HANDHELD 1544 1549 1545 #ifdef Q_ OS_WINCE_WM1550 #ifdef Q_WS_WINCE_WM 1546 1551 menuBar()->setDefaultAction(menuFile->menuAction()); 1547 1552 … … 1554 1559 #else 1555 1560 setCentralWidget(tabWidget); 1556 #endif // Q_ OS_WINCE_WM1561 #endif // Q_WS_WINCE_WM 1557 1562 1558 1563 //! \hack HACK: A little hack for toolbar icons to have a sane size. 1559 #if def HANDHELD1564 #if defined(HANDHELD) && !defined(Q_WS_MAEMO_5) 1560 1565 toolBarMain->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 1561 1566 #endif // HANDHELD … … 1588 1593 1589 1594 groupSettingsLanguageList = new QActionGroup(this); 1595 #ifdef Q_WS_MAEMO_5 1596 groupSettingsLanguageList->addAction(actionSettingsLanguageAutodetect); 1597 #endif 1590 1598 actionSettingsLanguageEnglish->setData("en"); 1591 1599 actionSettingsLanguageEnglish->setActionGroup(groupSettingsLanguageList); … … 1595 1603 actionSettingsStyleSystem->setData(true); 1596 1604 groupSettingsStyleList = new QActionGroup(this); 1605 #ifdef Q_WS_MAEMO_5 1606 groupSettingsStyleList->addAction(actionSettingsStyleSystem); 1607 #endif 1597 1608 1598 1609 #ifndef HANDHELD … … 1630 1641 retranslateUi(false); 1631 1642 1632 #ifdef Q_ OS_WIN321643 #ifdef Q_WS_WIN32 1633 1644 // Adding some eyecandy in Vista and 7 :-) 1634 1645 if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()) { 1635 1646 toggleTranclucency(true); 1636 1647 } 1637 #endif // Q_ OS_WIN321648 #endif // Q_WS_WIN32 1638 1649 } 1639 1650 … … 1651 1662 void MainWindow::toggleTranclucency(bool enable) 1652 1663 { 1653 #ifdef Q_ OS_WIN321664 #ifdef Q_WS_WIN32 1654 1665 toggleStyle(labelVariant, enable); 1655 1666 toggleStyle(labelCities, enable); … … 1659 1670 #else 1660 1671 Q_UNUSED(enable); 1661 #endif // Q_ OS_WIN321662 } 1672 #endif // Q_WS_WIN32 1673 }
Note: See TracChangeset
for help on using the changeset viewer.