Changeset 135 in tspsg-svn for trunk/src


Ignore:
Timestamp:
Sep 10, 2010, 7:49:32 PM (14 years ago)
Author:
laleppa
Message:
  • TSPSG now compiles when QtConcurrent? is not available (QT_NO_CONCURRENT is set).
  • Don't set non-existent icons under Windows Mobile.
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mainwindow.cpp

    r134 r135  
    711711                QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    712712
     713#ifndef QT_NO_CONCURRENT
    713714QFuture<void> f = QtConcurrent::run(&solver, &CTSPSolver::cleanup, false);
    714715                while (!f.isFinished()) {
    715716                        QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    716717                }
     718#else
     719                solver.cleanup(true);
     720#endif
    717721                pd.reset();
    718722#ifdef Q_OS_WIN32
     
    742746                pic.begin(&graph);
    743747                pic.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    744 QFont font = settings->value("Output/Font", QFont(DEF_FONT_FACE, 9)).value<QFont>();
     748QFont font = qvariant_cast<QFont>(settings->value("Output/Font", QFont(DEF_FONT_FACE, 9)));
    745749                if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) {
    746750                        font.setWeight(QFont::DemiBold);
     
    792796                                tl->SetProgressState(winId(), TBPF_INDETERMINATE);
    793797#endif
     798#ifndef QT_NO_CONCURRENT
    794799QFuture<void> f = QtConcurrent::run(&solver, &CTSPSolver::cleanup, false);
    795800                        while (!f.isFinished()) {
    796801                                QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    797802                        }
     803#else
     804                        solver.cleanup(true);
     805#endif
    798806                        solutionText->clear();
    799807                        toggleSolutionActions(false);
     
    920928                tl->SetProgressState(winId(), TBPF_INDETERMINATE);
    921929#endif
     930#ifndef QT_NO_CONCURRENT
    922931QFuture<void> f = QtConcurrent::run(&solver, &CTSPSolver::cleanup, false);
    923932        while (!f.isFinished()) {
    924933                QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    925934        }
     935#else
     936        solver.cleanup(true);
     937#endif
    926938        toggleSolutionActions();
    927939        tabWidget->setCurrentIndex(1);
     
    10451057                        settings->endGroup();
    10461058                }
     1059#else
     1060                settings->setValue("MainWindow/ToolbarVisible", toolBarMain->isVisible());
    10471061#endif // HANDHELD
    10481062        } else {
     
    11391153void MainWindow::initDocStyleSheet()
    11401154{
    1141         solutionText->document()->setDefaultFont(settings->value("Output/Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE)).value<QFont>());
     1155        solutionText->document()->setDefaultFont(qvariant_cast<QFont>(settings->value("Output/Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE))));
    11421156
    11431157        fmt_paragraph.setTopMargin(0);
     
    11581172        settings->beginGroup("Output/Colors");
    11591173
    1160 QColor color = settings->value("Text", DEF_TEXT_COLOR).value<QColor>();
     1174QColor color = qvariant_cast<QColor>(settings->value("Text", DEF_TEXT_COLOR));
    11611175QColor hilight;
    11621176        if (color.value() < 192)
     
    11681182        fmt_default.setForeground(QBrush(color));
    11691183
    1170         fmt_selected.setForeground(QBrush(settings->value("Selected", DEF_SELECTED_COLOR).value<QColor>()));
     1184        fmt_selected.setForeground(QBrush(qvariant_cast<QColor>(settings->value("Selected", DEF_SELECTED_COLOR))));
    11711185        fmt_selected.setFontWeight(QFont::Bold);
    11721186
    1173         fmt_alternate.setForeground(QBrush(settings->value("Alternate", DEF_ALTERNATE_COLOR).value<QColor>()));
     1187        fmt_alternate.setForeground(QBrush(qvariant_cast<QColor>(settings->value("Alternate", DEF_ALTERNATE_COLOR))));
    11741188        fmt_alternate.setFontWeight(QFont::Bold);
    11751189        fmt_altlist.setForeground(QBrush(hilight));
     
    13981412{
    13991413        if (all)
    1400                 Ui::MainWindow::retranslateUi(this);
     1414                Ui_MainWindow::retranslateUi(this);
    14011415
    14021416        loadStyleList();
     
    14741488void MainWindow::setupUi()
    14751489{
    1476         Ui::MainWindow::setupUi(this);
     1490        Ui_MainWindow::setupUi(this);
    14771491
    14781492        // File Menu
     
    14801494        actionFileOpen->setIcon(GET_ICON("document-open"));
    14811495        actionFileSave->setIcon(GET_ICON("document-save"));
     1496#ifndef HANDHELD
    14821497        menuFileSaveAs->setIcon(GET_ICON("document-save-as"));
     1498#endif
    14831499        actionFileExit->setIcon(GET_ICON("application-exit"));
    14841500        // Settings Menu
     1501#ifndef HANDHELD
    14851502        menuSettingsLanguage->setIcon(GET_ICON("preferences-desktop-locale"));
    1486         actionSettingsLanguageEnglish->setIcon(GET_ICON("flag-gb"));
     1503#if QT_VERSION >= 0x040600
     1504        actionSettingsLanguageEnglish->setIcon(QIcon::fromTheme("flag-gb", QIcon(":/images/icons/l10n/flag-gb.png")));
     1505#else // QT_VERSION >= 0x040600
     1506        actionSettingsLanguageEnglish->setIcon(QIcon(":/images/icons/l10n/flag-gb.png"));
     1507#endif // QT_VERSION >= 0x040600
    14871508        menuSettingsStyle->setIcon(GET_ICON("preferences-desktop-theme"));
     1509#endif // HANDHELD
    14881510        actionSettingsPreferences->setIcon(GET_ICON("preferences-system"));
    14891511        // Help Menu
     1512#ifndef HANDHELD
    14901513        actionHelpContents->setIcon(GET_ICON("help-contents"));
    14911514        actionHelpContextual->setIcon(GET_ICON("help-contextual"));
    14921515        actionHelpAbout->setIcon(GET_ICON("help-about"));
     1516#endif
    14931517        // Buttons
    14941518        buttonRandom->setIcon(GET_ICON("roll"));
     
    15891613//      toolBarManager->addAction(action, cat);
    15901614        toolBarManager->restoreState(settings->value("MainWindow/Toolbars").toByteArray());
     1615#else
     1616        toolBarMain->setVisible(settings->value("MainWindow/ToolbarVisible", true).toBool());
    15911617#endif // HANDHELD
    15921618
  • trunk/src/settingsdialog.cpp

    r134 r135  
    255255        cbScrollToEnd->setChecked(settings->value("ScrollToEnd", DEF_SCROLL_TO_END).toBool());
    256256
    257         font = settings->value("Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE)).value<QFont>();
    258         color = settings->value("Colors/Text", DEF_TEXT_COLOR).value<QColor>();
     257        font = qvariant_cast<QFont>(settings->value("Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE)));
     258        color = qvariant_cast<QColor>(settings->value("Colors/Text", DEF_TEXT_COLOR));
    259259        settings->endGroup();
    260260
Note: See TracChangeset for help on using the changeset viewer.