Fix wrong mod file name
This commit is contained in:
parent
00e12b776b
commit
86935068f5
@ -140,14 +140,15 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
auto packProfile = ((MinecraftInstance *)m_instance)->getPackProfile();
|
auto packProfile = ((MinecraftInstance *)m_instance)->getPackProfile();
|
||||||
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
||||||
QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge";
|
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)){
|
if(!version.mcVersion.contains(mcVersion)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl));
|
ui->versionSelectionBox->addItem(version.version, QVariant(i));
|
||||||
}
|
}
|
||||||
if(ui->versionSelectionBox->count() == 0){
|
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();
|
suggestCurrent();
|
||||||
@ -156,11 +157,11 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(auto version : current.versions) {
|
for(int i = 0; i < current.versions.size(); i++) {
|
||||||
ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl));
|
ui->versionSelectionBox->addItem(current.versions[i].version, QVariant(i));
|
||||||
}
|
}
|
||||||
if(ui->versionSelectionBox->count() == 0){
|
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();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
@ -173,22 +174,23 @@ void FlameModPage::suggestCurrent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedVersion.isEmpty())
|
if (selectedVersion == -1)
|
||||||
{
|
{
|
||||||
dialog->setSuggestedMod();
|
dialog->setSuggestedMod();
|
||||||
return;
|
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)
|
void FlameModPage::onVersionSelectionChanged(QString data)
|
||||||
{
|
{
|
||||||
if(data.isNull() || data.isEmpty())
|
if(data.isNull() || data.isEmpty())
|
||||||
{
|
{
|
||||||
selectedVersion = "";
|
selectedVersion = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedVersion = ui->versionSelectionBox->currentData().toString();
|
selectedVersion = ui->versionSelectionBox->currentData().toInt();
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
|
@ -63,5 +63,5 @@ private:
|
|||||||
FlameMod::ListModel* listModel = nullptr;
|
FlameMod::ListModel* listModel = nullptr;
|
||||||
FlameMod::IndexedPack current;
|
FlameMod::IndexedPack current;
|
||||||
|
|
||||||
QString selectedVersion;
|
int selectedVersion = -1;
|
||||||
};
|
};
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
#include "minecraft/MinecraftInstance.h"
|
#include "minecraft/MinecraftInstance.h"
|
||||||
#include "minecraft/PackProfile.h"
|
#include "minecraft/PackProfile.h"
|
||||||
#include "ModrinthPage.h"
|
#include "ModrinthPage.h"
|
||||||
|
#include "ui/dialogs/ModDownloadDialog.h"
|
||||||
#include <Json.h>
|
#include <Json.h>
|
||||||
|
|
||||||
#include <MMCStrings.h>
|
#include <MMCStrings.h>
|
||||||
#include <Version.h>
|
#include <Version.h>
|
||||||
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
|
||||||
namespace Modrinth {
|
namespace Modrinth {
|
||||||
@ -250,6 +252,12 @@ void Modrinth::ListModel::searchRequestFinished()
|
|||||||
|
|
||||||
void Modrinth::ListModel::searchRequestFailed(QString reason)
|
void Modrinth::ListModel::searchRequestFailed(QString reason)
|
||||||
{
|
{
|
||||||
|
if(jobPtr->first()->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409){
|
||||||
|
//409 Gone, notify user to update
|
||||||
|
QMessageBox::critical(nullptr, tr("Error"), tr("Modrinth API version too old!\nPlease update PolyMC!"));
|
||||||
|
//self-destruct
|
||||||
|
((ModDownloadDialog *)((ModrinthPage *)parent())->parentWidget())->reject();
|
||||||
|
}
|
||||||
jobPtr.reset();
|
jobPtr.reset();
|
||||||
|
|
||||||
if(searchState == ResetRequested) {
|
if(searchState == ResetRequested) {
|
||||||
|
@ -125,14 +125,15 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
auto packProfile = ((MinecraftInstance *)m_instance)->getPackProfile();
|
auto packProfile = ((MinecraftInstance *)m_instance)->getPackProfile();
|
||||||
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
||||||
QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge";
|
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) || !version.loaders.contains(loaderString)){
|
if(!version.mcVersion.contains(mcVersion) || !version.loaders.contains(loaderString)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl));
|
ui->versionSelectionBox->addItem(version.version, QVariant(i));
|
||||||
}
|
}
|
||||||
if(ui->versionSelectionBox->count() == 0){
|
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();
|
suggestCurrent();
|
||||||
@ -141,11 +142,11 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(auto version : current.versions) {
|
for(int i = 0; i < current.versions.size(); i++) {
|
||||||
ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl));
|
ui->versionSelectionBox->addItem(current.versions[i].version, QVariant(i));
|
||||||
}
|
}
|
||||||
if(ui->versionSelectionBox->count() == 0){
|
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();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
@ -158,22 +159,22 @@ void ModrinthPage::suggestCurrent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedVersion.isEmpty())
|
if (selectedVersion == -1)
|
||||||
{
|
{
|
||||||
dialog->setSuggestedMod();
|
dialog->setSuggestedMod();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto version = current.versions[selectedVersion];
|
||||||
dialog->setSuggestedMod(current.name, new ModDownloadTask(selectedVersion, current.versions.at(0).fileName ,dialog->mods));
|
dialog->setSuggestedMod(current.name, new ModDownloadTask(version.downloadUrl, version.fileName , dialog->mods));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModrinthPage::onVersionSelectionChanged(QString data)
|
void ModrinthPage::onVersionSelectionChanged(QString data)
|
||||||
{
|
{
|
||||||
if(data.isNull() || data.isEmpty())
|
if(data.isNull() || data.isEmpty())
|
||||||
{
|
{
|
||||||
selectedVersion = "";
|
selectedVersion = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedVersion = ui->versionSelectionBox->currentData().toString();
|
selectedVersion = ui->versionSelectionBox->currentData().toInt();
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
|
@ -63,5 +63,5 @@ private:
|
|||||||
Modrinth::ListModel* listModel = nullptr;
|
Modrinth::ListModel* listModel = nullptr;
|
||||||
Modrinth::IndexedPack current;
|
Modrinth::IndexedPack current;
|
||||||
|
|
||||||
QString selectedVersion;
|
int selectedVersion = -1;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user