summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2017-07-07 08:16:28 +0200
committerspycrab <spycrab@users.noreply.github.com>2017-07-09 16:09:30 +0200
commitadf2cd4252482e5d77f43f171cc40f01832ec062 (patch)
treec312278aa06ca90d6f661a94c2837a61016dc179 /Source
parentc941cd6aa90f5e5a48a35365d8193c6961577f4f (diff)
Qt: Fix "Install WAD" being enabled while emulation is running
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt2/GameList/GameList.cpp21
-rw-r--r--Source/Core/DolphinQt2/GameList/GameList.h2
-rw-r--r--Source/Core/DolphinQt2/MainWindow.cpp2
3 files changed, 22 insertions, 3 deletions
diff --git a/Source/Core/DolphinQt2/GameList/GameList.cpp b/Source/Core/DolphinQt2/GameList/GameList.cpp
index d3e7dfcac4..daadb38f02 100644
--- a/Source/Core/DolphinQt2/GameList/GameList.cpp
+++ b/Source/Core/DolphinQt2/GameList/GameList.cpp
@@ -18,6 +18,7 @@
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
+#include "Core/Core.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
@@ -154,10 +155,24 @@ void GameList::ShowContextMenu(const QPoint&)
}
if (platform == DiscIO::Platform::WII_WAD)
{
- menu->addAction(tr("Install to the NAND"), this, SLOT(InstallWAD()));
+ QAction* wad_install_action = new QAction(tr("Install to the NAND"), menu);
+ QAction* wad_uninstall_action = new QAction(tr("Uninstall from the NAND"), menu);
- if (GameFile(game).IsInstalled())
- menu->addAction(tr("Uninstall from the NAND"), this, SLOT(UninstallWAD()));
+ connect(wad_install_action, &QAction::triggered, this, &GameList::InstallWAD);
+ connect(wad_uninstall_action, &QAction::triggered, this, &GameList::UninstallWAD);
+
+ for (QAction* a : {wad_install_action, wad_uninstall_action})
+ {
+ connect(this, &GameList::EmulationStarted, a, [a] { a->setEnabled(false); });
+ a->setEnabled(!Core::IsRunning());
+ menu->addAction(a);
+ }
+
+ connect(this, &GameList::EmulationStopped, wad_install_action,
+ [wad_install_action] { wad_install_action->setEnabled(true); });
+ connect(this, &GameList::EmulationStopped, wad_uninstall_action, [wad_uninstall_action, game] {
+ wad_uninstall_action->setEnabled(GameFile(game).IsInstalled());
+ });
menu->addSeparator();
}
diff --git a/Source/Core/DolphinQt2/GameList/GameList.h b/Source/Core/DolphinQt2/GameList/GameList.h
index ae4e6edf74..da0b352358 100644
--- a/Source/Core/DolphinQt2/GameList/GameList.h
+++ b/Source/Core/DolphinQt2/GameList/GameList.h
@@ -42,6 +42,8 @@ private slots:
signals:
void GameSelected();
+ void EmulationStarted();
+ void EmulationStopped();
private:
void MakeTableView();
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index 59eff4da6d..a4137af20e 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -249,6 +249,8 @@ void MainWindow::ConnectToolBar()
void MainWindow::ConnectGameList()
{
connect(m_game_list, &GameList::GameSelected, this, &MainWindow::Play);
+ connect(this, &MainWindow::EmulationStarted, m_game_list, &GameList::EmulationStarted);
+ connect(this, &MainWindow::EmulationStopped, m_game_list, &GameList::EmulationStopped);
}
void MainWindow::ConnectRenderWidget()