Changeset 89e5214692 in tspsg for src


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.

Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/3rdparty/qttoolbardialog-2.2_1-opensource/src/qttoolbardialog.h

    rf48433245d r89e5214692  
    5656#endif
    5757
    58 #if defined(Q_WS_WIN)
     58#if defined(Q_OS_WIN32)
    5959#  if !defined(QT_QTTOOLBARDIALOG_EXPORT) && !defined(QT_QTTOOLBARDIALOG_IMPORT)
    6060#    define QT_QTTOOLBARDIALOG_EXPORT
  • src/defaults.h

    rf48433245d r89e5214692  
    4242 * \brief Default for "Use native file dialog".
    4343 */
    44 #ifdef Q_WS_WINCE_WM
     44#ifdef Q_OS_WINCE_WM
    4545#   define DEF_USE_NATIVE_DIALOGS false
    4646#else
    4747#   define DEF_USE_NATIVE_DIALOGS true
    48 #endif // Q_WS_WINCE_WM
     48#endif // Q_OS_WINCE_WM
    4949//! Default for "Save main window state and position"
    5050#define DEF_SAVEPOS true
     
    5353 * \brief Default for "Use translucency effects"
    5454 */
    55 #ifdef Q_WS_WIN32
     55#ifdef Q_OS_WIN32
    5656#   define DEF_USE_TRANSLUCENCY true
    5757#else
     
    102102 * \brief Default font size
    103103 */
    104 #ifdef Q_WS_S60
     104#ifdef Q_OS_SYMBIAN
    105105#   define DEF_FONT_SIZE 8
    106106#else
    107107#   define DEF_FONT_SIZE 10
    108 #endif // Q_WS_S60
     108#endif // Q_OS_SYMBIAN
    109109//! Default solution text color
    110110#define DEF_TEXT_COLOR QPalette().color(QPalette::Text)
  • src/globals.h

    rf48433245d r89e5214692  
    3434#   error You are using Qt version < 4.5 but minimum required version is 4.5.0. Compilation aborted.
    3535#endif
    36 #if defined(Q_WS_WINCE_WM) || defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
     36#if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    3737    //! This is defined on handheld devices (e.g., Windows Mobile, Symbian).
    3838#   define HANDHELD
     
    131131inline bool hasUpdater()
    132132{
    133 #ifdef Q_WS_WIN32
     133#ifdef Q_OS_WIN32
    134134    return QFile::exists("updater/Update.exe");
    135 #else // Q_WS_WIN32
     135#else // Q_OS_WIN32
    136136    return false;
    137 #endif // Q_WS_WIN32
     137#endif // Q_OS_WIN32
    138138}
    139139
  • src/main.cpp

    rf48433245d r89e5214692  
    4141int main(int argc, char *argv[])
    4242{
    43 #ifdef Q_WS_S60
     43#ifdef Q_OS_SYMBIAN
    4444    // Not enough memory for solution graph generation with tasks
    4545    // of 20 and more cities if we use non-raster graphics system.
     
    6161    qsrand(QDateTime::currentDateTime().toTime_t() ^ QCursor::pos().x() ^ QCursor::pos().y());
    6262
    63 #ifdef Q_WS_WINCE_WM
     63#ifdef Q_OS_WINCE_WM
    6464    // Qt "leaves" unpacked .ttf files after running - let's try to delete them.
    6565QStringList files = QDir(app.applicationDirPath(), "*.ttf").entryList();
     
    8181
    8282MainWindow mainwindow;
    83 #ifdef Q_WS_S60
     83#ifdef Q_OS_SYMBIAN
    8484    //! \hack HACK: A workaround to hide Actions menu item in Symbian.
    8585QWidgetList widgets = QApplication::allWidgets();
  • 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
  • src/mainwindow.h

    rf48433245d r89e5214692  
    3636#include "tspmodel.h"
    3737
    38 #ifdef Q_WS_WIN32
     38#ifdef Q_OS_WIN32
    3939    // Forward declaration. A real one is in shobjidl.h
    4040    struct ITaskbarList3;
     
    8686    void dataChanged();
    8787    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
    88 #ifdef Q_WS_WINCE_WM
     88#ifdef Q_OS_WINCE_WM
    8989    void changeEvent(QEvent *ev);
    9090    void desktopResized(int screen);
    91 #endif // Q_WS_WINCE_WM
     91#endif // Q_OS_WINCE_WM
    9292    void numCitiesChanged(int nCities);
    9393#ifndef QT_NO_PRINTER
    9494    void printPreview(QPrinter *printer);
    9595#endif // QT_NO_PRINTER
    96 #ifdef Q_WS_WIN32
     96#ifdef Q_OS_WIN32
    9797    void solverRoutePartFound(int n);
    98 #endif // Q_WS_WIN32
     98#endif // Q_OS_WIN32
    9999    void spinCitiesValueChanged(int nCities);
    100100
     
    114114#endif // QT_NO_PRINTER
    115115    QAction *actionHelpCheck4Updates;
    116 #ifdef Q_WS_S60
     116#ifdef Q_OS_SYMBIAN
    117117    QAction *actionRightSoftKey;
    118118#endif
    119119    QSettings *settings;
    120120    CTSPModel *tspmodel;
    121 #ifdef Q_WS_WINCE_WM
     121#ifdef Q_OS_WINCE_WM
    122122    QRect currentGeometry;
    123 #endif // Q_WS_WINCE_WM
     123#endif // Q_OS_WINCE_WM
    124124
    125 #ifdef Q_WS_WIN32
     125#ifdef Q_OS_WIN32
    126126    ITaskbarList3 *tl;
    127 #endif // Q_WS_WIN32
     127#endif // Q_OS_WIN32
    128128
    129129    // The solution graph SVG
     
    154154    void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
    155155    void outputMatrix(QTextCursor &cur, const SStep &step);
    156 #ifdef Q_WS_S60
     156#ifdef Q_OS_SYMBIAN
    157157    void resizeEvent(QResizeEvent *ev);
    158 #endif // Q_WS_S60
     158#endif // Q_OS_SYMBIAN
    159159    void retranslateUi(bool all = true);
    160160    bool saveTask();
     
    165165};
    166166
    167 #ifdef Q_WS_S60
     167#ifdef Q_OS_SYMBIAN
    168168// A quickly hacked QMessageBox for Symbian that supports three buttons.
    169169class QSMessageBox: public QMessageBox {
     
    175175    QSMessageBox(QWidget *parent = 0);
    176176};
    177 #endif // Q_WS_S60
     177#endif // Q_OS_SYMBIAN
    178178
    179179#endif // MAINWINDOW_H
  • src/qtwin.cpp

    rf48433245d r89e5214692  
    1919#endif // Q_WS_X11
    2020
    21 #ifdef Q_WS_WIN
     21#ifdef Q_OS_WIN32
    2222
    2323#include <qt_windows.h>
     
    9999bool QtWin::isCompositionEnabled()
    100100{
    101 #ifdef Q_WS_WIN
     101#ifdef Q_OS_WIN32
    102102    if (resolveLibs()) {
    103103        HRESULT hr = S_OK;
     
    124124{
    125125    Q_ASSERT(widget);
    126     Q_UNUSED(widget);
    127     Q_UNUSED(enable);
    128126    bool result = false;
    129 #ifdef Q_WS_WIN
     127#ifdef Q_OS_WIN32
    130128    if (resolveLibs()) {
    131129        DWM_BLURBEHIND bb = {0};
     
    137135        widget->setAttribute(Qt::WA_TranslucentBackground, enable);
    138136        widget->setAttribute(Qt::WA_NoSystemBackground, enable);
    139 #ifdef Q_WS_WIN
    140         hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb);
     137#ifdef Q_OS_WIN32
     138        hr = pDwmEnableBlurBehindWindow(HWND(widget->winId()), &bb);
    141139        if (SUCCEEDED(hr)) {
    142140            result = true;
     
    171169
    172170    bool result = false;
    173 #ifdef Q_WS_WIN
     171#ifdef Q_OS_WIN32
    174172    if (resolveLibs()) {
    175173        QLibrary dwmLib(QString::fromAscii("dwmapi"));
    176174        HRESULT hr = S_OK;
    177175        MARGINS m = {left, top, right, bottom};
    178         hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
     176        hr = pDwmExtendFrameIntoClientArea(HWND(widget->winId()), &m);
    179177        if (SUCCEEDED(hr)) {
    180178            result = true;
     
    196194    QColor resultColor = QApplication::palette().window().color();
    197195
    198 #ifdef Q_WS_WIN
     196#ifdef Q_OS_WIN32
    199197    if (resolveLibs()) {
    200198        DWORD color = 0;
     
    210208}
    211209
    212 #ifdef Q_WS_WIN
     210#ifdef Q_OS_WIN32
    213211WindowNotifier *QtWin::windowNotifier()
    214212{
  • src/settingsdialog.cpp

    rf48433245d r89e5214692  
    128128    bgWhite->layout()->setMargin(0);
    129129
    130 #ifdef Q_WS_S60
     130#ifdef Q_OS_SYMBIAN
    131131    // On Symbian buttons are moved to a native bar so Help button is
    132132    // left alone. This causes it to be more to the middle instead of
     
    217217#endif // HANDHELD
    218218
    219 #ifdef Q_WS_WINCE_WM
     219#ifdef Q_OS_WINCE_WM
    220220    // We need to react to SIP show/hide and resize the window appropriately
    221221    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
    222 #endif // Q_WS_WINCE_WM
     222#endif // Q_OS_WINCE_WM
    223223    connect(spinRandMin, SIGNAL(valueChanged(int)), SLOT(spinRandMinValueChanged(int)));
    224224    connect(buttonFont, SIGNAL(clicked()), SLOT(buttonFontClicked()));
     
    325325#else
    326326    adjustSize();
    327 #endif // Q_WS_WINCE_WM
     327#endif // Q_OS_WINCE_WM
    328328}
    329329
     
    512512}
    513513
    514 #ifdef Q_WS_WINCE_WM
     514#ifdef Q_OS_WINCE_WM
    515515void SettingsDialog::desktopResized(int screen)
    516516{
     
    544544    QWidget::showEvent(ev);
    545545}
    546 #endif // Q_WS_WINCE_WM
     546#endif // Q_OS_WINCE_WM
    547547
    548548void SettingsDialog::spinRandMinValueChanged(int val) {
  • src/settingsdialog.h

    rf48433245d r89e5214692  
    6464    QCheckBox *cbHQGraph;
    6565#endif
    66 #ifdef Q_WS_WINCE_WM
     66#ifdef Q_OS_WINCE_WM
    6767    QRect currentGeometry;
    6868#elif !defined(HANDHELD)
     
    7575    bool event(QEvent *ev);
    7676#endif // QT_NO_STATUSTIP
    77 #endif // Q_WS_WINCE_WM
     77#endif // Q_OS_WINCE_WM
    7878
    7979    void pickColor(QColor &where);
     
    8888//    void buttonBgColorClicked();
    8989    void buttonFontClicked();
    90 #ifdef Q_WS_WINCE_WM
     90#ifdef Q_OS_WINCE_WM
    9191    void desktopResized(int screen);
    9292    void showEvent(QShowEvent *ev);
    93 #endif // Q_WS_WINCE_WM
     93#endif // Q_OS_WINCE_WM
    9494    void spinRandMinValueChanged(int val);
    9595};
Note: See TracChangeset for help on using the changeset viewer.