Qt: Fix "Install WAD" being enabled while emulation is running
This commit is contained in:
parent
c941cd6aa9
commit
adf2cd4252
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
#include "Core/Core.h"
|
||||||
#include "DiscIO/Blob.h"
|
#include "DiscIO/Blob.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
|
|
||||||
|
@ -154,10 +155,24 @@ void GameList::ShowContextMenu(const QPoint&)
|
||||||
}
|
}
|
||||||
if (platform == DiscIO::Platform::WII_WAD)
|
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())
|
connect(wad_install_action, &QAction::triggered, this, &GameList::InstallWAD);
|
||||||
menu->addAction(tr("Uninstall from the NAND"), this, SLOT(UninstallWAD()));
|
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();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ private slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void GameSelected();
|
void GameSelected();
|
||||||
|
void EmulationStarted();
|
||||||
|
void EmulationStopped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void MakeTableView();
|
void MakeTableView();
|
||||||
|
|
|
@ -249,6 +249,8 @@ void MainWindow::ConnectToolBar()
|
||||||
void MainWindow::ConnectGameList()
|
void MainWindow::ConnectGameList()
|
||||||
{
|
{
|
||||||
connect(m_game_list, &GameList::GameSelected, this, &MainWindow::Play);
|
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()
|
void MainWindow::ConnectRenderWidget()
|
||||||
|
|
Loading…
Reference in New Issue