GH-1003 add some save locking for dialog pages that deal with settings

This commit is contained in:
Petr Mrázek 2015-05-25 08:21:35 +02:00
parent 185ff238c2
commit 8fb5d4add3
7 changed files with 18 additions and 0 deletions

View File

@ -54,9 +54,12 @@ PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWid
void PageDialog::closeEvent(QCloseEvent *event)
{
qDebug() << "Paged dialog close requested";
if (m_container->requestClose(event))
{
qDebug() << "Paged dialog close approved";
MMC->settings()->set("PagedGeometry", saveGeometry().toBase64());
qDebug() << "Paged dialog geometry saved";
QDialog::closeEvent(event);
}
}

View File

@ -37,6 +37,8 @@ bool InstanceSettingsPage::apply()
void InstanceSettingsPage::applySettings()
{
SettingsObject::Lock lock(m_settings);
// Console
bool console = ui->consoleSettingsBox->isChecked();
m_settings->set("OverrideConsole", console);

View File

@ -61,6 +61,9 @@ void ExternalToolsPage::loadSettings()
void ExternalToolsPage::applySettings()
{
auto s = MMC->settings();
SettingsObject::Lock lock(s);
s->set("JProfilerPath", ui->jprofilerPathEdit->text());
s->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
s->set("MCEditPath", ui->mceditPathEdit->text());

View File

@ -58,6 +58,9 @@ bool JavaPage::apply()
void JavaPage::applySettings()
{
auto s = MMC->settings();
SettingsObject::Lock lock(s);
// Memory
s->set("MinMemAlloc", ui->minMemSpinBox->value());
s->set("MaxMemAlloc", ui->maxMemSpinBox->value());

View File

@ -62,6 +62,8 @@ void MinecraftPage::applySettings()
{
auto s = MMC->settings();
SettingsObject::Lock lock(s);
// Window Size
s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());

View File

@ -247,6 +247,9 @@ void MultiMCPage::refreshUpdateChannelDesc()
void MultiMCPage::applySettings()
{
auto s = MMC->settings();
SettingsObject::Lock lock(s);
// Language
s->set("Language",
ui->languageBox->itemData(ui->languageBox->currentIndex()).toLocale().bcp47Name());

View File

@ -57,6 +57,8 @@ void ProxyPage::applySettings()
{
auto s = MMC->settings();
SettingsObject::Lock lock(s);
// Proxy
QString proxyType = "None";
if (ui->proxyDefaultBtn->isChecked())