refactor!!!: migrate from shared pointers

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
(cherry picked from commit 549405ab2f)
This commit is contained in:
Octol1ttle 2026-01-07 19:16:54 +05:00 committed by Trial97
parent 7755e0def9
commit e89ce1124a
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318
199 changed files with 742 additions and 710 deletions

View file

@ -18,8 +18,8 @@ static ModrinthAPI api;
ModrinthCheckUpdate::ModrinthCheckUpdate(QList<Resource*>& resources,
std::list<Version>& mcVersions,
QList<ModPlatform::ModLoaderType> loadersList,
std::shared_ptr<ResourceFolderModel> resourceModel)
: CheckUpdateTask(resources, mcVersions, std::move(loadersList), std::move(resourceModel))
ResourceFolderModel* resourceModel)
: CheckUpdateTask(resources, mcVersions, std::move(loadersList), resourceModel)
, m_hashType(ModPlatform::ProviderCapabilities::hashType(ModPlatform::ResourceProvider::MODRINTH).first())
{
if (!m_loadersList.isEmpty()) { // this is for mods so append all the other posible loaders to the initial list
@ -105,9 +105,9 @@ void ModrinthCheckUpdate::getUpdateModsForLoader(std::optional<ModPlatform::ModL
return;
}
auto job = api.latestVersions(hashes, m_hashType, m_gameVersions, loader, response);
auto job = api.latestVersions(hashes, m_hashType, m_gameVersions, loader, response.get());
connect(job.get(), &Task::succeeded, this, [this, response, loader] { checkVersionsResponse(response, loader); });
connect(job.get(), &Task::succeeded, this, [this, response, loader] { checkVersionsResponse(response.get(), loader); });
connect(job.get(), &Task::failed, this, &ModrinthCheckUpdate::checkNextLoader);
@ -115,7 +115,7 @@ void ModrinthCheckUpdate::getUpdateModsForLoader(std::optional<ModPlatform::ModL
job->start();
}
void ModrinthCheckUpdate::checkVersionsResponse(std::shared_ptr<QByteArray> response, std::optional<ModPlatform::ModLoaderTypes> loader)
void ModrinthCheckUpdate::checkVersionsResponse(QByteArray* response, std::optional<ModPlatform::ModLoaderTypes> loader)
{
setStatus(tr("Parsing the API response from Modrinth..."));
setProgress(m_progress + 1, m_progressTotal);
@ -230,4 +230,4 @@ void ModrinthCheckUpdate::checkNextLoader()
}
emitSucceeded();
}
}