No end in sight :<

This commit is contained in:
Petr Mrázek 2014-03-03 01:44:07 +01:00
parent 29cdc9364b
commit d66f2500a6
3 changed files with 27 additions and 19 deletions

View File

@ -175,6 +175,7 @@ void OneSixModEditDialog::on_moveLibraryUpBtn_clicked()
order[ourId] = ourNewOrder; order[ourId] = ourNewOrder;
order[sortedOrder[sortedOrders[ourIndex - 1]]] = ourOrder; order[sortedOrder[sortedOrders[ourIndex - 1]]] = ourOrder;
// FIXME: why is GUI code doing this in particular? why isn't this part of a model?
if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst)) if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst))
{ {
QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order")); QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order"));
@ -185,6 +186,8 @@ void OneSixModEditDialog::on_moveLibraryUpBtn_clicked()
ui->libraryTreeView->selectionModel()->select(m_version->index(ourRow - 1), QItemSelectionModel::SelectCurrent); ui->libraryTreeView->selectionModel()->select(m_version->index(ourRow - 1), QItemSelectionModel::SelectCurrent);
} }
} }
// FIXME: WHY IS THIS DUPLICATED?
void OneSixModEditDialog::on_moveLibraryDownBtn_clicked() void OneSixModEditDialog::on_moveLibraryDownBtn_clicked()
{ {
QMap<QString, int> order = getExistingOrder(); QMap<QString, int> order = getExistingOrder();
@ -212,6 +215,7 @@ void OneSixModEditDialog::on_moveLibraryDownBtn_clicked()
order[ourId] = ourNewOrder; order[ourId] = ourNewOrder;
order[sortedOrder[sortedOrders[ourIndex + 1]]] = ourOrder; order[sortedOrder[sortedOrders[ourIndex + 1]]] = ourOrder;
// FIXME: why is GUI code doing this in particular? why isn't this part of a model?
if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst)) if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst))
{ {
QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order")); QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order"));

View File

@ -130,29 +130,32 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
} while(0); } while(0);
// some final touches // some final touches
finalizeVersion();
}
void OneSixVersionBuilder::finalizeVersion()
{
if (m_version->assets.isEmpty())
{ {
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->assets = "legacy"; m_version->minecraftArguments = " ${auth_player_name} ${auth_session}";
} }
if (m_version->minecraftArguments.isEmpty()) else if (toCompare == "username_session")
{ {
QString toCompare = m_version->processArguments.toLower(); m_version->minecraftArguments =
if (toCompare == "legacy") "--username ${auth_player_name} --session ${auth_session}";
{ }
m_version->minecraftArguments = " ${auth_player_name} ${auth_session}"; else if (toCompare == "username_session_version")
} {
else if (toCompare == "username_session") m_version->minecraftArguments = "--username ${auth_player_name} "
{ "--session ${auth_session} "
m_version->minecraftArguments = "--version ${profile_name}";
"--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}";
}
} }
} }
} }

View File

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