GH-1003 Fix settings dialog delays

This commit is contained in:
Petr Mrázek 2015-05-26 08:14:33 +02:00
parent 8fb5d4add3
commit c1c23e47a7
7 changed files with 18 additions and 24 deletions

View File

@ -1382,8 +1382,11 @@ void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QStrin
auto provider = std::dynamic_pointer_cast<BasePageProvider>(raw_provider); auto provider = std::dynamic_pointer_cast<BasePageProvider>(raw_provider);
if(!provider) if(!provider)
return; return;
{
SettingsObject::Lock lock(MMC->settings());
PageDialog dlg(provider, open_page, parent); PageDialog dlg(provider, open_page, parent);
dlg.exec(); dlg.exec();
}
} }
void ShowInstancePageDialog(InstancePtr instance, QWidget * parent, QString open_page = QString()) void ShowInstancePageDialog(InstancePtr instance, QWidget * parent, QString open_page = QString())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -213,26 +213,27 @@ InstancePtr createInstance(SettingsObjectPtr globalSettings, QMap<QString, QStri
{ {
m_settings->set("InstanceType", "LegacyFTB"); m_settings->set("InstanceType", "LegacyFTB");
inst.reset(new LegacyFTBInstance(globalSettings, m_settings, record.instanceDir)); inst.reset(new LegacyFTBInstance(globalSettings, m_settings, record.instanceDir));
inst->setIntendedVersionId(mcVersion->descriptor());
} }
else else
{ {
m_settings->set("InstanceType", "OneSixFTB"); m_settings->set("InstanceType", "OneSixFTB");
inst.reset(new OneSixFTBInstance(globalSettings, m_settings, record.instanceDir)); inst.reset(new OneSixFTBInstance(globalSettings, m_settings, record.instanceDir));
}
// initialize
{
SettingsObject::Lock lock(inst->settings());
inst->setIntendedVersionId(mcVersion->descriptor()); inst->setIntendedVersionId(mcVersion->descriptor());
inst->init(); inst->init();
}
inst->setGroupInitial("FTB"); inst->setGroupInitial("FTB");
inst->setName(record.name); inst->setName(record.name);
inst->setIconKey(record.iconKey); inst->setIconKey(record.iconKey);
inst->setIntendedVersionId(record.mcVersion);
inst->setNotes(record.description); inst->setNotes(record.description);
qDebug() << "Post-Process " << record.instanceDir; qDebug() << "Post-Process " << record.instanceDir;
if (!InstanceList::continueProcessInstance(inst, InstanceList::NoCreateError, record.instanceDir, groupMap)) if (!InstanceList::continueProcessInstance(inst, InstanceList::NoCreateError, record.instanceDir, groupMap))
{ {
return nullptr; return nullptr;
} }
}
return inst; return inst;
} }