Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "reinstate access to QSettings to store ignored version". Fixed compilation on Windows with Qt 5.1.1. Added an option to disable GUI, this time for both Qt 4 and Qt 5. #15

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions Fervor.pri
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
36 changes: 14 additions & 22 deletions fvignoredversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
#include <QCoreApplication>
#include <string>

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
}
Expand All @@ -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;
}
Expand All @@ -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;
}
}
8 changes: 4 additions & 4 deletions fvupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -903,4 +903,4 @@ void FvUpdater::decideWhatToDoWithCurrentUpdateProposal()
RemindMeLater();
}

#endif
#endif
6 changes: 1 addition & 5 deletions fvupdatewindow.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#ifndef FVUPDATEWINDOW_H
#define FVUPDATEWINDOW_H

#if QT_VERSION >= 0x050000
#include <QtWidgets/QWidget>
#else
#include <QWidget>
#endif
#include <QWidget>

class QGraphicsScene;

Expand Down