Changeset 89e5214692 in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Sep 12, 2012, 6:50:04 PM (12 years ago)
Author:
Oleksii Serdiuk
Branches:
appveyor, imgbot, master, readme
Children:
197f54a2b9
Parents:
f48433245d
Message:

Replaced all Q_WS_xxx with Q_OS_xxx ifdefs where possible.

This is needed for compatibility with Qt 5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    rf48433245d r89e5214692  
    2424#include "mainwindow.h"
    2525
    26 #ifdef Q_WS_WIN32
     26#ifdef Q_OS_WIN32
    2727#   include "shobjidl.h"
    2828#endif
     
    8080#endif // QT_NO_PRINTER
    8181
    82 #ifdef Q_WS_WINCE_WM
     82#ifdef Q_OS_WINCE_WM
    8383    currentGeometry = QApplication::desktop()->availableGeometry(0);
    8484    // We need to react to SIP show/hide and resize the window appropriately
    8585    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
    86 #endif // Q_WS_WINCE_WM
     86#endif // Q_OS_WINCE_WM
    8787    connect(actionFileNew, SIGNAL(triggered()), SLOT(actionFileNewTriggered()));
    8888    connect(actionFileOpen, SIGNAL(triggered()), SLOT(actionFileOpenTriggered()));
     
    453453{
    454454SettingsDialog sd(this);
    455 #ifdef Q_WS_S60
     455#ifdef Q_OS_SYMBIAN
    456456    sd.setWindowState(Qt::WindowMaximized);
    457457#endif
     
    669669    hb2->addWidget(bb);
    670670
    671 #ifdef Q_WS_WINCE_WM
     671#ifdef Q_OS_WINCE_WM
    672672    vb->setMargin(3);
    673 #endif // Q_WS_WINCE_WM
     673#endif // Q_OS_WINCE_WM
    674674    vb->addLayout(hb1);
    675675#ifdef HANDHELD
     
    714714#ifndef HANDHELD
    715715    dlg->resize(450, 350);
    716 #elif defined(Q_WS_S60)
     716#elif defined(Q_OS_SYMBIAN)
    717717    dlg->setWindowState(Qt::WindowMaximized);
    718718#endif
     
    771771    pd.show();
    772772
    773 #ifdef Q_WS_WIN32
     773#ifdef Q_OS_WIN32
    774774HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID*)&tl);
    775775    if (SUCCEEDED(hr)) {
     
    788788    connect(&solver, SIGNAL(routePartFound(int)), &pd, SLOT(setValue(int)));
    789789    connect(&pd, SIGNAL(canceled()), &solver, SLOT(cancel()));
    790 #ifdef Q_WS_WIN32
     790#ifdef Q_OS_WIN32
    791791    if (tl != NULL)
    792792        connect(&solver, SIGNAL(routePartFound(int)), SLOT(solverRoutePartFound(int)));
    793793#endif
    794794SStep *root = solver.solve(n, matrix);
    795 #ifdef Q_WS_WIN32
     795#ifdef Q_OS_WIN32
    796796    if (tl != NULL)
    797797        disconnect(&solver, SIGNAL(routePartFound(int)), this, SLOT(solverRoutePartFound(int)));
     
    802802        pd.reset();
    803803        if (!solver.wasCanceled()) {
    804 #ifdef Q_WS_WIN32
     804#ifdef Q_OS_WIN32
    805805            if (tl != NULL) {
    806806                tl->SetProgressState(winId(), TBPF_ERROR);
     
    814814        pd.setCancelButton(NULL);
    815815        pd.show();
    816 #ifdef Q_WS_WIN32
     816#ifdef Q_OS_WIN32
    817817        if (tl != NULL)
    818818            tl->SetProgressState(winId(), TBPF_INDETERMINATE);
     
    829829#endif
    830830        pd.reset();
    831 #ifdef Q_WS_WIN32
     831#ifdef Q_OS_WIN32
    832832        if (tl != NULL) {
    833833            tl->SetProgressState(winId(), TBPF_NOPROGRESS);
     
    843843    pd.setValue(0);
    844844
    845 #ifdef Q_WS_WIN32
     845#ifdef Q_OS_WIN32
    846846    if (tl != NULL)
    847847        tl->SetProgressValue(winId(), spinCities->value(), spinCities->value() + solver.getTotalSteps() + 1);
     
    860860        // Font size in pixels = graph node radius / 2.75.
    861861        // See MainWindow::drawNode() for graph node radius calcualtion description.
    862 #ifndef Q_WS_S60
     862#ifndef Q_OS_SYMBIAN
    863863        font.setPixelSize(logicalDpiX() * (settings->value("Output/GraphWidth", DEF_GRAPH_WIDTH).toReal() / CM_IN_INCH) / 4.5 / 2.75);
    864864#else
     
    913913            pd.show();
    914914            QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    915 #ifdef Q_WS_WIN32
     915#ifdef Q_OS_WIN32
    916916            if (tl != NULL)
    917917                tl->SetProgressState(winId(), TBPF_INDETERMINATE);
     
    927927            solutionText->clear();
    928928            toggleSolutionActions(false);
    929 #ifdef Q_WS_WIN32
     929#ifdef Q_OS_WIN32
    930930            if (tl != NULL) {
    931931                tl->SetProgressState(winId(), TBPF_NOPROGRESS);
     
    937937        }
    938938        pd.setValue(n);
    939 #ifdef Q_WS_WIN32
     939#ifdef Q_OS_WIN32
    940940        if (tl != NULL)
    941941            tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1);
     
    984984    pb->setFormat(tr("Generating footer"));
    985985    pd.setValue(n);
    986 #ifdef Q_WS_WIN32
     986#ifdef Q_OS_WIN32
    987987    if (tl != NULL)
    988988        tl->SetProgressValue(winId(), spinCities->value() + n, spinCities->value() + solver.getTotalSteps() + 1);
     
    10471047    pd.setCancelButton(NULL);
    10481048    QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    1049 #ifdef Q_WS_WIN32
     1049#ifdef Q_OS_WIN32
    10501050    if (tl != NULL)
    10511051        tl->SetProgressState(winId(), TBPF_INDETERMINATE);
     
    10611061    toggleSolutionActions();
    10621062    tabWidget->setCurrentIndex(1);
    1063 #ifdef Q_WS_WIN32
     1063#ifdef Q_OS_WIN32
    10641064    if (tl != NULL) {
    10651065        tl->SetProgressState(winId(), TBPF_NOPROGRESS);
     
    10891089}
    10901090
    1091 #ifdef Q_WS_WINCE_WM
     1091#ifdef Q_OS_WINCE_WM
    10921092void MainWindow::changeEvent(QEvent *ev)
    10931093{
     
    11221122    }
    11231123}
    1124 #endif // Q_WS_WINCE_WM
     1124#endif // Q_OS_WINCE_WM
    11251125
    11261126void MainWindow::numCitiesChanged(int nCities)
     
    11381138#endif // QT_NO_PRINTER
    11391139
    1140 #ifdef Q_WS_WIN32
     1140#ifdef Q_OS_WIN32
    11411141void MainWindow::solverRoutePartFound(int n)
    11421142{
    11431143    tl->SetProgressValue(winId(), n, spinCities->value() * 2);
    11441144}
    1145 #endif // Q_WS_WIN32
     1145#endif // Q_OS_WIN32
    11461146
    11471147void MainWindow::spinCitiesValueChanged(int n)
     
    11601160void MainWindow::check4Updates(bool silent)
    11611161{
    1162 #ifdef Q_WS_WIN32
     1162#ifdef Q_OS_WIN32
    11631163    if (silent)
    11641164        QProcess::startDetached("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\" -silentcheck");
     
    12211221    if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool())
    12221222        r *= HQ_FACTOR;
    1223 #ifdef Q_WS_S60
     1223#ifdef Q_OS_SYMBIAN
    12241224    /*! \hack HACK: Solution graph on Symbian is visually larger than on
    12251225     *   Windows Mobile. This coefficient makes it about the same size.
     
    13721372        hilight.setHsv(color.hue(), color.saturation(), color.value() / 2);
    13731373
    1374 #ifdef Q_WS_S60
     1374#ifdef Q_OS_SYMBIAN
    13751375    /*!
    13761376     * \hack HACK: Fixing some weird behavior with default Symbian theme
     
    13811381    solutionText->document()->setDefaultStyleSheet(QString("* {color: %1;}").arg(color.name()));
    13821382    fmt_default.setForeground(QBrush(color));
    1383 #ifdef Q_WS_S60
     1383#ifdef Q_OS_SYMBIAN
    13841384    }
    13851385#endif
     
    15491549    if (!isWindowModified())
    15501550        return true;
    1551 #ifdef Q_WS_S60
     1551#ifdef Q_OS_SYMBIAN
    15521552    int res = QSMessageBox(this).exec();
    15531553#else
     
    16111611}
    16121612
    1613 #ifdef Q_WS_S60
     1613#ifdef Q_OS_SYMBIAN
    16141614void MainWindow::resizeEvent(QResizeEvent *ev)
    16151615{
     
    16311631    QWidget::resizeEvent(ev);
    16321632}
    1633 #endif // Q_WS_S60
     1633#endif // Q_OS_SYMBIAN
    16341634
    16351635void MainWindow::retranslateUi(bool all)
     
    16921692#endif // QT_NO_STATUSTIP
    16931693
    1694 #ifdef Q_WS_S60
     1694#ifdef Q_OS_SYMBIAN
    16951695    actionRightSoftKey->setText(tr("E&xit"));
    16961696#endif
     
    17391739    Ui_MainWindow::setupUi(this);
    17401740
    1741 #ifdef Q_WS_S60
     1741#ifdef Q_OS_SYMBIAN
    17421742    setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
    1743 #endif // Q_WS_S60
     1743#endif // Q_OS_SYMBIAN
    17441744
    17451745    // File Menu
     
    17931793#endif // HANDHELD
    17941794
    1795 #ifdef Q_WS_WINCE_WM
     1795#ifdef Q_OS_WINCE_WM
    17961796    menuBar()->setDefaultAction(menuFile->menuAction());
    17971797
     
    18041804#else
    18051805    setCentralWidget(tabWidget);
    1806 #endif // Q_WS_WINCE_WM
     1806#endif // Q_OS_WINCE_WM
    18071807
    18081808    //! \hack HACK: A little hack for toolbar icons to have a sane size.
    18091809#if defined(HANDHELD) && !defined(Q_WS_MAEMO_5)
    1810 #ifdef Q_WS_S60
     1810#ifdef Q_OS_SYMBIAN
    18111811    toolBarMain->setIconSize(QSize(logicalDpiX() / 5.2, logicalDpiY() / 5.2));
    18121812#else
    18131813    toolBarMain->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4));
    1814 #endif // Q_WS_S60
     1814#endif // Q_OS_SYMBIAN
    18151815#endif // HANDHELD && !Q_WS_MAEMO_5
    18161816QToolButton *tb = static_cast<QToolButton *>(toolBarMain->widgetForAction(actionFileSave));
     
    18981898#endif // HANDHELD
    18991899
    1900 #ifdef Q_WS_S60
     1900#ifdef Q_OS_SYMBIAN
    19011901    // Replace Exit on the right soft key with our own exit action.
    19021902    // This makes it translatable.
     
    19511951}
    19521952
    1953 #ifdef Q_WS_S60
     1953#ifdef Q_OS_SYMBIAN
    19541954QSMessageBox::QSMessageBox(QWidget *parent)
    19551955    : QMessageBox(parent)
     
    19791979    done(QMessageBox::Discard);
    19801980}
    1981 #endif // Q_WS_S60
     1981#endif // Q_OS_SYMBIAN
Note: See TracChangeset for help on using the changeset viewer.