Finalize version on reload.

This commit is contained in:
Petr Mrázek 2014-03-19 23:23:59 +01:00
parent 1705832feb
commit 4901985db6
4 changed files with 30 additions and 29 deletions

View File

@ -137,35 +137,10 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
} while (0);
// some final touches
finalizeVersion();
m_version->finalize();
}
void OneSixVersionBuilder::finalizeVersion()
{
if (m_version->assets.isEmpty())
{
m_version->assets = "legacy";
}
if (m_version->minecraftArguments.isEmpty())
{
QString toCompare = m_version->processArguments.toLower();
if (toCompare == "legacy")
{
m_version->minecraftArguments = " ${auth_player_name} ${auth_session}";
}
else if (toCompare == "username_session")
{
m_version->minecraftArguments =
"--username ${auth_player_name} --session ${auth_session}";
}
else if (toCompare == "username_session_version")
{
m_version->minecraftArguments = "--username ${auth_player_name} "
"--session ${auth_session} "
"--version ${profile_name}";
}
}
}
void OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj)
{

View File

@ -41,7 +41,6 @@ private:
void buildInternal(const bool onlyVanilla, const QStringList &external);
void readJsonAndApply(const QJsonObject &obj);
void finalizeVersion();
VersionFilePtr parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder,
bool isFTB = false);

View File

@ -310,9 +310,35 @@ void VersionFinal::reapply(const bool alreadyReseting)
file->applyTo(this);
}
versionFiles.swap(newVersionFiles);
finalize();
if (!alreadyReseting)
{
endResetModel();
}
}
void VersionFinal::finalize()
{
if (assets.isEmpty())
{
assets = "legacy";
}
if (minecraftArguments.isEmpty())
{
QString toCompare = processArguments.toLower();
if (toCompare == "legacy")
{
minecraftArguments = " ${auth_player_name} ${auth_session}";
}
else if (toCompare == "username_session")
{
minecraftArguments = "--username ${auth_player_name} --session ${auth_session}";
}
else if (toCompare == "username_session_version")
{
minecraftArguments = "--username ${auth_player_name} "
"--session ${auth_session} "
"--version ${profile_name}";
}
}
}

View File

@ -56,6 +56,7 @@ public:
// clears and reapplies all version files
void reapply(const bool alreadyReseting = false);
void finalize();
public
slots: