remove duplicate code from net folder
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
330c95e55b
commit
c07260e836
28 changed files with 72 additions and 189 deletions
|
@ -103,7 +103,7 @@ void Flame::FileResolvingTask::netJobFinished()
|
|||
auto url = QString("https://api.modrinth.com/v2/version_file/%1?algorithm=sha1").arg(hash);
|
||||
auto output = std::make_shared<QByteArray>();
|
||||
auto dl = Net::ApiDownload::makeByteArray(QUrl(url), output);
|
||||
QObject::connect(dl.get(), &Net::ApiDownload::succeeded, [&out]() { out.resolved = true; });
|
||||
QObject::connect(dl.get(), &Task::succeeded, [&out]() { out.resolved = true; });
|
||||
|
||||
m_checkJob->addNetAction(dl);
|
||||
blockedProjects.insert(&out, output);
|
||||
|
@ -175,7 +175,7 @@ void Flame::FileResolvingTask::modrinthCheckFinished()
|
|||
auto url = QString("https://api.curseforge.com/v1/mods/%1").arg(projectId);
|
||||
auto dl = Net::ApiDownload::makeByteArray(url, output);
|
||||
qDebug() << "Fetching url slug for file:" << mod->fileName;
|
||||
QObject::connect(dl.get(), &Net::ApiDownload::succeeded, [block, index, output]() {
|
||||
QObject::connect(dl.get(), &Task::succeeded, [block, index, output]() {
|
||||
auto mod = block->at(index); // use the shared_ptr so it is captured and only freed when we are done
|
||||
auto json = QJsonDocument::fromJson(*output);
|
||||
auto base =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue