diff options
Diffstat (limited to 'launcher/ui/pages/modplatform/flame')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlamePage.cpp | 17 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlamePage.h | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp index a65b6585..d288a869 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp @@ -197,12 +197,18 @@ void FlamePage::suggestCurrent() return; } - if (selectedVersion.isEmpty() || selectedVersion == "-1") { + if (m_selected_version_index == -1) { dialog->setSuggestedPack(); return; } - dialog->setSuggestedPack(current.name, new InstanceImportTask(selectedVersion,this)); + auto version = current.versions.at(m_selected_version_index); + + QMap<QString, QString> extra_info; + extra_info.insert("pack_id", QString::number(current.addonId)); + extra_info.insert("pack_version_id", QString::number(version.fileId)); + + dialog->setSuggestedPack(current.name, new InstanceImportTask(version.downloadUrl, this, extra_info)); QString editedLogoName; editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); listModel->getLogo(current.logoName, current.logoUrl, @@ -212,10 +218,13 @@ void FlamePage::suggestCurrent() void FlamePage::onVersionSelectionChanged(QString data) { if (data.isNull() || data.isEmpty()) { - selectedVersion = ""; + m_selected_version_index = -1; return; } - selectedVersion = ui->versionSelectionBox->currentData().toString(); + + m_selected_version_index = ui->versionSelectionBox->currentIndex(); + Q_ASSERT(current.versions.at(m_selected_version_index).downloadUrl == ui->versionSelectionBox->currentData().toString()); + suggestCurrent(); } diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.h b/launcher/ui/pages/modplatform/flame/FlamePage.h index 8130e416..8bdca38e 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.h +++ b/launcher/ui/pages/modplatform/flame/FlamePage.h @@ -99,5 +99,5 @@ private: Flame::ListModel* listModel = nullptr; Flame::IndexedPack current; - QString selectedVersion; + int m_selected_version_index = -1; }; |