diff --git a/deploy/FortFirewall.iss b/deploy/FortFirewall.iss index 3531b423..2eb808ab 100644 --- a/deploy/FortFirewall.iss +++ b/deploy/FortFirewall.iss @@ -1,7 +1,7 @@ #define SRC_PATH AddBackslash(SourcePath) + "..\src" -#include SRC_PATH + "\version.h" +#include SRC_PATH + "\version\fort-version.h" #define APP_EXE_NAME "FortFirewall.exe" #define APP_ICO_NAME "FortFirewall.ico" diff --git a/src/driver/fortdrv.c b/src/driver/fortdrv.c index 8d928be9..fe2dbef8 100644 --- a/src/driver/fortdrv.c +++ b/src/driver/fortdrv.c @@ -1,8 +1,8 @@ /* Fort Firewall Driver */ -#include "fortdrv.h" +#include "../version/fort_version.h" -#include "../version.h" +#include "fortdrv.h" #include "common/fortconf.h" #include "common/fortdev.h" diff --git a/src/driver/fortdrv.rc b/src/driver/fortdrv.rc index 9f252969..5faa4d9e 100644 --- a/src/driver/fortdrv.rc +++ b/src/driver/fortdrv.rc @@ -1,7 +1,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../version.h" +#include "../version/fort_version.h" #define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,DRIVER_VERSION #define VER_FILEVERSION_STR APP_VERSION_STR diff --git a/src/tests/Common/Common.pro b/src/tests/Common/Common.pro index 55693a0f..807f921e 100644 --- a/src/tests/Common/Common.pro +++ b/src/tests/Common/Common.pro @@ -75,6 +75,9 @@ HEADERS += \ $$UI_PWD/util/processinfo.h \ $$UI_PWD/util/stringutil.h +# Version +include($$UI_PWD/../version/Version.pri) + # Driver integration include($$UI_PWD/../driver/Driver.pri) diff --git a/src/ui/FortFirewall.rc b/src/ui/FortFirewall.rc index d1138c0b..5cffce3b 100644 --- a/src/ui/FortFirewall.rc +++ b/src/ui/FortFirewall.rc @@ -1,7 +1,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../version.h" +#include "../version/fort_version.h" #define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,0 #define VER_FILEVERSION_STR APP_VERSION_STR diff --git a/src/ui/FortFirewallUI.pro b/src/ui/FortFirewallUI.pro index 31681812..84b4864d 100644 --- a/src/ui/FortFirewallUI.pro +++ b/src/ui/FortFirewallUI.pro @@ -124,7 +124,6 @@ SOURCES += \ util/worker/workerobject.cpp HEADERS += \ - ../version.h \ conf/addressgroup.h \ conf/appgroup.h \ conf/confmanager.h \ @@ -239,6 +238,9 @@ HEADERS += \ util/worker/workermanager.h \ util/worker/workerobject.h +# Version +include(../version/Version.pri) + # Driver integration include(../driver/Driver.pri) diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 786da24e..7c0b6d54 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -4,6 +4,8 @@ #include #include +#include + #include "conf/addressgroup.h" #include "conf/firewallconf.h" #include "util/dateutil.h" @@ -22,6 +24,16 @@ FortSettings::FortSettings(const QStringList &args, QObject *parent) : setupIni(); } +QString FortSettings::appUpdatesUrl() const +{ + return APP_UPDATES_URL; +} + +int FortSettings::appVersion() const +{ + return APP_VERSION; +} + bool FortSettings::startWithWindows() const { return FileUtil::fileExists(startupShortcutPath()); diff --git a/src/ui/fortsettings.h b/src/ui/fortsettings.h index 7d4bc9e5..7de0ad3f 100644 --- a/src/ui/fortsettings.h +++ b/src/ui/fortsettings.h @@ -7,8 +7,6 @@ #include #include -#include "../version.h" - class FirewallConf; class FortSettings : public QObject @@ -18,6 +16,7 @@ class FortSettings : public QObject Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY iniChanged) Q_PROPERTY(bool hasPassword READ hasPassword NOTIFY iniChanged) Q_PROPERTY(QString passwordHash READ passwordHash WRITE setPasswordHash NOTIFY iniChanged) + Q_PROPERTY(QString appUpdatesUrl READ appUpdatesUrl CONSTANT) Q_PROPERTY(int appVersion READ appVersion CONSTANT) Q_PROPERTY(int iniVersion READ iniVersion WRITE setIniVersion NOTIFY iniChanged) Q_PROPERTY(QByteArray optWindowAddrSplit READ optWindowAddrSplit WRITE setOptWindowAddrSplit @@ -62,7 +61,6 @@ class FortSettings : public QObject Q_PROPERTY(QString logsPath READ logsPath CONSTANT) Q_PROPERTY(QString cachePath READ cachePath CONSTANT) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged) - Q_PROPERTY(QString appUpdatesUrl READ appUpdatesUrl CONSTANT) public: explicit FortSettings(const QStringList &args, QObject *parent = nullptr); @@ -87,7 +85,8 @@ public: QString passwordHash() const { return iniText("base/passwordHash"); } void setPasswordHash(const QString &v) { setIniValue("base/passwordHash", v); } - int appVersion() const { return APP_VERSION; } + QString appUpdatesUrl() const; + int appVersion() const; int iniVersion() const { return iniInt("base/version", appVersion()); } void setIniVersion(int v) { setIniValue("base/version", v); } @@ -251,8 +250,6 @@ public: QString errorMessage() const { return m_errorMessage; } - QString appUpdatesUrl() const { return APP_UPDATES_URL; } - bool confMigrated() const; bool confCanMigrate(QString &viaVersion) const; diff --git a/src/ui/main.cpp b/src/ui/main.cpp index 6b58ad25..a3f74762 100644 --- a/src/ui/main.cpp +++ b/src/ui/main.cpp @@ -7,7 +7,8 @@ # include #endif -#include "../version.h" +#include + #include "control/controlmanager.h" #include "control/controlworker.h" #include "driver/drivermanager.h" diff --git a/src/ui/task/taskinfoupdatechecker.cpp b/src/ui/task/taskinfoupdatechecker.cpp index 2a584416..2a6f4489 100644 --- a/src/ui/task/taskinfoupdatechecker.cpp +++ b/src/ui/task/taskinfoupdatechecker.cpp @@ -2,7 +2,8 @@ #include -#include "../../version.h" +#include + #include "../fortmanager.h" #include "taskupdatechecker.h" diff --git a/src/ui/task/taskupdatechecker.cpp b/src/ui/task/taskupdatechecker.cpp index 11b34300..17eac19a 100644 --- a/src/ui/task/taskupdatechecker.cpp +++ b/src/ui/task/taskupdatechecker.cpp @@ -4,7 +4,8 @@ #include #include -#include "../../version.h" +#include + #include "../util/net/netdownloader.h" #include "../util/net/netutil.h" #include "../util/json/jsonutil.h" diff --git a/src/ui/util/conf/confutil.cpp b/src/ui/util/conf/confutil.cpp index 483488f7..d4e025b2 100644 --- a/src/ui/util/conf/confutil.cpp +++ b/src/ui/util/conf/confutil.cpp @@ -3,13 +3,13 @@ #include #include +#include #include "../../conf/addressgroup.h" #include "../../conf/appgroup.h" #include "../../conf/firewallconf.h" #include "../../fortcommon.h" #include "../../util/conf/confappswalker.h" -#include "../../version.h" #include "../dateutil.h" #include "../envmanager.h" #include "../fileutil.h" diff --git a/src/ui/util/logger.cpp b/src/ui/util/logger.cpp index c61ed041..a49117f1 100644 --- a/src/ui/util/logger.cpp +++ b/src/ui/util/logger.cpp @@ -3,7 +3,8 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../../version.h" +#include + #include "dateutil.h" #define LOGGER_FILE_PREFIX "log_fort_" diff --git a/src/version/Version.pri b/src/version/Version.pri new file mode 100644 index 00000000..d990e4e1 --- /dev/null +++ b/src/version/Version.pri @@ -0,0 +1,4 @@ +INCLUDEPATH *= $$PWD + +HEADERS += \ + $$PWD/fort_version.h diff --git a/src/version.h b/src/version/fort_version.h similarity index 78% rename from src/version.h rename to src/version/fort_version.h index 86253d45..ff782ce4 100644 --- a/src/version.h +++ b/src/version/fort_version.h @@ -1,5 +1,5 @@ -#ifndef VERSION_H -#define VERSION_H +#ifndef FORT_VERSION_H +#define FORT_VERSION_H #define APP_VERSION_MAJOR 3 #define APP_VERSION_MINOR 3 @@ -9,11 +9,11 @@ #define APP_NAME "Fort Firewall" #define APP_PUBLISHER "Nodir Temirkhodjaev" -#define APP_LEGALCOPYRIGHT "Copyright (C) 2015-2020 Nodir Temirkhodjaev. All Rights Reserved." +#define APP_LEGALCOPYRIGHT "Copyright (C) 2015-2021 Nodir Temirkhodjaev. All Rights Reserved." #define APP_URL "https://github.com/tnodir/fort" #define APP_UPDATES_URL "https://github.com/tnodir/fort/releases" #define APP_UPDATES_API_URL "https://api.github.com/repos/tnodir/fort/releases/latest" #define DRIVER_VERSION 22 -#endif // VERSION_H +#endif // FORT_VERSION_H