refactor: move "get versions" task from page to model
This seems more reasonable
This commit is contained in:
@ -97,6 +97,26 @@ void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallbac
|
||||
}
|
||||
}
|
||||
|
||||
void ListModel::populateVersions(ModPlatform::IndexedPack const& current)
|
||||
{
|
||||
auto netJob = new NetJob(QString("%1::ModVersions(%2)").arg(m_parent->debugName()).arg(current.name), APPLICATION->network());
|
||||
auto response = new QByteArray();
|
||||
QString addonId = current.addonId.toString();
|
||||
|
||||
netJob->addNetAction(Net::Download::makeByteArray(m_parent->apiProvider()->getVersionsURL(addonId), response));
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]{
|
||||
m_parent->onGetVersionsSucceeded(m_parent, response, addonId);
|
||||
});
|
||||
|
||||
QObject::connect(netJob, &NetJob::finished, this, [response, netJob] {
|
||||
netJob->deleteLater();
|
||||
delete response;
|
||||
});
|
||||
|
||||
netJob->start();
|
||||
}
|
||||
|
||||
void ListModel::performPaginatedSearch()
|
||||
{
|
||||
QString mcVersion = ((MinecraftInstance*)((ModPage*)parent())->m_instance)->getPackProfile()->getComponentVersion("net.minecraft");
|
||||
|
Reference in New Issue
Block a user