diff options
| author | Al <26797547+Al12rs@users.noreply.github.com> | 2020-06-07 12:21:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-07 12:21:41 -0700 |
| commit | ec5a78cefa610df153063c3cbfcc42b36998a542 (patch) | |
| tree | 0345d3543d85d0aaf93b6c1b1761b8c2dc554ebd /src/mainwindow.h | |
| parent | 8b667fe69a268c7d183f60dd43ec95dbd976c47b (diff) | |
| parent | 6d7c0866859a0fe27a8055068552470b67d680e3 (diff) | |
Merge pull request #1112 from Al12rs/updateProblemsButton
Move Problems Checks on a thread and avoid redundant calls
Diffstat (limited to 'src/mainwindow.h')
| -rw-r--r-- | src/mainwindow.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h index 25d09584..94626ff3 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -178,6 +178,8 @@ signals: void modListDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void checkForProblemsDone(); + protected: virtual void showEvent(QShowEvent *event); @@ -244,8 +246,9 @@ private: void fixCategories(); bool extractProgress(QProgressDialog &extractProgress, int percentage, std::string fileName); - - size_t checkForProblems(); + + // Performs checks, sets the m_NumberOfProblems and signals checkForProblemsDone(). + void checkForProblemsImpl(); void setCategoryListVisible(bool visible); @@ -267,8 +270,6 @@ private: QMenu *openFolderMenu(); - void scheduleUpdateButton(); - QDir currentSavesDir() const; void startMonitorSaves(); @@ -358,6 +359,10 @@ private: // when painting the count QIcon m_originalNotificationIcon; + std::atomic<std::size_t> m_NumberOfProblems; + std::atomic<bool> m_ProblemsCheckRequired; + std::mutex m_CheckForProblemsMutex; + Executable* getSelectedExecutable(); private slots: @@ -523,8 +528,15 @@ private slots: void checkBSAList(); + // Only visually update the problems icon. void updateProblemsButton(); + // Queue a problem check to allow collapsing of multiple requests in short amount of time. + void scheduleCheckForProblems(); + + // Perform the actual problem check in another thread. + QFuture<void> checkForProblemsAsync(); + void saveModMetas(); void updateStyle(const QString &style); |
