summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jrim@rimpo.org>2023-10-02 18:28:35 -0500
committerJeremy Rimpo <jrim@rimpo.org>2023-10-02 18:28:35 -0500
commit62e8ddc9ca1bb8bfd4c912068932563a7438bca8 (patch)
tree9476eb3dfd792fe2d306c6c055c2b6c32ff48909 /src/mainwindow.cpp
parentc19fbb6818be3c99dcd402f41fd11baf7496e6a5 (diff)
Updates to refresh sort button after various events
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp25
1 files changed, 19 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();