GH-992 Add a transaction/locking mechanism to settings objects

This can cut the FTB loading by ~66% - worth it, but not ideal.
Real solution will have to be implemented later.
This commit is contained in:
Petr Mrázek
2015-05-23 16:07:47 +02:00
parent 0e0ddf5494
commit ce99fabe13
14 changed files with 102 additions and 41 deletions

View File

@ -138,7 +138,7 @@ ConsoleWindow::ConsoleWindow(BaseProcess *process, QWidget *parent)
setMayClose(false);
if (m_proc->instance()->settings().get("ShowConsole").toBool())
if (m_proc->instance()->settings()->get("ShowConsole").toBool())
{
show();
}
@ -225,7 +225,7 @@ void ConsoleWindow::onEnded(InstancePtr instance, int code, QProcess::ExitStatus
bool peacefulExit = code == 0 && status != QProcess::CrashExit;
m_killButton->setEnabled(false);
setMayClose(true);
if (instance->settings().get("AutoCloseConsole").toBool())
if (instance->settings()->get("AutoCloseConsole").toBool())
{
if (peacefulExit)
{

View File

@ -1548,7 +1548,7 @@ void MainWindow::instanceActivated(QModelIndex index)
if (!inst)
return;
JavaCommon::checkJVMArgs(inst->settings().get("JvmArgs").toString(), this);
JavaCommon::checkJVMArgs(inst->settings()->get("JvmArgs").toString(), this);
doLaunch();
}
@ -1557,7 +1557,7 @@ void MainWindow::on_actionLaunchInstance_triggered()
{
if (m_selectedInstance)
{
JavaCommon::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this);
JavaCommon::checkJVMArgs(m_selectedInstance->settings()->get("JvmArgs").toString(), this);
doLaunch();
}
}
@ -1566,7 +1566,7 @@ void MainWindow::on_actionLaunchInstanceOffline_triggered()
{
if (m_selectedInstance)
{
JavaCommon::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this);
JavaCommon::checkJVMArgs(m_selectedInstance->settings()->get("JvmArgs").toString(), this);
doLaunch(false);
}
}

View File

@ -14,7 +14,7 @@
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
{
m_settings = &(inst->settings());
m_settings = inst->settings();
ui->setupUi(this);
loadSettings();
}

View File

@ -69,6 +69,6 @@ private slots:
private:
Ui::InstanceSettingsPage *ui;
BaseInstance *m_instance;
SettingsObject *m_settings;
SettingsObjectPtr m_settings;
QObjectPtr<JavaCommon::TestCheck> checker;
};