GH-992 GH-997 Do not rewrite values when loading FTB packs

name, icon and notes won't be overwritten when loading FTB packs
this also eliminates the file saving delay from setting the values
This commit is contained in:
Petr Mrázek 2015-05-25 07:35:43 +02:00
parent 09673cc16e
commit 185ff238c2
2 changed files with 19 additions and 1 deletions

View File

@ -153,18 +153,27 @@ qint64 BaseInstance::lastLaunch() const
void BaseInstance::setLastLaunch(qint64 val) void BaseInstance::setLastLaunch(qint64 val)
{ {
//FIXME: if no change, do not set. setting involves saving a file.
m_settings->set("lastLaunchTime", val); m_settings->set("lastLaunchTime", val);
emit propertiesChanged(this); emit propertiesChanged(this);
} }
void BaseInstance::setGroupInitial(QString val) void BaseInstance::setGroupInitial(QString val)
{ {
if(m_group == val)
{
return;
}
m_group = val; m_group = val;
emit propertiesChanged(this); emit propertiesChanged(this);
} }
void BaseInstance::setGroupPost(QString val) void BaseInstance::setGroupPost(QString val)
{ {
if(m_group == val)
{
return;
}
setGroupInitial(val); setGroupInitial(val);
emit groupChanged(); emit groupChanged();
} }
@ -176,6 +185,7 @@ QString BaseInstance::group() const
void BaseInstance::setNotes(QString val) void BaseInstance::setNotes(QString val)
{ {
//FIXME: if no change, do not set. setting involves saving a file.
m_settings->set("notes", val); m_settings->set("notes", val);
} }
@ -186,6 +196,7 @@ QString BaseInstance::notes() const
void BaseInstance::setIconKey(QString val) void BaseInstance::setIconKey(QString val)
{ {
//FIXME: if no change, do not set. setting involves saving a file.
m_settings->set("iconKey", val); m_settings->set("iconKey", val);
emit propertiesChanged(this); emit propertiesChanged(this);
} }
@ -197,6 +208,7 @@ QString BaseInstance::iconKey() const
void BaseInstance::setName(QString val) void BaseInstance::setName(QString val)
{ {
//FIXME: if no change, do not set. setting involves saving a file.
m_settings->set("name", val); m_settings->set("name", val);
emit propertiesChanged(this); emit propertiesChanged(this);
} }

View File

@ -161,13 +161,19 @@ InstancePtr loadInstance(SettingsObjectPtr globalSettings, QMap<QString, QString
inst->init(); inst->init();
qDebug() << "Init " << record.instanceDir; qDebug() << "Init " << record.instanceDir;
inst->setGroupInitial("FTB"); inst->setGroupInitial("FTB");
/**
* FIXME: this does not respect the user's preferences. BUT, it would work nicely with the planned pack support
* -> instead of changing the user values, change pack values (defaults you can look at and revert to)
*/
/*
inst->setName(record.name); inst->setName(record.name);
inst->setIconKey(record.iconKey); inst->setIconKey(record.iconKey);
inst->setNotes(record.description);
*/
if (inst->intendedVersionId() != record.mcVersion) if (inst->intendedVersionId() != record.mcVersion)
{ {
inst->setIntendedVersionId(record.mcVersion); inst->setIntendedVersionId(record.mcVersion);
} }
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))
{ {