mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 23:11:05 +00:00
Initial screen resizing implementation
This feature allows the user to resize the game screen to a predefined multiple of native. There are some issues that will be addressed in future commits. Namely: -interaction with layout change -a way to change in the configurations menu -singe window off -maybe game list needs a separate geometry
This commit is contained in:
parent
9ff97270cf
commit
a54ea07d6f
@ -606,6 +606,8 @@ void Config::ReadUIValues() {
|
|||||||
ReadShortcutValues();
|
ReadShortcutValues();
|
||||||
ReadMultiplayerValues();
|
ReadMultiplayerValues();
|
||||||
|
|
||||||
|
UISettings::values.fixed_screen_size =
|
||||||
|
ReadSetting(QStringLiteral("FixedScreenSize"), 0).toInt();
|
||||||
UISettings::values.single_window_mode =
|
UISettings::values.single_window_mode =
|
||||||
ReadSetting(QStringLiteral("singleWindowMode"), true).toBool();
|
ReadSetting(QStringLiteral("singleWindowMode"), true).toBool();
|
||||||
UISettings::values.fullscreen = ReadSetting(QStringLiteral("fullscreen"), false).toBool();
|
UISettings::values.fullscreen = ReadSetting(QStringLiteral("fullscreen"), false).toBool();
|
||||||
@ -1096,6 +1098,7 @@ void Config::SaveUIValues() {
|
|||||||
SaveShortcutValues();
|
SaveShortcutValues();
|
||||||
SaveMultiplayerValues();
|
SaveMultiplayerValues();
|
||||||
|
|
||||||
|
WriteSetting(QStringLiteral("FixedScreenSize"), UISettings::values.fixed_screen_size, 0);
|
||||||
WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true);
|
WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true);
|
||||||
WriteSetting(QStringLiteral("fullscreen"), UISettings::values.fullscreen, false);
|
WriteSetting(QStringLiteral("fullscreen"), UISettings::values.fullscreen, false);
|
||||||
WriteSetting(QStringLiteral("displayTitleBars"), UISettings::values.display_titlebar, true);
|
WriteSetting(QStringLiteral("displayTitleBars"), UISettings::values.display_titlebar, true);
|
||||||
|
@ -314,6 +314,12 @@ void GMainWindow::InitializeWidgets() {
|
|||||||
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Single_Screen);
|
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Single_Screen);
|
||||||
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Large_Screen);
|
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Large_Screen);
|
||||||
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Side_by_Side);
|
actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Side_by_Side);
|
||||||
|
|
||||||
|
QActionGroup* actionGroup_ScreenSizes = new QActionGroup(this);
|
||||||
|
actionGroup_ScreenSizes->addAction(ui->action_Screen_Size_1x);
|
||||||
|
actionGroup_ScreenSizes->addAction(ui->action_Screen_Size_2x);
|
||||||
|
actionGroup_ScreenSizes->addAction(ui->action_Screen_Size_3x);
|
||||||
|
actionGroup_ScreenSizes->addAction(ui->action_Screen_Size_4x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::InitializeDebugWidgets() {
|
void GMainWindow::InitializeDebugWidgets() {
|
||||||
@ -752,6 +758,11 @@ void GMainWindow::ConnectMenuEvents() {
|
|||||||
connect(ui->action_Screen_Layout_Upright_Screens, &QAction::triggered, this,
|
connect(ui->action_Screen_Layout_Upright_Screens, &QAction::triggered, this,
|
||||||
&GMainWindow::OnRotateScreens);
|
&GMainWindow::OnRotateScreens);
|
||||||
|
|
||||||
|
connect(ui->action_Screen_Size_1x, &QAction::triggered, this, &GMainWindow::ChangeScreenSize);
|
||||||
|
connect(ui->action_Screen_Size_2x, &QAction::triggered, this, &GMainWindow::ChangeScreenSize);
|
||||||
|
connect(ui->action_Screen_Size_3x, &QAction::triggered, this, &GMainWindow::ChangeScreenSize);
|
||||||
|
connect(ui->action_Screen_Size_4x, &QAction::triggered, this, &GMainWindow::ChangeScreenSize);
|
||||||
|
|
||||||
// Movie
|
// Movie
|
||||||
connect(ui->action_Record_Movie, &QAction::triggered, this, &GMainWindow::OnRecordMovie);
|
connect(ui->action_Record_Movie, &QAction::triggered, this, &GMainWindow::OnRecordMovie);
|
||||||
connect(ui->action_Play_Movie, &QAction::triggered, this, &GMainWindow::OnPlayMovie);
|
connect(ui->action_Play_Movie, &QAction::triggered, this, &GMainWindow::OnPlayMovie);
|
||||||
@ -1665,6 +1676,37 @@ void GMainWindow::ToggleWindowMode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ResizeScreen(const int scale) {
|
||||||
|
const auto size = Layout::GetMinimumSizeFromLayout(Settings::values.layout_option,
|
||||||
|
Settings::values.upright_screen);
|
||||||
|
|
||||||
|
auto_resized = true;
|
||||||
|
|
||||||
|
render_window->setMinimumSize(scale * size.first, scale * size.second);
|
||||||
|
render_window->UpdateCurrentFramebufferLayout(scale * size.first, scale * size.second);
|
||||||
|
ui->centralwidget->resize(scale * size.first, scale * size.second);
|
||||||
|
resize(sizeHint());
|
||||||
|
render_window->setMinimumSize(size.first, size.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ChangeScreenSize() {
|
||||||
|
int new_scale = 0;
|
||||||
|
|
||||||
|
if (ui->action_Screen_Size_1x->isChecked()) {
|
||||||
|
new_scale = 1;
|
||||||
|
} else if (ui->action_Screen_Size_2x->isChecked()) {
|
||||||
|
new_scale = 2;
|
||||||
|
} else if (ui->action_Screen_Size_3x->isChecked()) {
|
||||||
|
new_scale = 3;
|
||||||
|
} else if (ui->action_Screen_Size_4x->isChecked()) {
|
||||||
|
new_scale = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
UISettings::values.fixed_screen_size = new_scale;
|
||||||
|
|
||||||
|
ResizeScreen(new_scale);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::ChangeScreenLayout() {
|
void GMainWindow::ChangeScreenLayout() {
|
||||||
Settings::LayoutOption new_layout = Settings::LayoutOption::Default;
|
Settings::LayoutOption new_layout = Settings::LayoutOption::Default;
|
||||||
|
|
||||||
@ -2126,6 +2168,15 @@ void GMainWindow::mouseReleaseEvent([[maybe_unused]] QMouseEvent* event) {
|
|||||||
OnMouseActivity();
|
OnMouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::resizeEvent(QResizeEvent* event) {
|
||||||
|
// This resize event was not triggered by the user
|
||||||
|
if (auto_resized) {
|
||||||
|
auto_resized = false;
|
||||||
|
} else {
|
||||||
|
UncheckWindowSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
||||||
QString status_message;
|
QString status_message;
|
||||||
|
|
||||||
@ -2372,6 +2423,13 @@ void GMainWindow::UpdateWindowTitle() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::UncheckWindowSize() {
|
||||||
|
ui->action_Screen_Size_1x->setChecked(false);
|
||||||
|
ui->action_Screen_Size_2x->setChecked(false);
|
||||||
|
ui->action_Screen_Size_3x->setChecked(false);
|
||||||
|
ui->action_Screen_Size_4x->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::UpdateUISettings() {
|
void GMainWindow::UpdateUISettings() {
|
||||||
if (!ui->action_Fullscreen->isChecked()) {
|
if (!ui->action_Fullscreen->isChecked()) {
|
||||||
UISettings::values.geometry = saveGeometry();
|
UISettings::values.geometry = saveGeometry();
|
||||||
@ -2401,6 +2459,11 @@ void GMainWindow::SyncMenuUISettings() {
|
|||||||
Settings::LayoutOption::SideScreen);
|
Settings::LayoutOption::SideScreen);
|
||||||
ui->action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen);
|
ui->action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen);
|
||||||
ui->action_Screen_Layout_Upright_Screens->setChecked(Settings::values.upright_screen);
|
ui->action_Screen_Layout_Upright_Screens->setChecked(Settings::values.upright_screen);
|
||||||
|
|
||||||
|
ui->action_Screen_Size_1x->setChecked(UISettings::values.fixed_screen_size == 1);
|
||||||
|
ui->action_Screen_Size_2x->setChecked(UISettings::values.fixed_screen_size == 2);
|
||||||
|
ui->action_Screen_Size_3x->setChecked(UISettings::values.fixed_screen_size == 3);
|
||||||
|
ui->action_Screen_Size_4x->setChecked(UISettings::values.fixed_screen_size == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::RetranslateStatusBar() {
|
void GMainWindow::RetranslateStatusBar() {
|
||||||
|
@ -120,6 +120,9 @@ private:
|
|||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
void ConnectMenuEvents();
|
void ConnectMenuEvents();
|
||||||
|
|
||||||
|
void ResizeScreen(int scale);
|
||||||
|
void UncheckWindowSize();
|
||||||
|
|
||||||
void PreventOSSleep();
|
void PreventOSSleep();
|
||||||
void AllowOSSleep();
|
void AllowOSSleep();
|
||||||
|
|
||||||
@ -197,6 +200,7 @@ private slots:
|
|||||||
void OnDisplayTitleBars(bool);
|
void OnDisplayTitleBars(bool);
|
||||||
void InitializeHotkeys();
|
void InitializeHotkeys();
|
||||||
void ToggleFullscreen();
|
void ToggleFullscreen();
|
||||||
|
void ChangeScreenSize();
|
||||||
void ChangeScreenLayout();
|
void ChangeScreenLayout();
|
||||||
void ToggleScreenLayout();
|
void ToggleScreenLayout();
|
||||||
void OnSwapScreens();
|
void OnSwapScreens();
|
||||||
@ -261,8 +265,10 @@ private:
|
|||||||
// The path to the game currently running
|
// The path to the game currently running
|
||||||
QString game_path;
|
QString game_path;
|
||||||
|
|
||||||
|
// Internal states of misc features
|
||||||
bool auto_paused = false;
|
bool auto_paused = false;
|
||||||
QTimer mouse_hide_timer;
|
QTimer mouse_hide_timer;
|
||||||
|
bool auto_resized = false;
|
||||||
|
|
||||||
// Movie
|
// Movie
|
||||||
bool movie_record_on_start = false;
|
bool movie_record_on_start = false;
|
||||||
@ -316,6 +322,7 @@ protected:
|
|||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::size_t);
|
Q_DECLARE_METATYPE(std::size_t);
|
||||||
|
@ -129,9 +129,19 @@
|
|||||||
<addaction name="action_Screen_Layout_Upright_Screens"/>
|
<addaction name="action_Screen_Layout_Upright_Screens"/>
|
||||||
<addaction name="action_Screen_Layout_Swap_Screens"/>
|
<addaction name="action_Screen_Layout_Swap_Screens"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_Screen_Size">
|
||||||
|
<property name="title">
|
||||||
|
<string>Screen Size</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_Screen_Size_1x"/>
|
||||||
|
<addaction name="action_Screen_Size_2x"/>
|
||||||
|
<addaction name="action_Screen_Size_3x"/>
|
||||||
|
<addaction name="action_Screen_Size_4x"/>
|
||||||
|
</widget>
|
||||||
<addaction name="action_Fullscreen"/>
|
<addaction name="action_Fullscreen"/>
|
||||||
<addaction name="action_Single_Window_Mode"/>
|
<addaction name="action_Single_Window_Mode"/>
|
||||||
<addaction name="menu_Screen_Layout"/>
|
<addaction name="menu_Screen_Layout"/>
|
||||||
|
<addaction name="menu_Screen_Size"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<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"/>
|
||||||
@ -477,6 +487,38 @@
|
|||||||
<string>Rotate Upright</string>
|
<string>Rotate Upright</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_Screen_Size_1x">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1x</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Size_2x">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2x</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Size_3x">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>3x</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_Screen_Size_4x">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>4x</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="action_Check_For_Updates">
|
<action name="action_Check_For_Updates">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Check for Updates</string>
|
<string>Check for Updates</string>
|
||||||
|
@ -72,6 +72,7 @@ struct Values {
|
|||||||
bool display_titlebar;
|
bool display_titlebar;
|
||||||
bool show_filter_bar;
|
bool show_filter_bar;
|
||||||
bool show_status_bar;
|
bool show_status_bar;
|
||||||
|
int fixed_screen_size;
|
||||||
|
|
||||||
bool confirm_before_closing;
|
bool confirm_before_closing;
|
||||||
bool first_start;
|
bool first_start;
|
||||||
|
Loading…
Reference in New Issue
Block a user