Qt: Add "Load System Menu" option to menubar

This commit is contained in:
spycrab 2017-07-06 11:00:37 +02:00
parent cf79ff2366
commit 3a27d60937
2 changed files with 20 additions and 0 deletions

View File

@ -86,6 +86,12 @@ void MenuBar::AddToolsMenu()
QMenu* tools_menu = addMenu(tr("Tools"));
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, SLOT(InstallWAD()));
// Label will be set by a NANDRefresh later
m_boot_sysmenu = tools_menu->addAction(QStringLiteral(""), [this] { emit BootWiiSystemMenu(); });
m_boot_sysmenu->setEnabled(false);
connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); });
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
m_perform_online_update_for_current_region = m_perform_online_update_menu->addAction(
tr("Current Region"), [this] { emit PerformOnlineUpdate(""); });
@ -267,11 +273,23 @@ void MenuBar::AddTableColumnsMenu(QMenu* view_menu)
void MenuBar::UpdateToolsMenu(bool emulation_started)
{
const bool enable_wii_tools = !emulation_started || !SConfig::GetInstance().bWii;
m_boot_sysmenu->setEnabled(!emulation_started);
m_perform_online_update_menu->setEnabled(enable_wii_tools);
if (enable_wii_tools)
{
IOS::HLE::Kernel ios;
const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
const QString sysmenu_version =
tmd.IsValid() ?
QString::fromStdString(DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion())) :
QStringLiteral("");
m_boot_sysmenu->setText(tr("Load Wii System Menu %1").arg(sysmenu_version));
m_boot_sysmenu->setEnabled(!emulation_started && tmd.IsValid());
for (QAction* action : m_perform_online_update_menu->actions())
action->setEnabled(!tmd.IsValid());
m_perform_online_update_for_current_region->setEnabled(tmd.IsValid());

View File

@ -39,6 +39,7 @@ signals:
void StateSaveUndo();
void StateSaveOldest();
void SetStateSlot(int slot);
void BootWiiSystemMenu();
void PerformOnlineUpdate(const std::string& region);
@ -95,6 +96,7 @@ private:
QAction* m_fullscreen_action;
QAction* m_frame_advance_action;
QAction* m_screenshot_action;
QAction* m_boot_sysmenu;
QMenu* m_state_load_menu;
QMenu* m_state_save_menu;
QMenu* m_state_slot_menu;