فهرست منبع

Bump 16.05.2019

Ivan Arkhipov 5 سال پیش
والد
کامیت
4fa4c7a21e
3فایلهای تغییر یافته به همراه43 افزوده شده و 41 حذف شده
  1. 1 6
      src/Legacy/models/internallogicmanager.cpp
  2. 42 34
      src/Legacy/models/internallogicmanager.h
  3. 0 1
      src/Legacy/models/lotrodatmanager.h

+ 1 - 6
src/Legacy/models/internallogicmanager.cpp

@@ -11,12 +11,6 @@ InternalLogicManager::InternalLogicManager(MainWindow *gui_, QSettings *settings
     lotro_manager_thread = new QThread();
     lotro_manager = new LotroDatManager(settings);
 
-    connect(patch_downloader, &PatchDownloader::checkForUpdatesStarted, this, &InternalLogicManager::semiCriticalSectionEntered, Qt::BlockingQueuedConnection);
-    connect(patch_downloader, &PatchDownloader::checkForUpdatesFinished, this, &InternalLogicManager::semiCriticalSectionLeaved, Qt::BlockingQueuedConnection);
-    connect(lotro_manager, &LotroDatManager::processStarted, this, &InternalLogicManager::criticalSectionEntered, Qt::BlockingQueuedConnection);
-    connect(lotro_manager, &LotroDatManager::processFinished, this, &InternalLogicManager::criticalSectionLeaved, Qt::BlockingQueuedConnection);
-//    connect(lotro_manager, &LotroDatManager::caughtError, this, &MainWindow::onLotroManagerErrorOccured, Qt::BlockingQueuedConnection);
-
     connect(lotro_manager_thread, &QThread::finished, lotro_manager, &QObject::deleteLater, Qt::QueuedConnection);
     connect(patch_downloader_thread, &QThread::finished, patch_downloader, &QObject::deleteLater, Qt::QueuedConnection);
 
@@ -28,6 +22,7 @@ InternalLogicManager::InternalLogicManager(MainWindow *gui_, QSettings *settings
 
 InternalLogicManager::~InternalLogicManager()
 {
+    stopThreads();
 }
 
 void InternalLogicManager::startInitPipeline()

+ 42 - 34
src/Legacy/models/internallogicmanager.h

@@ -43,6 +43,12 @@ Stage 10 - All settings are checked and set. If user is for the first time - sho
 
 class MainWindow;
 
+enum class APP_STATE {
+    NO_PROCESS,
+    SEMI_CRITICAL_PROCESS,
+    CRITICAL_PROCESS
+};
+
 class InternalLogicManager : public QObject
 {
     Q_OBJECT
@@ -51,40 +57,38 @@ public:
     ~InternalLogicManager();
 
 signals:
-    void initPipelineStarted();
-    void initPipelineFinished();
-
-    // Semi-critical sections signals. Example: patch files downloading
-    void semiCriticalSectionEntered();
-    void semiCriticalSectionLeaved();
-
-    // Critical sections. Example: patch applying, game updating, prelauncher files moving
-    void criticalSectionEntered();
-    void criticalSectionLeaved();
-
-//public slots:
-//    void startInitPipeline();
-
-//    // Actions from UI -> general window
-//    void startGame(QString locale = "Original"); // Original/RU
-
-//    // Actions from UI -> settings window
-//    void lotroSettingsUpdated();
-//    void createLotroFilesBackup();
-//    void removeLotroFilesBackup();
-//    void applySelectedPatches();
-//    void updateSettingsChanged();
-//    void terminateThreads();
-//    void stopThreads();
-//private slots:
-//    void checkFirstTimeOpening();
-//    void checkGameFolderCorrectness();
-//    void checkDatFilesExist();
-//    void processLotroManagerInit();
-//    void processPatchDownloaderInit(); // There begins also checkForUpdates cycle;
-//    void checkBackupExist();
-//    void checkUserHasEnteredPatchOptions();
-//    void checkDatFileWasPatched();
+    void stateChanged(APP_STATE state);
+
+public slots:
+    void startInitPipeline();
+
+    // Actions from UI -> general window
+    void startGame(QString locale = "Original"); // Original/RU
+
+    // Actions from UI -> settings window
+    void lotroSettingsUpdated();
+    void createLotroFilesBackup();
+    void removeLotroFilesBackup();
+    void applySelectedPatches();
+    void updateSettingsChanged();
+    void terminateThreads();
+    void stopThreads();
+
+private slots:
+    void onLotroManagerStarted(QString, QVector<QVariant>);
+    void onLotroManagerFinished(QString, QVector<QVariant>);
+    void onLotroManagerErrorOccured(QString, QVector<QVariant>);
+    void onLotroManagerProgressChanged();
+
+private slots:
+    void checkFirstTimeOpening();
+    void checkGameFolderCorrectness();
+    void checkDatFilesExist();
+    void processLotroManagerInit();
+    void processPatchDownloaderInit(); // There begins also checkForUpdates cycle;
+    void checkBackupExist();
+    void checkUserHasEnteredPatchOptions();
+    void checkDatFileWasPatched();
 
 private:
     PatchDownloader *patch_downloader;
@@ -95,6 +99,10 @@ private:
 
     QSettings *settings;
     MainWindow *gui;
+
+    APP_STATE state;
+    size_t active_critical_process_count;
+    size_t active_non_critical_process_count;
 };
 
 #endif // INTERNALLOGICMANAGER_H

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

@@ -64,7 +64,6 @@ signals:
     // general signals. First argument is process_name, second - processed values
     void processStarted(QString, QVector<QVariant> parameters = QVector<QVariant>());
     void processFinished(QString, QVector<QVariant> parameters = QVector<QVariant>());
-    void progressChanged();
     void caughtError(QString, QVector<QVariant>);
 
 private: