diff options
| author | 2018-01-16 15:50:33 +0100 | |
|---|---|---|
| committer | 2018-01-16 15:50:33 +0100 | |
| commit | f473780c52d2ee896e7c6ede3ffe9e8fadd37891 (patch) | |
| tree | 889e4ef749ceaca7351a90cdbb656e1a0f23e3a2 /src | |
| parent | Merge pull request #25 from chris062689/master (diff) | |
| download | yuzu-f473780c52d2ee896e7c6ede3ffe9e8fadd37891.tar.gz yuzu-f473780c52d2ee896e7c6ede3ffe9e8fadd37891.tar.xz yuzu-f473780c52d2ee896e7c6ede3ffe9e8fadd37891.zip | |
Merge citra-emu PR#3001 by Styleoshin(citra-qt : Adding fullscreen mode)
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 43 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 11 | ||||
| -rw-r--r-- | src/yuzu/ui_settings.h | 1 |
5 files changed, 57 insertions, 1 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index ab6ba0ec9..923a7c53f 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -137,6 +137,7 @@ void Config::ReadValues() { | |||
| 137 | qt_config->endGroup(); | 137 | qt_config->endGroup(); |
| 138 | 138 | ||
| 139 | UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); | 139 | UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); |
| 140 | UISettings::values.fullscreen = qt_config->value("fullscreen", false).toBool(); | ||
| 140 | UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); | 141 | UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); |
| 141 | UISettings::values.show_filter_bar = qt_config->value("showFilterBar", true).toBool(); | 142 | UISettings::values.show_filter_bar = qt_config->value("showFilterBar", true).toBool(); |
| 142 | UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool(); | 143 | UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool(); |
| @@ -216,6 +217,7 @@ void Config::SaveValues() { | |||
| 216 | qt_config->endGroup(); | 217 | qt_config->endGroup(); |
| 217 | 218 | ||
| 218 | qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); | 219 | qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); |
| 220 | qt_config->setValue("fullscreen", UISettings::values.fullscreen); | ||
| 219 | qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); | 221 | qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); |
| 220 | qt_config->setValue("showFilterBar", UISettings::values.show_filter_bar); | 222 | qt_config->setValue("showFilterBar", UISettings::values.show_filter_bar); |
| 221 | qt_config->setValue("showStatusBar", UISettings::values.show_status_bar); | 223 | qt_config->setValue("showStatusBar", UISettings::values.show_status_bar); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f64e68268..5e321095d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -185,12 +185,24 @@ void GMainWindow::InitializeRecentFileMenuActions() { | |||
| 185 | void GMainWindow::InitializeHotkeys() { | 185 | void GMainWindow::InitializeHotkeys() { |
| 186 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 186 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| 187 | RegisterHotkey("Main Window", "Start Emulation"); | 187 | RegisterHotkey("Main Window", "Start Emulation"); |
| 188 | RegisterHotkey( "Main Window", "Fullscreen", QKeySequence::FullScreen ); | ||
| 189 | RegisterHotkey( "Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut ); | ||
| 188 | LoadHotkeys(); | 190 | LoadHotkeys(); |
| 189 | 191 | ||
| 190 | connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, | 192 | connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, |
| 191 | SLOT(OnMenuLoadFile())); | 193 | SLOT(OnMenuLoadFile())); |
| 192 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, | 194 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, |
| 193 | SLOT(OnStartGame())); | 195 | SLOT(OnStartGame())); |
| 196 | connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated, | ||
| 197 | ui.action_Fullscreen, &QAction::trigger); | ||
| 198 | connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously, | ||
| 199 | ui.action_Fullscreen, &QAction::trigger); | ||
| 200 | connect(GetHotkey("Main Window", "Exit Fullscreen", this), &QShortcut::activated, this, [&] { | ||
| 201 | if (emulation_running) { | ||
| 202 | ui.action_Fullscreen->setChecked(false); | ||
| 203 | ToggleFullscreen(); | ||
| 204 | } | ||
| 205 | }); | ||
| 194 | } | 206 | } |
| 195 | 207 | ||
| 196 | void GMainWindow::SetDefaultUIGeometry() { | 208 | void GMainWindow::SetDefaultUIGeometry() { |
| @@ -219,6 +231,8 @@ void GMainWindow::RestoreUIState() { | |||
| 219 | ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); | 231 | ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); |
| 220 | ToggleWindowMode(); | 232 | ToggleWindowMode(); |
| 221 | 233 | ||
| 234 | ui.action_Fullscreen->setChecked(UISettings::values.fullscreen); | ||
| 235 | |||
| 222 | ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); | 236 | ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); |
| 223 | OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); | 237 | OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); |
| 224 | 238 | ||
| @@ -263,6 +277,10 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 263 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); | 277 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); |
| 264 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); | 278 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); |
| 265 | 279 | ||
| 280 | // Fullscreen | ||
| 281 | ui.action_Fullscreen->setShortcut(GetHotkey("Main Window", "Fullscreen", this)->key()); | ||
| 282 | connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); | ||
| 283 | |||
| 266 | // Help | 284 | // Help |
| 267 | connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout); | 285 | connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout); |
| 268 | } | 286 | } |
| @@ -402,6 +420,7 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 402 | render_window->setFocus(); | 420 | render_window->setFocus(); |
| 403 | 421 | ||
| 404 | emulation_running = true; | 422 | emulation_running = true; |
| 423 | ToggleFullscreen(); | ||
| 405 | OnStartGame(); | 424 | OnStartGame(); |
| 406 | } | 425 | } |
| 407 | 426 | ||
| @@ -548,6 +567,29 @@ void GMainWindow::OnStopGame() { | |||
| 548 | ShutdownGame(); | 567 | ShutdownGame(); |
| 549 | } | 568 | } |
| 550 | 569 | ||
| 570 | void GMainWindow::ToggleFullscreen() { | ||
| 571 | if (!emulation_running) { | ||
| 572 | return; | ||
| 573 | } | ||
| 574 | if (ui.action_Fullscreen->isChecked()) { | ||
| 575 | if (ui.action_Single_Window_Mode->isChecked()) { | ||
| 576 | ui.menubar->hide(); | ||
| 577 | statusBar()->hide(); | ||
| 578 | showFullScreen(); | ||
| 579 | } else { | ||
| 580 | render_window->showFullScreen(); | ||
| 581 | } | ||
| 582 | } else { | ||
| 583 | if (ui.action_Single_Window_Mode->isChecked()) { | ||
| 584 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); | ||
| 585 | ui.menubar->show(); | ||
| 586 | showNormal(); | ||
| 587 | } else { | ||
| 588 | render_window->showNormal(); | ||
| 589 | } | ||
| 590 | } | ||
| 591 | } | ||
| 592 | |||
| 551 | void GMainWindow::ToggleWindowMode() { | 593 | void GMainWindow::ToggleWindowMode() { |
| 552 | if (ui.action_Single_Window_Mode->isChecked()) { | 594 | if (ui.action_Single_Window_Mode->isChecked()) { |
| 553 | // Render in the main window... | 595 | // Render in the main window... |
| @@ -700,6 +742,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { | |||
| 700 | UISettings::values.microprofile_visible = microProfileDialog->isVisible(); | 742 | UISettings::values.microprofile_visible = microProfileDialog->isVisible(); |
| 701 | #endif | 743 | #endif |
| 702 | UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); | 744 | UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); |
| 745 | UISettings::values.fullscreen = ui.action_Fullscreen->isChecked(); | ||
| 703 | UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); | 746 | UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); |
| 704 | UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked(); | 747 | UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked(); |
| 705 | UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); | 748 | UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 3add882dd..04bb887ae 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -127,6 +127,7 @@ private slots: | |||
| 127 | void OnAbout(); | 127 | void OnAbout(); |
| 128 | void OnToggleFilterBar(); | 128 | void OnToggleFilterBar(); |
| 129 | void OnDisplayTitleBars(bool); | 129 | void OnDisplayTitleBars(bool); |
| 130 | void ToggleFullscreen(); | ||
| 130 | void ToggleWindowMode(); | 131 | void ToggleWindowMode(); |
| 131 | void OnCoreError(Core::System::ResultStatus, std::string); | 132 | void OnCoreError(Core::System::ResultStatus, std::string); |
| 132 | 133 | ||
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 721e769e8..0fcd93cc2 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -83,6 +83,7 @@ | |||
| 83 | <string>Debugging</string> | 83 | <string>Debugging</string> |
| 84 | </property> | 84 | </property> |
| 85 | </widget> | 85 | </widget> |
| 86 | <addaction name="action_Fullscreen"/> | ||
| 86 | <addaction name="action_Single_Window_Mode"/> | 87 | <addaction name="action_Single_Window_Mode"/> |
| 87 | <addaction name="action_Display_Dock_Widget_Headers"/> | 88 | <addaction name="action_Display_Dock_Widget_Headers"/> |
| 88 | <addaction name="action_Show_Filter_Bar"/> | 89 | <addaction name="action_Show_Filter_Bar"/> |
| @@ -189,6 +190,14 @@ | |||
| 189 | <string>Selects a folder to display in the game list</string> | 190 | <string>Selects a folder to display in the game list</string> |
| 190 | </property> | 191 | </property> |
| 191 | </action> | 192 | </action> |
| 192 | </widget> | 193 | <action name="action_Fullscreen"> |
| 194 | <property name="checkable"> | ||
| 195 | <bool>true</bool> | ||
| 196 | </property> | ||
| 197 | <property name="text"> | ||
| 198 | <string>Fullscreen</string> | ||
| 199 | </property> | ||
| 200 | </action> | ||
| 201 | </widget> | ||
| 193 | <resources/> | 202 | <resources/> |
| 194 | </ui> | 203 | </ui> |
diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h index e965f0ba9..d093da641 100644 --- a/src/yuzu/ui_settings.h +++ b/src/yuzu/ui_settings.h | |||
| @@ -27,6 +27,7 @@ struct Values { | |||
| 27 | bool microprofile_visible; | 27 | bool microprofile_visible; |
| 28 | 28 | ||
| 29 | bool single_window_mode; | 29 | bool single_window_mode; |
| 30 | bool fullscreen; | ||
| 30 | bool display_titlebar; | 31 | bool display_titlebar; |
| 31 | bool show_filter_bar; | 32 | bool show_filter_bar; |
| 32 | bool show_status_bar; | 33 | bool show_status_bar; |