Browse Source

Small patch hotfixes, Apply all patches button impl

Ivan Arkhipov 5 years ago
parent
commit
a5630679e8

+ 2 - 2
src/Legacy/models/lotrodatmanager.cpp

@@ -363,11 +363,11 @@ void LotroDatManager::removeBackup()
 bool LotroDatManager::startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale)
 {
     QStringList args;
-    if (Settings::getValue("Lotro/skip_raw_download").toString() == "True") {
+    if (Settings::getValue("Lotro/skip_raw_download").toBool()) {
         args << "-skiprawdownload";
     }
 
-    if (Settings::getValue("Lotro/no_splash_screen").toString() == "True") {
+    if (Settings::getValue("Lotro/no_splash_screen").toBool()) {
         args << "-nosplashscreen";
     }
 

+ 2 - 0
src/Legacy/models/patch/graphicspatch.cpp

@@ -290,6 +290,8 @@ void GraphicsPatch::installLoadscreens()
         progress.install_finished_parts++;
         emit progressChanged(progress, this);
     }
+
+    Settings::setValue("DatabaseNeedInstall/loadscreen", false);
 }
 
 void GraphicsPatch::enableLoadscreens()

+ 2 - 2
src/Legacy/models/patch/videospatch.cpp

@@ -102,13 +102,13 @@ void VideosPatch::download()
 
 void VideosPatch::install()
 {
-    QThread::sleep(3);
+    QThread::msleep(500);
     emit operationFinished(E_INSTALL, this);
 }
 
 void VideosPatch::activate()
 {
-    QThread::sleep(3);
+    QThread::msleep(500);
     emit operationFinished(E_ACTIVATE, this);
 }
 

+ 17 - 0
src/Legacy/models/patchlist.cpp

@@ -222,3 +222,20 @@ void PatchList::update()
     }
 }
 
+void PatchList::forceInstallPatches()
+{
+    if (active_operations_num_ > 0) {
+        qWarning() << "Trying to start force patch installation, while there are already some operations running!";
+    }
+
+    auto is_database_enabled = [](QString db_name) -> bool {
+        return Settings::getValue("DatabaseDownload/" + db_name).toBool();
+    };
+
+    for (const QString& db_name : QStringList(
+            {"text", "font", "image", "loadscreen",
+            "texture", "sound", "video", "micro"})) {
+        Settings::setValue("DatabaseNeedInstall/" + db_name, is_database_enabled(db_name));
+    }
+    update();
+}

+ 2 - 0
src/Legacy/models/patchlist.h

@@ -43,6 +43,8 @@ public slots:
 
     void removeBackup();
 
+    void forceInstallPatches();
+
 private slots:
     void onPatchOperationStarted(Patch::Operation operation, Patch* patch);
     void onPatchOperationFinished(Patch::Operation operation, Patch* patch);

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

@@ -68,6 +68,7 @@ void ServerStatusWidget::enterEvent(QEvent *event)
 
 void ServerStatusWidget::updateStatus()
 {
+    qDebug() << "Status data: " << QString(status_data);
     if (QString(status_data).contains("profilaktika")) {
         servers_disabled = true;
         qDebug() << "All servers are closed!";

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

@@ -416,7 +416,7 @@ void SettingsWidget::on_patch_video_checkbox_clicked()
 
 void SettingsWidget::on_patch_force_apply_button_clicked()
 {
- // TODO(endevir): Implement
+    QMetaObject::invokeMethod(legacy_patches_, "forceInstallPatches");
 }
 
 void SettingsWidget::on_micropatch_checkbox_clicked()

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

@@ -1658,7 +1658,7 @@ QPushButton:default {
 }</string>
           </property>
           <property name="text">
-           <string>Повторно применить все патчи Наследия</string>
+           <string>Переустановить все компоненты русификации</string>
           </property>
          </widget>
         </item>