diff options
| author | AL <26797547+Al12rs@users.noreply.github.com> | 2020-06-06 23:13:14 +0200 |
|---|---|---|
| committer | AL <26797547+Al12rs@users.noreply.github.com> | 2020-06-06 23:13:14 +0200 |
| commit | a30ec0018bfa9056492cab100321ebfcb7b0672e (patch) | |
| tree | 3297dbbabc7068fb43459e0210037dd900a8d372 /src | |
| parent | 1497685ea5d7059b34bfb65643388a4f4edf4d49 (diff) | |
* Change the diagnoseUpdate() signals to collapse into a single async call in case of multiple signals in short time span.
* Make mainwindow constructor and show() use updateProblemsButton() to just update the problems icon without performing checks.
* Make directory refreshed schedule a problems check since it can overlap with other invocations.
* Make changing translation not trigger checks at all.
* Make changing style only update the icon instead of also performing the check.
* Make MainWindow ctor, MainWindow::show()and MainWindow::resetActionIcons() just update the icon without actually performing a check.
* Make clearing overwrite checkForProblems synchronously. Same before opening the notifications window and after closing it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c49b0bdd..5a56e22b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -401,7 +401,7 @@ MainWindow::MainWindow(Settings &settings ui->bossButton->setToolTip(tr("There is no supported sort mechanism for this game. You will probably have to use a third-party tool.")); } - connect(&m_PluginContainer, SIGNAL(diagnosisUpdate()), this, SLOT(updateProblemsButton())); + connect(&m_PluginContainer, SIGNAL(diagnosisUpdate()), this, SLOT(scheduleCheckForProblems())); connect(ui->savegameList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(saveSelectionChanged(QListWidgetItem*))); @@ -474,8 +474,8 @@ MainWindow::MainWindow(Settings &settings setFilterShortcuts(ui->downloadView, ui->downloadFilterEdit); m_UpdateProblemsTimer.setSingleShot(true); - connect(&m_UpdateProblemsTimer, SIGNAL(timeout()), this, SLOT(checkForProblemsAsync())); - connect(this, SIGNAL(checkForProblemsDone()), this, SLOT(updateProblemsButton()), Qt::ConnectionType::QueuedConnection); + connect(&m_UpdateProblemsTimer, &QTimer::timeout, this, &MainWindow::checkForProblemsAsync); + connect(this, &MainWindow::checkForProblemsDone, this, &MainWindow::updateProblemsButton, Qt::ConnectionType::QueuedConnection); m_SaveMetaTimer.setSingleShot(false); connect(&m_SaveMetaTimer, SIGNAL(timeout()), this, SLOT(saveModMetas())); @@ -1011,8 +1011,6 @@ void MainWindow::scheduleCheckForProblems() void MainWindow::updateProblemsButton() { - TimeThis tt("MainWindow::updateProblemsButton()"); - // if the current stylesheet doesn't provide an icon, this is used instead const char* DefaultIconName = ":/MO/gui/warning"; @@ -1107,6 +1105,7 @@ void MainWindow::checkForProblemsAsync() { void MainWindow::checkForProblems() { + TimeThis tt("MainWindow::checkForProblems()"); size_t numProblems = 0; for (QObject *pluginObj : m_PluginContainer.plugins<QObject>()) { IPlugin *plugin = qobject_cast<IPlugin*>(pluginObj); @@ -2464,7 +2463,7 @@ void MainWindow::directory_refreshed() { // some problem-reports may rely on the virtual directory tree so they need to be updated // now - updateProblemsButton(); + scheduleCheckForProblems(); //Some better check for the current tab is needed. if (ui->tabWidget->currentIndex() == 2) { @@ -3790,7 +3789,7 @@ void MainWindow::clearOverwrite() for (auto f : overwriteDir.entryList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot)) delList.push_back(overwriteDir.absoluteFilePath(f)); if (shellDelete(delList, true)) { - updateProblemsButton(); + checkForProblems(); m_OrganizerCore.refreshModList(); } else { const auto e = GetLastError(); @@ -5170,7 +5169,6 @@ void MainWindow::languageChange(const QString &newLanguage) createHelpMenu(); updateDownloadView(); - updateProblemsButton(); QMenu *listOptionsMenu = new QMenu(ui->listOptionsBtn); initModListContextMenu(listOptionsMenu); @@ -5877,12 +5875,12 @@ void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int) void MainWindow::on_actionNotifications_triggered() { - updateProblemsButton(); + checkForProblems(); ProblemsDialog problems(m_PluginContainer.plugins<QObject>(), this); problems.exec(); - updateProblemsButton(); + checkForProblems(); } void MainWindow::on_actionChange_Game_triggered() |
