mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-26 14:25:45 +01:00
main: Add option to reset window size to 900p
This commit is contained in:
parent
4fbec776d6
commit
5c829c7e4e
@ -1172,10 +1172,16 @@ void GMainWindow::ConnectMenuEvents() {
|
|||||||
&GMainWindow::OnDisplayTitleBars);
|
&GMainWindow::OnDisplayTitleBars);
|
||||||
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
|
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
|
||||||
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
||||||
|
|
||||||
connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this,
|
connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this,
|
||||||
&GMainWindow::ResetWindowSize720);
|
&GMainWindow::ResetWindowSize720);
|
||||||
|
connect(ui.action_Reset_Window_Size_900, &QAction::triggered, this,
|
||||||
|
&GMainWindow::ResetWindowSize900);
|
||||||
connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this,
|
connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this,
|
||||||
&GMainWindow::ResetWindowSize1080);
|
&GMainWindow::ResetWindowSize1080);
|
||||||
|
ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_720);
|
||||||
|
ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_900);
|
||||||
|
ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_1080);
|
||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
|
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
|
||||||
@ -2621,32 +2627,29 @@ void GMainWindow::ToggleWindowMode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::ResetWindowSize720() {
|
void GMainWindow::ResetWindowSize(u32 width, u32 height) {
|
||||||
const auto aspect_ratio = Layout::EmulationAspectRatio(
|
const auto aspect_ratio = Layout::EmulationAspectRatio(
|
||||||
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
|
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
|
||||||
static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width);
|
static_cast<float>(height) / width);
|
||||||
if (!ui.action_Single_Window_Mode->isChecked()) {
|
if (!ui.action_Single_Window_Mode->isChecked()) {
|
||||||
render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio,
|
render_window->resize(height / aspect_ratio, height);
|
||||||
Layout::ScreenUndocked::Height);
|
|
||||||
} else {
|
} else {
|
||||||
resize(Layout::ScreenUndocked::Height / aspect_ratio,
|
const bool show_status_bar = ui.action_Show_Status_Bar->isChecked();
|
||||||
Layout::ScreenUndocked::Height + menuBar()->height() +
|
const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
|
||||||
(ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
|
resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ResetWindowSize720() {
|
||||||
|
ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ResetWindowSize900() {
|
||||||
|
ResetWindowSize(1600U, 900U);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::ResetWindowSize1080() {
|
void GMainWindow::ResetWindowSize1080() {
|
||||||
const auto aspect_ratio = Layout::EmulationAspectRatio(
|
ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height);
|
||||||
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
|
|
||||||
static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width);
|
|
||||||
if (!ui.action_Single_Window_Mode->isChecked()) {
|
|
||||||
render_window->resize(Layout::ScreenDocked::Height / aspect_ratio,
|
|
||||||
Layout::ScreenDocked::Height);
|
|
||||||
} else {
|
|
||||||
resize(Layout::ScreenDocked::Height / aspect_ratio,
|
|
||||||
Layout::ScreenDocked::Height + menuBar()->height() +
|
|
||||||
(ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
|
@ -272,7 +272,9 @@ private slots:
|
|||||||
void ShowFullscreen();
|
void ShowFullscreen();
|
||||||
void HideFullscreen();
|
void HideFullscreen();
|
||||||
void ToggleWindowMode();
|
void ToggleWindowMode();
|
||||||
|
void ResetWindowSize(u32 width, u32 height);
|
||||||
void ResetWindowSize720();
|
void ResetWindowSize720();
|
||||||
|
void ResetWindowSize900();
|
||||||
void ResetWindowSize1080();
|
void ResetWindowSize1080();
|
||||||
void OnCaptureScreenshot();
|
void OnCaptureScreenshot();
|
||||||
void OnCoreError(Core::System::ResultStatus, std::string);
|
void OnCoreError(Core::System::ResultStatus, std::string);
|
||||||
|
@ -78,6 +78,35 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&View</string>
|
<string>&View</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menu_Reset_Window_Size">
|
||||||
|
<property name="title">
|
||||||
|
<string>&Reset Window Size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<action name="action_Reset_Window_Size_720">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Window Size to &720p</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconText">
|
||||||
|
<string>Reset Window Size to 720p</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Reset_Window_Size_900">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Window Size to &900p</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconText">
|
||||||
|
<string>Reset Window Size to 900p</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Reset_Window_Size_1080">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Window Size to &1080p</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconText">
|
||||||
|
<string>Reset Window Size to 1080p</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<widget class="QMenu" name="menu_View_Debugging">
|
<widget class="QMenu" name="menu_View_Debugging">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Debugging</string>
|
<string>&Debugging</string>
|
||||||
@ -88,9 +117,8 @@
|
|||||||
<addaction name="action_Display_Dock_Widget_Headers"/>
|
<addaction name="action_Display_Dock_Widget_Headers"/>
|
||||||
<addaction name="action_Show_Filter_Bar"/>
|
<addaction name="action_Show_Filter_Bar"/>
|
||||||
<addaction name="action_Show_Status_Bar"/>
|
<addaction name="action_Show_Status_Bar"/>
|
||||||
<addaction name="action_Reset_Window_Size_720"/>
|
|
||||||
<addaction name="action_Reset_Window_Size_1080"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="menu_Reset_Window_Size"/>
|
||||||
<addaction name="menu_View_Debugging"/>
|
<addaction name="menu_View_Debugging"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Tools">
|
<widget class="QMenu" name="menu_Tools">
|
||||||
@ -216,22 +244,6 @@
|
|||||||
<string>Show Status Bar</string>
|
<string>Show Status Bar</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_Reset_Window_Size_720">
|
|
||||||
<property name="text">
|
|
||||||
<string>Reset Window Size to &720p</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconText">
|
|
||||||
<string>Reset Window Size to 720p</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="action_Reset_Window_Size_1080">
|
|
||||||
<property name="text">
|
|
||||||
<string>Reset Window Size to &1080p</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconText">
|
|
||||||
<string>Reset Window Size to 1080p</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="action_Fullscreen">
|
<action name="action_Fullscreen">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
Loading…
Reference in New Issue
Block a user