Merge pull request #1141 from FearlessTobi/port-3902

Port #3902 from Citra: "Add restart hotkey & menu option"
merge-requests/60/head
bunnei 2018-08-22 01:07:59 +07:00 committed by GitHub
commit eef0c93643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

@ -231,6 +231,7 @@ void GMainWindow::InitializeHotkeys() {
hotkey_registry.RegisterHotkey("Main Window", "Load File", QKeySequence::Open); hotkey_registry.RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
hotkey_registry.RegisterHotkey("Main Window", "Start Emulation"); hotkey_registry.RegisterHotkey("Main Window", "Start Emulation");
hotkey_registry.RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); hotkey_registry.RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4));
hotkey_registry.RegisterHotkey("Main Window", "Restart", QKeySequence(Qt::Key_F5));
hotkey_registry.RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); hotkey_registry.RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen);
hotkey_registry.RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape), hotkey_registry.RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape),
Qt::ApplicationShortcut); Qt::ApplicationShortcut);
@ -252,6 +253,12 @@ void GMainWindow::InitializeHotkeys() {
} }
} }
}); });
connect(hotkey_registry.GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this,
[this] {
if (!Core::System::GetInstance().IsPoweredOn())
return;
BootGame(QString(game_path));
});
connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window),
&QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger);
connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window),
@ -336,6 +343,7 @@ void GMainWindow::ConnectMenuEvents() {
connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); });
connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
// View // View
@ -545,6 +553,7 @@ void GMainWindow::ShutdownGame() {
ui.action_Start->setText(tr("Start")); ui.action_Start->setText(tr("Start"));
ui.action_Pause->setEnabled(false); ui.action_Pause->setEnabled(false);
ui.action_Stop->setEnabled(false); ui.action_Stop->setEnabled(false);
ui.action_Restart->setEnabled(false);
render_window->hide(); render_window->hide();
game_list->show(); game_list->show();
game_list->setFilterFocus(); game_list->setFilterFocus();
@ -823,6 +832,7 @@ void GMainWindow::OnPauseGame() {
ui.action_Start->setEnabled(true); ui.action_Start->setEnabled(true);
ui.action_Pause->setEnabled(false); ui.action_Pause->setEnabled(false);
ui.action_Stop->setEnabled(true); ui.action_Stop->setEnabled(true);
ui.action_Restart->setEnabled(true);
} }
void GMainWindow::OnStopGame() { void GMainWindow::OnStopGame() {

@ -211,6 +211,14 @@
<string>Fullscreen</string> <string>Fullscreen</string>
</property> </property>
</action> </action>
<action name="action_Restart">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Restart</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
</ui> </ui>