diff options
author | flow <flowlnlnln@gmail.com> | 2022-12-10 06:34:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-10 06:34:18 -0800 |
commit | 4a13d72997d4ed4d7f0df72c80c6e0aaabfea1e0 (patch) | |
tree | 374f6d2a4d37cd1a0b1f2c31480f236ad9822a08 /launcher/ui/pages/modplatform/flame/FlamePage.cpp | |
parent | 590875d022c58709b3bfb5e78aafa2318fe009d1 (diff) | |
parent | 34230bfcf415b4ad314d2534e09b40058ef9eaa2 (diff) | |
download | PrismLauncher-4a13d72997d4ed4d7f0df72c80c6e0aaabfea1e0.tar.gz PrismLauncher-4a13d72997d4ed4d7f0df72c80c6e0aaabfea1e0.tar.bz2 PrismLauncher-4a13d72997d4ed4d7f0df72c80c6e0aaabfea1e0.zip |
Merge pull request #32 from flowln/modpack_update_page
Closes https://github.com/PrismLauncher/PrismLauncher/issues/180
Closes https://github.com/PrismLauncher/PrismLauncher/issues/170
Diffstat (limited to 'launcher/ui/pages/modplatform/flame/FlamePage.cpp')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlamePage.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp index a65b6585..f9ac4a78 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, std::move(extra_info))); QString editedLogoName; editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); listModel->getLogo(current.logoName, current.logoUrl, @@ -211,11 +217,18 @@ void FlamePage::suggestCurrent() void FlamePage::onVersionSelectionChanged(QString data) { - if (data.isNull() || data.isEmpty()) { - selectedVersion = ""; + bool is_blocked = false; + ui->versionSelectionBox->currentData().toInt(&is_blocked); + + if (data.isNull() || data.isEmpty() || is_blocked) { + 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(); } |