Merge pull request #205 from timoreo22/fix-version-select
Fixed wrong version info
This commit is contained in:
commit
8bdd2befe9
@ -118,7 +118,10 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second) {
|
|||||||
.arg(addonId),
|
.arg(addonId),
|
||||||
response));
|
response));
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response] {
|
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId] {
|
||||||
|
if(addonId != current.addonId){
|
||||||
|
return; //wrong request
|
||||||
|
}
|
||||||
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) {
|
||||||
|
@ -109,13 +109,16 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
if (current.versionsLoaded == false)
|
if (current.versionsLoaded == false)
|
||||||
{
|
{
|
||||||
qDebug() << "Loading flame modpack versions";
|
qDebug() << "Loading flame modpack versions";
|
||||||
NetJob *netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name), APPLICATION->network());
|
auto netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name), APPLICATION->network());
|
||||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
auto response = new 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));
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response]
|
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]
|
||||||
{
|
{
|
||||||
|
if(addonId != current.addonId){
|
||||||
|
return; //wrong request
|
||||||
|
}
|
||||||
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) {
|
||||||
@ -140,6 +143,11 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
|
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
});
|
});
|
||||||
|
QObject::connect(netJob, &NetJob::finished, this, [response, netJob]
|
||||||
|
{
|
||||||
|
netJob->deleteLater();
|
||||||
|
delete response;
|
||||||
|
});
|
||||||
netJob->start();
|
netJob->start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -103,7 +103,10 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second) {
|
|||||||
QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId),
|
QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId),
|
||||||
response));
|
response));
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response] {
|
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId] {
|
||||||
|
if(addonId != current.addonId){
|
||||||
|
return;
|
||||||
|
}
|
||||||
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