From 1630a23fb029c4ba7d622d0ae4da5c9fbfc57fe2 Mon Sep 17 00:00:00 2001 From: flow Date: Fri, 25 Nov 2022 10:17:43 -0300 Subject: [PATCH] refactor(InstanceImport): require rvalue from 'extra_info' mappings Signed-off-by: flow --- launcher/InstanceImportTask.cpp | 4 ++-- launcher/InstanceImportTask.h | 2 +- launcher/ui/pages/instance/ManagedPackPage.cpp | 4 ++-- launcher/ui/pages/modplatform/flame/FlamePage.cpp | 2 +- launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index 7c04ec47..834e9320 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -55,8 +55,8 @@ #include -InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap extra_info) - : m_sourceUrl(sourceUrl), m_extra_info(std::move(extra_info)), m_parent(parent) +InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap&& extra_info) + : m_sourceUrl(sourceUrl), m_extra_info(extra_info), m_parent(parent) {} bool InstanceImportTask::abort() diff --git a/launcher/InstanceImportTask.h b/launcher/InstanceImportTask.h index 712ef054..6b8ac966 100644 --- a/launcher/InstanceImportTask.h +++ b/launcher/InstanceImportTask.h @@ -56,7 +56,7 @@ class InstanceImportTask : public InstanceTask { Q_OBJECT public: - explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap extra_info = {}); + explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap&& extra_info = {}); bool abort() override; const QVector &getBlockedFiles() const diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index 16b2cb57..d8cb9362 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -275,7 +275,7 @@ void ModrinthManagedPackPage::update() extra_info.insert("pack_id", m_pack.id); extra_info.insert("pack_version_id", version.id); - auto extracted = new InstanceImportTask(version.download_url, this, extra_info); + auto extracted = new InstanceImportTask(version.download_url, this, std::move(extra_info)); InstanceName inst_name(m_inst->getManagedPackName(), version.version); inst_name.setName(m_inst->name().replace(m_inst->getManagedPackVersionName(), version.version)); @@ -413,7 +413,7 @@ void FlameManagedPackPage::update() extra_info.insert("pack_id", m_inst->getManagedPackID()); extra_info.insert("pack_version_id", QString::number(version.fileId)); - auto extracted = new InstanceImportTask(version.downloadUrl, this, extra_info); + auto extracted = new InstanceImportTask(version.downloadUrl, this, std::move(extra_info)); InstanceName inst_name(m_inst->getManagedPackName(), version.version); inst_name.setName(m_inst->name().replace(m_inst->getManagedPackVersionName(), version.version)); diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp index d288a869..6023e741 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp @@ -208,7 +208,7 @@ void FlamePage::suggestCurrent() extra_info.insert("pack_id", QString::number(current.addonId)); extra_info.insert("pack_version_id", QString::number(version.fileId)); - dialog->setSuggestedPack(current.name, new InstanceImportTask(version.downloadUrl, this, extra_info)); + dialog->setSuggestedPack(current.name, new InstanceImportTask(version.downloadUrl, this, std::move(extra_info))); QString editedLogoName; editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); listModel->getLogo(current.logoName, current.logoUrl, diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp index c66395f2..8ab2ad1d 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp @@ -304,7 +304,7 @@ void ModrinthPage::suggestCurrent() extra_info.insert("pack_id", current.id); extra_info.insert("pack_version_id", ver.id); - dialog->setSuggestedPack(current.name, ver.version, new InstanceImportTask(ver.download_url, this, extra_info)); + dialog->setSuggestedPack(current.name, ver.version, new InstanceImportTask(ver.download_url, this, std::move(extra_info))); auto iconName = current.iconName; m_model->getLogo(iconName, current.iconUrl.toString(), [this, iconName](QString logo) { dialog->setSuggestedIconFromFile(logo, iconName); });