aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
authordada513 <dada513@protonmail.com>2022-06-11 19:41:02 +0200
committerGitHub <noreply@github.com>2022-06-11 19:41:02 +0200
commitd75571ffa183c703033881b95fff085d3107ca7b (patch)
tree9fbab86bd311ab33fbfa2c86b445febdaa8db434 /launcher/ui
parent2ee4b6768d1ba8093237bf69fc72398a24b03027 (diff)
parentfa5b1d99786567a6a183513df6fdf63d1e667bc5 (diff)
downloadPrismLauncher-d75571ffa183c703033881b95fff085d3107ca7b.tar.gz
PrismLauncher-d75571ffa183c703033881b95fff085d3107ca7b.tar.bz2
PrismLauncher-d75571ffa183c703033881b95fff085d3107ca7b.zip
Merge pull request #773 from vancez/fix-launch-button
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/MainWindow.cpp11
-rw-r--r--launcher/ui/MainWindow.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 7e152b96..0a5f2000 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::refreshCurrentInstance);
+ }
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::refreshCurrentInstance);
}
else
{
@@ -2216,3 +2221,9 @@ void MainWindow::updateStatusCenter()
m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed)));
}
}
+
+void MainWindow::refreshCurrentInstance(bool running)
+{
+ auto current = view->selectionModel()->currentIndex();
+ instanceChanged(current, current);
+}
diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h
index 2032acba..61a75c45 100644
--- a/launcher/ui/MainWindow.h
+++ b/launcher/ui/MainWindow.h
@@ -192,6 +192,8 @@ private slots:
void keyReleaseEvent(QKeyEvent *event) override;
#endif
+ void refreshCurrentInstance(bool running);
+
private:
void retranslateUi();