From d66f2500a6b4215a135f1e41802f7c7498375c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 3 Mar 2014 01:44:07 +0100 Subject: [PATCH] No end in sight :< --- gui/dialogs/OneSixModEditDialog.cpp | 4 +++ logic/OneSixVersionBuilder.cpp | 41 ++++++++++++++++------------- logic/OneSixVersionBuilder.h | 1 + 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp index d936f3f1..cc383993 100644 --- a/gui/dialogs/OneSixModEditDialog.cpp +++ b/gui/dialogs/OneSixModEditDialog.cpp @@ -175,6 +175,7 @@ void OneSixModEditDialog::on_moveLibraryUpBtn_clicked() order[ourId] = ourNewOrder; 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)) { 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); } } + +// FIXME: WHY IS THIS DUPLICATED? void OneSixModEditDialog::on_moveLibraryDownBtn_clicked() { QMap order = getExistingOrder(); @@ -212,6 +215,7 @@ void OneSixModEditDialog::on_moveLibraryDownBtn_clicked() order[ourId] = ourNewOrder; 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)) { QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order")); diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index 37467aef..879ff72e 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -130,29 +130,32 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi } while(0); // 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(); - 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}"; - } + 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}"; } } } diff --git a/logic/OneSixVersionBuilder.h b/logic/OneSixVersionBuilder.h index c5ef83f3..c48e8ec5 100644 --- a/logic/OneSixVersionBuilder.h +++ b/logic/OneSixVersionBuilder.h @@ -41,6 +41,7 @@ private: void buildInternal(const bool onlyVanilla, const QStringList &external); void readJsonAndApply(const QJsonObject &obj); + void finalizeVersion(); VersionFile parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder, bool isFTB = false); };