diff options
Diffstat (limited to 'gui/dialogs')
-rw-r--r-- | gui/dialogs/InstanceSettings.cpp | 17 | ||||
-rw-r--r-- | gui/dialogs/InstanceSettings.h | 1 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.cpp | 17 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.h | 5 |
4 files changed, 36 insertions, 4 deletions
diff --git a/gui/dialogs/InstanceSettings.cpp b/gui/dialogs/InstanceSettings.cpp index e3f8a66b..edb4a921 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 1e7b9f6e..e296db4c 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 569c8f63..9362075e 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 bcf57a80..11fdb696 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(); |