Browse Source

Design features

Ivan Arkhipov 5 years ago
parent
commit
0084e519ff

+ 32 - 30
src/Legacy/models/lotrodatmanager.cpp

@@ -33,7 +33,7 @@ bool LotroDatManager::NotPatched()
 void LotroDatManager::InitialiseManager()
 {
     qDebug() << "Initialising .dat manager";
-    emit processStarted();
+    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")
@@ -42,7 +42,7 @@ void LotroDatManager::InitialiseManager()
         qDebug() << "Finished initialisation .dat manager - error: required files not found!";
 
         emit caughtError(QString("InitialiseManager"), {"FileNotFound"});
-        emit processFinished();
+        emit processFinished("InitialiseManager");
         return;
     }
 
@@ -52,7 +52,7 @@ void LotroDatManager::InitialiseManager()
         qDebug() << "Unable to update permissions on client_local_* file!";
 
         emit caughtError(QString("InitialiseManager"), {"PermissionsError"});
-        emit processFinished();
+        emit processFinished("InitialiseManager");
         return;
     }
 
@@ -60,7 +60,7 @@ void LotroDatManager::InitialiseManager()
         qDebug() << "Unable to update permissions on client_general* file!";
 
         emit caughtError(QString("InitialiseManager"), {"PermissionsError"});
-        emit processFinished();
+        emit processFinished("InitialiseManager");
         return;
     }
 
@@ -77,26 +77,26 @@ void LotroDatManager::InitialiseManager()
         qDebug() << "Finished initialisation .dat manager - error: DatFile initialisation error!";
 
         emit caughtError(QString("InitialiseManager"), {"InitialisationError"});
-        emit processFinished();
+        emit processFinished("InitialiseManager");
         return;
     }
 
-    emit processFinished();
+    emit processFinished("InitialiseManager");
 }
 
 void LotroDatManager::DeinitialiseManager()
 {
-    emit processStarted();
+    emit processStarted("DeinitialiseManager");
     qDebug() << "Started DEinitialisation .dat manager.";
     client_local_file.Deinitialize();
     client_general_file.Deinitialize();
     qDebug() << "Finished DEinitialisation .dat manager.";
-    emit processFinished();
+    emit processFinished("DeinitialiseManager");
 }
 
 void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
 {
-    emit processStarted();
+    emit processStarted("StartGame");
     qDebug() << "Starting game!";
 
     client_general_file.GetLocaleManager().SetLocale(locale);
@@ -107,7 +107,7 @@ void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
     if (!FileSystem::fileExists(QApplication::applicationDirPath() + "/Launcher.exe")) {
         emit caughtError("StartGame", {"NoGameLauncherInLegacyDir"});
         qDebug() << "Starting game FAILED - no game launcher in legacy directory found!";
-        emit processFinished();
+        emit processFinished("StartGame");
         return;
     }
 
@@ -116,7 +116,7 @@ void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
         if (!QFile::copy(QApplication::applicationDirPath() + "/LotroLauncher.exe", game_folder + "/lotro_ru.exe")) {
             emit caughtError("StartGame", {"NoAccessToGameLauncher"});
             qDebug() << "Starting game FAILED - cannot copy LotroLauncher to LotroLauncher_fwd!!";
-            emit processFinished();
+            emit processFinished("StartGame");
             return;
         }
 
@@ -124,7 +124,7 @@ void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
         if (!QFile::copy(QApplication::applicationDirPath() + "/Launcher.exe", game_folder + "/LotroLauncher.exe")) {
             emit caughtError("StartGame", {"NoAccessToGameLauncher"});
             qDebug() << "Starting game FAILED - cannot copy GameLauncher to LotroLauncher!!";
-            emit processFinished();
+            emit processFinished("StartGame");
             return;
         }
 
@@ -140,14 +140,14 @@ void LotroDatManager::StartGame(LOTRO_DAT::DatLocaleManager::LOCALE locale)
             qDebug() << game_folder + "/LotroLauncher.exe";
             emit caughtError("StartGame", {"NoAccessToGameLauncher"});
             qDebug() << "Starting game FAILED - cannot copy LotroLauncher from working dir to LotroLauncher in lotro dir!!";
-            emit processFinished();
+            emit processFinished("StartGame");
             return;
         }
     }
 
     qDebug() << "Starting game finished!!";
     startLotroLauncherWithParameters(locale);
-    emit processFinished();
+    emit processFinished("StartGame");
 }
 
 void LotroDatManager::ChangeTranslationLanguage()
@@ -168,6 +168,7 @@ void LotroDatManager::InstallActivePatches()
 
 void LotroDatManager::InstallPatches()
 {
+    emit processStarted("InstallPatches");
     const QStringList all_patch_names = {"sound", "text", "image", "texture"};
     foreach (QString patch_name, all_patch_names) {
         if (app_settings->value("patch_databases/" + patch_name, "Disabled").toString() == "Disabled")
@@ -188,11 +189,12 @@ void LotroDatManager::InstallPatches()
 
         db.CloseDatabase();
     }
+    emit processFinished("InstallPatches");
 }
 
 void LotroDatManager::InstallLoadscreens()
 {
-    emit processStarted();
+    emit processStarted("InstallLoadscreens");
 
     if (app_settings->value("patch_databases/loadscreen", "Disabled").toString() == "Disabled")
         return;
@@ -233,6 +235,7 @@ void LotroDatManager::InstallLoadscreens()
     LOTRO_DAT::Database db;
     if (!db.InitDatabase(database_path.toStdString())) {
         emit caughtError("InstallLoadscreens", {"ErrorInitDatabase"});
+        emit processFinished("InstallLoadscreens");
         return;
     }
 
@@ -246,13 +249,12 @@ void LotroDatManager::InstallLoadscreens()
         subfile.binary_data.WriteToFile((folder + filenames[i]).toStdString());
     }
     db.CloseDatabase();
-
-    emit processFinished();
+    emit processFinished("InstallLoadscreens");
 }
 
 void LotroDatManager::InstallVideos()
 {
-    emit processStarted();
+    emit processStarted("InstallVideos");
     if (app_settings->value("patch_databases/video", "Disabled").toString() == "Disabled")
         return;
 
@@ -263,6 +265,7 @@ void LotroDatManager::InstallVideos()
     LOTRO_DAT::Database db;
     if (!db.InitDatabase(database_path.toStdString())) {
         emit caughtError("InstallVideos", {"ErrorInitDatabase"});
+        emit processFinished("InstallVideos");
         return;
     }
 
@@ -293,6 +296,8 @@ void LotroDatManager::InstallVideos()
         video_downloader.targetFile = new QFile(target_folder + filename);
         video_downloader.targetFile->open(QIODevice::ReadWrite);
         video_downloader.start();
+// TODO: Progress notification on video download!
+//        connect(&video_downloader, &Downloader::progressChanged, this, &LotroDatManager::VideoDownloadProgressChanged);
         video_downloader.waitForDownloaded();
         video_downloader.targetFile->close();
         video_downloader.targetFile->deleteLater();
@@ -303,7 +308,7 @@ void LotroDatManager::InstallVideos()
     }
     db.CloseDatabase();
 
-    emit processFinished();
+    emit processFinished("InstallVideos");
 }
 
 void LotroDatManager::InstallUpdates()
@@ -318,29 +323,29 @@ void LotroDatManager::InstallMicroPatch()
 
 void LotroDatManager::CreateBackup()
 {
-    emit processStarted();
+    emit processStarted("CreateBackup");
     QString locale_prefix = app_settings->value("General/original_locale", "English").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();
+    emit processFinished("CreateBackup");
 }
 
 void LotroDatManager::RestoreFromBackup()
 {
-    emit processStarted();
+    emit processStarted("CreateBackup");
     QString locale_prefix = app_settings->value("General/original_locale", "English").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();
+    emit processFinished("CreateBackup");
 }
 
 void LotroDatManager::RemoveBackup()
 {
-    emit processStarted();
+    emit processStarted("CreateBackup");
     QString locale_prefix = app_settings->value("General/original_locale", "English").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();
+    emit processFinished("CreateBackup");
 }
 
 void LotroDatManager::ApplyTexts()
@@ -362,21 +367,18 @@ void LotroDatManager::ApplyTexts()
     } else {
         client_local_file.GetLocaleManager().DisableCategory(102);
     }
-    emit processFinished();
 }
 
 void LotroDatManager::ApplyImages() {
-    emit processStarted();
     if (app_settings->value("patch_options/maps", "Disabled").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(200);
     } else {
         client_local_file.GetLocaleManager().DisableCategory(200);
     }
-    emit processFinished();
 }
 
 void LotroDatManager::ApplySounds() {
-    emit processStarted();
+    emit processStarted("ApplySounds");
     if (app_settings->value("patch_options/sounds", "Disabled").toString() == "Enabled") {
         client_local_file.GetLocaleManager().EnableCategory(300);
     } else {
@@ -388,7 +390,7 @@ void LotroDatManager::ApplySounds() {
     } else {
         client_local_file.GetLocaleManager().DisableCategory(103);
     }
-    emit processFinished();
+    emit processFinished("ApplySounds");
 }
 
 bool LotroDatManager::startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale)

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

@@ -4,6 +4,8 @@
 #include <QObject>
 #include <QSettings>
 #include <QApplication>
+#include <QVector>
+#include <QVariant>
 
 #include <LotroDat/LotroDat.h>
 
@@ -59,8 +61,9 @@ private:
 
 signals:
     // general signals. First argument is process_name, second - processed values
-    void processStarted();
-    void processFinished();
+    void processStarted(QString, QVector<QVariant> parameters = QVector<QVariant>());
+    void processFinished(QString, QVector<QVariant> parameters = QVector<QVariant>());
+    void progressChanged();
     void caughtError(QString, QVector<QVariant>);
 
 private:

+ 1 - 1
src/Legacy/widgets/mainwindow.ui

@@ -155,7 +155,7 @@
         <enum>Qt::LeftToRight</enum>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(210, 210, 210);</string>
+        <string notr="true">color: rgb(255, 255, 255);</string>
        </property>
        <property name="text">
         <string>ГЛАВНАЯ</string>

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

@@ -20,8 +20,7 @@ public:
     explicit SettingsWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);
     ~SettingsWidget();
 
-private slots:
-
+private slots:    
     void on_interface_scale_combobox_common_currentIndexChanged(const QString &arg1);
 
     void on_change_folder_button_clicked();

+ 2 - 104
src/Legacy/widgets/statuswidget.ui

@@ -74,8 +74,8 @@ color: white;
       <font>
        <family>Trajan Pro 3</family>
        <pointsize>12</pointsize>
-       <weight>75</weight>
-       <bold>true</bold>
+       <weight>50</weight>
+       <bold>false</bold>
       </font>
      </property>
      <property name="cursor">
@@ -163,108 +163,6 @@ color: white;
       <property name="bottomMargin">
        <number>0</number>
       </property>
-      <item>
-       <widget class="QWidget" name="widget_2" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>40</width>
-          <height>40</height>
-         </size>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="leftMargin">
-          <number>0</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>0</number>
-         </property>
-         <property name="bottomMargin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QWidget" name="widget_4" native="true">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">border-image: url(:/icon_ring.png);</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QWidget" name="widget_5" native="true">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">border-image: url(:/quest_icon.png);</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QWidget" name="widget_3" native="true">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">border-image: url(:/icon_eye.png);</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
       <item>
        <widget class="QPushButton" name="site_link_button">
         <property name="sizePolicy">