refactor(InstanceImport): require rvalue from 'extra_info' mappings

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-11-25 10:17:43 -03:00
parent 4e75419e08
commit 1630a23fb0
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
5 changed files with 7 additions and 7 deletions

View File

@ -55,8 +55,8 @@
#include <quazip/quazipdir.h> #include <quazip/quazipdir.h>
InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap<QString, QString> extra_info) InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap<QString, QString>&& extra_info)
: m_sourceUrl(sourceUrl), m_extra_info(std::move(extra_info)), m_parent(parent) : m_sourceUrl(sourceUrl), m_extra_info(extra_info), m_parent(parent)
{} {}
bool InstanceImportTask::abort() bool InstanceImportTask::abort()

View File

@ -56,7 +56,7 @@ class InstanceImportTask : public InstanceTask
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap<QString, QString> extra_info = {}); explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
bool abort() override; bool abort() override;
const QVector<Flame::File> &getBlockedFiles() const const QVector<Flame::File> &getBlockedFiles() const

View File

@ -275,7 +275,7 @@ void ModrinthManagedPackPage::update()
extra_info.insert("pack_id", m_pack.id); extra_info.insert("pack_id", m_pack.id);
extra_info.insert("pack_version_id", version.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); InstanceName inst_name(m_inst->getManagedPackName(), version.version);
inst_name.setName(m_inst->name().replace(m_inst->getManagedPackVersionName(), 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_id", m_inst->getManagedPackID());
extra_info.insert("pack_version_id", QString::number(version.fileId)); 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); InstanceName inst_name(m_inst->getManagedPackName(), version.version);
inst_name.setName(m_inst->name().replace(m_inst->getManagedPackVersionName(), version.version)); inst_name.setName(m_inst->name().replace(m_inst->getManagedPackVersionName(), version.version));

View File

@ -208,7 +208,7 @@ void FlamePage::suggestCurrent()
extra_info.insert("pack_id", QString::number(current.addonId)); extra_info.insert("pack_id", QString::number(current.addonId));
extra_info.insert("pack_version_id", QString::number(version.fileId)); 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; QString editedLogoName;
editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0);
listModel->getLogo(current.logoName, current.logoUrl, listModel->getLogo(current.logoName, current.logoUrl,

View File

@ -304,7 +304,7 @@ void ModrinthPage::suggestCurrent()
extra_info.insert("pack_id", current.id); extra_info.insert("pack_id", current.id);
extra_info.insert("pack_version_id", ver.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; auto iconName = current.iconName;
m_model->getLogo(iconName, current.iconUrl.toString(), m_model->getLogo(iconName, current.iconUrl.toString(),
[this, iconName](QString logo) { dialog->setSuggestedIconFromFile(logo, iconName); }); [this, iconName](QString logo) { dialog->setSuggestedIconFromFile(logo, iconName); });