diff options
author | timoreo <timo.oreo34@gmail.com> | 2022-02-04 16:24:19 +0100 |
---|---|---|
committer | timoreo <timo.oreo34@gmail.com> | 2022-02-04 16:24:19 +0100 |
commit | 86935068f522dedbb6673afd7075f156648abbb6 (patch) | |
tree | d9b535e408b28f38d47c0cb877654fab01b98b81 /launcher/ui/pages/modplatform/flame/FlameModPage.cpp | |
parent | 00e12b776bbdc3db5bc8456b046117218ad12b83 (diff) | |
download | PrismLauncher-86935068f522dedbb6673afd7075f156648abbb6.tar.gz PrismLauncher-86935068f522dedbb6673afd7075f156648abbb6.tar.bz2 PrismLauncher-86935068f522dedbb6673afd7075f156648abbb6.zip |
Fix wrong mod file name
Diffstat (limited to 'launcher/ui/pages/modplatform/flame/FlameModPage.cpp')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlameModPage.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp index 80f3de19..a816c681 100644 --- a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp @@ -140,14 +140,15 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second) auto packProfile = ((MinecraftInstance *)m_instance)->getPackProfile(); QString mcVersion = packProfile->getComponentVersion("net.minecraft"); QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge"; - for(const auto& version : current.versions) { + for(int i = 0; i < current.versions.size(); i++) { + auto version = current.versions[i]; if(!version.mcVersion.contains(mcVersion)){ continue; } - ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl)); + ui->versionSelectionBox->addItem(version.version, QVariant(i)); } if(ui->versionSelectionBox->count() == 0){ - ui->versionSelectionBox->addItem(tr("No Valid Version found!"), QVariant("")); + ui->versionSelectionBox->addItem(tr("No Valid Version found!"), QVariant(-1)); } suggestCurrent(); @@ -156,11 +157,11 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second) } else { - for(auto version : current.versions) { - ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl)); + for(int i = 0; i < current.versions.size(); i++) { + ui->versionSelectionBox->addItem(current.versions[i].version, QVariant(i)); } if(ui->versionSelectionBox->count() == 0){ - ui->versionSelectionBox->addItem(tr("No Valid Version found!"), QVariant("")); + ui->versionSelectionBox->addItem(tr("No Valid Version found!"), QVariant(-1)); } suggestCurrent(); } @@ -173,22 +174,23 @@ void FlameModPage::suggestCurrent() return; } - if (selectedVersion.isEmpty()) + if (selectedVersion == -1) { dialog->setSuggestedMod(); return; } - dialog->setSuggestedMod(current.name, new ModDownloadTask(selectedVersion, current.versions.at(0).fileName ,dialog->mods)); + auto version = current.versions[selectedVersion]; + dialog->setSuggestedMod(current.name, new ModDownloadTask(version.downloadUrl, version.fileName , dialog->mods)); } void FlameModPage::onVersionSelectionChanged(QString data) { if(data.isNull() || data.isEmpty()) { - selectedVersion = ""; + selectedVersion = -1; return; } - selectedVersion = ui->versionSelectionBox->currentData().toString(); + selectedVersion = ui->versionSelectionBox->currentData().toInt(); suggestCurrent(); } |