diff --git a/Fervor.pri b/Fervor.pri index f4c3973..1985715 100644 --- a/Fervor.pri +++ b/Fervor.pri @@ -1,21 +1,34 @@ +QT += core network +!build_pass:message("If you want to enable GUI for Fervor, add CONFIG += fervor_gui to your .pro file") contains(QT_VERSION, ^5\\.[0-9]\\..*){ - QT += core widgets webkitwidgets network + fervor_gui { + DEFINES += FV_GUI + QT += webkitwidgets + } win32:INCLUDEPATH += $$[QT_INSTALL_PREFIX]/include/QtZlib }else{ - #QT += core gui webkit network - QT += core webkit network fervor_gui { DEFINES += FV_GUI - QT += gui + QT += gui webkit } win32:INCLUDEPATH += $$[QT_INSTALL_PREFIX]/../../../../QtSources/4.8.1/src/3rdparty/zlib } DEFINES += FV_APP_NAME=\\\"$$TARGET\\\" DEFINES += FV_APP_VERSION=\\\"$$VERSION\\\" +PREVIOUS_FERVOR_GUI = $$cat($$PWD/fervor.gui) +fervor_gui { + CURRENT_FERVOR_GUI = enabled +} else { + CURRENT_FERVOR_GUI = disabled +} +# if last build was with another GUI option, recompile some files +!equals(PREVIOUS_FERVOR_GUI, $$CURRENT_FERVOR_GUI) { + write_file($$PWD/fervor.gui, CURRENT_FERVOR_GUI) + touch($$PWD/fvupdater.h, $$PWD/fervor.gui) +} - -DEFINES +=QUAZIP_BUILD QUAZIP_STATIC +DEFINES += QUAZIP_BUILD QUAZIP_STATIC INCLUDEPATH += $$PWD/quazip HEADERS += $$PWD/quazip/crypt.h \ diff --git a/fvignoredversions.cpp b/fvignoredversions.cpp index c665f9c..3c47ef5 100644 --- a/fvignoredversions.cpp +++ b/fvignoredversions.cpp @@ -4,12 +4,14 @@ #include #include +extern QSettings* settings; + // QSettings key for the latest skipped version #define FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY "FVLatestSkippedVersion" FVIgnoredVersions::FVIgnoredVersions(QObject *parent) : -QObject(parent) + QObject(parent) { // noop } @@ -21,32 +23,27 @@ bool FVIgnoredVersions::VersionIsIgnored(QString version) // 2) The version that was skipped before and thus stored in QSettings (ignore) // 3) A newer version (don't ignore) // 'version' is not likely to contain an older version in any case. - + if (version == QCoreApplication::applicationVersion()) { return true; } - - QSettings settings(QSettings::NativeFormat, - QSettings::UserScope, - QCoreApplication::organizationDomain(), - QCoreApplication::applicationName()); - + //QSettings settings; - if (settings.contains(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY)) { - QString lastSkippedVersion = settings.value(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY).toString(); + if (settings->contains(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY)) { + QString lastSkippedVersion = settings->value(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY).toString(); if (version == lastSkippedVersion) { // Implicitly skipped version - skip return true; } } - + std::string currentAppVersion = QCoreApplication::applicationVersion().toStdString(); std::string suggestedVersion = std::string(version.toStdString()); if (FvVersionComparator::CompareVersions(currentAppVersion, suggestedVersion) == FvVersionComparator::kAscending) { // Newer version - do not skip return false; } - + // Fallback - skip return true; } @@ -57,18 +54,13 @@ void FVIgnoredVersions::IgnoreVersion(QString version) // Don't ignore the current version return; } - + if (version.isEmpty()) { return; } - - QSettings settings(QSettings::NativeFormat, - QSettings::UserScope, - QCoreApplication::organizationDomain(), - QCoreApplication::applicationName()); - - settings.setValue(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY, version); - + //QSettings settings; + settings->setValue(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY, version); + return; -} \ No newline at end of file +} diff --git a/fvupdater.cpp b/fvupdater.cpp index 3fb99b3..45f8855 100644 --- a/fvupdater.cpp +++ b/fvupdater.cpp @@ -786,12 +786,12 @@ void FvUpdater::finishUpdate(QString pathToFinish) void FvUpdater::restartApplication() { // Spawn a new instance of myApplication: - QString app = QApplication::applicationFilePath(); - QStringList arguments = QApplication::arguments(); + QString app = QCoreApplication::applicationFilePath(); + QStringList arguments = QCoreApplication::arguments(); QString wd = QDir::currentPath(); qDebug() << app << arguments << wd; QProcess::startDetached(app, arguments, wd); - QApplication::exit(); + QCoreApplication::exit(); } void FvUpdater::setRequiredSslFingerPrint(QString md5) @@ -903,4 +903,4 @@ void FvUpdater::decideWhatToDoWithCurrentUpdateProposal() RemindMeLater(); } -#endif \ No newline at end of file +#endif diff --git a/fvupdatewindow.h b/fvupdatewindow.h index b2e3feb..f9b2fcb 100644 --- a/fvupdatewindow.h +++ b/fvupdatewindow.h @@ -1,11 +1,7 @@ #ifndef FVUPDATEWINDOW_H #define FVUPDATEWINDOW_H -#if QT_VERSION >= 0x050000 - #include -#else - #include -#endif +#include class QGraphicsScene;