aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2022-10-30 22:42:35 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2022-11-01 04:24:11 -0700
commitfda2c116bef33df2ca49d77ff4b016e724f47549 (patch)
tree6d3dc177d5349ba85b8909c10e5bcc2e0fb44a03 /launcher/modplatform/flame
parentd2f3dbaa2984b70a71e5fb1b246a31987a6fdf10 (diff)
downloadPrismLauncher-fda2c116bef33df2ca49d77ff4b016e724f47549.tar.gz
PrismLauncher-fda2c116bef33df2ca49d77ff4b016e724f47549.tar.bz2
PrismLauncher-fda2c116bef33df2ca49d77ff4b016e724f47549.zip
code quality cleanup
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.cpp23
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.h2
2 files changed, 12 insertions, 13 deletions
diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
index edacb819..30438a1a 100644
--- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
+++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
@@ -413,31 +413,32 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop)
/// @brief copy the matched blocked mods to the instance staging area
/// @param blocked_mods list of the blocked mods and their matched paths
-void FlameCreationTask::copyBlockedMods(QList<BlockedMod> blocked_mods) {
+void FlameCreationTask::copyBlockedMods(QList<BlockedMod> const& blocked_mods) {
setStatus(tr("Copying Blocked Mods..."));
setAbortable(false);
int i = 0;
int total = blocked_mods.length();
setProgress(i, total);
- for (auto mod = blocked_mods.begin(); mod != blocked_mods.end(); mod++, i++) {
+ for (auto &mod : blocked_mods) {
- if (!mod->matched) {
- qDebug() << mod->name << "was not matched to a local file, skipping copy";
+ if (!mod.matched) {
+ qDebug() << mod.name << "was not matched to a local file, skipping copy";
continue;
}
- auto dest_path = FS::PathCombine(m_stagingPath, "minecraft", "mods", mod->name);
+ auto dest_path = FS::PathCombine(m_stagingPath, "minecraft", "mods", mod.name);
setStatus(tr("Copying Blocked Mods (%1 out of %2 are done)").arg(QString::number(i), QString::number(total)));
- qDebug() << "Will try to copy" << mod->localPath << "to" << dest_path;
+ qDebug() << "Will try to copy" << mod.localPath << "to" << dest_path;
- if (!FS::copyFile(mod->localPath, dest_path)) {
- qDebug() << "Copy of" << mod->localPath << "to" << dest_path << "Failed";
+ if (!FS::copyFile(mod.localPath, dest_path)) { // FIXME: use FS::copy once #333 is merged
+ qDebug() << "Copy of" << mod.localPath << "to" << dest_path << "Failed";
}
- setProgress(i+1, total);
+ i++;
+ setProgress(i, total);
}
setAbortable(true);
@@ -488,9 +489,7 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop)
m_files_job.reset();
setError(reason);
});
- connect(m_files_job.get(), &NetJob::progress, [&](qint64 current, qint64 total) {
- setProgress(current, total);
- });
+ connect(m_files_job.get(), &NetJob::progress, this, &FlameCreationTask::setProgress);
connect(m_files_job.get(), &NetJob::finished, &loop, &QEventLoop::quit);
setStatus(tr("Downloading mods..."));
diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.h b/launcher/modplatform/flame/FlameInstanceCreationTask.h
index 69a8f1ab..fbc7d5bf 100644
--- a/launcher/modplatform/flame/FlameInstanceCreationTask.h
+++ b/launcher/modplatform/flame/FlameInstanceCreationTask.h
@@ -31,7 +31,7 @@ class FlameCreationTask final : public InstanceCreationTask {
private slots:
void idResolverSucceeded(QEventLoop&);
void setupDownloadJob(QEventLoop&);
- void copyBlockedMods(QList<BlockedMod> blocked_mods);
+ void copyBlockedMods(QList<BlockedMod> const& blocked_mods);
private:
QWidget* m_parent = nullptr;