Browse Source

Changed settings policy: now available via Settings class

Ivan Arkhipov 5 years ago
parent
commit
708a7ac82f

+ 0 - 1
src/Legacy/Legacy.pro

@@ -16,7 +16,6 @@ CONFIG += resources_big
 SOURCES += \
     main.cpp \
     models/downloader.cpp \
-    models/filesystem.cpp \
     models/lotrodatmanager.cpp \
     models/patchdownloader.cpp \
     models/selfupdater.cpp \

+ 3 - 1
src/Legacy/main.cpp

@@ -21,8 +21,10 @@ int main(int argc, char *argv[])
 
     QCoreApplication::setOrganizationName("LotroLegacy");
     QCoreApplication::setOrganizationDomain("translate.lotros.ru");
-    QCoreApplication::setApplicationName("Legacy v2");
+    QCoreApplication::setApplicationName("Legacy_v2");
     QSettings::setDefaultFormat(QSettings::IniFormat);
+    QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, QApplication::applicationDirPath());
+    QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, QApplication::applicationDirPath());
 
     qDebug() << "Checking if there's another instance of Legacy";
 

+ 0 - 81
src/Legacy/models/filesystem.cpp

@@ -1,81 +0,0 @@
-#include "filesystem.h"
-#include <QDebug>
-#include <QSettings>
-
-bool FileSystem::fileExists(QString path) {
-    QFileInfo check_file(path);
-    bool exists = check_file.exists() && check_file.isFile();
-    if (exists == false)
-        qWarning("%s:%i: %s%s", __FILE__, __LINE__, "Файл не найден: ", path.toStdString().c_str());
-    else
-        qInfo("%s:%i: %s%s", __FILE__, __LINE__, "Файл найден: ", path.toStdString().c_str());
-    return exists;
-}
-
-QString FileSystem::fileHash(const QString &fileName, QCryptographicHash::Algorithm hashAlgorithm){
-    QFile file(fileName);
-    if (file.open(QIODevice::ReadOnly)) {
-        QCryptographicHash hash(hashAlgorithm);
-        hash.addData(&file);
-        QByteArray hashData = hash.result();
-        return hashData.toHex();
-    }
-    return QByteArray();
-}
-
-void FileSystem::clearFolder(QDir &dir){
-    //Получаем список файлов
-    QStringList lstFiles = dir.entryList(QDir::Files);
-
-    //Удаляем файлы
-    foreach (QString entry, lstFiles){
-        QString entryAbsPath = dir.absolutePath() + "/" + entry;
-        //QFile::setPermissions(entryAbsPath, QFile::ReadOwner | QFile::WriteOwner);
-        qDebug() << dir.absolutePath();
-        QFile::remove(entryAbsPath);
-    }
-}
-
-QStringList FileSystem::recognizeRegistryLotroPath()
-{
-    QStringList paths;
-
-    #ifdef _WIN32
-        // Windows 8, 10
-        QSettings n("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\12bbe590-c890-11d9-9669-0800200c9a66_is1", QSettings::NativeFormat);
-        foreach (QString key, n.allKeys()) {
-            qDebug() << key;
-            if(key.contains("InstallLocation") || key.contains("installlocation")){
-                QString folder = n.value(key).toString()
-                        .replace("\\", "/")
-                        .replace("/TurbineLauncher.exe", "")
-                        .replace("/LotroLauncher.exe", "")
-                        .replace("\"", "");
-
-                if(FileSystem::fileExists(folder + "/LotroLauncher.exe"))
-                    paths.append(folder);
-            }
-        }
-
-
-        // Windows 7
-        QSettings m("HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache", QSettings::NativeFormat);
-        foreach (QString key, m.allKeys()) {
-          if((key.contains("TurbineLauncher.exe") || key.contains("LotroLauncher.exe")) && FileSystem::fileExists(key)){
-              QString folder = n.value(key).toString()
-                      .replace("\\", "/")
-                      .replace("/TurbineLauncher.exe", "")
-                      .replace("/LotroLauncher.exe", "")
-                      .replace("\"", "");
-
-              if(FileSystem::fileExists(folder + "/LotroLauncher.exe"))
-                  paths.append(folder);
-          }
-        }
-    #else
-        // Реализация под Linux
-    #endif
-
-    return paths;
-
-}

+ 79 - 15
src/Legacy/models/filesystem.h

@@ -6,21 +6,85 @@
 #include <QDir>
 #include <QFileInfo>
 #include <QCryptographicHash>
+#include <QDebug>
 
-class FileSystem : public QObject
-{
-    Q_OBJECT
-private:
-    explicit FileSystem(QObject *parent = nullptr);
-
-public:
-    static bool fileExists(QString path);
-    static QString fileHash(const QString &fileName, QCryptographicHash::Algorithm hashAlgorithm = QCryptographicHash::Md5);
-    static void clearFolder(QDir &dir);
-    static QStringList recognizeRegistryLotroPath();
-signals:
-
-public slots:
-};
+namespace FileSystem {
+    static bool fileExists(QString path) {
+        QFileInfo check_file(path);
+        return check_file.exists() && check_file.isFile();
+    }
+
+    static bool folderExists(QString path) {
+        return QDir(path).exists();
+    }
+
+    static QString fileHash(const QString &fileName, QCryptographicHash::Algorithm hashAlgorithm = QCryptographicHash::Md5) {
+        QFile file(fileName);
+        if (file.open(QIODevice::ReadOnly)) {
+            QCryptographicHash hash(hashAlgorithm);
+            hash.addData(&file);
+            QByteArray hashData = hash.result();
+            return hashData.toHex();
+        }
+        return QByteArray();
+    }
+
+
+    static void clearFolder(QDir &dir) {
+        //Получаем список файлов
+        QStringList lstFiles = dir.entryList(QDir::Files);
+
+        //Удаляем файлы
+        foreach (QString entry, lstFiles){
+            QString entryAbsPath = dir.absolutePath() + "/" + entry;
+            //QFile::setPermissions(entryAbsPath, QFile::ReadOwner | QFile::WriteOwner);
+            qDebug() << dir.absolutePath();
+            QFile::remove(entryAbsPath);
+        }
+    }
+
+
+    static QStringList recognizeRegistryLotroPath() {
+        QStringList paths;
+
+        #ifdef _WIN32
+            // Windows 8, 10
+            QSettings n("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\12bbe590-c890-11d9-9669-0800200c9a66_is1", QSettings::NativeFormat);
+            foreach (QString key, n.allKeys()) {
+                qDebug() << key;
+                if(key.contains("InstallLocation") || key.contains("installlocation")){
+                    QString folder = n.value(key).toString()
+                            .replace("\\", "/")
+                            .replace("/TurbineLauncher.exe", "")
+                            .replace("/LotroLauncher.exe", "")
+                            .replace("\"", "");
+
+                    if(fileExists(folder + "/LotroLauncher.exe"))
+                        paths.append(folder);
+                }
+            }
+
+
+            // Windows 7
+            QSettings m("HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache", QSettings::NativeFormat);
+            foreach (QString key, m.allKeys()) {
+              if((key.contains("TurbineLauncher.exe") || key.contains("LotroLauncher.exe")) && fileExists(key)){
+                  QString folder = n.value(key).toString()
+                          .replace("\\", "/")
+                          .replace("/TurbineLauncher.exe", "")
+                          .replace("/LotroLauncher.exe", "")
+                          .replace("\"", "");
+
+                  if(fileExists(folder + "/LotroLauncher.exe"))
+                      paths.append(folder);
+              }
+            }
+        #else
+            // Реализация под Linux
+        #endif
+
+        return paths;
+    }
+}
 
 #endif // FILESYSTEM_H

+ 72 - 40
src/Legacy/models/lotrodatmanager.cpp

@@ -2,6 +2,7 @@
 #include "filesystem.h"
 #include "LotroDat/Subfiles/TextSubFile.h"
 #include "models/patchdownloader.h"
+#include "models/settings.h"
 
 #include <QtConcurrent/QtConcurrent>
 #include <QFontDatabase>
@@ -15,8 +16,8 @@
 Q_DECLARE_METATYPE(LOTRO_DAT::DatLocaleManager::LOCALE)
 Q_DECLARE_METATYPE(QVector<QVariant>)
 
-LotroDatManager::LotroDatManager(QSettings* settings, QObject *parent) :
-    QObject(parent), app_settings(settings) {
+LotroDatManager::LotroDatManager(QObject *parent) :
+    QObject(parent) {
 
     qRegisterMetaType<QVector<QVariant>>();
     qRegisterMetaType<LOTRO_DAT::DatLocaleManager::LOCALE>();
@@ -46,9 +47,10 @@ void LotroDatManager::InitialiseManager()
 {
     qDebug() << "Initialising .dat manager";
     emit processStarted("InitialiseManager");
-    QString game_folder = app_settings->value("General/game_folder_path", QString()).toString();
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
-    if (game_folder.isEmpty() || !FileSystem::fileExists(game_folder + "client_local_" + locale_prefix + ".dat")
+    QString game_folder = Settings::getValue("Lotro/game_path").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
+
+    if (game_folder == "none" || !FileSystem::fileExists(game_folder + "client_local_" + locale_prefix + ".dat")
             || !FileSystem::fileExists(game_folder + "client_general.dat")) {
 
         qDebug() << "Finished initialisation .dat manager - error: required files not found!";
@@ -106,7 +108,14 @@ void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
     client_general_file.GetLocaleManager().SetLocale(locale);
     client_local_file.GetLocaleManager().SetLocale(locale);
 
-    QString game_folder = app_settings->value("General/game_folder_path", QString()).toString();
+    QString game_folder = Settings::getValue("Lotro/game_path").toString();
+
+    if (game_folder == "none") {
+        emit caughtError("StartGame", {"GameFolderNotSet"});
+        qDebug() << "Starting game FAILED - game folder wasnt set!";
+        emit processFinished("StartGame");
+        return;
+    }
 
     if (!FileSystem::fileExists(QApplication::applicationDirPath() + "/Launcher.exe")) {
         emit caughtError("StartGame", {"NoGameLauncherInLegacyDir"});
@@ -171,7 +180,7 @@ void LotroDatManager::InstallActivePatches()
 void LotroDatManager::SetupAllPatches()
 {
     foreach (QString patch_name, all_patch_names) {
-        if (app_settings->value("PatchDatabasesDownload/" + patch_name, "Disabled").toString() == "Disabled") {
+        if (Settings::getValue("DatabaseDownload/" + patch_name).toString() == "Disabled") {
             continue;
         }
 
@@ -180,7 +189,7 @@ void LotroDatManager::SetupAllPatches()
 
         if (patch_name == "video") {
             InstallVideos();
-            app_settings->setValue("PatchApplied/" + patch_name, "True");
+            Settings::setValue("DatabaseApplied/" + patch_name, "True");
             current_installing_patch_name = "none";
             emit processFinished("SetupPatch", {patch_name});
             return;
@@ -188,13 +197,13 @@ void LotroDatManager::SetupAllPatches()
 
         if (patch_name == "loadscreen") {
             InstallLoadscreens();
-            app_settings->setValue("PatchApplied/" + patch_name, "True");
+            Settings::setValue("DatabaseApplied/" + patch_name, "True");
             current_installing_patch_name = "none";
             emit processFinished("SetupPatch", {patch_name});
             return;
         }
 
-        QString database_path = app_settings->value("PatchPath/" + patch_name, "none").toString(); //patch_downloader->getDatabasePathByPatchName(patch_name);
+        QString database_path = Settings::getValue("DatabasePath/" + patch_name).toString(); //patch_downloader->getDatabasePathByPatchName(patch_name);
         if (database_path == "none") {
             qDebug() << __FUNCTION__ << "Database for " << patch_name << " has no database path! Skipping!";
             continue;
@@ -214,7 +223,7 @@ void LotroDatManager::SetupAllPatches()
 
         db.CloseDatabase();
 
-        app_settings->setValue("PatchApplied/" + patch_name, "True");
+        Settings::setValue("DatabaseApplied/" + patch_name, "True");
         current_installing_patch_name = "none";
         emit processFinished("SetupPatch", {patch_name});
     }
@@ -224,11 +233,13 @@ void LotroDatManager::InstallLoadscreens()
 {
     emit processStarted("InstallLoadscreens");
 
-    if (app_settings->value("PatchDatabasesDownload/loadscreen", "Disabled").toString() == "Disabled")
+    if (Settings::getValue("DatabaseDownload/loadscreen").toString() == "Disabled") {
+        emit processFinished("InstallLoadscreens", {"Success"});
         return;
+    }
 
-    QString game_folder = app_settings->value("General/game_folder_path", QString()).toString();
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
+    QString game_folder = Settings::getValue("Lotro/game_path").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
 
     QString raw_folder;
     if (locale_prefix == "English")
@@ -240,6 +251,11 @@ void LotroDatManager::InstallLoadscreens()
 
     QString folder = game_folder + "/raw/" + raw_folder + "/logo/";
 
+    if (!FileSystem::folderExists(folder)) {
+        emit processFinished("InstallLoadscreens", {"Error", "Incorrect folder"});
+        return;
+    }
+
     QString mainscreen =
             game_folder == "en"
             ? "lotro_ad_pregame.jpg"
@@ -259,7 +275,7 @@ void LotroDatManager::InstallLoadscreens()
               << "lotro_generic_teleport_screen_10.jpg";
 
 
-    QString database_path = app_settings->value("PatchPath/loadscreen", "none").toString();
+    QString database_path = Settings::getValue("DatabasePath/loadscreen").toString();
     if (database_path == "none") {
         qDebug() << __FUNCTION__ << "No path to loadscreens patch found!";
         return;
@@ -287,15 +303,26 @@ void LotroDatManager::InstallLoadscreens()
 
 void LotroDatManager::InstallVideos()
 {
+    if (Settings::getValue("DatabaseDownload/video").toString() == "Disabled")
+        return;
+
     emit processStarted("InstallVideos");
-    if (app_settings->value("PatchDatabasesDownload/video", "Disabled").toString() == "Disabled")
+
+    QString game_folder = Settings::getValue("Lotro/game_path").toString();
+
+    if (game_folder == "none") {
+        qDebug() << __FUNCTION__ << "No path to game folder found!";
+        emit caughtError("InstallVideos", {"ErrorGameFolderNotFound"});
+        emit processFinished("InstallVideos");
         return;
+    }
 
-    QString game_folder = app_settings->value("General/game_folder_path", QString()).toString();
+    QString database_path = Settings::getValue("DatabasePath/video").toString();
 
-    QString database_path = app_settings->value("PatchPath/video", "none").toString();
     if (database_path == "none") {
         qDebug() << __FUNCTION__ << "No path to videos patch found!";
+        emit caughtError("InstallVideos", {"ErrorFindDatabase"});
+        emit processFinished("InstallVideos");
         return;
     }
 
@@ -352,8 +379,9 @@ void LotroDatManager::InstallUpdates()
 {
     emit processStarted("InstallUpdates");
     foreach (QString patch_name, all_patch_names) {
-        if (app_settings->value("PatchDatabasesDownload/" + patch_name, "Disabled").toString() == "Disabled" ||
-                app_settings->value("PatchApplied/" + patch_name, "False").toString() == "True") {
+        if (Settings::getValue("DatabaseDownload/" + patch_name).toString() == "Disabled" ||
+            Settings::getValue("DatabaseApplied/" + patch_name).toString() == "True")
+        {
             continue;
         }
 
@@ -362,21 +390,17 @@ void LotroDatManager::InstallUpdates()
 
         if (patch_name == "video") {
             InstallVideos();
-            app_settings->setValue("PatchApplied/" + patch_name, "True");
+            Settings::setValue("DatabaseApplied/" + patch_name, "True");
             current_installing_patch_name = "none";
-            emit processFinished("SetupPatch", {patch_name});
-            return;
         }
 
         if (patch_name == "loadscreen") {
             InstallLoadscreens();
-            app_settings->setValue("PatchApplied/" + patch_name, "True");
+            Settings::setValue("DatabaseApplied/" + patch_name, "True");
             current_installing_patch_name = "none";
-            emit processFinished("SetupPatch", {patch_name});
-            return;
         }
 
-        QString database_path = app_settings->value("PatchPath/" + patch_name, "none").toString(); //patch_downloader->getDatabasePathByPatchName(patch_name);
+        QString database_path = Settings::getValue("PatchPath/" + patch_name).toString();
         if (database_path == "none") {
             qDebug() << __FUNCTION__ << "Database for " << patch_name << " has no database path! Skipping!";
             continue;
@@ -396,7 +420,7 @@ void LotroDatManager::InstallUpdates()
 
         db.CloseDatabase();
 
-        app_settings->setValue("PatchApplied/" + patch_name, "True");
+        Settings::setValue("DatabaseApplied/" + patch_name, "True");
         current_installing_patch_name = "none";
         emit processFinished("SetupPatch", {patch_name});
     }
@@ -410,7 +434,7 @@ void LotroDatManager::InstallMicroPatch()
 void LotroDatManager::CreateBackup()
 {
     emit processStarted("CreateBackup");
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
     client_local_file.GetBackupManager().CreateBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
     client_general_file.GetBackupManager().CreateBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
     emit processFinished("CreateBackup");
@@ -419,7 +443,7 @@ void LotroDatManager::CreateBackup()
 void LotroDatManager::RestoreFromBackup()
 {
     emit processStarted("CreateBackup");
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
     client_local_file.GetBackupManager().RestoreFromBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
     client_general_file.GetBackupManager().RestoreFromBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
     emit processFinished("CreateBackup");
@@ -428,7 +452,7 @@ void LotroDatManager::RestoreFromBackup()
 void LotroDatManager::RemoveBackup()
 {
     emit processStarted("CreateBackup");
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
     client_local_file.GetBackupManager().RemoveBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
     client_general_file.GetBackupManager().RemoveBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
     emit processFinished("CreateBackup");
@@ -436,19 +460,19 @@ void LotroDatManager::RemoveBackup()
 
 void LotroDatManager::ApplyTexts()
 {
-    if (app_settings->value("PatchApplyOptions/texts_general", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/texts_main").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(100);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(100);
     }
 
-    if (app_settings->value("PatchApplyOptions/texts_emotes", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/texts_emotes").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(101);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(101);
     }
 
-    if (app_settings->value("PatchApplyOptions/texts_items", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/texts_items").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(102);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(102);
@@ -456,7 +480,7 @@ void LotroDatManager::ApplyTexts()
 }
 
 void LotroDatManager::ApplyImages() {
-    if (app_settings->value("PatchApplyOptions/maps", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/maps").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(200);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(200);
@@ -465,13 +489,13 @@ void LotroDatManager::ApplyImages() {
 
 void LotroDatManager::ApplySounds() {
     emit processStarted("ApplySounds");
-    if (app_settings->value("PatchApplyOptions/sounds", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/sounds").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(300);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(300);
     }
 
-    if (app_settings->value("PatchApplyOptions/video", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("Components/videos").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(103);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(103);
@@ -482,9 +506,17 @@ void LotroDatManager::ApplySounds() {
 bool LotroDatManager::startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale)
 {
     QStringList args;
-    args << "-skiprawdownload";
-    if (locale == LOTRO_DAT::DatLocaleManager::PATCHED)
+    if (Settings::getValue("Lotro/skip_raw_download").toString() == "True") {
+        args << "-skiprawdownload";
+    }
+
+    if (Settings::getValue("Lotro/no_splash_screen").toString() == "True") {
+        args << "-nosplashscreen";
+    }
+
+    if (locale == LOTRO_DAT::DatLocaleManager::PATCHED) {
         args << "gamelaunch" << "-disablePatch";
+    }
 
     client_general_file.Deinitialize();
     client_local_file.Deinitialize();
@@ -500,7 +532,7 @@ bool LotroDatManager::startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManag
 
     qDebug() << "Запускаем игру со следующими аргументами: " << args;
 
-    QFile f(app_settings->value("General/game_folder_path", "none").toString() + "/LotroLauncher.exe");
+    QFile f(Settings::getValue("Lotro/game_path").toString() + "/LotroLauncher.exe");
     QProcess process;
 
     if (FileSystem::fileExists(f.fileName())) {

+ 1 - 2
src/Legacy/models/lotrodatmanager.h

@@ -16,7 +16,7 @@ class LotroDatManager : public QObject
     Q_OBJECT
 
 public:
-    explicit LotroDatManager(QSettings* settings, QObject *parent = nullptr);
+    explicit LotroDatManager(QObject *parent = nullptr);
 
     bool Initialised();
 
@@ -76,7 +76,6 @@ private:
 
     LOTRO_DAT::DatFile client_local_file;
     LOTRO_DAT::DatFile client_general_file;
-    QSettings* app_settings;
 };
 
 #endif // LEGACYAPP_H

+ 17 - 17
src/Legacy/models/patchdownloader.cpp

@@ -1,5 +1,6 @@
 #include "patchdownloader.h"
 #include "models/filesystem.h"
+#include "models/settings.h"
 #include <QApplication>
 #include <QDir>
 #include <QStringList>
@@ -9,10 +10,9 @@
 
 Q_DECLARE_METATYPE(QList<PatchDownloadData>)
 
-PatchDownloader::PatchDownloader(QSettings *settings, QObject *parent) : QObject(parent), patch_download_dir(QApplication::applicationDirPath() + "/data")
+PatchDownloader::PatchDownloader(QObject *parent) : QObject(parent), patch_download_dir(QApplication::applicationDirPath() + "/data")
 {
     qRegisterMetaType<QList<PatchDownloadData>>();
-    app_settings = settings;
     active_downloads_number = 0;
 
     connect(&update_check_timer, &QTimer::timeout, this, &PatchDownloader::checkForUpdates);
@@ -32,25 +32,25 @@ QString PatchDownloader::getPredictedDownloadSizeFormatted()
 {
     double mbytes = 0;
 
-    if (app_settings->value("patch_database/sound", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 650;
     }
-    if (app_settings->value("patch_database/text", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 80;
     }
-    if (app_settings->value("patch_database/image", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 120;
     }
-    if (app_settings->value("patch_database/loadscreen", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 3;
     }
-    if (app_settings->value("patch_database/texture", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 4;
     }
-    if (app_settings->value("patch_database/font", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 1;
     }
-    if (app_settings->value("patch_database/video", "Disabled").toString() == "Enabled") {
+    if (Settings::getValue("DatabaseDownload/sound").toString() == "Enabled") {
         mbytes += 2100;
     }
 
@@ -111,9 +111,9 @@ void PatchDownloader::onDownloaderCompleted(Downloader *downloader_ptr)
 
     if (patch_finished_download_name != "none") {
         QString patch_filepath = patch_download_dir.absolutePath() + "/" + patch_data[patch_finished_download_name].url.fileName();
-        app_settings->setValue("PatchDownloadTime/" + patch_data[patch_finished_download_name].name, QDate::currentDate().toString("dd.MM.yyyy"));
-        app_settings->setValue("PatchApplied/" + patch_data[patch_finished_download_name].name, "False");
-        app_settings->setValue("PatchPath/" + patch_data[patch_finished_download_name].name, patch_filepath);
+        Settings::setValue("DatabaseDownloadDate/" + patch_data[patch_finished_download_name].name, QDate::currentDate().toString("dd.MM.yyyy"));
+        Settings::setValue("DatabaseApplied/" + patch_data[patch_finished_download_name].name, "False");
+        Settings::setValue("DatabasePath/" + patch_data[patch_finished_download_name].name, patch_filepath);
 
         emit changePatchStatus(patch_finished_download_name, "Загрузка завершена");
     }
@@ -248,22 +248,22 @@ bool PatchDownloader::DownloadMissingPatches()
     foreach (Patch patch, patch_data) {
         QString patch_filepath = patch_download_dir.absolutePath() + "/" + patch.url.fileName();
 
-        qDebug() << "Patch" << patch.name << "is marked as" << app_settings->value("PatchDatabasesDownload/" + patch.name, "Disabled");
+        qDebug() << "Patch" << patch.name << "is marked as" << Settings::getValue("DatabaseDownload/" + patch.name).toString();
 
-        if (app_settings->value("PatchDatabasesDownload/" + patch.name, "Disabled").toString() != "Enabled") {
+        if (Settings::getValue("DatabaseDownload/" + patch.name).toString() != "Enabled") {
             emit changePatchStatus(patch.name, "Не выбраны для установки");
             continue;
         }
 
         if (FileSystem::fileExists(patch_filepath)) {
             if (FileSystem::fileHash(patch_filepath, QCryptographicHash::Md5) == patch.md5_hash) {
-                app_settings->setValue("PatchPath/" + patch.name, patch_filepath);
-                QString download_date = app_settings->value("PatchDownloadTime/" + patch.name, "-1").toString();
+                Settings::setValue("DatabasePath/" + patch.name, patch_filepath);
+                QString download_date = Settings::getValue("DatabaseDownloadDate/" + patch.name).toString();
                 emit changePatchStatus(patch.name, "Актуальная версия (" + download_date + ")");
                 continue;
             }
 
-            app_settings->setValue("PatchPath/" + patch.name, "none");
+            Settings::setValue("DatabasePath/" + patch.name, "none");
 
             if (!QFile::remove(patch_filepath)) {
                 qDebug() << __FUNCTION__ << "Unable to remove file " << patch_filepath;

+ 1 - 3
src/Legacy/models/patchdownloader.h

@@ -28,7 +28,7 @@ class PatchDownloader : public QObject
 {
     Q_OBJECT
 public:
-    explicit PatchDownloader(QSettings* settings, QObject *parent = nullptr);
+    explicit PatchDownloader(QObject *parent = nullptr);
     ~PatchDownloader();
     void enableAutoUpdate();
     void disableAutoUpdate();
@@ -65,8 +65,6 @@ private:
     bool DownloadMissingPatches();
 
 private:
-
-    QSettings* app_settings;
     quint8 active_downloads_number = 0;
 
     const QDir patch_download_dir;

+ 26 - 13
src/Legacy/models/settings.h

@@ -6,7 +6,7 @@
 namespace Settings
 {
 
-static inline QMap<QString, QVariant> defaults = {
+static QMap<QString, QVariant> defaults = {
     // General info
     {"General/UI_scale", "100"},
     {"General/CurrentInitStage", "0"},
@@ -15,7 +15,7 @@ static inline QMap<QString, QVariant> defaults = {
     // Lotro Manager
     {"Lotro/game_path", "none"},
     {"Lotro/original_locale", "English"},
-    {"Lotro/skip_raw_downloads", "True"},
+    {"Lotro/skip_raw_download", "True"},
     {"Lotro/no_splash_screen", "True"},
 
     // Databases download settings
@@ -37,13 +37,13 @@ static inline QMap<QString, QVariant> defaults = {
     {"DatabaseApplied/video", "False"},
 
     // Databases downloaded paths
-    {"DatabasePath/sound", "False"},
-    {"DatabasePath/text", "False"},
-    {"DatabasePath/image", "False"},
-    {"DatabasePath/loadscreen", "False"},
-    {"DatabasePath/texture", "False"},
-    {"DatabasePath/font", "False"},
-    {"DatabasePath/video", "False"},
+    {"DatabasePath/sound", "none"},
+    {"DatabasePath/text", "none"},
+    {"DatabasePath/image", "none"},
+    {"DatabasePath/loadscreen", "none"},
+    {"DatabasePath/texture", "none"},
+    {"DatabasePath/font", "none"},
+    {"DatabasePath/video", "none"},
 
     // Databases download date
     {"DatabaseDownloadDate/sound", "none"},
@@ -62,7 +62,18 @@ static inline QMap<QString, QVariant> defaults = {
     {"Components/maps", "Disabled"},
     {"Components/loadscreens", "Disabled"},
     {"Components/sounds", "Disabled"},
-    {"Components/videos", "Disabled"}
+    {"Components/videos", "Disabled"},
+
+    // Network
+    {"Network/site_url", "http://translate.lotros.ru/"},
+    {"Network/forum_url", "http://lotros.ru/"},
+    {"Network/discord_url", "https://discord.gg/j25MdKR"},
+    {"Network/add_report_url", "http://translate.lotros.ru/bugs/add"},
+    {"Network/donate_url", "http://translate.lotros.ru/donate"},
+    {"Network/game_servers_status", "http://translate.lotros.ru/servers.txt"},
+    {"Network/game_servers_message", "http://translate.lotros.ru/profmessage.txt"},
+    {"Network/weekly_code_url", "http://translate.lotros.ru/coupon.txt"},
+    {"Network/news_list_url", "http://translate.lotros.ru/groupware/launcher_news/30/1"}
 };
 
 static void setDefaultSettings()
@@ -73,16 +84,18 @@ static void setDefaultSettings()
     }
 }
 
-static QVariant getSettingsValue(QString key) {
+static QVariant getValue(QString key) {
+    Q_ASSERT(defaults.contains(key)); // any required key should be pre-defined in defaults
     QSettings settings;
-    return settings.value(key);
+    return settings.value(key, defaults[key]);
 }
 
-static void setSettingsValue(QString key, QVariant value) {
+static void setValue(QString key, QVariant value) {
     QSettings settings;
     settings.setValue(key, value);
 }
 
+
 }
 
 #endif // SETTINGS_H

+ 0 - 2
src/Legacy/object_script.Legacy.Debug

@@ -3,7 +3,6 @@ INPUT(
 ./..\..\build\debug\Legacy\rcc\qrc_common.o
 ./..\..\build\debug\Legacy\obj\main.o
 ./..\..\build\debug\Legacy\obj\downloader.o
-./..\..\build\debug\Legacy\obj\filesystem.o
 ./..\..\build\debug\Legacy\obj\lotrodatmanager.o
 ./..\..\build\debug\Legacy\obj\patchdownloader.o
 ./..\..\build\debug\Legacy\obj\selfupdater.o
@@ -24,7 +23,6 @@ INPUT(
 ./..\..\build\debug\Legacy\obj\fonts.o
 ./..\..\build\debug\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\debug\Legacy\obj\moc_downloader.o
-./..\..\build\debug\Legacy\obj\moc_filesystem.o
 ./..\..\build\debug\Legacy\obj\moc_lotrodatmanager.o
 ./..\..\build\debug\Legacy\obj\moc_patchdownloader.o
 ./..\..\build\debug\Legacy\obj\moc_selfupdater.o

+ 0 - 2
src/Legacy/object_script.Legacy.Release

@@ -1,7 +1,6 @@
 INPUT(
 ./..\..\build\release\Legacy\obj\main.o
 ./..\..\build\release\Legacy\obj\downloader.o
-./..\..\build\release\Legacy\obj\filesystem.o
 ./..\..\build\release\Legacy\obj\lotrodatmanager.o
 ./..\..\build\release\Legacy\obj\patchdownloader.o
 ./..\..\build\release\Legacy\obj\selfupdater.o
@@ -22,7 +21,6 @@ INPUT(
 ./..\..\build\release\Legacy\obj\fonts.o
 ./..\..\build\release\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\release\Legacy\obj\moc_downloader.o
-./..\..\build\release\Legacy\obj\moc_filesystem.o
 ./..\..\build\release\Legacy\obj\moc_lotrodatmanager.o
 ./..\..\build\release\Legacy\obj\moc_patchdownloader.o
 ./..\..\build\release\Legacy\obj\moc_selfupdater.o

+ 10 - 11
src/Legacy/widgets/aboutwidget.cpp

@@ -4,14 +4,15 @@
 #include "models/lotrodatmanager.h"
 #include "widgets/mainwindow.h"
 #include "constants.h"
+#include "models/settings.h"
 
 #include <QDebug>
 #include <QFileDialog>
 #include <QMessageBox>
 #include <QDesktopServices>
 
-AboutWidget::AboutWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
-    QWidget(parent), app_settings(settings), lotro_manager(lotro_dat_manager),
+AboutWidget::AboutWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
+    QWidget(parent), lotro_manager(lotro_dat_manager),
     ui(new Ui::AboutWidget)
 {
     ui->setupUi(this);
@@ -36,7 +37,7 @@ void AboutWidget::updateFontsSizes()
     ui->client_side->setFont(trajan_8pt);
 }
 
-void AboutWidget::resizeEvent(QResizeEvent *event)
+void AboutWidget::resizeEvent(QResizeEvent *)
 {
     double coefficient = window_width / default_window_width;
 
@@ -46,30 +47,28 @@ void AboutWidget::resizeEvent(QResizeEvent *event)
     ui->widget_name_label->move(QPoint(45, 33)* coefficient);
     ui->widget_name_label->resize(QSize(180, 21) * coefficient);
 
-    ui->endevir_icon->setMinimumSize({50 * coefficient, 50 * coefficient});
-    ui->coder_icon->setMinimumSize({50 * coefficient, 50 * coefficient});
+    ui->endevir_icon->setMinimumSize({int(50.0 * coefficient), int(50.0 * coefficient)});
+    ui->coder_icon->setMinimumSize({int(50.0 * coefficient), int(50.0 * coefficient)});
 
     updateFontsSizes();
 }
 
 void AboutWidget::on_goto_site_clicked()
 {
-    QDesktopServices::openUrl(QUrl(app_settings->value("General/site_url", "http://translate.lotros.ru/").toString()));
+    QDesktopServices::openUrl(Settings::getValue("Network/site_url").toUrl());
 }
 
-
-
 void AboutWidget::on_goto_forum_clicked()
 {
-    QDesktopServices::openUrl(QUrl(app_settings->value("General/forum_url", "http://lotros.ru/").toString()));
+    QDesktopServices::openUrl(Settings::getValue("Network/forum_url").toUrl());
 }
 
 void AboutWidget::on_goto_bugs_clicked()
 {
-    QDesktopServices::openUrl(QUrl(app_settings->value("General/bugs_url", "http://translate.lotros.ru/bugs/add").toString()));
+    QDesktopServices::openUrl(Settings::getValue("Network/add_report_url").toUrl());
 }
 
 void AboutWidget::on_goto_donate_clicked()
 {
-    QDesktopServices::openUrl(QUrl(app_settings->value("General/donate_url", "http://translate.lotros.ru/donate").toString()));
+    QDesktopServices::openUrl(Settings::getValue("Network/donate_url").toUrl());
 }

+ 1 - 2
src/Legacy/widgets/aboutwidget.h

@@ -17,7 +17,7 @@ class AboutWidget : public QWidget
     Q_OBJECT
 
 public:
-    explicit AboutWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
+    explicit AboutWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
     ~AboutWidget();
 
 public slots:
@@ -36,7 +36,6 @@ private slots:
     void on_goto_donate_clicked();
 
 private:
-    QSettings* app_settings;
     PatchDownloader* patch_updater;
     LotroDatManager* lotro_manager;
 

+ 4 - 3
src/Legacy/widgets/chooseversiondialog.cpp

@@ -3,11 +3,12 @@
 
 #include "models/lotrodatmanager.h"
 #include "models/patchdownloader.h"
+#include "models/settings.h"
 #include "widgets/mainwindow.h"
 #include "constants.h"
 
-ChooseVersionDialog::ChooseVersionDialog(QSettings *settings, PatchDownloader *patch_downloader, LotroDatManager *lotro_dat_manager, QWidget *parent) :
-    QWidget(parent), app_settings(settings), lotro_manager(lotro_dat_manager),
+ChooseVersionDialog::ChooseVersionDialog(PatchDownloader *patch_downloader, LotroDatManager *lotro_dat_manager, QWidget *parent) :
+    QWidget(parent), lotro_manager(lotro_dat_manager),
     ui(new Ui::ChooseVersionDialog)
 {
 //    setWindowModality(Qt::WindowModal);
@@ -34,7 +35,7 @@ void ChooseVersionDialog::resizeEvent(QResizeEvent *event)
 
 void ChooseVersionDialog::show()
 {
-    QString locale_prefix = app_settings->value("General/original_locale", "English").toString();
+    QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
     ui->start_original->setStyleSheet("QWidget#start_original{\n	border: 0;\n	border-image: url(:/buttons/run_" + locale_prefix + ".png);\n}\n\nQWidget#start_original:hover{\n	border: 3px;\n	border-image: url(:/buttons/run_" + locale_prefix + ".png);\n}");
     QWidget::show();
 }

+ 1 - 2
src/Legacy/widgets/chooseversiondialog.h

@@ -17,7 +17,7 @@ class ChooseVersionDialog : public QWidget
     Q_OBJECT
 
 public:
-    explicit ChooseVersionDialog(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
+    explicit ChooseVersionDialog(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
     ~ChooseVersionDialog();
 
 public slots:
@@ -41,7 +41,6 @@ signals:
     void cancelled();
 
 private:
-    QSettings* app_settings;
     PatchDownloader* patch_updater;
     LotroDatManager* lotro_manager;
 

+ 1 - 1
src/Legacy/widgets/helpwidget.cpp

@@ -3,7 +3,7 @@
 #include <QDebug>
 #include <QScrollBar>
 
-HelpWidget::HelpWidget(QSettings*, PatchDownloader*, LotroDatManager*, QWidget *parent) :
+HelpWidget::HelpWidget(PatchDownloader*, LotroDatManager*, QWidget *parent) :
     QWidget(parent),
     ui(new Ui::HelpWidget)
 {

+ 1 - 2
src/Legacy/widgets/helpwidget.h

@@ -19,7 +19,7 @@ class HelpWidget : public QWidget
     Q_OBJECT
 
 public:
-    explicit HelpWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
+    explicit HelpWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
 
     ~HelpWidget();
 
@@ -48,7 +48,6 @@ private slots:
     void on_menuentry_5_clicked();
 
 private:
-    QSettings* app_settings;
     PatchDownloader* patch_updater;
     LotroDatManager* lotro_manager;
 

+ 7 - 10
src/Legacy/widgets/mainwindow.cpp

@@ -38,13 +38,10 @@ MainWindow::MainWindow(QWidget *parent) :
     currently_active_entry = ui->menuentry_1;
     currently_hover_entry = nullptr;
 
-    qDebug() << "Initialising Settings module";
-    QSettings *settings = new QSettings(qApp->applicationDirPath() + "/legacy_v2.ini", QSettings::IniFormat);
-
     qDebug() << "Creating patch downloader instance & thread";
     lotro_functions_thread = new QThread();
-    patch_updater = new PatchDownloader(settings);
-    lotro_manager = new LotroDatManager(settings);
+    patch_updater = new PatchDownloader();
+    lotro_manager = new LotroDatManager();
 
 //    connect(patch_updater, &PatchDownloader::checkForUpdatesStarted, this, &MainWindow::onPatchDownloaderStarted, Qt::BlockingQueuedConnection);
 //    connect(patch_updater, &PatchDownloader::checkForUpdatesFinished, this, &MainWindow::onPatchDownloaderFinished, Qt::BlockingQueuedConnection);
@@ -61,12 +58,12 @@ MainWindow::MainWindow(QWidget *parent) :
     qDebug() << "Initialising lotro manager...";
     QMetaObject::invokeMethod(lotro_manager, "InitialiseManager", Qt::QueuedConnection);
 
-    status_widget = new StatusWidget(settings, patch_updater, lotro_manager, this);
-    settings_widget = new SettingsWidget(settings, patch_updater, lotro_manager, this);
-    help_widget = new HelpWidget(settings, patch_updater, lotro_manager, this);
-    about_widget = new AboutWidget(settings, patch_updater, lotro_manager, this);
+    status_widget = new StatusWidget(patch_updater, lotro_manager, this);
+    settings_widget = new SettingsWidget(patch_updater, lotro_manager, this);
+    help_widget = new HelpWidget(patch_updater, lotro_manager, this);
+    about_widget = new AboutWidget(patch_updater, lotro_manager, this);
 
-    choose_locale_dialog = new ChooseVersionDialog(settings, patch_updater, lotro_manager, this);
+    choose_locale_dialog = new ChooseVersionDialog(patch_updater, lotro_manager, this);
     choose_locale_dialog->resize(size());
     choose_locale_dialog->hide();
     connect(choose_locale_dialog, &ChooseVersionDialog::cancelled, this, &MainWindow::hideChooseVersionDialog);

+ 2 - 1
src/Legacy/widgets/newslistwidget.cpp

@@ -4,11 +4,12 @@
 #include <QStringList>
 #include <QSpacerItem>
 #include <widgets/newspiece.h>
+#include "models/settings.h"
 
 NewsListWidget::NewsListWidget(QWidget *parent) : QWidget(parent)
 {
     news_downloader.targetBytearray = &news_data;
-    news_downloader.setUrl(QUrl("http://translate.lotros.ru/groupware/launcher_news/30/1"));
+    news_downloader.setUrl(Settings::getValue("Network/news_list_url").toUrl());
 
     news_layout = new QVBoxLayout(this);
     news_layout->setSpacing(10);

+ 8 - 10
src/Legacy/widgets/serverstatuswidget.cpp

@@ -3,6 +3,7 @@
 
 #include <QDebug>
 #include "constants.h"
+#include "models/settings.h"
 
 ServerStatusWidget::ServerStatusWidget(QWidget *parent) :
     QWidget(parent),
@@ -17,20 +18,12 @@ ServerStatusWidget::ServerStatusWidget(QWidget *parent) :
     connect(&status_downloader, &Downloader::downloadFinished, this, &ServerStatusWidget::updateStatus);
     // updateStatus will start tech_work_message_downloader
     connect(&tech_work_message_downloader, &Downloader::downloadFinished, this, &ServerStatusWidget::updateTechWorksMessage);
-}
-
-ServerStatusWidget::~ServerStatusWidget()
-{
-    delete ui;
-}
 
-void ServerStatusWidget::setupUpdater(QUrl status_url, QUrl tech_works_message_url)
-{
     status_downloader.targetBytearray = &status_data;
-    status_downloader.setUrl(status_url);
+    status_downloader.setUrl(Settings::getValue("Network/game_servers_status").toUrl());
 
     tech_work_message_downloader.targetBytearray = &tech_work_message_data;
-    tech_work_message_downloader.setUrl(tech_works_message_url);
+    tech_work_message_downloader.setUrl(Settings::getValue("Network/game_servers_message").toUrl());
 
     update_timer.setInterval(1000 * 60); // 1 minute;
     update_timer.start();
@@ -39,6 +32,11 @@ void ServerStatusWidget::setupUpdater(QUrl status_url, QUrl tech_works_message_u
     status_downloader.start();
 }
 
+ServerStatusWidget::~ServerStatusWidget()
+{
+    delete ui;
+}
+
 void ServerStatusWidget::updateFontsSizes()
 {
     foreach (QString server_name, servers_list) {

+ 0 - 1
src/Legacy/widgets/serverstatuswidget.h

@@ -19,7 +19,6 @@ public:
     ~ServerStatusWidget();
 
 public slots:
-    void setupUpdater(QUrl status_url, QUrl tech_works_message_url);
     void updateFontsSizes();
 
 signals:

+ 17 - 9
src/Legacy/widgets/settingswidget.cpp

@@ -4,6 +4,7 @@
 #include "models/filesystem.h"
 #include "models/lotrodatmanager.h"
 #include "models/patchdownloader.h"
+#include "models/settings.h"
 #include "constants.h"
 
 #include <QDebug>
@@ -11,8 +12,8 @@
 #include <QFileDialog>
 #include <QMetaObject>
 
-SettingsWidget::SettingsWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
-    QWidget(parent), app_settings(settings), patch_updater(patch_downloader), lotro_manager(lotro_dat_manager),
+SettingsWidget::SettingsWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
+    QWidget(parent), patch_updater(patch_downloader), lotro_manager(lotro_dat_manager),
     ui(new Ui::SettingsWidget)
 {
     ui->setupUi(this);
@@ -167,14 +168,15 @@ void SettingsWidget::on_interface_scale_combobox_currentIndexChanged(const QStri
     MainWindow* window = qobject_cast<MainWindow*>(qApp->activeWindow());
 
     if (!window) {
-        ui->interface_scale_combobox->setCurrentText(app_settings->value("general/ui_scale", 100).toString() + "%");
+        ui->interface_scale_combobox->setCurrentText(Settings::getValue("General/UI_scale").toString() + "%");
         qDebug() << "CANNOT FIND MAIN WINDOW!!!";
         return;
     }
 
     int value = arg1.left(arg1.length() - 1).toInt();
     window->resize(1000 * value / 100, 648 * value / 100);
-    app_settings->setValue("general/ui_scale", value);
+
+    Settings::setValue("General/UI_scale", value);
 }
 
 void SettingsWidget::on_change_folder_button_clicked()
@@ -182,19 +184,25 @@ void SettingsWidget::on_change_folder_button_clicked()
     QStringList known_paths = FileSystem::recognizeRegistryLotroPath();
     QString template_path = known_paths.empty() ? "" : known_paths[0];
     QString str = QFileDialog::getOpenFileName(0, "Расположение игры", template_path, "LotroLauncher.exe");
+
+    if (str.isEmpty()) {
+        return;
+    }
+
     QString game_folder= str.replace("/LotroLauncher.exe", "").replace("\\", "/").replace("//", "/") + "/";
 
-    if (app_settings->value("General/game_folder_path", "").toString() == game_folder)
+    if (Settings::getValue("Lotro/game_path").toString() == game_folder)
         return;
 
-    app_settings->setValue("General/game_folder_path", game_folder);
+    Settings::setValue("Lotro/game_path", game_folder);
     ui->game_folder_path->setText(game_folder);
     QMetaObject::invokeMethod(lotro_manager, "InitialiseManager", Qt::QueuedConnection);
 }
 
 void SettingsWidget::on_lotro_base_language_combobox_currentIndexChanged(int index)
 {
-    QString value = "";
+    QString value = "English";
+
     if (index == 0)
         value = "English";
     if (index == 1)
@@ -202,9 +210,9 @@ void SettingsWidget::on_lotro_base_language_combobox_currentIndexChanged(int ind
     if (index == 2)
         value = "FR";
 
-    if (app_settings->value("General/original_locale", "").toString() == value)
+    if (Settings::getValue("Lotro/original_locale").toString() == value)
         return;
 
-    app_settings->setValue("General/original_locale", value);
+    Settings::setValue("Lotro/original_locale", value);
     QMetaObject::invokeMethod(lotro_manager, "InitialiseManager", Qt::QueuedConnection);
 }

+ 1 - 2
src/Legacy/widgets/settingswidget.h

@@ -102,7 +102,7 @@ class SettingsWidget : public QWidget
 
 public:
 
-    explicit SettingsWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
+    explicit SettingsWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
 
     ~SettingsWidget();
 
@@ -137,7 +137,6 @@ private slots:
     void on_lotro_base_language_combobox_currentIndexChanged(int index);
 
 private:
-    QSettings* app_settings;
     PatchDownloader* patch_updater;
     LotroDatManager* lotro_manager;
 

+ 2 - 4
src/Legacy/widgets/statuswidget.cpp

@@ -10,14 +10,12 @@
 #include <QDebug>
 #include <QMessageBox>
 
-StatusWidget::StatusWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
-    QWidget(parent), app_settings(settings), patch_updater(patch_downloader), lotro_manager(lotro_dat_manager),
+StatusWidget::StatusWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent) :
+    QWidget(parent), patch_updater(patch_downloader), lotro_manager(lotro_dat_manager),
     ui(new Ui::StatusWidget)
 {
 
     ui->setupUi(this);
-    ui->server_status_widget->setupUpdater(settings->value("Network/game_servers_status", "http://translate.lotros.ru/servers.txt").toUrl(),
-                                           settings->value("Network/game_servers_message", "http://translate.lotros.ru/profmessage.txt").toUrl());
     last_progress_update_time.start();
 
     connect(patch_updater, &PatchDownloader::checkForUpdatesStarted, this, &StatusWidget::onPatchDownloaderStarted, Qt::QueuedConnection);

+ 1 - 2
src/Legacy/widgets/statuswidget.h

@@ -20,7 +20,7 @@ class StatusWidget : public QWidget
     Q_OBJECT
 
 public:
-    explicit StatusWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
+    explicit StatusWidget(PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
     ~StatusWidget();
 
 public slots:
@@ -51,7 +51,6 @@ private slots:
 private:
     Ui::StatusWidget *ui;
 
-    QSettings* app_settings;
     PatchDownloader* patch_updater;
     LotroDatManager* lotro_manager;
 

+ 2 - 1
src/Legacy/widgets/weeklycodewidget.cpp

@@ -7,6 +7,7 @@
 #include <QPaintEvent>
 #include <QClipboard>
 #include "constants.h"
+#include "models/settings.h"
 
 WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) :
     QWidget(parent), ui(new Ui::WeeklyCodeWidget)
@@ -18,7 +19,7 @@ WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) :
     code_data = "";
 
     code_downloader.targetBytearray = &code_data;
-    code_downloader.setUrl(QUrl("http://translate.lotros.ru/coupon.txt"));
+    code_downloader.setUrl(Settings::getValue("Network/weekly_code_url").toUrl());
 
     connect(&code_update_timer, &QTimer::timeout, &code_downloader, &Downloader::start);
     connect(&code_downloader, &Downloader::downloadFinished, this, &WeeklyCodeWidget::updateCode, Qt::QueuedConnection);