Browse Source

Reimplemented game launch functionality

Ivan Arkhipov 3 years ago
parent
commit
3c47b675c0

+ 1 - 1
Legacy_v2.pro

@@ -6,7 +6,7 @@
 
 QT       += core gui network
 
-# QMAKE_LFLAGS_RELEASE += -static -static-libgcc -static-libstdc++
+ QMAKE_LFLAGS_RELEASE += -static -static-libgcc -static-libstdc++
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 

+ 5 - 8
src/Legacy/legacyapplication.cpp

@@ -60,12 +60,10 @@ bool LegacyApplication::init()
     qDebug() << "Starting Patch managers initialization...";
 
     patch_installer_thread_ = new QThread();
-    PatchInstaller::instance().init();
     PatchInstaller::instance().moveToThread(patch_installer_thread_);
     patch_installer_thread_->start();
 
     patch_downloader_thread_ = new QThread();
-    PatchDownloader::instance().init();
     PatchDownloader::instance().moveToThread(patch_downloader_thread_);
     patch_downloader_thread_->start();
 
@@ -94,13 +92,12 @@ void LegacyApplication::InitModules()
     AppErrorStatus status = CheckAppPrerequesities();
     emit ErrorStatusChanged(status);
 
-    QMetaObject::invokeMethod(&PatchDownloader::instance(), &PatchDownloader::startPatchDownloaderChain, Qt::QueuedConnection);
     if (status == E_NO_ERRORS) {
-//        patch_list->initialize();
-//        patch_list->startAutoUpdate();
+        QMetaObject::invokeMethod(&PatchInstaller::instance(), &PatchInstaller::init, Qt::QueuedConnection);
+        QMetaObject::invokeMethod(&PatchDownloader::instance(), &PatchDownloader::init, Qt::QueuedConnection);
+        QMetaObject::invokeMethod(&PatchDownloader::instance(), &PatchDownloader::startPatchDownloaderChain, Qt::QueuedConnection);
     } else {
-//        qWarning() << "LegacyApplication: Couldnt init functional modules!";
-//        modules_init_timer_.start();
+        qWarning() << "LegacyApplication: Couldnt init functional modules!";
+        modules_init_timer_.start();
     }
-
 }

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

@@ -18,7 +18,6 @@ public:
         return instance_;
     }
 
-    void init();
     ~PatchDownloader();
 
 private:
@@ -28,6 +27,7 @@ private:
     static bool needDownloadDatabase(QString db_name); // Checks if database needs to be downloaded (by checksum comparing)
 
 public slots:
+    void init();
     void startPatchDownloaderChain();
 
 signals:

+ 1 - 1
src/Legacy/models/patchinstaller.h

@@ -25,7 +25,6 @@ public:
         static PatchInstaller instance_;
         return instance_;
     }
-    void init();
     bool initialised();
     ~PatchInstaller();
 
@@ -59,6 +58,7 @@ private:
 
 
 public slots:
+    void init();
     void startGame(bool freeze_updates);
 
 

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

@@ -69,10 +69,10 @@ MainWindow::MainWindow(QWidget *parent)
 
     qDebug() << __FUNCTION__ << "Initialising additional frames...";
 
-//    choose_locale_dialog_ = new ChooseVersionDialog(legacy_patches_->getManager(), this);
-//    choose_locale_dialog_->resize(size());
-//    choose_locale_dialog_->hide();
-//    connect(choose_locale_dialog_, &ChooseVersionDialog::cancelled, choose_locale_dialog_, &ChooseVersionDialog::hide);
+    choose_locale_dialog_ = new ChooseVersionDialog(this);
+    choose_locale_dialog_->resize(size());
+    choose_locale_dialog_->hide();
+    connect(choose_locale_dialog_, &ChooseVersionDialog::cancelled, choose_locale_dialog_, &ChooseVersionDialog::hide);
 
     dialog_window_ = new DialogWindow(this);
     dialog_window_->resize(size());
@@ -143,13 +143,13 @@ void MainWindow::resizeEvent(QResizeEvent * event)
     ui->content_area->move(0, height * 110 / default_window_height);
     ui->content_area->resize(width * 1000 / default_window_width, height * 530 / default_window_height);
     setupWindowBackgroundAndMask(current_bg_);
-//    choose_locale_dialog_->resize(event->size());
+    choose_locale_dialog_->resize(event->size());
 
     ui->closeButton->setMinimumSize(width * 20 / default_window_width, height * 20 / default_window_height);
     ui->minimizeButton->setMinimumSize(width * 20 / default_window_width, height * 20 / default_window_height);
 
-//    choose_locale_dialog_->move({0, 0});
-//    choose_locale_dialog_->resize(event->size());
+    choose_locale_dialog_->move({0, 0});
+    choose_locale_dialog_->resize(event->size());
 
     dialog_window_->move({0, 0});
     dialog_window_->resize(size());