Various fixes
This commit is contained in:
parent
975f77756d
commit
affc2521aa
@ -76,13 +76,14 @@ void FlameMod::loadIndexedPackVersions(FlameMod::IndexedPack & pack, QJsonArray
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
//this cannot check for the recent mcmod.toml formats
|
||||||
if(fname == "mcmod.info"){
|
if(fname == "mcmod.info"){
|
||||||
valid = true;
|
valid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!valid){
|
if(!valid || !hasFabric){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,8 @@ void ModFolderPage::on_actionInstall_mods_triggered()
|
|||||||
if(mdownload.exec()) {
|
if(mdownload.exec()) {
|
||||||
ModDownloadTask *task = mdownload.getTask();
|
ModDownloadTask *task = mdownload.getTask();
|
||||||
if (task) {
|
if (task) {
|
||||||
connect(task, &Task::failed, [this](QString reason) {
|
connect(task, &Task::failed, [this, task](QString reason) {
|
||||||
|
task->deleteLater();
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
});
|
});
|
||||||
connect(task, &Task::succeeded, [this, task]() {
|
connect(task, &Task::succeeded, [this, task]() {
|
||||||
@ -371,6 +372,7 @@ void ModFolderPage::on_actionInstall_mods_triggered()
|
|||||||
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'),
|
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'),
|
||||||
QMessageBox::Warning)->show();
|
QMessageBox::Warning)->show();
|
||||||
}
|
}
|
||||||
|
task->deleteLater();
|
||||||
});
|
});
|
||||||
ProgressDialog loadDialog(this);
|
ProgressDialog loadDialog(this);
|
||||||
loadDialog.setSkipButton(true, tr("Abort"));
|
loadDialog.setSkipButton(true, tr("Abort"));
|
||||||
|
@ -105,8 +105,9 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
auto fullPath = entry->getFullPath();
|
auto fullPath = entry->getFullPath();
|
||||||
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath]
|
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoLoaded(logo, QIcon(fullPath));
|
emit logoLoaded(logo, QIcon(fullPath));
|
||||||
if(waitingCallbacks.contains(logo))
|
if(waitingCallbacks.contains(logo))
|
||||||
{
|
{
|
||||||
@ -114,8 +115,9 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(job, &NetJob::failed, this, [this, logo]
|
QObject::connect(job, &NetJob::failed, this, [this, logo, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoFailed(logo);
|
emit logoFailed(logo);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -112,13 +112,14 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
if (!current.versionsLoaded)
|
if (!current.versionsLoaded)
|
||||||
{
|
{
|
||||||
qDebug() << "Loading flame mod versions";
|
qDebug() << "Loading flame mod versions";
|
||||||
NetJob *netJob = new NetJob(QString("Flame::ModVersions(%1)").arg(current.name), APPLICATION->network());
|
auto netJob = new NetJob(QString("Flame::ModVersions(%1)").arg(current.name), APPLICATION->network());
|
||||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
||||||
int addonId = current.addonId;
|
int addonId = current.addonId;
|
||||||
netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response.get()));
|
netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response.get()));
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response]
|
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, netJob]
|
||||||
{
|
{
|
||||||
|
netJob->deleteLater();
|
||||||
QJsonParseError parse_error;
|
QJsonParseError parse_error;
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
|
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
|
||||||
if(parse_error.error != QJsonParseError::NoError) {
|
if(parse_error.error != QJsonParseError::NoError) {
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
#include <Version.h>
|
#include <Version.h>
|
||||||
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
#include <RWStorage.h>
|
|
||||||
|
|
||||||
namespace Flame {
|
namespace Flame {
|
||||||
|
|
||||||
@ -100,12 +97,13 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
|
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
|
||||||
NetJob *job = new NetJob(QString("Flame Icon Download %1").arg(logo), APPLICATION->network());
|
auto job = new NetJob(QString("Flame Icon Download %1").arg(logo), APPLICATION->network());
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
auto fullPath = entry->getFullPath();
|
auto fullPath = entry->getFullPath();
|
||||||
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath]
|
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoLoaded(logo, QIcon(fullPath));
|
emit logoLoaded(logo, QIcon(fullPath));
|
||||||
if(waitingCallbacks.contains(logo))
|
if(waitingCallbacks.contains(logo))
|
||||||
{
|
{
|
||||||
@ -113,8 +111,9 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(job, &NetJob::failed, this, [this, logo]
|
QObject::connect(job, &NetJob::failed, this, [this, logo, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoFailed(logo);
|
emit logoFailed(logo);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,8 +105,9 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
auto fullPath = entry->getFullPath();
|
auto fullPath = entry->getFullPath();
|
||||||
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath]
|
QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoLoaded(logo, QIcon(fullPath));
|
emit logoLoaded(logo, QIcon(fullPath));
|
||||||
if(waitingCallbacks.contains(logo))
|
if(waitingCallbacks.contains(logo))
|
||||||
{
|
{
|
||||||
@ -114,8 +115,9 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(job, &NetJob::failed, this, [this, logo]
|
QObject::connect(job, &NetJob::failed, this, [this, logo, job]
|
||||||
{
|
{
|
||||||
|
job->deleteLater();
|
||||||
emit logoFailed(logo);
|
emit logoFailed(logo);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -110,14 +110,15 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
if (!current.versionsLoaded)
|
if (!current.versionsLoaded)
|
||||||
{
|
{
|
||||||
qDebug() << "Loading Modrinth mod versions";
|
qDebug() << "Loading Modrinth mod versions";
|
||||||
NetJob *netJob = new NetJob(QString("Modrinth::ModVersions(%1)").arg(current.name), APPLICATION->network());
|
auto netJob = new NetJob(QString("Modrinth::ModVersions(%1)").arg(current.name), APPLICATION->network());
|
||||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
||||||
QString addonId = current.addonId;
|
QString addonId = current.addonId;
|
||||||
addonId.remove(0,6);
|
addonId.remove(0,6);
|
||||||
netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.modrinth.com/api/v1/mod/%1/version").arg(addonId), response.get()));
|
netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.modrinth.com/api/v1/mod/%1/version").arg(addonId), response.get()));
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response]
|
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, netJob]
|
||||||
{
|
{
|
||||||
|
netJob->deleteLater();
|
||||||
QJsonParseError parse_error;
|
QJsonParseError parse_error;
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
|
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
|
||||||
if(parse_error.error != QJsonParseError::NoError) {
|
if(parse_error.error != QJsonParseError::NoError) {
|
||||||
|
Loading…
Reference in New Issue
Block a user