Save/restore settings dialog (and instance specific settings) window geometry

This commit is contained in:
Sky
2014-01-02 02:20:34 +00:00
parent 7f89da2043
commit eb4e7d3f67
5 changed files with 38 additions and 4 deletions

View File

@ -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."));
}
}
}