Changeset 2a436ea693 in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Sep 6, 2010, 10:23:38 PM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
a713b103e8
Parents:
bbac1ebb13
git-author:
Oleksii Serdiuk <contacts@…> (09/06/10 22:23:38)
git-committer:
Oleksii Serdiuk <contacts@…> (06/29/12 19:45:57)
Message:
  • The minimum required version of Qt is now 4.5.0.
  • Updated source code to be compatible with the minimum required version of Qt.
  • Updated documentation to reflect these changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    rbbac1ebb13 r2a436ea693  
    226226#endif
    227227        filters.append(tr("HTML Files") + " (*.html *.htm)");
    228 #if QT_VERSION >= 0x040500
    229228        filters.append(tr("OpenDocument Files") + " (*.odt)");
    230 #endif // QT_VERSION >= 0x040500
    231229        filters.append(tr("All Files") + " (*)");
    232230
     
    258256QFileInfo fi(selectedFile);
    259257QString format = settings->value("Output/GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT).toString();
    260 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)
     258#if !defined(NOSVG)
    261259        if (!QImageWriter::supportedImageFormats().contains(format.toAscii()) && (format != "svg")) {
    262 #else // NOSVG && QT_VERSION >= 0x040500
     260#else // NOSVG
    263261        if (!QImageWriter::supportedImageFormats().contains(format.toAscii())) {
    264 #endif // NOSVG && QT_VERSION >= 0x040500
     262#endif // NOSVG
    265263                format = DEF_GRAPH_IMAGE_FORMAT;
    266264                settings->remove("Output/GraphImageFormat");
     
    277275
    278276                // Saving solution graph as SVG or PNG (depending on settings and SVG support)
    279 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)
     277#if !defined(NOSVG)
    280278                if (format == "svg") {
    281279QSvgGenerator svg;
     
    290288                        p.end();
    291289                } else {
    292 #endif // NOSVG && QT_VERSION >= 0x040500
     290#endif // NOSVG
    293291QImage i(graph.width(), graph.height(), QImage::Format_ARGB32);
    294292                        i.fill(0x00FFFFFF);
     
    311309                                return;
    312310                        }
    313 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)
    314                 }
    315 #endif // NOSVG && QT_VERSION >= 0x040500
    316 
    317 // Qt < 4.5 has no QTextDocumentWriter class
    318 #if QT_VERSION >= 0x040500
     311#if !defined(NOSVG)
     312                }
     313#endif // NOSVG
    319314        } else {
    320315QTextDocumentWriter dw(selectedFile);
     
    323318                if (!dw.write(solutionText->document()))
    324319                        QMessageBox::critical(this, tr("Solution Save"), tr("Unable to save the solution.\nError: %1").arg(dw.device()->errorString()));
    325 #endif // QT_VERSION >= 0x040500
    326320        }
    327321        QApplication::restoreOverrideCursor();
     
    565559
    566560        bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
    567         bb->button(QDialogButtonBox::Ok)->setIcon(QIcon::fromTheme("dialog-ok", QIcon(":/images/icons/dialog-ok.png")));
     561        bb->button(QDialogButtonBox::Ok)->setIcon(GET_ICON("dialog-ok"));
    568562
    569563        hb2->addWidget(bb);
     
    599593        dlg->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
    600594        dlg->setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
    601         dlg->setWindowIcon(QIcon::fromTheme("help-about", QIcon(":/images/icons/help-about.png")));
     595        dlg->setWindowIcon(GET_ICON("help-about"));
    602596        dlg->setLayout(vb);
    603597
     
    655649        pd.setBar(pb);
    656650QPushButton *cancel = new QPushButton(&pd);
    657         cancel->setIcon(QIcon::fromTheme("dialog-cancel", QIcon(":/images/icons/dialog-cancel.png")));
     651        cancel->setIcon(GET_ICON("dialog-cancel"));
    658652        cancel->setText(QApplication::translate("QProgressDialog", "Cancel", "No need to translate this. This translation will be taken from Qt translation files."));
    659653        pd.setCancelButton(cancel);
     
    12241218                a = menuSettingsLanguage->addAction(language.at(2));
    12251219                a->setStatusTip(language.at(3));
     1220#if QT_VERSION >= 0x040600
    12261221                a->setIcon(QIcon::fromTheme(QString("flag-%1").arg(language.at(1)), QIcon(QString(":/images/icons/l10n/flag-%1.png").arg(language.at(1)))));
     1222#else
     1223                a->setIcon(QIcon(QString(":/images/icons/l10n/flag-%1.png").arg(language.at(1))));
     1224#endif
    12271225                a->setData(language.at(0));
    12281226                a->setCheckable(true);
     
    14791477
    14801478        // File Menu
    1481         actionFileNew->setIcon(QIcon::fromTheme("document-new", QIcon(":/images/icons/document-new.png")));
    1482         actionFileOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/icons/document-open.png")));
    1483         actionFileSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/icons/document-save.png")));
    1484         menuFileSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/icons/document-save-as.png")));
    1485         actionFileExit->setIcon(QIcon::fromTheme("application-exit", QIcon(":/images/icons/application-exit.png")));
     1479        actionFileNew->setIcon(GET_ICON("document-new"));
     1480        actionFileOpen->setIcon(GET_ICON("document-open"));
     1481        actionFileSave->setIcon(GET_ICON("document-save"));
     1482        menuFileSaveAs->setIcon(GET_ICON("document-save-as"));
     1483        actionFileExit->setIcon(GET_ICON("application-exit"));
    14861484        // Settings Menu
    1487         menuSettingsLanguage->setIcon(QIcon::fromTheme("preferences-desktop-locale", QIcon(":/images/icons/preferences-desktop-locale.png")));
    1488         actionSettingsLanguageEnglish->setIcon(QIcon::fromTheme("flag-gb", QIcon(":/images/icons/l10n/flag-gb.png")));
    1489         menuSettingsStyle->setIcon(QIcon::fromTheme("preferences-desktop-theme", QIcon(":/images/icons/preferences-desktop-theme.png")));
    1490         actionSettingsPreferences->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png")));
     1485        menuSettingsLanguage->setIcon(GET_ICON("preferences-desktop-locale"));
     1486        actionSettingsLanguageEnglish->setIcon(GET_ICON("flag-gb"));
     1487        menuSettingsStyle->setIcon(GET_ICON("preferences-desktop-theme"));
     1488        actionSettingsPreferences->setIcon(GET_ICON("preferences-system"));
    14911489        // Help Menu
    1492         actionHelpContents->setIcon(QIcon::fromTheme("help-contents", QIcon(":/images/icons/help-contents.png")));
    1493         actionHelpContextual->setIcon(QIcon::fromTheme("help-contextual", QIcon(":/images/icons/help-contextual.png")));
    1494         actionHelpAbout->setIcon(QIcon::fromTheme("help-about", QIcon(":/images/icons/help-about.png")));
     1490        actionHelpContents->setIcon(GET_ICON("help-contents"));
     1491        actionHelpContextual->setIcon(GET_ICON("help-contextual"));
     1492        actionHelpAbout->setIcon(GET_ICON("help-about"));
    14951493        // Buttons
    1496         buttonRandom->setIcon(QIcon::fromTheme("roll", QIcon(":/images/icons/roll.png")));
    1497         buttonSolve->setIcon(QIcon::fromTheme("dialog-ok", QIcon(":/images/icons/dialog-ok.png")));
    1498         buttonSaveSolution->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/icons/document-save-as.png")));
    1499         buttonBackToTask->setIcon(QIcon::fromTheme("go-previous", QIcon(":/images/icons/go-previous.png")));
    1500 
    1501 //      action->setIcon(QIcon::fromTheme("", QIcon(":/images/icons/.png")));
     1494        buttonRandom->setIcon(GET_ICON("roll"));
     1495        buttonSolve->setIcon(GET_ICON("dialog-ok"));
     1496        buttonSaveSolution->setIcon(GET_ICON("document-save-as"));
     1497        buttonBackToTask->setIcon(GET_ICON("go-previous"));
     1498
     1499//      action->setIcon(GET_ICON(""));
    15021500
    15031501#if QT_VERSION >= 0x040600
     
    15411539        actionFilePrintPreview->setObjectName("actionFilePrintPreview");
    15421540        actionFilePrintPreview->setEnabled(false);
    1543         actionFilePrintPreview->setIcon(QIcon::fromTheme("document-print-preview", QIcon(":/images/icons/document-print-preview.png")));
     1541        actionFilePrintPreview->setIcon(GET_ICON("document-print-preview"));
    15441542
    15451543        actionFilePrint = new QAction(this);
    15461544        actionFilePrint->setObjectName("actionFilePrint");
    15471545        actionFilePrint->setEnabled(false);
    1548         actionFilePrint->setIcon(QIcon::fromTheme("document-print", QIcon(":/images/icons/document-print.png")));
     1546        actionFilePrint->setIcon(GET_ICON("document-print"));
    15491547
    15501548        menuFile->insertAction(actionFileExit,actionFilePrintPreview);
     
    15661564#ifndef HANDHELD
    15671565        actionSettingsToolbarsConfigure = new QAction(this);
    1568         actionSettingsToolbarsConfigure->setIcon(QIcon::fromTheme("configure-toolbars", QIcon(":/images/icons/configure-toolbars.png")));
     1566        actionSettingsToolbarsConfigure->setIcon(GET_ICON("configure-toolbars"));
    15691567#endif // HANDHELD
    15701568
    15711569#ifdef Q_OS_WIN32
    15721570        actionHelpCheck4Updates = new QAction(this);
    1573         actionHelpCheck4Updates->setIcon(QIcon::fromTheme("system-software-update", QIcon(":/images/icons/system-software-update.png")));
     1571        actionHelpCheck4Updates->setIcon(GET_ICON("system-software-update"));
    15741572        actionHelpCheck4Updates->setEnabled(hasUpdater());
    15751573        menuHelp->insertAction(actionHelpAboutQt, actionHelpCheck4Updates);
Note: See TracChangeset for help on using the changeset viewer.