NOISSUE fix build and change how NetJob is used
Feed it network upfront...
This commit is contained in:
@ -133,10 +133,10 @@ AboutDialog::~AboutDialog()
|
||||
|
||||
void AboutDialog::loadPatronList()
|
||||
{
|
||||
netJob = new NetJob("Patreon Patron List");
|
||||
netJob = new NetJob("Patreon Patron List", APPLICATION->network());
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl("https://files.multimc.org/patrons.txt"), &dataSink));
|
||||
connect(netJob.get(), &NetJob::succeeded, this, &AboutDialog::patronListLoaded);
|
||||
netJob->start(APPLICATION->network());
|
||||
netJob->start();
|
||||
}
|
||||
|
||||
void AboutDialog::patronListLoaded()
|
||||
|
@ -34,7 +34,7 @@ UpdateDialog::~UpdateDialog()
|
||||
void UpdateDialog::loadChangelog()
|
||||
{
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
dljob.reset(new NetJob("Changelog"));
|
||||
dljob = new NetJob("Changelog", APPLICATION->network());
|
||||
QString url;
|
||||
if(channel == "stable")
|
||||
{
|
||||
@ -49,7 +49,7 @@ void UpdateDialog::loadChangelog()
|
||||
dljob->addNetAction(Net::Download::makeByteArray(QUrl(url), &changelogData));
|
||||
connect(dljob.get(), &NetJob::succeeded, this, &UpdateDialog::changelogLoaded);
|
||||
connect(dljob.get(), &NetJob::failed, this, &UpdateDialog::changelogFailed);
|
||||
dljob->start(APPLICATION->network());
|
||||
dljob->start();
|
||||
}
|
||||
|
||||
QString reprocessMarkdown(QByteArray markdown)
|
||||
|
@ -304,7 +304,7 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
return;
|
||||
|
||||
QList<ScreenShot::Ptr> uploaded;
|
||||
auto job = NetJob::Ptr(new NetJob("Screenshot Upload"));
|
||||
auto job = NetJob::Ptr(new NetJob("Screenshot Upload", APPLICATION->network()));
|
||||
if(selection.size() < 2)
|
||||
{
|
||||
auto item = selection.at(0);
|
||||
@ -315,7 +315,6 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
m_uploadActive = true;
|
||||
ProgressDialog dialog(this);
|
||||
|
||||
job->setNetwork(APPLICATION->network());
|
||||
if(dialog.execWithTask(job.get()) != QDialog::Accepted)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"),
|
||||
@ -347,19 +346,21 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
job->addNetAction(ImgurUpload::make(screenshot));
|
||||
}
|
||||
SequentialTask task;
|
||||
auto albumTask = NetJob::Ptr(new NetJob("Imgur Album Creation"));
|
||||
auto albumTask = NetJob::Ptr(new NetJob("Imgur Album Creation", APPLICATION->network()));
|
||||
auto imgurAlbum = ImgurAlbumCreation::make(uploaded);
|
||||
albumTask->addNetAction(imgurAlbum);
|
||||
job->setNetwork(APPLICATION->network());
|
||||
task.addTask(job);
|
||||
albumTask->setNetwork(APPLICATION->network());
|
||||
task.addTask(albumTask);
|
||||
m_uploadActive = true;
|
||||
ProgressDialog prog(this);
|
||||
if (prog.execWithTask(&task) != QDialog::Accepted)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"),
|
||||
tr("Unknown error"), QMessageBox::Warning)->exec();
|
||||
CustomMessageBox::selectable(
|
||||
this,
|
||||
tr("Failed to upload screenshots!"),
|
||||
tr("Unknown error"),
|
||||
QMessageBox::Warning
|
||||
)->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,11 +86,11 @@ void ListModel::request()
|
||||
modpacks.clear();
|
||||
endResetModel();
|
||||
|
||||
auto *netJob = new NetJob("Atl::Request");
|
||||
auto *netJob = new NetJob("Atl::Request", APPLICATION->network());
|
||||
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/json/packsnew.json");
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start(APPLICATION->network());
|
||||
jobPtr->start();
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::requestFinished);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &ListModel::requestFailed);
|
||||
@ -183,7 +183,7 @@ void ListModel::requestLogo(QString file, QString url)
|
||||
}
|
||||
|
||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
||||
NetJob *job = new NetJob(QString("ATLauncher Icon Download %1").arg(file));
|
||||
NetJob *job = new NetJob(QString("ATLauncher Icon Download %1").arg(file), APPLICATION->network());
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
@ -201,7 +201,7 @@ void ListModel::requestLogo(QString file, QString url)
|
||||
emit logoFailed(file);
|
||||
});
|
||||
|
||||
job->start(APPLICATION->network());
|
||||
job->start();
|
||||
|
||||
m_loadingLogos.append(file);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
||||
}
|
||||
|
||||
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));
|
||||
NetJob *job = new NetJob(QString("Flame Icon Download %1").arg(logo), APPLICATION->network());
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
@ -118,7 +118,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
||||
emit logoFailed(logo);
|
||||
});
|
||||
|
||||
job->start(APPLICATION->network());
|
||||
job->start();
|
||||
|
||||
m_loadingLogos.append(logo);
|
||||
}
|
||||
@ -158,7 +158,7 @@ void ListModel::fetchMore(const QModelIndex& parent)
|
||||
|
||||
void ListModel::performPaginatedSearch()
|
||||
{
|
||||
NetJob *netJob = new NetJob("Flame::Search");
|
||||
NetJob *netJob = new NetJob("Flame::Search", APPLICATION->network());
|
||||
auto searchUrl = QString(
|
||||
"https://addons-ecs.forgesvc.net/api/v2/addon/search?"
|
||||
"categoryId=0&"
|
||||
@ -171,7 +171,7 @@ void ListModel::performPaginatedSearch()
|
||||
).arg(nextSearchOffset).arg(currentSearchTerm).arg(currentSort);
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start(APPLICATION->network());
|
||||
jobPtr->start();
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
||||
if (current.versionsLoaded == false)
|
||||
{
|
||||
qDebug() << "Loading flame modpack versions";
|
||||
NetJob *netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name));
|
||||
NetJob *netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name), APPLICATION->network());
|
||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
||||
int addonId = current.addonId;
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response.get()));
|
||||
@ -140,7 +140,7 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
||||
|
||||
suggestCurrent();
|
||||
});
|
||||
netJob->start(APPLICATION->network());
|
||||
netJob->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -107,11 +107,11 @@ void ListModel::request()
|
||||
modpacks.clear();
|
||||
endResetModel();
|
||||
|
||||
auto *netJob = new NetJob("Ftb::Request");
|
||||
auto *netJob = new NetJob("Ftb::Request", APPLICATION->network());
|
||||
auto url = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/all");
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start(APPLICATION->network());
|
||||
jobPtr->start();
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::requestFinished);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &ListModel::requestFailed);
|
||||
@ -150,12 +150,11 @@ void ListModel::requestFailed(QString reason)
|
||||
|
||||
void ListModel::requestPack()
|
||||
{
|
||||
auto *netJob = new NetJob("Ftb::Search");
|
||||
auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1")
|
||||
.arg(currentPack);
|
||||
auto *netJob = new NetJob("Ftb::Search", APPLICATION->network());
|
||||
auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1").arg(currentPack);
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start(APPLICATION->network());
|
||||
jobPtr->start();
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::packRequestFinished);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &ListModel::packRequestFailed);
|
||||
@ -271,7 +270,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
||||
|
||||
bool stale = entry->isStale();
|
||||
|
||||
NetJob *job = new NetJob(QString("FTB Icon Download %1").arg(logo));
|
||||
NetJob *job = new NetJob(QString("FTB Icon Download %1").arg(logo), APPLICATION->network());
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
@ -288,7 +287,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
||||
auto &newLogoEntry = m_logoMap[logo];
|
||||
newLogoEntry.downloadJob = job;
|
||||
newLogoEntry.fullpath = fullPath;
|
||||
job->start(APPLICATION->network());
|
||||
job->start();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ void ListModel::requestLogo(QString file)
|
||||
}
|
||||
|
||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
||||
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file));
|
||||
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file), APPLICATION->network());
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
@ -234,7 +234,7 @@ void ListModel::requestLogo(QString file)
|
||||
emit logoFailed(file);
|
||||
});
|
||||
|
||||
job->start(APPLICATION->network());
|
||||
job->start();
|
||||
|
||||
m_loadingLogos.append(file);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void Technic::ListModel::searchWithTerm(const QString& term)
|
||||
|
||||
void Technic::ListModel::performSearch()
|
||||
{
|
||||
NetJob *netJob = new NetJob("Technic::Search");
|
||||
NetJob *netJob = new NetJob("Technic::Search", APPLICATION->network());
|
||||
QString searchUrl = "";
|
||||
if (currentSearchTerm.isEmpty()) {
|
||||
searchUrl = "https://api.technicpack.net/trending?build=multimc";
|
||||
@ -104,7 +104,7 @@ void Technic::ListModel::performSearch()
|
||||
}
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start(APPLICATION->network());
|
||||
jobPtr->start();
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed);
|
||||
}
|
||||
@ -216,7 +216,7 @@ void Technic::ListModel::requestLogo(QString logo, QString url)
|
||||
}
|
||||
|
||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo));
|
||||
NetJob *job = new NetJob(QString("Technic Icon Download %1").arg(logo));
|
||||
NetJob *job = new NetJob(QString("Technic Icon Download %1").arg(logo), APPLICATION->network());
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
@ -231,7 +231,7 @@ void Technic::ListModel::requestLogo(QString logo, QString url)
|
||||
logoFailed(logo);
|
||||
});
|
||||
|
||||
job->start(APPLICATION->network());
|
||||
job->start();
|
||||
|
||||
m_loadingLogos.append(logo);
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ void TechnicPage::suggestCurrent()
|
||||
metadataLoaded();
|
||||
return;
|
||||
}
|
||||
|
||||
NetJob *netJob = new NetJob(QString("Technic::PackMeta(%1)").arg(current.name));
|
||||
|
||||
NetJob *netJob = new NetJob(QString("Technic::PackMeta(%1)").arg(current.name), APPLICATION->network());
|
||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
||||
QString slug = current.slug;
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.technicpack.net/modpack/%1?build=multimc").arg(slug), response.get()));
|
||||
@ -167,7 +167,7 @@ void TechnicPage::suggestCurrent()
|
||||
current.metadataLoaded = true;
|
||||
metadataLoaded();
|
||||
});
|
||||
netJob->start(APPLICATION->network());
|
||||
netJob->start();
|
||||
}
|
||||
|
||||
// expects current.metadataLoaded to be true
|
||||
|
Reference in New Issue
Block a user