diff options
| author | 2021-10-13 12:29:45 -0700 | |
|---|---|---|
| committer | 2021-10-13 12:29:45 -0700 | |
| commit | 9f0f827db47b7aaec45f3d0ee87a0e3ad14ebc5c (patch) | |
| tree | da1f4763255b4a88882b0076d8d3e14391fb4e86 /src | |
| parent | Merge pull request #7120 from Morph1984/update-dynarmic (diff) | |
| parent | main: Add option to reset window size to 900p (diff) | |
| download | yuzu-9f0f827db47b7aaec45f3d0ee87a0e3ad14ebc5c.tar.gz yuzu-9f0f827db47b7aaec45f3d0ee87a0e3ad14ebc5c.tar.xz yuzu-9f0f827db47b7aaec45f3d0ee87a0e3ad14ebc5c.zip | |
Merge pull request #7158 from ameerj/window-900p
main: Add option to reset window size to 900p
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/main.cpp | 39 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 48 |
3 files changed, 53 insertions, 36 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 552c2cc63..3eea61354 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1172,10 +1172,16 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1172 | &GMainWindow::OnDisplayTitleBars); | 1172 | &GMainWindow::OnDisplayTitleBars); |
| 1173 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); | 1173 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); |
| 1174 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); | 1174 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); |
| 1175 | |||
| 1175 | connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this, | 1176 | connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this, |
| 1176 | &GMainWindow::ResetWindowSize720); | 1177 | &GMainWindow::ResetWindowSize720); |
| 1178 | connect(ui.action_Reset_Window_Size_900, &QAction::triggered, this, | ||
| 1179 | &GMainWindow::ResetWindowSize900); | ||
| 1177 | connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this, | 1180 | connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this, |
| 1178 | &GMainWindow::ResetWindowSize1080); | 1181 | &GMainWindow::ResetWindowSize1080); |
| 1182 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_720); | ||
| 1183 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_900); | ||
| 1184 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_1080); | ||
| 1179 | 1185 | ||
| 1180 | // Fullscreen | 1186 | // Fullscreen |
| 1181 | connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); | 1187 | connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); |
| @@ -2621,32 +2627,29 @@ void GMainWindow::ToggleWindowMode() { | |||
| 2621 | } | 2627 | } |
| 2622 | } | 2628 | } |
| 2623 | 2629 | ||
| 2624 | void GMainWindow::ResetWindowSize720() { | 2630 | void GMainWindow::ResetWindowSize(u32 width, u32 height) { |
| 2625 | const auto aspect_ratio = Layout::EmulationAspectRatio( | 2631 | const auto aspect_ratio = Layout::EmulationAspectRatio( |
| 2626 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), | 2632 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), |
| 2627 | static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width); | 2633 | static_cast<float>(height) / width); |
| 2628 | if (!ui.action_Single_Window_Mode->isChecked()) { | 2634 | if (!ui.action_Single_Window_Mode->isChecked()) { |
| 2629 | render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio, | 2635 | render_window->resize(height / aspect_ratio, height); |
| 2630 | Layout::ScreenUndocked::Height); | ||
| 2631 | } else { | 2636 | } else { |
| 2632 | resize(Layout::ScreenUndocked::Height / aspect_ratio, | 2637 | const bool show_status_bar = ui.action_Show_Status_Bar->isChecked(); |
| 2633 | Layout::ScreenUndocked::Height + menuBar()->height() + | 2638 | const auto status_bar_height = show_status_bar ? statusBar()->height() : 0; |
| 2634 | (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); | 2639 | resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height); |
| 2635 | } | 2640 | } |
| 2636 | } | 2641 | } |
| 2637 | 2642 | ||
| 2643 | void GMainWindow::ResetWindowSize720() { | ||
| 2644 | ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height); | ||
| 2645 | } | ||
| 2646 | |||
| 2647 | void GMainWindow::ResetWindowSize900() { | ||
| 2648 | ResetWindowSize(1600U, 900U); | ||
| 2649 | } | ||
| 2650 | |||
| 2638 | void GMainWindow::ResetWindowSize1080() { | 2651 | void GMainWindow::ResetWindowSize1080() { |
| 2639 | const auto aspect_ratio = Layout::EmulationAspectRatio( | 2652 | ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height); |
| 2640 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), | ||
| 2641 | static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width); | ||
| 2642 | if (!ui.action_Single_Window_Mode->isChecked()) { | ||
| 2643 | render_window->resize(Layout::ScreenDocked::Height / aspect_ratio, | ||
| 2644 | Layout::ScreenDocked::Height); | ||
| 2645 | } else { | ||
| 2646 | resize(Layout::ScreenDocked::Height / aspect_ratio, | ||
| 2647 | Layout::ScreenDocked::Height + menuBar()->height() + | ||
| 2648 | (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); | ||
| 2649 | } | ||
| 2650 | } | 2653 | } |
| 2651 | 2654 | ||
| 2652 | void GMainWindow::OnConfigure() { | 2655 | void GMainWindow::OnConfigure() { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 60ce01471..5df2c9422 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -272,7 +272,9 @@ private slots: | |||
| 272 | void ShowFullscreen(); | 272 | void ShowFullscreen(); |
| 273 | void HideFullscreen(); | 273 | void HideFullscreen(); |
| 274 | void ToggleWindowMode(); | 274 | void ToggleWindowMode(); |
| 275 | void ResetWindowSize(u32 width, u32 height); | ||
| 275 | void ResetWindowSize720(); | 276 | void ResetWindowSize720(); |
| 277 | void ResetWindowSize900(); | ||
| 276 | void ResetWindowSize1080(); | 278 | void ResetWindowSize1080(); |
| 277 | void OnCaptureScreenshot(); | 279 | void OnCaptureScreenshot(); |
| 278 | void OnCoreError(Core::System::ResultStatus, std::string); | 280 | void OnCoreError(Core::System::ResultStatus, std::string); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 653c010d8..a62e39a06 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -78,6 +78,35 @@ | |||
| 78 | <property name="title"> | 78 | <property name="title"> |
| 79 | <string>&View</string> | 79 | <string>&View</string> |
| 80 | </property> | 80 | </property> |
| 81 | <widget class="QMenu" name="menu_Reset_Window_Size"> | ||
| 82 | <property name="title"> | ||
| 83 | <string>&Reset Window Size</string> | ||
| 84 | </property> | ||
| 85 | </widget> | ||
| 86 | <action name="action_Reset_Window_Size_720"> | ||
| 87 | <property name="text"> | ||
| 88 | <string>Reset Window Size to &720p</string> | ||
| 89 | </property> | ||
| 90 | <property name="iconText"> | ||
| 91 | <string>Reset Window Size to 720p</string> | ||
| 92 | </property> | ||
| 93 | </action> | ||
| 94 | <action name="action_Reset_Window_Size_900"> | ||
| 95 | <property name="text"> | ||
| 96 | <string>Reset Window Size to &900p</string> | ||
| 97 | </property> | ||
| 98 | <property name="iconText"> | ||
| 99 | <string>Reset Window Size to 900p</string> | ||
| 100 | </property> | ||
| 101 | </action> | ||
| 102 | <action name="action_Reset_Window_Size_1080"> | ||
| 103 | <property name="text"> | ||
| 104 | <string>Reset Window Size to &1080p</string> | ||
| 105 | </property> | ||
| 106 | <property name="iconText"> | ||
| 107 | <string>Reset Window Size to 1080p</string> | ||
| 108 | </property> | ||
| 109 | </action> | ||
| 81 | <widget class="QMenu" name="menu_View_Debugging"> | 110 | <widget class="QMenu" name="menu_View_Debugging"> |
| 82 | <property name="title"> | 111 | <property name="title"> |
| 83 | <string>&Debugging</string> | 112 | <string>&Debugging</string> |
| @@ -88,9 +117,8 @@ | |||
| 88 | <addaction name="action_Display_Dock_Widget_Headers"/> | 117 | <addaction name="action_Display_Dock_Widget_Headers"/> |
| 89 | <addaction name="action_Show_Filter_Bar"/> | 118 | <addaction name="action_Show_Filter_Bar"/> |
| 90 | <addaction name="action_Show_Status_Bar"/> | 119 | <addaction name="action_Show_Status_Bar"/> |
| 91 | <addaction name="action_Reset_Window_Size_720"/> | ||
| 92 | <addaction name="action_Reset_Window_Size_1080"/> | ||
| 93 | <addaction name="separator"/> | 120 | <addaction name="separator"/> |
| 121 | <addaction name="menu_Reset_Window_Size"/> | ||
| 94 | <addaction name="menu_View_Debugging"/> | 122 | <addaction name="menu_View_Debugging"/> |
| 95 | </widget> | 123 | </widget> |
| 96 | <widget class="QMenu" name="menu_Tools"> | 124 | <widget class="QMenu" name="menu_Tools"> |
| @@ -216,22 +244,6 @@ | |||
| 216 | <string>Show Status Bar</string> | 244 | <string>Show Status Bar</string> |
| 217 | </property> | 245 | </property> |
| 218 | </action> | 246 | </action> |
| 219 | <action name="action_Reset_Window_Size_720"> | ||
| 220 | <property name="text"> | ||
| 221 | <string>Reset Window Size to &720p</string> | ||
| 222 | </property> | ||
| 223 | <property name="iconText"> | ||
| 224 | <string>Reset Window Size to 720p</string> | ||
| 225 | </property> | ||
| 226 | </action> | ||
| 227 | <action name="action_Reset_Window_Size_1080"> | ||
| 228 | <property name="text"> | ||
| 229 | <string>Reset Window Size to &1080p</string> | ||
| 230 | </property> | ||
| 231 | <property name="iconText"> | ||
| 232 | <string>Reset Window Size to 1080p</string> | ||
| 233 | </property> | ||
| 234 | </action> | ||
| 235 | <action name="action_Fullscreen"> | 247 | <action name="action_Fullscreen"> |
| 236 | <property name="checkable"> | 248 | <property name="checkable"> |
| 237 | <bool>true</bool> | 249 | <bool>true</bool> |