diff options
| author | Jeremy Rimpo <jrim@rimpo.org> | 2023-10-02 18:28:35 -0500 |
|---|---|---|
| committer | Jeremy Rimpo <jrim@rimpo.org> | 2023-10-02 18:28:35 -0500 |
| commit | 62e8ddc9ca1bb8bfd4c912068932563a7438bca8 (patch) | |
| tree | 9476eb3dfd792fe2d306c6c055c2b6c32ff48909 /src | |
| parent | c19fbb6818be3c99dcd402f41fd11baf7496e6a5 (diff) | |
Updates to refresh sort button after various events
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 25 | ||||
| -rw-r--r-- | src/mainwindow.h | 2 | ||||
| -rw-r--r-- | src/organizercore.cpp | 2 | ||||
| -rw-r--r-- | src/organizercore.h | 3 |
4 files changed, 26 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b576c318..dae91806 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -371,12 +371,7 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore, ui->groupCombo->installEventFilter(noWheel); ui->profileBox->installEventFilter(noWheel); - if (organizerCore.managedGame()->sortMechanism() == - MOBase::IPluginGame::SortMechanism::NONE) { - ui->sortButton->setDisabled(true); - ui->sortButton->setToolTip(tr("There is no supported sort mechanism for this game. " - "You will probably have to use a third-party tool.")); - } + updateSortButton(); connect(&m_PluginContainer, SIGNAL(diagnosisUpdate()), this, SLOT(scheduleCheckForProblems())); @@ -399,6 +394,9 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore, SLOT(updateAvailable())); connect(m_OrganizerCore.updater(), SIGNAL(motdAvailable(QString)), this, SLOT(motdReceived(QString))); + connect(&m_OrganizerCore, &OrganizerCore::refreshTriggered, this, [this]() { + updateSortButton(); + }); connect(&NexusInterface::instance(), SIGNAL(requestNXMDownload(QString)), &m_OrganizerCore, SLOT(downloadRequestedNXM(QString))); @@ -2766,6 +2764,8 @@ void MainWindow::on_actionSettings_triggered() m_OrganizerCore.refreshLists(); + updateSortButton(); + if (settings.paths().profiles() != oldProfilesDirectory) { refreshProfiles(); } @@ -3033,6 +3033,19 @@ void MainWindow::toggleUpdateAction() ui->actionUpdate->setVisible(s.checkForUpdates()); } +void MainWindow::updateSortButton() +{ + if (m_OrganizerCore.managedGame()->sortMechanism() != + IPluginGame::SortMechanism::NONE) { + ui->sortButton->setEnabled(true); + ui->sortButton->setToolTip(tr("Sort the plugins using LOOT.")); + } else { + ui->sortButton->setDisabled(true); + ui->sortButton->setToolTip(tr("There is no supported sort mechanism for this game. " + "You will probably have to use a third-party tool.")); + } +} + void MainWindow::nxmEndorsementsAvailable(QVariant userData, QVariant resultData, int) { QVariantList data = resultData.toList(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 99feca83..fb424403 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -243,6 +243,8 @@ private: void toggleMO2EndorseState(); void toggleUpdateAction(); + void updateSortButton(); + // update info struct NxmUpdateInfoData { diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 769c6018..21dcfd48 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1220,6 +1220,8 @@ void OrganizerCore::refresh(bool saveChanges) m_ModList.notifyChange(-1); refreshDirectoryStructure(); + + emit refreshTriggered(); } void OrganizerCore::refreshESPList(bool force) diff --git a/src/organizercore.h b/src/organizercore.h index 7238466a..5bf6f4b6 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -471,6 +471,9 @@ signals: // Use queued connections void directoryStructureReady(); + // Notify of a general UI refresh + void refreshTriggered(); + private: std::pair<unsigned int, ModInfo::Ptr> doInstall(const QString& archivePath, MOBase::GuessedValue<QString> modName, |
