- Timestamp:
- Sep 6, 2010, 10:23:38 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/globals.h
r129 r134 31 31 // INCLUDES 32 32 #include <QtCore> 33 #if QT_VERSION < 0x040500 34 #error You are using Qt version < 4.5 but minimum required version is 4.5.0. Compilation aborted. 35 #endif 36 #ifdef QT_NO_SVG 37 #define NOSVG 38 #endif 33 39 #include <QtGui> 34 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)40 #if !defined(NOSVG) 35 41 #include <QtSvg> 36 #endif // NOSVG && QT_VERSION >= 0x04050042 #endif // NOSVG 37 43 38 44 #if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) … … 119 125 #endif // Q_OS_WIN32 120 126 127 #if QT_VERSION >= 0x040600 128 #define GET_ICON(x) QIcon::fromTheme(x, QIcon(":/images/icons/"x".png")) 129 #else 130 #define GET_ICON(x) QIcon(":/images/icons/"x".png") 131 #endif 132 121 133 // Sanity checks 122 134 // Check that default number of cities is sane (<= MAX_NUM_CITIES) -
trunk/src/main.cpp
r132 r134 23 23 24 24 #include "mainwindow.h" 25 #if QT_VERSION < 0x040 50026 #ifdef _MSC_VER27 #pragma message("WARNING: You are using Qt version < 4. 5. Application will not support some non-critical features.")28 #elif (defined(__GNUC__) || defined(__MINGW32__))29 #warning WARNING: You are using Qt version < 4. 5. Application will not support some non-critical features.25 #if QT_VERSION < 0x040600 26 #ifdef Q_CC_MSVC 27 #pragma message("WARNING: You are using Qt version < 4.6. Application will not support some non-critical features.") 28 #elif defined(Q_CC_GNU) 29 #warning WARNING: You are using Qt version < 4.6. Application will not support some non-critical features. 30 30 #else 31 #error You are using Qt version < 4. 5. Application will not support some non-critical features. To continue, please, comment line 31 at main.cpp.31 #error You are using Qt version < 4.6. Application will not support some non-critical features. To continue, please, comment line 31 at main.cpp. 32 32 #endif 33 33 #endif -
trunk/src/mainwindow.cpp
r133 r134 226 226 #endif 227 227 filters.append(tr("HTML Files") + " (*.html *.htm)"); 228 #if QT_VERSION >= 0x040500229 228 filters.append(tr("OpenDocument Files") + " (*.odt)"); 230 #endif // QT_VERSION >= 0x040500231 229 filters.append(tr("All Files") + " (*)"); 232 230 … … 258 256 QFileInfo fi(selectedFile); 259 257 QString format = settings->value("Output/GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT).toString(); 260 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)258 #if !defined(NOSVG) 261 259 if (!QImageWriter::supportedImageFormats().contains(format.toAscii()) && (format != "svg")) { 262 #else // NOSVG && QT_VERSION >= 0x040500260 #else // NOSVG 263 261 if (!QImageWriter::supportedImageFormats().contains(format.toAscii())) { 264 #endif // NOSVG && QT_VERSION >= 0x040500262 #endif // NOSVG 265 263 format = DEF_GRAPH_IMAGE_FORMAT; 266 264 settings->remove("Output/GraphImageFormat"); … … 277 275 278 276 // Saving solution graph as SVG or PNG (depending on settings and SVG support) 279 #if !defined(NOSVG) && (QT_VERSION >= 0x040500)277 #if !defined(NOSVG) 280 278 if (format == "svg") { 281 279 QSvgGenerator svg; … … 290 288 p.end(); 291 289 } else { 292 #endif // NOSVG && QT_VERSION >= 0x040500290 #endif // NOSVG 293 291 QImage i(graph.width(), graph.height(), QImage::Format_ARGB32); 294 292 i.fill(0x00FFFFFF); … … 311 309 return; 312 310 } 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 319 314 } else { 320 315 QTextDocumentWriter dw(selectedFile); … … 323 318 if (!dw.write(solutionText->document())) 324 319 QMessageBox::critical(this, tr("Solution Save"), tr("Unable to save the solution.\nError: %1").arg(dw.device()->errorString())); 325 #endif // QT_VERSION >= 0x040500326 320 } 327 321 QApplication::restoreOverrideCursor(); … … 565 559 566 560 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")); 568 562 569 563 hb2->addWidget(bb); … … 599 593 dlg->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); 600 594 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")); 602 596 dlg->setLayout(vb); 603 597 … … 655 649 pd.setBar(pb); 656 650 QPushButton *cancel = new QPushButton(&pd); 657 cancel->setIcon( QIcon::fromTheme("dialog-cancel", QIcon(":/images/icons/dialog-cancel.png")));651 cancel->setIcon(GET_ICON("dialog-cancel")); 658 652 cancel->setText(QApplication::translate("QProgressDialog", "Cancel", "No need to translate this. This translation will be taken from Qt translation files.")); 659 653 pd.setCancelButton(cancel); … … 1224 1218 a = menuSettingsLanguage->addAction(language.at(2)); 1225 1219 a->setStatusTip(language.at(3)); 1220 #if QT_VERSION >= 0x040600 1226 1221 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 1227 1225 a->setData(language.at(0)); 1228 1226 a->setCheckable(true); … … 1479 1477 1480 1478 // 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")); 1486 1484 // 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")); 1491 1489 // 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")); 1495 1493 // 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("")); 1502 1500 1503 1501 #if QT_VERSION >= 0x040600 … … 1541 1539 actionFilePrintPreview->setObjectName("actionFilePrintPreview"); 1542 1540 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")); 1544 1542 1545 1543 actionFilePrint = new QAction(this); 1546 1544 actionFilePrint->setObjectName("actionFilePrint"); 1547 1545 actionFilePrint->setEnabled(false); 1548 actionFilePrint->setIcon( QIcon::fromTheme("document-print", QIcon(":/images/icons/document-print.png")));1546 actionFilePrint->setIcon(GET_ICON("document-print")); 1549 1547 1550 1548 menuFile->insertAction(actionFileExit,actionFilePrintPreview); … … 1566 1564 #ifndef HANDHELD 1567 1565 actionSettingsToolbarsConfigure = new QAction(this); 1568 actionSettingsToolbarsConfigure->setIcon( QIcon::fromTheme("configure-toolbars", QIcon(":/images/icons/configure-toolbars.png")));1566 actionSettingsToolbarsConfigure->setIcon(GET_ICON("configure-toolbars")); 1569 1567 #endif // HANDHELD 1570 1568 1571 1569 #ifdef Q_OS_WIN32 1572 1570 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")); 1574 1572 actionHelpCheck4Updates->setEnabled(hasUpdater()); 1575 1573 menuHelp->insertAction(actionHelpAboutQt, actionHelpCheck4Updates); -
trunk/src/settingsdialog.cpp
r129 r134 35 35 setupUi(this); 36 36 37 setWindowIcon( QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png")));38 39 buttonBox->button(QDialogButtonBox::Ok)->setIcon( QIcon::fromTheme("dialog-ok", QIcon(":/images/icons/dialog-ok.png")));37 setWindowIcon(GET_ICON("preferences-system")); 38 39 buttonBox->button(QDialogButtonBox::Ok)->setIcon(GET_ICON("dialog-ok")); 40 40 buttonBox->button(QDialogButtonBox::Ok)->setStatusTip(tr("Save new preferences")); 41 41 buttonBox->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor)); 42 buttonBox->button(QDialogButtonBox::Cancel)->setIcon( QIcon::fromTheme("dialog-cancel", QIcon(":/images/icons/dialog-cancel.png")));42 buttonBox->button(QDialogButtonBox::Cancel)->setIcon(GET_ICON("dialog-cancel")); 43 43 buttonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Close without saving preferences")); 44 44 buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor)); 45 45 46 buttonColor->setIcon( QIcon::fromTheme("format-text-color", QIcon(":/images/icons/format-text-color.png")));47 buttonFont->setIcon( QIcon::fromTheme("preferences-desktop-font", QIcon(":/images/icons/preferences-desktop-font.png")));48 buttonHelp->setIcon( QIcon::fromTheme("help-hint", QIcon(":/images/icons/help-hint.png")));46 buttonColor->setIcon(GET_ICON("format-text-color")); 47 buttonFont->setIcon(GET_ICON("preferences-desktop-font")); 48 buttonHelp->setIcon(GET_ICON("help-hint")); 49 49 50 50 QPalette p = bgWhite->palette(); … … 131 131 imgIcon->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding); 132 132 imgIcon->setFrameShape(QFrame::NoFrame); 133 imgIcon->setPixmap( QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png")).pixmap(128, 128));133 imgIcon->setPixmap(GET_ICON("preferences-system").pixmap(128, 128)); 134 134 imgIcon->setStyleSheet("background-color: #0080C0; padding-top: 11px;"); 135 135 imgIcon->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
Note: See TracChangeset
for help on using the changeset viewer.