Refactor version.h

This commit is contained in:
Nodir Temirkhodjaev 2021-02-08 11:12:40 +03:00
parent e353a01297
commit 979a1b101a
15 changed files with 43 additions and 21 deletions

View File

@ -1,7 +1,7 @@
#define SRC_PATH AddBackslash(SourcePath) + "..\src" #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_EXE_NAME "FortFirewall.exe"
#define APP_ICO_NAME "FortFirewall.ico" #define APP_ICO_NAME "FortFirewall.ico"

View File

@ -1,8 +1,8 @@
/* Fort Firewall Driver */ /* Fort Firewall Driver */
#include "fortdrv.h" #include "../version/fort_version.h"
#include "../version.h" #include "fortdrv.h"
#include "common/fortconf.h" #include "common/fortconf.h"
#include "common/fortdev.h" #include "common/fortdev.h"

View File

@ -1,7 +1,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#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 APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,DRIVER_VERSION
#define VER_FILEVERSION_STR APP_VERSION_STR #define VER_FILEVERSION_STR APP_VERSION_STR

View File

@ -75,6 +75,9 @@ HEADERS += \
$$UI_PWD/util/processinfo.h \ $$UI_PWD/util/processinfo.h \
$$UI_PWD/util/stringutil.h $$UI_PWD/util/stringutil.h
# Version
include($$UI_PWD/../version/Version.pri)
# Driver integration # Driver integration
include($$UI_PWD/../driver/Driver.pri) include($$UI_PWD/../driver/Driver.pri)

View File

@ -1,7 +1,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include "../version.h" #include "../version/fort_version.h"
#define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,0 #define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,0
#define VER_FILEVERSION_STR APP_VERSION_STR #define VER_FILEVERSION_STR APP_VERSION_STR

View File

@ -124,7 +124,6 @@ SOURCES += \
util/worker/workerobject.cpp util/worker/workerobject.cpp
HEADERS += \ HEADERS += \
../version.h \
conf/addressgroup.h \ conf/addressgroup.h \
conf/appgroup.h \ conf/appgroup.h \
conf/confmanager.h \ conf/confmanager.h \
@ -239,6 +238,9 @@ HEADERS += \
util/worker/workermanager.h \ util/worker/workermanager.h \
util/worker/workerobject.h util/worker/workerobject.h
# Version
include(../version/Version.pri)
# Driver integration # Driver integration
include(../driver/Driver.pri) include(../driver/Driver.pri)

View File

@ -4,6 +4,8 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QSettings> #include <QSettings>
#include <fort_version.h>
#include "conf/addressgroup.h" #include "conf/addressgroup.h"
#include "conf/firewallconf.h" #include "conf/firewallconf.h"
#include "util/dateutil.h" #include "util/dateutil.h"
@ -22,6 +24,16 @@ FortSettings::FortSettings(const QStringList &args, QObject *parent) :
setupIni(); setupIni();
} }
QString FortSettings::appUpdatesUrl() const
{
return APP_UPDATES_URL;
}
int FortSettings::appVersion() const
{
return APP_VERSION;
}
bool FortSettings::startWithWindows() const bool FortSettings::startWithWindows() const
{ {
return FileUtil::fileExists(startupShortcutPath()); return FileUtil::fileExists(startupShortcutPath());

View File

@ -7,8 +7,6 @@
#include <QRect> #include <QRect>
#include <QSettings> #include <QSettings>
#include "../version.h"
class FirewallConf; class FirewallConf;
class FortSettings : public QObject class FortSettings : public QObject
@ -18,6 +16,7 @@ class FortSettings : public QObject
Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY iniChanged) Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY iniChanged)
Q_PROPERTY(bool hasPassword READ hasPassword NOTIFY iniChanged) Q_PROPERTY(bool hasPassword READ hasPassword NOTIFY iniChanged)
Q_PROPERTY(QString passwordHash READ passwordHash WRITE setPasswordHash 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 appVersion READ appVersion CONSTANT)
Q_PROPERTY(int iniVersion READ iniVersion WRITE setIniVersion NOTIFY iniChanged) Q_PROPERTY(int iniVersion READ iniVersion WRITE setIniVersion NOTIFY iniChanged)
Q_PROPERTY(QByteArray optWindowAddrSplit READ optWindowAddrSplit WRITE setOptWindowAddrSplit 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 logsPath READ logsPath CONSTANT)
Q_PROPERTY(QString cachePath READ cachePath CONSTANT) Q_PROPERTY(QString cachePath READ cachePath CONSTANT)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
Q_PROPERTY(QString appUpdatesUrl READ appUpdatesUrl CONSTANT)
public: public:
explicit FortSettings(const QStringList &args, QObject *parent = nullptr); explicit FortSettings(const QStringList &args, QObject *parent = nullptr);
@ -87,7 +85,8 @@ public:
QString passwordHash() const { return iniText("base/passwordHash"); } QString passwordHash() const { return iniText("base/passwordHash"); }
void setPasswordHash(const QString &v) { setIniValue("base/passwordHash", v); } 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()); } int iniVersion() const { return iniInt("base/version", appVersion()); }
void setIniVersion(int v) { setIniValue("base/version", v); } void setIniVersion(int v) { setIniValue("base/version", v); }
@ -251,8 +250,6 @@ public:
QString errorMessage() const { return m_errorMessage; } QString errorMessage() const { return m_errorMessage; }
QString appUpdatesUrl() const { return APP_UPDATES_URL; }
bool confMigrated() const; bool confMigrated() const;
bool confCanMigrate(QString &viaVersion) const; bool confCanMigrate(QString &viaVersion) const;

View File

@ -7,7 +7,8 @@
# include <vld.h> # include <vld.h>
#endif #endif
#include "../version.h" #include <fort_version.h>
#include "control/controlmanager.h" #include "control/controlmanager.h"
#include "control/controlworker.h" #include "control/controlworker.h"
#include "driver/drivermanager.h" #include "driver/drivermanager.h"

View File

@ -2,7 +2,8 @@
#include <QDataStream> #include <QDataStream>
#include "../../version.h" #include <fort_version.h>
#include "../fortmanager.h" #include "../fortmanager.h"
#include "taskupdatechecker.h" #include "taskupdatechecker.h"

View File

@ -4,7 +4,8 @@
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include "../../version.h" #include <fort_version.h>
#include "../util/net/netdownloader.h" #include "../util/net/netdownloader.h"
#include "../util/net/netutil.h" #include "../util/net/netutil.h"
#include "../util/json/jsonutil.h" #include "../util/json/jsonutil.h"

View File

@ -3,13 +3,13 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <common/fortconf.h> #include <common/fortconf.h>
#include <fort_version.h>
#include "../../conf/addressgroup.h" #include "../../conf/addressgroup.h"
#include "../../conf/appgroup.h" #include "../../conf/appgroup.h"
#include "../../conf/firewallconf.h" #include "../../conf/firewallconf.h"
#include "../../fortcommon.h" #include "../../fortcommon.h"
#include "../../util/conf/confappswalker.h" #include "../../util/conf/confappswalker.h"
#include "../../version.h"
#include "../dateutil.h" #include "../dateutil.h"
#include "../envmanager.h" #include "../envmanager.h"
#include "../fileutil.h" #include "../fileutil.h"

View File

@ -3,7 +3,8 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <qt_windows.h> #include <qt_windows.h>
#include "../../version.h" #include <fort_version.h>
#include "dateutil.h" #include "dateutil.h"
#define LOGGER_FILE_PREFIX "log_fort_" #define LOGGER_FILE_PREFIX "log_fort_"

4
src/version/Version.pri Normal file
View File

@ -0,0 +1,4 @@
INCLUDEPATH *= $$PWD
HEADERS += \
$$PWD/fort_version.h

View File

@ -1,5 +1,5 @@
#ifndef VERSION_H #ifndef FORT_VERSION_H
#define VERSION_H #define FORT_VERSION_H
#define APP_VERSION_MAJOR 3 #define APP_VERSION_MAJOR 3
#define APP_VERSION_MINOR 3 #define APP_VERSION_MINOR 3
@ -9,11 +9,11 @@
#define APP_NAME "Fort Firewall" #define APP_NAME "Fort Firewall"
#define APP_PUBLISHER "Nodir Temirkhodjaev" #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_URL "https://github.com/tnodir/fort"
#define APP_UPDATES_URL "https://github.com/tnodir/fort/releases" #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 APP_UPDATES_API_URL "https://api.github.com/repos/tnodir/fort/releases/latest"
#define DRIVER_VERSION 22 #define DRIVER_VERSION 22
#endif // VERSION_H #endif // FORT_VERSION_H