Changeset f5c945d7ac in tspsg
- Timestamp:
- Sep 29, 2010, 11:21:46 PM (14 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 0007f69c46
- Parents:
- 131c5fc3ba
- git-author:
- Oleksii Serdiuk <contacts@…> (09/29/10 23:21:46)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:45:57)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
r131c5fc3ba rf5c945d7ac 42 42 * \brief Default for "Use native file dialog". 43 43 */ 44 #ifdef Q_OS_WINCE 44 #ifdef Q_OS_WINCE_WM 45 45 #define DEF_USE_NATIVE_DIALOGS false 46 46 #else … … 51 51 //! Default for "Use translucency effects in Vista/7" 52 52 #define DEF_USE_TRANSLUCENCY true 53 //! Default for "Check for updates" 54 #define DEF_CHECK_FOR_UPDATES false 55 //! Default update check interval (in days) 56 #define DEF_UPDATE_CHECK_INTERVAL 30 53 57 54 58 //////// TASK -
src/globals.h
r131c5fc3ba rf5c945d7ac 114 114 } 115 115 116 /*! 117 * \brief Checks whether the updater app is installed/available. 118 * \return \c true if updater app is available, oherwise \c false. 119 * \note The updater app is only available under Windows at this moment. 120 * On other systems this function always returns \c false. 121 */ 122 inline bool hasUpdater() 123 { 124 #ifdef Q_OS_WIN32 125 return QFile::exists("updater/Update.exe"); 126 #else // Q_OS_WIN32 127 return false; 128 #endif // Q_OS_WIN32 129 } 130 116 131 #ifdef Q_OS_WIN32 117 132 /*! -
src/main.cpp
r131c5fc3ba rf5c945d7ac 37 37 // Q_IMPORT_PLUGIN(qsvgicon) 38 38 // #endif 39 // Q_IMPORT_PLUGIN(qjpeg)40 // Q_IMPORT_PLUGIN(qtiff)41 39 //#endif 42 40 -
src/mainwindow.cpp
r131c5fc3ba rf5c945d7ac 81 81 #endif // HANDHELD 82 82 connect(actionSettingsPreferences, SIGNAL(triggered()), SLOT(actionSettingsPreferencesTriggered())); 83 #ifdef Q_OS_WIN32 84 connect(actionHelpCheck4Updates, SIGNAL(triggered()), SLOT(actionHelpCheck4UpdatesTriggered())); 85 #endif // Q_OS_WIN32 83 if (actionHelpCheck4Updates != NULL) 84 connect(actionHelpCheck4Updates, SIGNAL(triggered()), SLOT(actionHelpCheck4UpdatesTriggered())); 86 85 connect(actionSettingsLanguageAutodetect, SIGNAL(triggered(bool)), SLOT(actionSettingsLanguageAutodetectTriggered(bool))); 87 86 connect(groupSettingsLanguageList, SIGNAL(triggered(QAction *)), SLOT(groupSettingsLanguageListTriggered(QAction *))); … … 123 122 } 124 123 setWindowModified(false); 124 125 if ((actionHelpCheck4Updates != NULL) 126 && (settings->value("Check4Updates/Enabled", DEF_CHECK_FOR_UPDATES).toBool()) 127 && (QDate(qvariant_cast<QDate>(settings->value("Check4Updates/LastAttempt"))).daysTo(QDate::currentDate()) >= settings->value("Check4Updates/Interval", DEF_UPDATE_CHECK_INTERVAL).toInt())) { 128 check4Updates(true); 129 } 125 130 } 126 131 … … 430 435 #endif // HANDHELD 431 436 432 #ifdef Q_OS_WIN32433 437 void MainWindow::actionHelpCheck4UpdatesTriggered() 434 438 { … … 438 442 } 439 443 440 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 441 QProcess::execute("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\""); 442 QApplication::restoreOverrideCursor(); 443 } 444 #endif // Q_OS_WIN32 444 check4Updates(); 445 } 445 446 446 447 void MainWindow::actionHelpAboutTriggered() … … 1040 1041 } 1041 1042 1043 void MainWindow::check4Updates(bool silent) 1044 { 1045 #ifdef Q_OS_WIN32 1046 if (silent) 1047 QProcess::startDetached("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\" -silentcheck"); 1048 else { 1049 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 1050 QProcess::execute("updater/Update.exe -name=\"TSPSG: TSP Solver and Generator\" -check=\"freeupdate\""); 1051 QApplication::restoreOverrideCursor(); 1052 } 1053 #endif 1054 settings->setValue("Check4Updates/LastAttempt", QDate::currentDate().toString(Qt::ISODate)); 1055 } 1056 1042 1057 void MainWindow::closeEvent(QCloseEvent *ev) 1043 1058 { … … 1141 1156 ev->accept(); 1142 1157 } 1143 }1144 1145 bool MainWindow::hasUpdater() const1146 {1147 #ifdef Q_OS_WIN321148 return QFile::exists("updater/Update.exe");1149 #else // Q_OS_WIN321150 return false;1151 #endif // Q_OS_WIN321152 1158 } 1153 1159 … … 1444 1450 #endif // HANDHELD 1445 1451 1446 #ifdef Q_OS_WIN32 1447 actionHelpCheck4Updates->setText(tr("Check for &Updates..."));1452 if (actionHelpCheck4Updates != NULL) { 1453 actionHelpCheck4Updates->setText(tr("Check for &Updates...")); 1448 1454 #ifndef QT_NO_STATUSTIP 1449 actionHelpCheck4Updates->setStatusTip(tr("Check for %1 updates").arg(QApplication::applicationName()));1455 actionHelpCheck4Updates->setStatusTip(tr("Check for %1 updates").arg(QApplication::applicationName())); 1450 1456 #endif // QT_NO_STATUSTIP 1451 #endif // Q_OS_WIN32 1457 } 1452 1458 } 1453 1459 … … 1593 1599 #endif // HANDHELD 1594 1600 1595 #ifdef Q_OS_WIN32 1596 actionHelpCheck4Updates = new QAction(this); 1597 actionHelpCheck4Updates->setIcon(GET_ICON("system-software-update")); 1598 actionHelpCheck4Updates->setEnabled(hasUpdater()); 1599 menuHelp->insertAction(actionHelpAboutQt, actionHelpCheck4Updates); 1600 menuHelp->insertSeparator(actionHelpAboutQt); 1601 #endif // Q_OS_WIN32 1601 if (hasUpdater()) { 1602 actionHelpCheck4Updates = new QAction(this); 1603 actionHelpCheck4Updates->setIcon(GET_ICON("system-software-update")); 1604 actionHelpCheck4Updates->setEnabled(hasUpdater()); 1605 menuHelp->insertAction(actionHelpAboutQt, actionHelpCheck4Updates); 1606 menuHelp->insertSeparator(actionHelpAboutQt); 1607 } else 1608 actionHelpCheck4Updates = NULL; 1602 1609 1603 1610 spinCities->setMaximum(MAX_NUM_CITIES); -
src/mainwindow.h
r131c5fc3ba rf5c945d7ac 74 74 void actionSettingsToolbarsConfigureTriggered(); 75 75 #endif // HANDHELD 76 #ifdef Q_OS_WIN3277 76 void actionHelpCheck4UpdatesTriggered(); 78 #endif // Q_OS_WIN3279 77 void actionHelpAboutTriggered(); 80 78 // Buttons … … 111 109 QAction *actionFilePrint; 112 110 #endif // QT_NO_PRINTER 113 #ifdef Q_OS_WIN32114 111 QAction *actionHelpCheck4Updates; 115 #endif // Q_OS_WIN32116 112 QSettings *settings; 117 113 CTSPModel *tspmodel; … … 136 132 fmt_altlist; 137 133 134 void check4Updates(bool silent = false); 138 135 void closeEvent(QCloseEvent *ev); 139 136 void dragEnterEvent(QDragEnterEvent *ev); 140 137 void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL); 141 138 void dropEvent(QDropEvent *ev); 142 bool hasUpdater() const;143 139 void initDocStyleSheet(); 144 140 void loadLangList(); -
src/settingsdialog.cpp
r131c5fc3ba rf5c945d7ac 72 72 connect(cbShowGraph, SIGNAL(toggled(bool)), cbHQGraph, SLOT(setEnabled(bool))); 73 73 #endif 74 75 if (hasUpdater()) { 76 cbCheck4Updates = new QCheckBox(bgWhite); 77 cbCheck4Updates->setObjectName("cbCheck4Updates"); 78 #ifndef QT_NO_STATUSTIP 79 cbCheck4Updates->setStatusTip(tr("Automatically check for updates at the given interval")); 80 #endif // QT_NO_STATUSTIP 81 cbCheck4Updates->setText(tr("Check for updates every")); 82 cbCheck4Updates->setCursor(QCursor(Qt::PointingHandCursor)); 83 84 spinUpdateCheckInterval = new QSpinBox(bgWhite); 85 spinUpdateCheckInterval->setObjectName("spinUpdateCheckInterval"); 86 #ifndef QT_NO_STATUSTIP 87 spinUpdateCheckInterval->setStatusTip(tr("Minimal interval at which to check for updates")); 88 #endif // QT_NO_STATUSTIP 89 spinUpdateCheckInterval->setSuffix(tr(" days", "Don't forget a space at the beginning!")); 90 spinUpdateCheckInterval->setRange(1, 365); 91 spinUpdateCheckInterval->setCursor(QCursor(Qt::PointingHandCursor)); 92 93 connect(cbCheck4Updates, SIGNAL(toggled(bool)), spinUpdateCheckInterval, SLOT(setEnabled(bool))); 94 95 box = static_cast<QBoxLayout *>(tabGeneral->layout()); 96 hbox1 = new QHBoxLayout(); 97 hbox1->setSpacing(0); 98 hbox1->addWidget(cbCheck4Updates); 99 hbox1->addWidget(spinUpdateCheckInterval); 100 hbox1->addStretch(); 101 box->insertLayout(box->indexOf(cbUseNativeDialogs) + 1, hbox1); 102 } else 103 cbCheck4Updates = NULL; 74 104 75 105 #ifdef HANDHELD … … 209 239 cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool()); 210 240 #endif // HANDHELD 241 if (cbCheck4Updates != NULL) { 242 settings->beginGroup("Check4Updates"); 243 cbCheck4Updates->setChecked(settings->value("Enabled", DEF_CHECK_FOR_UPDATES).toBool()); 244 spinUpdateCheckInterval->setValue(settings->value("Interval", DEF_UPDATE_CHECK_INTERVAL).toInt()); 245 settings->endGroup(); 246 spinUpdateCheckInterval->setEnabled(cbCheck4Updates->isChecked()); 247 } 211 248 212 249 settings->beginGroup("Task"); … … 231 268 comboGraphImageFormat->addItem("svg"); 232 269 #endif // NOSVG && QT_VERSION >= 0x040500 233 // We create awhitelist of formats, supported by the most popular web browsers according to234 // http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support235 // + TIFF format (there are plugins to support it).270 // We create whitelist of formats, supported by the most popular web browsers according to 271 // http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support 272 // + TIFF format (there are plugins to support it). 236 273 QStringList whitelist; 237 274 whitelist << "bmp" << "jpeg" << "png" << "tiff" << "xbm"; … … 327 364 settings->setValue("SavePos", cbSaveState->isChecked()); 328 365 #endif // HANDHELD 366 if (cbCheck4Updates != NULL) { 367 settings->beginGroup("Check4Updates"); 368 settings->setValue("Enabled", cbCheck4Updates->isChecked()); 369 if (cbCheck4Updates->isChecked()) 370 settings->setValue("Interval", spinUpdateCheckInterval->value()); 371 settings->endGroup(); 372 } 329 373 330 374 settings->beginGroup("Task"); -
src/settingsdialog.h
r131c5fc3ba rf5c945d7ac 59 59 QCheckBox *cbUseTranslucency; 60 60 #endif // Q_OS_WIN32 61 QCheckBox *cbCheck4Updates; 62 QSpinBox *spinUpdateCheckInterval; 61 63 #ifndef QT_NO_PRINTER 62 64 QCheckBox *cbHQGraph; -
tspsg.pri
r131c5fc3ba rf5c945d7ac 4 4 # Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name> 5 5 # 6 # $Id $7 # $URL $6 # $Id: tspsg.pri 137 2010-09-15 14:57:37Z laleppa $ 7 # $URL: https://svn.tspsg.info/svnroot/tspsg/trunk/tspsg.pri $ 8 8 # 9 9 # This file is part of TSPSG. … … 46 46 } 47 47 48 win* { 49 RC_FILE = resources/tspsg.rc 50 } 51 48 52 #Translations 49 53 CODECFORTR = UTF-8 … … 60 64 HEADERS += src/_.h 61 65 } 66 -
tspsg.pro
r131c5fc3ba rf5c945d7ac 20 20 21 21 # QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk 22 23 # Version information 24 QMAKE_TARGET_COMPANY = Oleksii "Lёppa" Serdiuk 25 QMAKE_TARGET_PRODUCT = TSP Solver and Generator 26 QMAKE_TARGET_DESCRIPTION = TSPSG: TSP Solver and Generator 27 QMAKE_TARGET_COPYRIGHT = Copyright © 2007-2010 Oleksii "Lёppa" Serdiuk <contacts[at]oleksii[dot]name> 22 28 23 29 # Versioning … … 64 70 # We "embed" SVG icon, JPEG and TIFF support on static build 65 71 DEFINES += STATIC_BUILD 66 # QTPLUGIN += qjpeg qtiff67 72 # !nosvg:QTPLUGIN += qsvgicon 68 73 }
Note: See TracChangeset
for help on using the changeset viewer.