diff options
| author | 2018-08-21 13:24:55 +0200 | |
|---|---|---|
| committer | 2018-08-21 13:24:55 +0200 | |
| commit | f2d5b100c2ed1d5b551f6c6c434d11eae63d98f9 (patch) | |
| tree | 3d6a9f46b381f81ee97ae28635baa692fd3bbbf2 /src | |
| parent | Merge pull request #1123 from lioncash/screen (diff) | |
| download | yuzu-f2d5b100c2ed1d5b551f6c6c434d11eae63d98f9.tar.gz yuzu-f2d5b100c2ed1d5b551f6c6c434d11eae63d98f9.tar.xz yuzu-f2d5b100c2ed1d5b551f6c6c434d11eae63d98f9.zip | |
Port #3902 from Citra: "Add restart hotkey & menu option"
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3db3f9d98..8444f54ac 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -223,6 +223,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 223 | hotkey_registry.RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 223 | hotkey_registry.RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| 224 | hotkey_registry.RegisterHotkey("Main Window", "Start Emulation"); | 224 | hotkey_registry.RegisterHotkey("Main Window", "Start Emulation"); |
| 225 | hotkey_registry.RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); | 225 | hotkey_registry.RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); |
| 226 | hotkey_registry.RegisterHotkey("Main Window", "Restart", QKeySequence(Qt::Key_F5)); | ||
| 226 | hotkey_registry.RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); | 227 | hotkey_registry.RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); |
| 227 | hotkey_registry.RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape), | 228 | hotkey_registry.RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape), |
| 228 | Qt::ApplicationShortcut); | 229 | Qt::ApplicationShortcut); |
| @@ -244,6 +245,12 @@ void GMainWindow::InitializeHotkeys() { | |||
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 246 | }); | 247 | }); |
| 248 | connect(hotkey_registry.GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this, | ||
| 249 | [this] { | ||
| 250 | if (!Core::System::GetInstance().IsPoweredOn()) | ||
| 251 | return; | ||
| 252 | BootGame(QString(game_path)); | ||
| 253 | }); | ||
| 247 | connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), | 254 | connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), |
| 248 | &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); | 255 | &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); |
| 249 | connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), | 256 | connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), |
| @@ -328,6 +335,7 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 328 | connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); | 335 | connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); |
| 329 | connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); | 336 | connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); |
| 330 | connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); | 337 | connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); |
| 338 | connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); }); | ||
| 331 | connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); | 339 | connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); |
| 332 | 340 | ||
| 333 | // View | 341 | // View |
| @@ -535,6 +543,7 @@ void GMainWindow::ShutdownGame() { | |||
| 535 | ui.action_Start->setText(tr("Start")); | 543 | ui.action_Start->setText(tr("Start")); |
| 536 | ui.action_Pause->setEnabled(false); | 544 | ui.action_Pause->setEnabled(false); |
| 537 | ui.action_Stop->setEnabled(false); | 545 | ui.action_Stop->setEnabled(false); |
| 546 | ui.action_Restart->setEnabled(false); | ||
| 538 | render_window->hide(); | 547 | render_window->hide(); |
| 539 | game_list->show(); | 548 | game_list->show(); |
| 540 | game_list->setFilterFocus(); | 549 | game_list->setFilterFocus(); |
| @@ -811,6 +820,7 @@ void GMainWindow::OnPauseGame() { | |||
| 811 | ui.action_Start->setEnabled(true); | 820 | ui.action_Start->setEnabled(true); |
| 812 | ui.action_Pause->setEnabled(false); | 821 | ui.action_Pause->setEnabled(false); |
| 813 | ui.action_Stop->setEnabled(true); | 822 | ui.action_Stop->setEnabled(true); |
| 823 | ui.action_Restart->setEnabled(true); | ||
| 814 | } | 824 | } |
| 815 | 825 | ||
| 816 | void GMainWindow::OnStopGame() { | 826 | void GMainWindow::OnStopGame() { |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index a3bfb2af3..d4c26b80a 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -211,6 +211,14 @@ | |||
| 211 | <string>Fullscreen</string> | 211 | <string>Fullscreen</string> |
| 212 | </property> | 212 | </property> |
| 213 | </action> | 213 | </action> |
| 214 | <action name="action_Restart"> | ||
| 215 | <property name="enabled"> | ||
| 216 | <bool>false</bool> | ||
| 217 | </property> | ||
| 218 | <property name="text"> | ||
| 219 | <string>Restart</string> | ||
| 220 | </property> | ||
| 221 | </action> | ||
| 214 | </widget> | 222 | </widget> |
| 215 | <resources/> | 223 | <resources/> |
| 216 | </ui> | 224 | </ui> |