From 7167149565b645ebffa6d8040189a1d6beea80ce Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sat, 9 Sep 2017 05:08:11 +0500 Subject: [PATCH] Remove unneeded default .ini --- src/common/version.h | 1 + src/ui/FortFirewall.pro | 6 +----- src/ui/fort_ini.qrc | 5 ----- src/ui/fortsettings.cpp | 9 --------- src/ui/fortsettings.h | 9 +++++---- 5 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 src/ui/fort_ini.qrc diff --git a/src/common/version.h b/src/common/version.h index eadb282d..b4e0ccff 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -4,5 +4,6 @@ #define APP_NAME "Fort Firewall" #define APP_VERSION_STR "0.1.0" #define APP_VERSION 0x000100 +#define APP_UPDATES_URL "https://github.com/tnodir/fort/releases" #endif VERSION_H diff --git a/src/ui/FortFirewall.pro b/src/ui/FortFirewall.pro index 61240714..b22fa945 100644 --- a/src/ui/FortFirewall.pro +++ b/src/ui/FortFirewall.pro @@ -58,8 +58,7 @@ QML_FILES += \ qml/pages/apps/*.qml OTHER_FILES += \ - $${QML_FILES} \ - *.ini + $${QML_FILES} TRANSLATIONS += \ i18n/i18n_ru.ts @@ -70,9 +69,6 @@ RESOURCES += fort_qml.qrc # Compiled translation files RESOURCES += fort_i18n.qrc -# Default FortFirewall.ini -RESOURCES += fort_ini.qrc - # Images RESOURCES += fort_images.qrc diff --git a/src/ui/fort_ini.qrc b/src/ui/fort_ini.qrc deleted file mode 100644 index cdd35b01..00000000 --- a/src/ui/fort_ini.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - FortFirewall.ini - - diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 169217bf..7375b931 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -67,19 +67,10 @@ void FortSettings::processArguments(const QStringList &args) void FortSettings::setupIni() { - const QString qrcIniPath(":/FortFirewall.ini"); const QString iniPath(m_profilePath + "FortFirewall.ini"); FileUtil::makePath(m_profilePath); - // Copy default .ini into writable location - if (!FileUtil::fileExists(iniPath)) { - const QString text = FileUtil::readFile(qrcIniPath); - if (!FileUtil::writeFile(iniPath, text)) { - FileUtil::removeFile(iniPath); - } - } - m_ini = new QSettings(iniPath, QSettings::IniFormat, this); } diff --git a/src/ui/fortsettings.h b/src/ui/fortsettings.h index 791ce096..a30aed86 100644 --- a/src/ui/fortsettings.h +++ b/src/ui/fortsettings.h @@ -4,6 +4,8 @@ #include #include +#include "../common/version.h" + class FirewallConf; class FortSettings : public QObject @@ -11,7 +13,7 @@ class FortSettings : public QObject Q_OBJECT Q_PROPERTY(bool debug READ debug WRITE setDebug NOTIFY iniChanged) Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY iniChanged) - Q_PROPERTY(QString updatesUrl READ updatesUrl WRITE setUpdatesUrl NOTIFY iniChanged) + Q_PROPERTY(QString updatesUrl READ updatesUrl CONSTANT) Q_PROPERTY(bool startWithWindows READ startWithWindows WRITE setStartWithWindows NOTIFY startWithWindowsChanged) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged) @@ -25,10 +27,9 @@ public: void setDebug(bool on) { setIniValue("base/debug", on); } QString language() const { return iniText("base/language", "en"); } - void setLanguage(const QString &v) { setIniValue("base/language", v, "en"); } + void setLanguage(const QString &v) { setIniValue("base/language", v); } - QString updatesUrl() const { return iniText("base/updatesUrl"); } - void setUpdatesUrl(const QString &v) { setIniValue("base/updatesUrl", v); } + QString updatesUrl() const { return APP_UPDATES_URL; } bool startWithWindows() const; void setStartWithWindows(bool start);