aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/MainWindow.cpp
diff options
context:
space:
mode:
authorVance <40771709+vancez@users.noreply.github.com>2022-06-10 10:25:13 +0800
committerGitHub <noreply@github.com>2022-06-10 10:25:13 +0800
commit4a261cac1a71b0817ed9693da3b16796ada8f348 (patch)
treecde382ea5e924daf7af69ebdaf99f7cc6f20b069 /launcher/ui/MainWindow.cpp
parent309013efb3e148310ba4802ee946a55c01d1d56e (diff)
downloadPrismLauncher-4a261cac1a71b0817ed9693da3b16796ada8f348.tar.gz
PrismLauncher-4a261cac1a71b0817ed9693da3b16796ada8f348.tar.bz2
PrismLauncher-4a261cac1a71b0817ed9693da3b16796ada8f348.zip
fix: update toolbar when instance state changes
Diffstat (limited to 'launcher/ui/MainWindow.cpp')
-rw-r--r--launcher/ui/MainWindow.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 7e152b96..c5a4cafe 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -2101,6 +2101,9 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
selectionBad();
return;
}
+ if (m_selectedInstance) {
+ disconnect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::on_InstanceState_changed);
+ }
QString id = current.data(InstanceList::InstanceIDRole).toString();
m_selectedInstance = APPLICATION->instances()->getInstanceById(id);
if (m_selectedInstance)
@@ -2127,6 +2130,8 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
updateToolsMenu();
APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id());
+
+ connect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::on_InstanceState_changed);
}
else
{
@@ -2216,3 +2221,9 @@ void MainWindow::updateStatusCenter()
m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed)));
}
}
+
+void MainWindow::on_InstanceState_changed(bool running)
+{
+ auto current = view->selectionModel()->currentIndex();
+ instanceChanged(current, current);
+}