diff --git a/MultiMC.cpp b/MultiMC.cpp index 30b3f7f52..93524af7d 100644 --- a/MultiMC.cpp +++ b/MultiMC.cpp @@ -427,6 +427,8 @@ void MultiMC::initGlobalSettings() m_settings->registerSetting("ConsoleWindowState", ""); m_settings->registerSetting("ConsoleWindowGeometry", ""); + + m_settings->registerSetting("SettingsGeometry", ""); } void MultiMC::initHttpMetaCache() diff --git a/gui/dialogs/InstanceSettings.cpp b/gui/dialogs/InstanceSettings.cpp index e3f8a66ba..edb4a9219 100644 --- a/gui/dialogs/InstanceSettings.cpp +++ b/gui/dialogs/InstanceSettings.cpp @@ -36,6 +36,9 @@ InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent) { MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); + + restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray())); + loadSettings(); } @@ -47,7 +50,13 @@ InstanceSettings::~InstanceSettings() void InstanceSettings::showEvent(QShowEvent *ev) { QDialog::showEvent(ev); - adjustSize(); +} + +void InstanceSettings::closeEvent(QCloseEvent *ev) +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + + QDialog::closeEvent(ev); } void InstanceSettings::on_customCommandsGroupBox_toggled(bool state) @@ -57,12 +66,16 @@ void InstanceSettings::on_customCommandsGroupBox_toggled(bool state) void InstanceSettings::on_buttonBox_accepted() { + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + applySettings(); accept(); } void InstanceSettings::on_buttonBox_rejected() { + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + reject(); } @@ -227,4 +240,4 @@ void InstanceSettings::checkFinished(JavaCheckResult result) tr("The specified java binary didn't work. You should use the auto-detect feature, " "or set the path to the java executable.")); } -} \ No newline at end of file +} diff --git a/gui/dialogs/InstanceSettings.h b/gui/dialogs/InstanceSettings.h index 1e7b9f6e2..e296db4c6 100644 --- a/gui/dialogs/InstanceSettings.h +++ b/gui/dialogs/InstanceSettings.h @@ -39,6 +39,7 @@ public: protected: virtual void showEvent(QShowEvent *); + virtual void closeEvent(QCloseEvent *); private slots: void on_customCommandsGroupBox_toggled(bool arg1); diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index 569c8f636..9362075ed 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -44,6 +44,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se ui->jsonEditorTextBox->setClearButtonEnabled(true); #endif + restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray())); + loadSettings(MMC->settings().get()); updateCheckboxStuff(); } @@ -55,7 +57,13 @@ SettingsDialog::~SettingsDialog() void SettingsDialog::showEvent(QShowEvent *ev) { QDialog::showEvent(ev); - adjustSize(); +} + +void SettingsDialog::closeEvent(QCloseEvent *ev) +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); + + QDialog::closeEvent(ev); } void SettingsDialog::updateCheckboxStuff() @@ -180,6 +188,13 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) void SettingsDialog::on_buttonBox_accepted() { applySettings(MMC->settings().get()); + + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); +} + +void SettingsDialog::on_buttonBox_rejected() +{ + MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64()); } void SettingsDialog::applySettings(SettingsObject *s) diff --git a/gui/dialogs/SettingsDialog.h b/gui/dialogs/SettingsDialog.h index bcf57a80f..11fdb6965 100644 --- a/gui/dialogs/SettingsDialog.h +++ b/gui/dialogs/SettingsDialog.h @@ -41,7 +41,8 @@ public: void loadSettings(SettingsObject *s); protected: - virtual void showEvent(QShowEvent *); + virtual void showEvent(QShowEvent *ev); + virtual void closeEvent(QCloseEvent *ev); private slots: @@ -64,6 +65,8 @@ slots: void on_buttonBox_accepted(); + void on_buttonBox_rejected(); + void on_javaDetectBtn_clicked(); void on_javaTestBtn_clicked();