mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Qt: add option to automatically resize the game window
This commit is contained in:
parent
2eef3ab645
commit
8199f97e7a
4 changed files with 35 additions and 6 deletions
|
@ -281,8 +281,17 @@ std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
||||||
|
|
||||||
if (m_gui_settings->GetValue(gui::gs_resize).toBool())
|
if (m_gui_settings->GetValue(gui::gs_resize).toBool())
|
||||||
{
|
{
|
||||||
w = m_gui_settings->GetValue(gui::gs_width).toInt();
|
if (m_gui_settings->GetValue(gui::gs_resize_manual).toBool())
|
||||||
h = m_gui_settings->GetValue(gui::gs_height).toInt();
|
{
|
||||||
|
w = m_gui_settings->GetValue(gui::gs_width).toInt();
|
||||||
|
h = m_gui_settings->GetValue(gui::gs_height).toInt();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const qreal device_pixel_ratio = devicePixelRatio();
|
||||||
|
w /= device_pixel_ratio;
|
||||||
|
h /= device_pixel_ratio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto screen = m_main_window ? m_main_window->screen() : primaryScreen();
|
const auto screen = m_main_window ? m_main_window->screen() : primaryScreen();
|
||||||
|
|
|
@ -212,6 +212,7 @@ namespace gui
|
||||||
const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false);
|
const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false);
|
||||||
const gui_save gs_lockMouseFs = gui_save(gs_frame, "lockMouseInFullscreen", true);
|
const gui_save gs_lockMouseFs = gui_save(gs_frame, "lockMouseInFullscreen", true);
|
||||||
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
|
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
|
||||||
|
const gui_save gs_resize_manual = gui_save(gs_frame, "resizeManual", true);
|
||||||
const gui_save gs_width = gui_save(gs_frame, "width", 1280);
|
const gui_save gs_width = gui_save(gs_frame, "width", 1280);
|
||||||
const gui_save gs_height = gui_save(gs_frame, "height", 720);
|
const gui_save gs_height = gui_save(gs_frame, "height", 720);
|
||||||
const gui_save gs_hideMouseIdle = gui_save(gs_frame, "hideMouseOnIdle", false);
|
const gui_save gs_hideMouseIdle = gui_save(gs_frame, "hideMouseOnIdle", false);
|
||||||
|
|
|
@ -1754,9 +1754,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
});
|
});
|
||||||
|
|
||||||
const bool enable_buttons = m_gui_settings->GetValue(gui::gs_resize).toBool();
|
const bool enable_buttons = m_gui_settings->GetValue(gui::gs_resize).toBool();
|
||||||
|
const bool use_manual_resize = m_gui_settings->GetValue(gui::gs_resize_manual).toBool();
|
||||||
ui->gs_resizeOnBoot->setChecked(enable_buttons);
|
ui->gs_resizeOnBoot->setChecked(enable_buttons);
|
||||||
ui->gs_width->setEnabled(enable_buttons);
|
ui->gs_resizeOnBootManual->setChecked(use_manual_resize);
|
||||||
ui->gs_height->setEnabled(enable_buttons);
|
ui->gs_resizeOnBootManual->setEnabled(enable_buttons);
|
||||||
|
ui->gs_width->setEnabled(enable_buttons && use_manual_resize);
|
||||||
|
ui->gs_height->setEnabled(enable_buttons && use_manual_resize);
|
||||||
|
|
||||||
const QRect screen = QGuiApplication::primaryScreen()->geometry();
|
const QRect screen = QGuiApplication::primaryScreen()->geometry();
|
||||||
const int width = m_gui_settings->GetValue(gui::gs_width).toInt();
|
const int width = m_gui_settings->GetValue(gui::gs_width).toInt();
|
||||||
|
@ -1766,9 +1769,18 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
|
|
||||||
connect(ui->gs_resizeOnBoot, &QCheckBox::toggled, [this](bool checked)
|
connect(ui->gs_resizeOnBoot, &QCheckBox::toggled, [this](bool checked)
|
||||||
{
|
{
|
||||||
|
const bool enabled = checked && ui->gs_resizeOnBootManual->isChecked();
|
||||||
m_gui_settings->SetValue(gui::gs_resize, checked);
|
m_gui_settings->SetValue(gui::gs_resize, checked);
|
||||||
ui->gs_width->setEnabled(checked);
|
ui->gs_resizeOnBootManual->setEnabled(checked);
|
||||||
ui->gs_height->setEnabled(checked);
|
ui->gs_width->setEnabled(enabled);
|
||||||
|
ui->gs_height->setEnabled(enabled);
|
||||||
|
});
|
||||||
|
connect(ui->gs_resizeOnBootManual, &QCheckBox::toggled, [this](bool checked)
|
||||||
|
{
|
||||||
|
const bool enabled = checked && ui->gs_resizeOnBoot->isChecked();
|
||||||
|
m_gui_settings->SetValue(gui::gs_resize_manual, checked);
|
||||||
|
ui->gs_width->setEnabled(enabled);
|
||||||
|
ui->gs_height->setEnabled(enabled);
|
||||||
});
|
});
|
||||||
connect(ui->gs_width, &QSpinBox::editingFinished, [this]()
|
connect(ui->gs_width, &QSpinBox::editingFinished, [this]()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2991,6 +2991,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="gs_resizeOnBootManual">
|
||||||
|
<property name="text">
|
||||||
|
<string>Resize manually</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="gs_resolution_layout">
|
<layout class="QHBoxLayout" name="gs_resolution_layout">
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue