2015-12-19 22:24:48 -07:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2017-08-24 09:38:31 -06:00
|
|
|
#include "DolphinQt2/MenuBar.h"
|
|
|
|
|
2015-12-19 22:24:48 -07:00
|
|
|
#include <QAction>
|
2016-02-11 04:59:44 -07:00
|
|
|
#include <QDesktopServices>
|
2017-05-04 15:01:12 -06:00
|
|
|
#include <QFileDialog>
|
2017-05-08 11:03:59 -06:00
|
|
|
#include <QMap>
|
2017-05-04 15:01:12 -06:00
|
|
|
#include <QMessageBox>
|
2016-02-11 04:59:44 -07:00
|
|
|
#include <QUrl>
|
2015-12-19 22:24:48 -07:00
|
|
|
|
2017-08-24 08:35:47 -06:00
|
|
|
#include "Common/CommonPaths.h"
|
|
|
|
#include "Common/FileUtil.h"
|
2017-06-14 03:58:11 -06:00
|
|
|
#include "Core/CommonTitles.h"
|
2017-06-22 16:11:53 -06:00
|
|
|
#include "Core/ConfigManager.h"
|
2017-08-27 05:55:05 -06:00
|
|
|
#include "Core/Core.h"
|
2017-08-24 07:11:04 -06:00
|
|
|
#include "Core/HW/WiiSaveCrypted.h"
|
2017-08-27 05:55:05 -06:00
|
|
|
#include "Core/HW/Wiimote.h"
|
2017-06-14 03:58:11 -06:00
|
|
|
#include "Core/IOS/ES/ES.h"
|
|
|
|
#include "Core/IOS/IOS.h"
|
2017-08-27 05:55:05 -06:00
|
|
|
#include "Core/Movie.h"
|
2016-02-14 18:56:40 -07:00
|
|
|
#include "Core/State.h"
|
2017-08-24 09:38:31 -06:00
|
|
|
#include "DiscIO/NANDImporter.h"
|
2016-02-11 04:59:44 -07:00
|
|
|
#include "DolphinQt2/AboutDialog.h"
|
2017-05-04 15:01:12 -06:00
|
|
|
#include "DolphinQt2/GameList/GameFile.h"
|
2017-09-02 15:38:02 -06:00
|
|
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
2016-01-01 03:29:39 -07:00
|
|
|
#include "DolphinQt2/Settings.h"
|
2015-12-19 22:24:48 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent)
|
2015-12-19 22:24:48 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
AddFileMenu();
|
|
|
|
AddEmulationMenu();
|
2017-08-27 05:55:05 -06:00
|
|
|
AddMovieMenu();
|
2017-06-06 05:49:49 -06:00
|
|
|
AddOptionsMenu();
|
2017-05-04 15:01:12 -06:00
|
|
|
AddToolsMenu();
|
2016-06-24 02:43:46 -06:00
|
|
|
AddViewMenu();
|
|
|
|
AddHelpMenu();
|
|
|
|
|
|
|
|
EmulationStopped();
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
connect(this, &MenuBar::SelectionChanged, this, &MenuBar::OnSelectionChanged);
|
|
|
|
connect(this, &MenuBar::RecordingStatusChanged, this, &MenuBar::OnRecordingStatusChanged);
|
|
|
|
connect(this, &MenuBar::ReadOnlyModeChanged, this, &MenuBar::OnReadOnlyModeChanged);
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::EmulationStarted()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
// Emulation
|
|
|
|
m_play_action->setEnabled(false);
|
|
|
|
m_play_action->setVisible(false);
|
|
|
|
m_pause_action->setEnabled(true);
|
|
|
|
m_pause_action->setVisible(true);
|
|
|
|
m_stop_action->setEnabled(true);
|
|
|
|
m_reset_action->setEnabled(true);
|
|
|
|
m_fullscreen_action->setEnabled(true);
|
|
|
|
m_frame_advance_action->setEnabled(true);
|
|
|
|
m_screenshot_action->setEnabled(true);
|
|
|
|
m_state_load_menu->setEnabled(true);
|
|
|
|
m_state_save_menu->setEnabled(true);
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
// Movie
|
|
|
|
m_recording_read_only->setEnabled(true);
|
|
|
|
m_recording_play->setEnabled(false);
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
UpdateStateSlotMenu();
|
2017-06-14 03:58:11 -06:00
|
|
|
UpdateToolsMenu(true);
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
void MenuBar::EmulationPaused()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_play_action->setEnabled(true);
|
|
|
|
m_play_action->setVisible(true);
|
|
|
|
m_pause_action->setEnabled(false);
|
|
|
|
m_pause_action->setVisible(false);
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
void MenuBar::EmulationStopped()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
// Emulation
|
|
|
|
m_play_action->setEnabled(true);
|
|
|
|
m_play_action->setVisible(true);
|
|
|
|
m_pause_action->setEnabled(false);
|
|
|
|
m_pause_action->setVisible(false);
|
|
|
|
m_stop_action->setEnabled(false);
|
|
|
|
m_reset_action->setEnabled(false);
|
|
|
|
m_fullscreen_action->setEnabled(false);
|
|
|
|
m_frame_advance_action->setEnabled(false);
|
|
|
|
m_screenshot_action->setEnabled(false);
|
|
|
|
m_state_load_menu->setEnabled(false);
|
|
|
|
m_state_save_menu->setEnabled(false);
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
// Movie
|
|
|
|
m_recording_read_only->setEnabled(false);
|
|
|
|
m_recording_stop->setEnabled(false);
|
|
|
|
m_recording_play->setEnabled(false);
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
UpdateStateSlotMenu();
|
2017-06-14 03:58:11 -06:00
|
|
|
UpdateToolsMenu(false);
|
2015-12-19 22:24:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddFileMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* file_menu = addMenu(tr("&File"));
|
2017-09-02 15:38:02 -06:00
|
|
|
m_open_action = AddAction(file_menu, tr("&Open..."), this, &MenuBar::Open,
|
|
|
|
QKeySequence(QStringLiteral("Ctrl+O")));
|
|
|
|
m_exit_action = AddAction(file_menu, tr("E&xit"), this, &MenuBar::Exit,
|
|
|
|
QKeySequence(QStringLiteral("Alt+F4")));
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
2017-05-04 15:01:12 -06:00
|
|
|
void MenuBar::AddToolsMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* tools_menu = addMenu(tr("&Tools"));
|
2017-08-24 07:11:04 -06:00
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(tools_menu, tr("Import Wii Save..."), this, &MenuBar::ImportWiiSave);
|
|
|
|
AddAction(tools_menu, tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves);
|
2017-08-24 07:11:04 -06:00
|
|
|
|
|
|
|
tools_menu->addSeparator();
|
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
m_wad_install_action = AddAction(tools_menu, tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
2017-06-14 03:58:11 -06:00
|
|
|
|
2017-08-24 08:35:47 -06:00
|
|
|
tools_menu->addSeparator();
|
|
|
|
QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu"));
|
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
m_ntscj_ipl = AddAction(gc_ipl, tr("NTSC-J"), this,
|
|
|
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_J); });
|
|
|
|
m_ntscu_ipl = AddAction(gc_ipl, tr("NTSC-U"), this,
|
|
|
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_U); });
|
2017-08-24 08:35:47 -06:00
|
|
|
m_pal_ipl =
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(gc_ipl, tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); });
|
2017-08-24 08:35:47 -06:00
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(tools_menu, tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay);
|
2017-07-20 09:52:45 -06:00
|
|
|
tools_menu->addSeparator();
|
|
|
|
|
2017-07-06 03:00:37 -06:00
|
|
|
// Label will be set by a NANDRefresh later
|
2017-09-02 15:38:02 -06:00
|
|
|
m_boot_sysmenu =
|
2017-09-09 22:43:29 -06:00
|
|
|
AddAction(tools_menu, QStringLiteral(""), this, [this] { emit BootWiiSystemMenu(); });
|
2017-09-02 15:38:02 -06:00
|
|
|
m_import_backup = AddAction(gc_ipl, tr("Import BootMii NAND Backup..."), this,
|
|
|
|
[this] { emit ImportNANDBackup(); });
|
2017-08-24 09:38:31 -06:00
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
m_extract_certificates = AddAction(tools_menu, tr("Extract Certificates from NAND"), this,
|
|
|
|
&MenuBar::NANDExtractCertificates);
|
2017-08-26 06:41:53 -06:00
|
|
|
|
2017-07-06 03:00:37 -06:00
|
|
|
m_boot_sysmenu->setEnabled(false);
|
|
|
|
|
|
|
|
connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); });
|
|
|
|
|
2017-06-14 03:58:11 -06:00
|
|
|
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
|
2017-09-02 15:38:02 -06:00
|
|
|
m_perform_online_update_for_current_region =
|
|
|
|
AddAction(m_perform_online_update_menu, tr("Current Region"), this,
|
|
|
|
[this] { emit PerformOnlineUpdate(""); });
|
2017-06-14 03:58:11 -06:00
|
|
|
m_perform_online_update_menu->addSeparator();
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(m_perform_online_update_menu, tr("Europe"), this,
|
|
|
|
[this] { emit PerformOnlineUpdate("EUR"); });
|
|
|
|
AddAction(m_perform_online_update_menu, tr("Japan"), this,
|
|
|
|
[this] { emit PerformOnlineUpdate("JPN"); });
|
|
|
|
AddAction(m_perform_online_update_menu, tr("Korea"), this,
|
|
|
|
[this] { emit PerformOnlineUpdate("KOR"); });
|
|
|
|
AddAction(m_perform_online_update_menu, tr("United States"), this,
|
|
|
|
[this] { emit PerformOnlineUpdate("USA"); });
|
2017-05-04 15:01:12 -06:00
|
|
|
}
|
|
|
|
|
2016-02-14 18:56:40 -07:00
|
|
|
void MenuBar::AddEmulationMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* emu_menu = addMenu(tr("&Emulation"));
|
2017-09-02 15:38:02 -06:00
|
|
|
m_play_action = AddAction(emu_menu, tr("&Play"), this, &MenuBar::Play);
|
|
|
|
m_pause_action = AddAction(emu_menu, tr("&Pause"), this, &MenuBar::Pause);
|
|
|
|
m_stop_action = AddAction(emu_menu, tr("&Stop"), this, &MenuBar::Stop);
|
|
|
|
m_reset_action = AddAction(emu_menu, tr("&Reset"), this, &MenuBar::Reset);
|
|
|
|
m_fullscreen_action = AddAction(emu_menu, tr("Toggle &Fullscreen"), this, &MenuBar::Fullscreen);
|
|
|
|
m_frame_advance_action = AddAction(emu_menu, tr("&Frame Advance"), this, &MenuBar::FrameAdvance);
|
2017-07-15 18:36:37 -06:00
|
|
|
|
2017-09-02 15:38:02 -06:00
|
|
|
m_screenshot_action = AddAction(emu_menu, tr("Take Screenshot"), this, &MenuBar::Screenshot);
|
2017-07-15 18:36:37 -06:00
|
|
|
|
|
|
|
emu_menu->addSeparator();
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
AddStateLoadMenu(emu_menu);
|
|
|
|
AddStateSaveMenu(emu_menu);
|
|
|
|
AddStateSlotMenu(emu_menu);
|
|
|
|
UpdateStateSlotMenu();
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
m_state_load_menu = emu_menu->addMenu(tr("&Load State"));
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(m_state_load_menu, tr("Load State from File"), this, &MenuBar::StateLoad);
|
|
|
|
AddAction(m_state_load_menu, tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot);
|
2016-06-24 02:43:46 -06:00
|
|
|
m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot"));
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(m_state_load_menu, tr("Undo Load State"), this, &MenuBar::StateLoadUndo);
|
2016-06-24 02:43:46 -06:00
|
|
|
|
|
|
|
for (int i = 1; i <= 10; i++)
|
|
|
|
{
|
|
|
|
QAction* action = m_state_load_slots_menu->addAction(QStringLiteral(""));
|
|
|
|
|
|
|
|
connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); });
|
|
|
|
}
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
m_state_save_menu = emu_menu->addMenu(tr("Sa&ve State"));
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(m_state_save_menu, tr("Save State to File"), this, &MenuBar::StateSave);
|
|
|
|
AddAction(m_state_save_menu, tr("Save State to Selected Slot"), this, &MenuBar::StateSaveSlot);
|
|
|
|
AddAction(m_state_save_menu, tr("Save State to Oldest Slot"), this, &MenuBar::StateSaveOldest);
|
2016-06-24 02:43:46 -06:00
|
|
|
m_state_save_slots_menu = m_state_save_menu->addMenu(tr("Save State to Slot"));
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(m_state_save_menu, tr("Undo Save State"), this, &MenuBar::StateSaveUndo);
|
2016-06-24 02:43:46 -06:00
|
|
|
|
|
|
|
for (int i = 1; i <= 10; i++)
|
|
|
|
{
|
|
|
|
QAction* action = m_state_save_slots_menu->addAction(QStringLiteral(""));
|
|
|
|
|
|
|
|
connect(action, &QAction::triggered, this, [=]() { emit StateSaveSlotAt(i); });
|
|
|
|
}
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddStateSlotMenu(QMenu* emu_menu)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_state_slot_menu = emu_menu->addMenu(tr("Select State Slot"));
|
|
|
|
m_state_slots = new QActionGroup(this);
|
|
|
|
|
|
|
|
for (int i = 1; i <= 10; i++)
|
|
|
|
{
|
|
|
|
QAction* action = m_state_slot_menu->addAction(QStringLiteral(""));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setActionGroup(m_state_slots);
|
2017-05-31 01:17:39 -06:00
|
|
|
if (Settings::Instance().GetStateSlot() == i)
|
2016-06-24 02:43:46 -06:00
|
|
|
action->setChecked(true);
|
|
|
|
|
|
|
|
connect(action, &QAction::triggered, this, [=]() { emit SetStateSlot(i); });
|
|
|
|
}
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::UpdateStateSlotMenu()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
QList<QAction*> actions_slot = m_state_slots->actions();
|
|
|
|
QList<QAction*> actions_load = m_state_load_slots_menu->actions();
|
|
|
|
QList<QAction*> actions_save = m_state_save_slots_menu->actions();
|
|
|
|
for (int i = 0; i < actions_slot.length(); i++)
|
|
|
|
{
|
|
|
|
int slot = i + 1;
|
|
|
|
QString info = QString::fromStdString(State::GetInfoStringOfSlot(slot));
|
2017-07-23 02:50:20 -06:00
|
|
|
actions_load.at(i)->setText(tr("Load from Slot %1 - %2").arg(slot).arg(info));
|
|
|
|
actions_save.at(i)->setText(tr("Save to Slot %1 - %2").arg(slot).arg(info));
|
|
|
|
actions_slot.at(i)->setText(tr("Select Slot %1 - %2").arg(slot).arg(info));
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
2015-12-19 22:24:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddViewMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* view_menu = addMenu(tr("&View"));
|
2017-08-03 08:43:50 -06:00
|
|
|
QAction* show_log = view_menu->addAction(tr("Show &Log"));
|
2017-06-29 04:46:20 -06:00
|
|
|
show_log->setCheckable(true);
|
|
|
|
show_log->setChecked(Settings::Instance().IsLogVisible());
|
|
|
|
|
|
|
|
connect(show_log, &QAction::toggled, &Settings::Instance(), &Settings::SetLogVisible);
|
|
|
|
|
2017-08-03 08:43:50 -06:00
|
|
|
QAction* show_log_config = view_menu->addAction(tr("Show Log &Configuration"));
|
2017-06-29 04:46:20 -06:00
|
|
|
show_log_config->setCheckable(true);
|
|
|
|
show_log_config->setChecked(Settings::Instance().IsLogConfigVisible());
|
|
|
|
|
|
|
|
connect(show_log_config, &QAction::toggled, &Settings::Instance(),
|
|
|
|
&Settings::SetLogConfigVisible);
|
|
|
|
|
|
|
|
connect(&Settings::Instance(), &Settings::LogVisibilityChanged, show_log, &QAction::setChecked);
|
|
|
|
connect(&Settings::Instance(), &Settings::LogConfigVisibilityChanged, show_log_config,
|
|
|
|
&QAction::setChecked);
|
|
|
|
|
|
|
|
view_menu->addSeparator();
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
AddGameListTypeSection(view_menu);
|
|
|
|
view_menu->addSeparator();
|
2017-08-05 02:28:53 -06:00
|
|
|
AddListColumnsMenu(view_menu);
|
2017-07-11 08:13:09 -06:00
|
|
|
view_menu->addSeparator();
|
|
|
|
AddShowPlatformsMenu(view_menu);
|
|
|
|
AddShowRegionsMenu(view_menu);
|
2015-12-19 22:24:48 -07:00
|
|
|
}
|
|
|
|
|
2017-06-06 05:49:49 -06:00
|
|
|
void MenuBar::AddOptionsMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* options_menu = addMenu(tr("&Options"));
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(options_menu, tr("Co&nfiguration"), this, &MenuBar::Configure);
|
2017-07-16 15:11:11 -06:00
|
|
|
options_menu->addSeparator();
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(options_menu, tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
|
|
|
|
AddAction(options_menu, tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
|
|
|
|
AddAction(options_menu, tr("&Controller Settings"), this, &MenuBar::ConfigureControllers);
|
|
|
|
AddAction(options_menu, tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys);
|
2017-06-06 05:49:49 -06:00
|
|
|
}
|
|
|
|
|
2016-02-11 04:59:44 -07:00
|
|
|
void MenuBar::AddHelpMenu()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
QMenu* help_menu = addMenu(tr("&Help"));
|
|
|
|
QAction* website = help_menu->addAction(tr("&Website"));
|
2017-05-05 02:08:01 -06:00
|
|
|
connect(website, &QAction::triggered, this,
|
|
|
|
[]() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); });
|
2017-07-23 04:58:32 -06:00
|
|
|
QAction* documentation = help_menu->addAction(tr("Online &Documentation"));
|
2017-05-05 02:08:01 -06:00
|
|
|
connect(documentation, &QAction::triggered, this, []() {
|
2016-06-24 02:43:46 -06:00
|
|
|
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides")));
|
|
|
|
});
|
2017-07-23 04:58:32 -06:00
|
|
|
QAction* github = help_menu->addAction(tr("&GitHub Repository"));
|
2017-05-05 02:08:01 -06:00
|
|
|
connect(github, &QAction::triggered, this, []() {
|
|
|
|
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin")));
|
|
|
|
});
|
|
|
|
|
|
|
|
help_menu->addSeparator();
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(help_menu, tr("&About"), this, &MenuBar::ShowAboutDialog);
|
2016-02-11 04:59:44 -07:00
|
|
|
}
|
|
|
|
|
2015-12-19 22:24:48 -07:00
|
|
|
void MenuBar::AddGameListTypeSection(QMenu* view_menu)
|
|
|
|
{
|
2017-08-05 02:28:53 -06:00
|
|
|
QAction* list_view = view_menu->addAction(tr("List View"));
|
2016-06-24 02:43:46 -06:00
|
|
|
list_view->setCheckable(true);
|
2015-12-19 22:24:48 -07:00
|
|
|
|
2017-08-05 02:28:53 -06:00
|
|
|
QAction* grid_view = view_menu->addAction(tr("Grid View"));
|
|
|
|
grid_view->setCheckable(true);
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
QActionGroup* list_group = new QActionGroup(this);
|
|
|
|
list_group->addAction(list_view);
|
2017-08-05 02:28:53 -06:00
|
|
|
list_group->addAction(grid_view);
|
2015-12-19 22:24:48 -07:00
|
|
|
|
2017-08-05 02:28:53 -06:00
|
|
|
bool prefer_list = Settings::Instance().GetPreferredView();
|
|
|
|
list_view->setChecked(prefer_list);
|
|
|
|
grid_view->setChecked(!prefer_list);
|
2015-12-19 22:24:48 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
connect(list_view, &QAction::triggered, this, &MenuBar::ShowList);
|
2017-08-05 02:28:53 -06:00
|
|
|
connect(grid_view, &QAction::triggered, this, &MenuBar::ShowGrid);
|
2015-12-19 22:24:48 -07:00
|
|
|
}
|
|
|
|
|
2017-08-05 02:28:53 -06:00
|
|
|
void MenuBar::AddListColumnsMenu(QMenu* view_menu)
|
2015-12-19 22:24:48 -07:00
|
|
|
{
|
2017-06-22 16:11:53 -06:00
|
|
|
static const QMap<QString, bool*> columns{
|
|
|
|
{tr("Platform"), &SConfig::GetInstance().m_showSystemColumn},
|
|
|
|
{tr("Banner"), &SConfig::GetInstance().m_showBannerColumn},
|
|
|
|
{tr("Title"), &SConfig::GetInstance().m_showTitleColumn},
|
|
|
|
{tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn},
|
|
|
|
{tr("Maker"), &SConfig::GetInstance().m_showMakerColumn},
|
2017-09-13 13:57:53 -06:00
|
|
|
{tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn},
|
|
|
|
{tr("Game ID"), &SConfig::GetInstance().m_showIDColumn},
|
|
|
|
{tr("Region"), &SConfig::GetInstance().m_showRegionColumn},
|
|
|
|
{tr("File Size"), &SConfig::GetInstance().m_showSizeColumn},
|
2017-07-23 04:58:32 -06:00
|
|
|
{tr("State"), &SConfig::GetInstance().m_showStateColumn}};
|
2017-05-08 11:03:59 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
QActionGroup* column_group = new QActionGroup(this);
|
2017-08-05 02:28:53 -06:00
|
|
|
QMenu* cols_menu = view_menu->addMenu(tr("List Columns"));
|
2016-06-24 02:43:46 -06:00
|
|
|
column_group->setExclusive(false);
|
|
|
|
|
2017-05-08 11:03:59 -06:00
|
|
|
for (const auto& key : columns.keys())
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2017-05-08 11:03:59 -06:00
|
|
|
bool* config = columns[key];
|
|
|
|
QAction* action = column_group->addAction(cols_menu->addAction(key));
|
2016-06-24 02:43:46 -06:00
|
|
|
action->setCheckable(true);
|
2017-05-08 11:03:59 -06:00
|
|
|
action->setChecked(*config);
|
|
|
|
connect(action, &QAction::toggled, [this, config, key](bool value) {
|
|
|
|
*config = value;
|
|
|
|
emit ColumnVisibilityToggled(key, value);
|
|
|
|
});
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
2015-12-19 22:24:48 -07:00
|
|
|
}
|
2017-05-04 15:01:12 -06:00
|
|
|
|
2017-07-11 08:13:09 -06:00
|
|
|
void MenuBar::AddShowPlatformsMenu(QMenu* view_menu)
|
|
|
|
{
|
|
|
|
static const QMap<QString, bool*> platform_map{
|
|
|
|
{tr("Show Wii"), &SConfig::GetInstance().m_ListWii},
|
|
|
|
{tr("Show GameCube"), &SConfig::GetInstance().m_ListGC},
|
|
|
|
{tr("Show WAD"), &SConfig::GetInstance().m_ListWad},
|
|
|
|
{tr("Show ELF/DOL"), &SConfig::GetInstance().m_ListElfDol}};
|
|
|
|
|
|
|
|
QActionGroup* platform_group = new QActionGroup(this);
|
|
|
|
QMenu* plat_menu = view_menu->addMenu(tr("Show Platforms"));
|
|
|
|
platform_group->setExclusive(false);
|
|
|
|
|
|
|
|
for (const auto& key : platform_map.keys())
|
|
|
|
{
|
|
|
|
bool* config = platform_map[key];
|
|
|
|
QAction* action = platform_group->addAction(plat_menu->addAction(key));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(*config);
|
|
|
|
connect(action, &QAction::toggled, [this, config, key](bool value) {
|
|
|
|
*config = value;
|
|
|
|
emit GameListPlatformVisibilityToggled(key, value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddShowRegionsMenu(QMenu* view_menu)
|
|
|
|
{
|
|
|
|
static const QMap<QString, bool*> region_map{
|
|
|
|
{tr("Show JAP"), &SConfig::GetInstance().m_ListJap},
|
|
|
|
{tr("Show PAL"), &SConfig::GetInstance().m_ListPal},
|
|
|
|
{tr("Show USA"), &SConfig::GetInstance().m_ListUsa},
|
|
|
|
{tr("Show Australia"), &SConfig::GetInstance().m_ListAustralia},
|
|
|
|
{tr("Show France"), &SConfig::GetInstance().m_ListFrance},
|
|
|
|
{tr("Show Germany"), &SConfig::GetInstance().m_ListGermany},
|
|
|
|
{tr("Show Italy"), &SConfig::GetInstance().m_ListItaly},
|
|
|
|
{tr("Show Korea"), &SConfig::GetInstance().m_ListKorea},
|
|
|
|
{tr("Show Netherlands"), &SConfig::GetInstance().m_ListNetherlands},
|
|
|
|
{tr("Show Russia"), &SConfig::GetInstance().m_ListRussia},
|
|
|
|
{tr("Show Spain"), &SConfig::GetInstance().m_ListSpain},
|
|
|
|
{tr("Show Taiwan"), &SConfig::GetInstance().m_ListTaiwan},
|
|
|
|
{tr("Show World"), &SConfig::GetInstance().m_ListWorld},
|
|
|
|
{tr("Show Unknown"), &SConfig::GetInstance().m_ListUnknown}};
|
|
|
|
|
|
|
|
QActionGroup* region_group = new QActionGroup(this);
|
|
|
|
QMenu* region_menu = view_menu->addMenu(tr("Show Regions"));
|
|
|
|
region_group->setExclusive(false);
|
|
|
|
|
|
|
|
for (const auto& key : region_map.keys())
|
|
|
|
{
|
|
|
|
bool* config = region_map[key];
|
|
|
|
QAction* action = region_group->addAction(region_menu->addAction(key));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(*config);
|
|
|
|
connect(action, &QAction::toggled, [this, config, key](bool value) {
|
|
|
|
*config = value;
|
|
|
|
emit GameListRegionVisibilityToggled(key, value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-27 05:55:05 -06:00
|
|
|
void MenuBar::AddMovieMenu()
|
|
|
|
{
|
|
|
|
auto* movie_menu = addMenu(tr("&Movie"));
|
|
|
|
m_recording_start =
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(movie_menu, tr("Start Recording Input"), this, [this] { emit StartRecording(); });
|
2017-08-27 05:55:05 -06:00
|
|
|
m_recording_play =
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(movie_menu, tr("Play Input Recording..."), this, [this] { emit PlayRecording(); });
|
|
|
|
m_recording_stop = AddAction(movie_menu, tr("Stop Playing/Recording Input"), this,
|
|
|
|
[this] { emit StopRecording(); });
|
2017-08-27 05:55:05 -06:00
|
|
|
m_recording_export =
|
2017-09-02 15:38:02 -06:00
|
|
|
AddAction(movie_menu, tr("Export Recording..."), this, [this] { emit ExportRecording(); });
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
m_recording_start->setEnabled(false);
|
|
|
|
m_recording_play->setEnabled(false);
|
|
|
|
m_recording_stop->setEnabled(false);
|
|
|
|
m_recording_export->setEnabled(false);
|
|
|
|
|
|
|
|
m_recording_read_only = movie_menu->addAction(tr("Read-Only Mode"));
|
|
|
|
m_recording_read_only->setCheckable(true);
|
|
|
|
m_recording_read_only->setChecked(Movie::IsReadOnly());
|
|
|
|
connect(m_recording_read_only, &QAction::toggled, [](bool value) { Movie::SetReadOnly(value); });
|
|
|
|
|
|
|
|
movie_menu->addSeparator();
|
|
|
|
|
|
|
|
auto* pause_at_end = movie_menu->addAction(tr("Pause at End of Movie"));
|
|
|
|
pause_at_end->setCheckable(true);
|
|
|
|
pause_at_end->setChecked(SConfig::GetInstance().m_PauseMovie);
|
|
|
|
connect(pause_at_end, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_PauseMovie = value; });
|
|
|
|
|
|
|
|
auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter"));
|
|
|
|
lag_counter->setCheckable(true);
|
|
|
|
lag_counter->setChecked(SConfig::GetInstance().m_ShowLag);
|
|
|
|
connect(lag_counter, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_ShowLag = value; });
|
|
|
|
|
|
|
|
auto* frame_counter = movie_menu->addAction(tr("Show Frame Counter"));
|
|
|
|
frame_counter->setCheckable(true);
|
|
|
|
frame_counter->setChecked(SConfig::GetInstance().m_ShowFrameCount);
|
|
|
|
connect(frame_counter, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_ShowFrameCount = value; });
|
|
|
|
|
|
|
|
auto* input_display = movie_menu->addAction(tr("Show Input Display"));
|
|
|
|
input_display->setCheckable(true);
|
|
|
|
input_display->setChecked(SConfig::GetInstance().m_ShowInputDisplay);
|
|
|
|
connect(frame_counter, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_ShowInputDisplay = value; });
|
|
|
|
|
|
|
|
auto* system_clock = movie_menu->addAction(tr("Show System Clock"));
|
|
|
|
system_clock->setCheckable(true);
|
|
|
|
system_clock->setChecked(SConfig::GetInstance().m_ShowRTC);
|
|
|
|
connect(system_clock, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_ShowRTC = value; });
|
|
|
|
|
|
|
|
movie_menu->addSeparator();
|
|
|
|
|
|
|
|
auto* dump_frames = movie_menu->addAction(tr("Dump Frames"));
|
|
|
|
dump_frames->setCheckable(true);
|
|
|
|
dump_frames->setChecked(SConfig::GetInstance().m_DumpFrames);
|
|
|
|
connect(dump_frames, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_DumpFrames = value; });
|
|
|
|
|
|
|
|
auto* dump_audio = movie_menu->addAction(tr("Dump Audio"));
|
|
|
|
dump_audio->setCheckable(true);
|
|
|
|
dump_audio->setChecked(SConfig::GetInstance().m_DumpAudio);
|
|
|
|
connect(dump_audio, &QAction::toggled,
|
|
|
|
[](bool value) { SConfig::GetInstance().m_DumpAudio = value; });
|
|
|
|
}
|
|
|
|
|
2017-06-14 03:58:11 -06:00
|
|
|
void MenuBar::UpdateToolsMenu(bool emulation_started)
|
|
|
|
{
|
2017-07-06 03:00:37 -06:00
|
|
|
m_boot_sysmenu->setEnabled(!emulation_started);
|
2017-07-06 03:01:32 -06:00
|
|
|
m_perform_online_update_menu->setEnabled(!emulation_started);
|
2017-08-24 08:35:47 -06:00
|
|
|
m_ntscj_ipl->setEnabled(!emulation_started &&
|
|
|
|
File::Exists(SConfig::GetInstance().GetBootROMPath(JAP_DIR)));
|
|
|
|
m_ntscu_ipl->setEnabled(!emulation_started &&
|
|
|
|
File::Exists(SConfig::GetInstance().GetBootROMPath(USA_DIR)));
|
|
|
|
m_pal_ipl->setEnabled(!emulation_started &&
|
|
|
|
File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
2017-08-24 09:38:31 -06:00
|
|
|
m_import_backup->setEnabled(!emulation_started);
|
2017-07-06 03:00:37 -06:00
|
|
|
|
2017-07-06 03:01:32 -06:00
|
|
|
if (!emulation_started)
|
2017-06-14 03:58:11 -06:00
|
|
|
{
|
|
|
|
IOS::HLE::Kernel ios;
|
|
|
|
const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
|
2017-07-06 03:00:37 -06:00
|
|
|
|
|
|
|
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));
|
|
|
|
|
2017-07-06 03:01:32 -06:00
|
|
|
m_boot_sysmenu->setEnabled(tmd.IsValid());
|
2017-07-06 03:00:37 -06:00
|
|
|
|
2017-06-14 03:58:11 -06:00
|
|
|
for (QAction* action : m_perform_online_update_menu->actions())
|
|
|
|
action->setEnabled(!tmd.IsValid());
|
|
|
|
m_perform_online_update_for_current_region->setEnabled(tmd.IsValid());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-04 15:01:12 -06:00
|
|
|
void MenuBar::InstallWAD()
|
|
|
|
{
|
|
|
|
QString wad_file = QFileDialog::getOpenFileName(this, tr("Select a title to install to NAND"),
|
|
|
|
QString(), tr("WAD files (*.wad)"));
|
|
|
|
|
|
|
|
if (wad_file.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QMessageBox result_dialog(this);
|
|
|
|
|
|
|
|
if (GameFile(wad_file).Install())
|
|
|
|
{
|
|
|
|
result_dialog.setIcon(QMessageBox::Information);
|
2017-07-23 04:58:32 -06:00
|
|
|
result_dialog.setText(tr("Successfully installed this title to the NAND."));
|
2017-05-04 15:01:12 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result_dialog.setIcon(QMessageBox::Critical);
|
2017-07-23 04:58:32 -06:00
|
|
|
result_dialog.setText(tr("Failed to install this title to the NAND."));
|
2017-05-04 15:01:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
result_dialog.exec();
|
|
|
|
}
|
2017-08-24 07:11:04 -06:00
|
|
|
|
|
|
|
void MenuBar::ImportWiiSave()
|
|
|
|
{
|
|
|
|
QString file = QFileDialog::getOpenFileName(this, tr("Select the save file"), QDir::currentPath(),
|
|
|
|
tr("Wii save files (*.bin);;"
|
|
|
|
"All Files (*)"));
|
|
|
|
|
|
|
|
if (!file.isEmpty())
|
|
|
|
CWiiSaveCrypted::ImportWiiSave(file.toStdString());
|
|
|
|
}
|
2017-08-24 07:21:21 -06:00
|
|
|
|
|
|
|
void MenuBar::ExportWiiSaves()
|
|
|
|
{
|
|
|
|
CWiiSaveCrypted::ExportAllSaves();
|
|
|
|
}
|
2017-08-24 09:38:31 -06:00
|
|
|
|
2017-08-26 06:41:53 -06:00
|
|
|
void MenuBar::NANDExtractCertificates()
|
|
|
|
{
|
|
|
|
if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)))
|
|
|
|
{
|
|
|
|
QMessageBox::information(this, tr("Success"),
|
|
|
|
tr("Successfully extracted certificates from NAND"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QMessageBox::critical(this, tr("Error"), tr("Failed to extract certificates from NAND"));
|
|
|
|
}
|
|
|
|
}
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
void MenuBar::OnSelectionChanged(QSharedPointer<GameFile> game_file)
|
|
|
|
{
|
|
|
|
bool is_null = game_file.isNull();
|
|
|
|
|
|
|
|
m_recording_play->setEnabled(!Core::IsRunning() && !is_null);
|
|
|
|
m_recording_start->setEnabled(!Movie::IsPlayingInput() && !is_null);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::OnRecordingStatusChanged(bool recording)
|
|
|
|
{
|
|
|
|
m_recording_start->setEnabled(!recording);
|
|
|
|
m_recording_stop->setEnabled(recording);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::OnReadOnlyModeChanged(bool read_only)
|
|
|
|
{
|
|
|
|
m_recording_read_only->setChecked(read_only);
|
|
|
|
}
|