Save/restore settings dialog (and instance specific settings) window geometry
This commit is contained in:
parent
7f89da2043
commit
eb4e7d3f67
@ -427,6 +427,8 @@ void MultiMC::initGlobalSettings()
|
|||||||
|
|
||||||
m_settings->registerSetting("ConsoleWindowState", "");
|
m_settings->registerSetting("ConsoleWindowState", "");
|
||||||
m_settings->registerSetting("ConsoleWindowGeometry", "");
|
m_settings->registerSetting("ConsoleWindowGeometry", "");
|
||||||
|
|
||||||
|
m_settings->registerSetting("SettingsGeometry", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiMC::initHttpMetaCache()
|
void MultiMC::initHttpMetaCache()
|
||||||
|
@ -36,6 +36,9 @@ InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent)
|
|||||||
{
|
{
|
||||||
MultiMCPlatform::fixWM_CLASS(this);
|
MultiMCPlatform::fixWM_CLASS(this);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray()));
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +50,13 @@ InstanceSettings::~InstanceSettings()
|
|||||||
void InstanceSettings::showEvent(QShowEvent *ev)
|
void InstanceSettings::showEvent(QShowEvent *ev)
|
||||||
{
|
{
|
||||||
QDialog::showEvent(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)
|
void InstanceSettings::on_customCommandsGroupBox_toggled(bool state)
|
||||||
@ -57,12 +66,16 @@ void InstanceSettings::on_customCommandsGroupBox_toggled(bool state)
|
|||||||
|
|
||||||
void InstanceSettings::on_buttonBox_accepted()
|
void InstanceSettings::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
|
MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstanceSettings::on_buttonBox_rejected()
|
void InstanceSettings::on_buttonBox_rejected()
|
||||||
{
|
{
|
||||||
|
MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
|
||||||
|
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *);
|
||||||
|
virtual void closeEvent(QCloseEvent *);
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void on_customCommandsGroupBox_toggled(bool arg1);
|
void on_customCommandsGroupBox_toggled(bool arg1);
|
||||||
|
@ -44,6 +44,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
|
|||||||
ui->jsonEditorTextBox->setClearButtonEnabled(true);
|
ui->jsonEditorTextBox->setClearButtonEnabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray()));
|
||||||
|
|
||||||
loadSettings(MMC->settings().get());
|
loadSettings(MMC->settings().get());
|
||||||
updateCheckboxStuff();
|
updateCheckboxStuff();
|
||||||
}
|
}
|
||||||
@ -55,7 +57,13 @@ SettingsDialog::~SettingsDialog()
|
|||||||
void SettingsDialog::showEvent(QShowEvent *ev)
|
void SettingsDialog::showEvent(QShowEvent *ev)
|
||||||
{
|
{
|
||||||
QDialog::showEvent(ev);
|
QDialog::showEvent(ev);
|
||||||
adjustSize();
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::closeEvent(QCloseEvent *ev)
|
||||||
|
{
|
||||||
|
MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
|
||||||
|
|
||||||
|
QDialog::closeEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::updateCheckboxStuff()
|
void SettingsDialog::updateCheckboxStuff()
|
||||||
@ -180,6 +188,13 @@ void SettingsDialog::on_maximizedCheckBox_clicked(bool checked)
|
|||||||
void SettingsDialog::on_buttonBox_accepted()
|
void SettingsDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
applySettings(MMC->settings().get());
|
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)
|
void SettingsDialog::applySettings(SettingsObject *s)
|
||||||
|
@ -41,7 +41,8 @@ public:
|
|||||||
void loadSettings(SettingsObject *s);
|
void loadSettings(SettingsObject *s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *ev);
|
||||||
|
virtual void closeEvent(QCloseEvent *ev);
|
||||||
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
@ -64,6 +65,8 @@ slots:
|
|||||||
|
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
|
|
||||||
|
void on_buttonBox_rejected();
|
||||||
|
|
||||||
void on_javaDetectBtn_clicked();
|
void on_javaDetectBtn_clicked();
|
||||||
|
|
||||||
void on_javaTestBtn_clicked();
|
void on_javaTestBtn_clicked();
|
||||||
|
Loading…
Reference in New Issue
Block a user