diff options
author | flow <flowlnlnln@gmail.com> | 2022-06-26 14:17:15 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-07-17 11:33:44 -0300 |
commit | c4316e81e64ad4ac63b0b50106b324a73abdc150 (patch) | |
tree | 9a9bb56eb95efa78e6f3a13fd618225ccda85908 /launcher/modplatform/flame/FlameCheckUpdate.cpp | |
parent | fac63541a4831414b052de6400e7543bbc611db0 (diff) | |
download | PrismLauncher-c4316e81e64ad4ac63b0b50106b324a73abdc150.tar.gz PrismLauncher-c4316e81e64ad4ac63b0b50106b324a73abdc150.tar.bz2 PrismLauncher-c4316e81e64ad4ac63b0b50106b324a73abdc150.zip |
change: make Mod a QObject used as a pointer
Prevents problems when copying it around!
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/flame/FlameCheckUpdate.cpp')
-rw-r--r-- | launcher/modplatform/flame/FlameCheckUpdate.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/launcher/modplatform/flame/FlameCheckUpdate.cpp b/launcher/modplatform/flame/FlameCheckUpdate.cpp index be12dee3..68a4589b 100644 --- a/launcher/modplatform/flame/FlameCheckUpdate.cpp +++ b/launcher/modplatform/flame/FlameCheckUpdate.cpp @@ -117,16 +117,16 @@ void FlameCheckUpdate::executeTask() setStatus(tr("Preparing mods for CurseForge...")); int i = 0; - for (auto mod : m_mods) { - if (!mod.enabled()) { + for (auto* mod : m_mods) { + if (!mod->enabled()) { emit checkFailed(mod, tr("Disabled mods won't be updated, to prevent mod duplication issues!")); continue; } - setStatus(tr("Getting API response from CurseForge for '%1'").arg(mod.name())); + setStatus(tr("Getting API response from CurseForge for '%1'").arg(mod->name())); setProgress(i++, m_mods.size()); - auto latest_ver = api.getLatestVersion({ mod.metadata()->project_id.toString(), m_game_versions, m_loaders }); + auto latest_ver = api.getLatestVersion({ mod->metadata()->project_id.toString(), m_game_versions, m_loaders }); // Check if we were aborted while getting the latest version if (m_was_aborted) { @@ -134,7 +134,7 @@ void FlameCheckUpdate::executeTask() return; } - setStatus(tr("Parsing the API response from CurseForge for '%1'...").arg(mod.name())); + setStatus(tr("Parsing the API response from CurseForge for '%1'...").arg(mod->name())); if (!latest_ver.addonId.isValid()) { emit checkFailed(mod, tr("No valid version found for this mod. It's probably unavailable for the current game " @@ -142,7 +142,7 @@ void FlameCheckUpdate::executeTask() continue; } - if (latest_ver.downloadUrl.isEmpty() && latest_ver.fileId != mod.metadata()->file_id) { + if (latest_ver.downloadUrl.isEmpty() && latest_ver.fileId != mod->metadata()->file_id) { auto pack = getProjectInfo(latest_ver); auto recover_url = QString("%1/download/%2").arg(pack.websiteUrl, latest_ver.fileId.toString()); emit checkFailed(mod, tr("Mod has a new update available, but is opted-out on CurseForge"), recover_url); @@ -150,26 +150,26 @@ void FlameCheckUpdate::executeTask() continue; } - if (!latest_ver.hash.isEmpty() && (mod.metadata()->hash != latest_ver.hash || mod.status() == ModStatus::NotInstalled)) { + if (!latest_ver.hash.isEmpty() && (mod->metadata()->hash != latest_ver.hash || mod->status() == ModStatus::NotInstalled)) { // Fake pack with the necessary info to pass to the download task :) ModPlatform::IndexedPack pack; - pack.name = mod.name(); - pack.slug = mod.metadata()->slug; - pack.addonId = mod.metadata()->project_id; - pack.websiteUrl = mod.homeurl(); - for (auto& author : mod.authors()) + pack.name = mod->name(); + pack.slug = mod->metadata()->slug; + pack.addonId = mod->metadata()->project_id; + pack.websiteUrl = mod->homeurl(); + for (auto& author : mod->authors()) pack.authors.append({ author }); - pack.description = mod.description(); + pack.description = mod->description(); pack.provider = ModPlatform::Provider::FLAME; - auto old_version = mod.version(); - if (old_version.isEmpty() && mod.status() != ModStatus::NotInstalled) { - auto current_ver = getFileInfo(latest_ver.addonId.toInt(), mod.metadata()->file_id.toInt()); + auto old_version = mod->version(); + if (old_version.isEmpty() && mod->status() != ModStatus::NotInstalled) { + auto current_ver = getFileInfo(latest_ver.addonId.toInt(), mod->metadata()->file_id.toInt()); old_version = current_ver.version; } auto download_task = new ModDownloadTask(pack, latest_ver, m_mods_folder); - m_updatable.emplace_back(mod.name(), mod.metadata()->hash, old_version, latest_ver.version, + m_updatable.emplace_back(pack.name, mod->metadata()->hash, old_version, latest_ver.version, api.getModFileChangelog(latest_ver.addonId.toInt(), latest_ver.fileId.toInt()), ModPlatform::Provider::FLAME, download_task); } |