Merge branch 'resize_windows_fix' into 'main'

fix: Dialogs now correctly remember their window size

See merge request citron/emulator!98
This commit is contained in:
Zephyron
2025-10-15 12:23:03 +10:00
4 changed files with 24 additions and 12 deletions

View File

@@ -90,20 +90,14 @@ rainbow_timer{new QTimer(this)} {
ui->setupUi(this);
if (!UISettings::values.configure_dialog_geometry.isEmpty()) {
restoreGeometry(UISettings::values.configure_dialog_geometry);
}
UpdateTheme();
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QScreen* screen = QApplication::primaryScreen();
if (screen) {
QRect screenGeometry = screen->availableGeometry();
qreal devicePixelRatio = screen->devicePixelRatio();
int logicalWidth = static_cast<int>(screenGeometry.width() / devicePixelRatio);
int logicalHeight = static_cast<int>(screenGeometry.height() / devicePixelRatio);
setGeometry(0, 0, logicalWidth, logicalHeight);
showMaximized();
}
tab_button_group = std::make_unique<QButtonGroup>(this);
tab_button_group->setExclusive(true);
@@ -173,7 +167,9 @@ rainbow_timer{new QTimer(this)} {
ui->buttonBox->setFocus();
}
ConfigureDialog::~ConfigureDialog() = default;
ConfigureDialog::~ConfigureDialog() {
UISettings::values.configure_dialog_geometry = saveGeometry();
}
void ConfigureDialog::UpdateTheme() {
QString accent_color_str;

View File

@@ -38,6 +38,7 @@
#include "core/loader/loader.h"
#include "frontend_common/config.h"
#include "ui_configure_per_game.h"
#include "citron/uisettings.h"
#include "citron/configuration/configuration_shared.h"
#include "citron/configuration/configure_audio.h"
#include "citron/configuration/configure_cpu.h"
@@ -78,6 +79,10 @@ rainbow_timer{new QTimer(this)} {
ui->setupUi(this);
if (!UISettings::values.per_game_configure_geometry.isEmpty()) {
restoreGeometry(UISettings::values.per_game_configure_geometry);
}
ApplyStaticTheme();
UpdateTheme(); // Run once to set initial colors
connect(rainbow_timer, &QTimer::timeout, this, &ConfigurePerGame::UpdateTheme);
@@ -131,7 +136,9 @@ rainbow_timer{new QTimer(this)} {
LoadConfiguration();
}
ConfigurePerGame::~ConfigurePerGame() = default;
ConfigurePerGame::~ConfigurePerGame() {
UISettings::values.per_game_configure_geometry = saveGeometry();
}
void ConfigurePerGame::accept() {
ApplyConfiguration();

View File

@@ -68,6 +68,8 @@ namespace UISettings {
config.setValue(QStringLiteral("geometry"), values.geometry);
config.setValue(QStringLiteral("state"), values.state);
config.setValue(QStringLiteral("geometryRenderWindow"), values.renderwindow_geometry);
config.setValue(QStringLiteral("configureDialogGeometry"), values.configure_dialog_geometry);
config.setValue(QStringLiteral("perGameConfigureGeometry"), values.per_game_configure_geometry);
config.setValue(QStringLiteral("gameListHeaderState"), values.gamelist_header_state);
config.setValue(QStringLiteral("microProfileDialogGeometry"), values.microprofile_geometry);
@@ -106,6 +108,10 @@ namespace UISettings {
values.state = config.value(QStringLiteral("state")).toByteArray();
values.renderwindow_geometry =
config.value(QStringLiteral("geometryRenderWindow")).toByteArray();
values.configure_dialog_geometry =
config.value(QStringLiteral("configureDialogGeometry")).toByteArray();
values.per_game_configure_geometry =
config.value(QStringLiteral("perGameConfigureGeometry")).toByteArray();
values.gamelist_header_state =
config.value(QStringLiteral("gameListHeaderState")).toByteArray();
values.microprofile_geometry =

View File

@@ -91,6 +91,9 @@ namespace UISettings {
QByteArray renderwindow_geometry;
QByteArray configure_dialog_geometry;
QByteArray per_game_configure_geometry;
QByteArray gamelist_header_state;
QByteArray microprofile_geometry;