Skip to content

Commit 42aa8f2

Browse files
committed
Qt: store pad settings state and remove max size
1 parent af95ff5 commit 42aa8f2

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

rpcs3/rpcs3qt/gui_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ namespace gui
245245
const gui_save loc_language = gui_save(localization, "language", "en");
246246

247247
const gui_save pads_show_emulated = gui_save(pad_settings, "show_emulated_values", false);
248+
const gui_save pads_geometry = gui_save(pad_settings, "geometry", QByteArray());
248249
}
249250

250251
/** Class for GUI settings..

rpcs3/rpcs3qt/pad_settings_dialog.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr<gui_settings> gui_setti
203203

204204
pad_settings_dialog::~pad_settings_dialog()
205205
{
206+
m_gui_settings->SetValue(gui::pads_geometry, saveGeometry());
207+
206208
delete ui;
207209

208210
if (!Emu.IsStopped())
@@ -219,10 +221,10 @@ void pad_settings_dialog::showEvent(QShowEvent* event)
219221
RepaintPreviewLabel(ui->preview_stick_right, ui->slider_stick_right->value(), ui->slider_stick_right->size().width(), 0, 0, 0, 0);
220222

221223
// Resize in order to fit into our scroll area
222-
ResizeDialog();
223-
224-
// Restrict our inner layout size. This is necessary because redrawing things will slow down the dialog otherwise.
225-
ui->mainLayout->setSizeConstraint(QLayout::SizeConstraint::SetFixedSize);
224+
if (!restoreGeometry(m_gui_settings->GetValue(gui::pads_geometry).toByteArray()))
225+
{
226+
ResizeDialog();
227+
}
226228

227229
QDialog::showEvent(event);
228230
}
@@ -603,6 +605,7 @@ void pad_settings_dialog::ReactivateButtons()
603605

604606
void pad_settings_dialog::RepaintPreviewLabel(QLabel* l, int deadzone, int desired_width, int x, int y, int squircle, double multiplier) const
605607
{
608+
desired_width = 100; // Let's keep a fixed size for these labels for now
606609
const int deadzone_max = m_handler ? m_handler->thumb_max : 255; // 255 used as fallback. The deadzone circle shall be small.
607610

608611
constexpr qreal relative_size = 0.9;
@@ -1725,7 +1728,6 @@ void pad_settings_dialog::ResizeDialog()
17251728
const QSize margin_size(margins.left() + margins.right(), margins.top() + margins.bottom());
17261729

17271730
resize(tabwidget_size + buttons_size + margin_size + spacing_size);
1728-
setMaximumSize(size());
17291731
}
17301732

17311733
void pad_settings_dialog::SubscribeTooltip(QObject* object, const QString& tooltip)

rpcs3/rpcs3qt/pad_settings_dialog.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,6 +2342,9 @@
23422342
<property name="text">
23432343
<string/>
23442344
</property>
2345+
<property name="alignment">
2346+
<set>Qt::AlignCenter</set>
2347+
</property>
23452348
</widget>
23462349
</item>
23472350
</layout>
@@ -2360,6 +2363,9 @@
23602363
<property name="text">
23612364
<string/>
23622365
</property>
2366+
<property name="alignment">
2367+
<set>Qt::AlignCenter</set>
2368+
</property>
23632369
</widget>
23642370
</item>
23652371
</layout>

0 commit comments

Comments
 (0)