fix: std::list -> QList

Qt6 removed Qlist::toStdList() 😭

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-07-10 15:15:25 -03:00
parent 650af5eb64
commit de9e304236
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
12 changed files with 28 additions and 28 deletions

View File

@ -271,9 +271,9 @@ bool ModFolderModel::isValid()
return m_dir.exists() && m_dir.isReadable(); return m_dir.exists() && m_dir.isReadable();
} }
auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> std::list<Mod::Ptr> auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> QList<Mod::Ptr>
{ {
std::list<Mod::Ptr> selected_mods; QList<Mod::Ptr> selected_mods;
for (auto i : indexes) { for (auto i : indexes) {
if(i.column() != 0) if(i.column() != 0)
continue; continue;

View File

@ -146,7 +146,7 @@ public:
return mods; return mods;
} }
auto selectedMods(QModelIndexList& indexes) -> std::list<Mod::Ptr>; auto selectedMods(QModelIndexList& indexes) -> QList<Mod::Ptr>;
public slots: public slots:
void disableInteraction(bool disabled); void disableInteraction(bool disabled);

View File

@ -12,7 +12,7 @@ class CheckUpdateTask : public Task {
Q_OBJECT Q_OBJECT
public: public:
CheckUpdateTask(std::list<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder) CheckUpdateTask(QList<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder)
: Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders(loaders), m_mods_folder(mods_folder) {}; : Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders(loaders), m_mods_folder(mods_folder) {};
struct UpdatableMod { struct UpdatableMod {
@ -42,7 +42,7 @@ class CheckUpdateTask : public Task {
void checkFailed(Mod* failed, QString reason, QUrl recover_url = {}); void checkFailed(Mod* failed, QString reason, QUrl recover_url = {});
protected: protected:
std::list<Mod*>& m_mods; QList<Mod*>& m_mods;
std::list<Version>& m_game_versions; std::list<Version>& m_game_versions;
ModAPI::ModLoaderTypes m_loaders; ModAPI::ModLoaderTypes m_loaders;
std::shared_ptr<ModFolderModel> m_mods_folder; std::shared_ptr<ModFolderModel> m_mods_folder;

View File

@ -28,7 +28,7 @@ EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::Provider
m_mods.insert(hash, mod); m_mods.insert(hash, mod);
} }
EnsureMetadataTask::EnsureMetadataTask(std::list<Mod*>& mods, QDir dir, ModPlatform::Provider prov) EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform::Provider prov)
: Task(nullptr), m_index_dir(dir), m_provider(prov) : Task(nullptr), m_index_dir(dir), m_provider(prov)
{ {
for (auto* mod : mods) { for (auto* mod : mods) {
@ -323,7 +323,7 @@ NetJob::Ptr EnsureMetadataTask::flameVersionsTask()
{ {
auto* response = new QByteArray(); auto* response = new QByteArray();
std::list<uint> fingerprints; QList<uint> fingerprints;
for (auto& murmur : m_mods.keys()) { for (auto& murmur : m_mods.keys()) {
fingerprints.push_back(murmur.toUInt()); fingerprints.push_back(murmur.toUInt());
} }

View File

@ -13,7 +13,7 @@ class EnsureMetadataTask : public Task {
public: public:
EnsureMetadataTask(Mod*, QDir, ModPlatform::Provider = ModPlatform::Provider::MODRINTH); EnsureMetadataTask(Mod*, QDir, ModPlatform::Provider = ModPlatform::Provider::MODRINTH);
EnsureMetadataTask(std::list<Mod*>&, QDir, ModPlatform::Provider = ModPlatform::Provider::MODRINTH); EnsureMetadataTask(QList<Mod*>&, QDir, ModPlatform::Provider = ModPlatform::Provider::MODRINTH);
~EnsureMetadataTask() = default; ~EnsureMetadataTask() = default;

View File

@ -7,7 +7,7 @@
#include "net/Upload.h" #include "net/Upload.h"
auto FlameAPI::matchFingerprints(const std::list<uint>& fingerprints, QByteArray* response) -> NetJob::Ptr auto FlameAPI::matchFingerprints(const QList<uint>& fingerprints, QByteArray* response) -> NetJob::Ptr
{ {
auto* netJob = new NetJob(QString("Flame::MatchFingerprints"), APPLICATION->network()); auto* netJob = new NetJob(QString("Flame::MatchFingerprints"), APPLICATION->network());

View File

@ -5,7 +5,7 @@
class FlameAPI : public NetworkModAPI { class FlameAPI : public NetworkModAPI {
public: public:
auto matchFingerprints(const std::list<uint>& fingerprints, QByteArray* response) -> NetJob::Ptr; auto matchFingerprints(const QList<uint>& fingerprints, QByteArray* response) -> NetJob::Ptr;
auto getModFileChangelog(int modId, int fileId) -> QString; auto getModFileChangelog(int modId, int fileId) -> QString;
auto getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::IndexedVersion; auto getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::IndexedVersion;

View File

@ -8,7 +8,7 @@ class FlameCheckUpdate : public CheckUpdateTask {
Q_OBJECT Q_OBJECT
public: public:
FlameCheckUpdate(std::list<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder) FlameCheckUpdate(QList<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder)
: CheckUpdateTask(mods, mcVersions, loaders, mods_folder) : CheckUpdateTask(mods, mcVersions, loaders, mods_folder)
{} {}

View File

@ -8,7 +8,7 @@ class ModrinthCheckUpdate : public CheckUpdateTask {
Q_OBJECT Q_OBJECT
public: public:
ModrinthCheckUpdate(std::list<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder) ModrinthCheckUpdate(QList<Mod*>& mods, std::list<Version>& mcVersions, ModAPI::ModLoaderTypes loaders, std::shared_ptr<ModFolderModel> mods_folder)
: CheckUpdateTask(mods, mcVersions, loaders, mods_folder) : CheckUpdateTask(mods, mcVersions, loaders, mods_folder)
{} {}

View File

@ -36,7 +36,7 @@ static ModAPI::ModLoaderTypes mcLoaders(BaseInstance* inst)
ModUpdateDialog::ModUpdateDialog(QWidget* parent, ModUpdateDialog::ModUpdateDialog(QWidget* parent,
BaseInstance* instance, BaseInstance* instance,
const std::shared_ptr<ModFolderModel> mods, const std::shared_ptr<ModFolderModel> mods,
std::list<Mod::Ptr>& search_for) QList<Mod::Ptr>& search_for)
: ReviewMessageBox(parent, tr("Confirm mods to update"), "") : ReviewMessageBox(parent, tr("Confirm mods to update"), "")
, m_parent(parent) , m_parent(parent)
, m_mod_model(mods) , m_mod_model(mods)
@ -88,14 +88,14 @@ void ModUpdateDialog::checkCandidates()
if (!m_modrinth_to_update.empty()) { if (!m_modrinth_to_update.empty()) {
m_modrinth_check_task = new ModrinthCheckUpdate(m_modrinth_to_update, versions, loaders, m_mod_model); m_modrinth_check_task = new ModrinthCheckUpdate(m_modrinth_to_update, versions, loaders, m_mod_model);
connect(m_modrinth_check_task, &CheckUpdateTask::checkFailed, this, connect(m_modrinth_check_task, &CheckUpdateTask::checkFailed, this,
[this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.emplace_back(mod, reason, recover_url); }); [this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.append({mod, reason, recover_url}); });
check_task.addTask(m_modrinth_check_task); check_task.addTask(m_modrinth_check_task);
} }
if (!m_flame_to_update.empty()) { if (!m_flame_to_update.empty()) {
m_flame_check_task = new FlameCheckUpdate(m_flame_to_update, versions, loaders, m_mod_model); m_flame_check_task = new FlameCheckUpdate(m_flame_to_update, versions, loaders, m_mod_model);
connect(m_flame_check_task, &CheckUpdateTask::checkFailed, this, connect(m_flame_check_task, &CheckUpdateTask::checkFailed, this,
[this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.emplace_back(mod, reason, recover_url); }); [this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.append({mod, reason, recover_url}); });
check_task.addTask(m_flame_check_task); check_task.addTask(m_flame_check_task);
} }
@ -205,8 +205,8 @@ auto ModUpdateDialog::ensureMetadata() -> bool
// A better use of data structures here could remove the need for this QHash // A better use of data structures here could remove the need for this QHash
QHash<QString, bool> should_try_others; QHash<QString, bool> should_try_others;
std::list<Mod*> modrinth_tmp; QList<Mod*> modrinth_tmp;
std::list<Mod*> flame_tmp; QList<Mod*> flame_tmp;
bool confirm_rest = false; bool confirm_rest = false;
bool try_others_rest = false; bool try_others_rest = false;
@ -332,7 +332,7 @@ void ModUpdateDialog::onMetadataFailed(Mod* mod, bool try_others, ModPlatform::P
} else { } else {
QString reason{ tr("Didn't find a valid version on the selected mod provider(s)") }; QString reason{ tr("Didn't find a valid version on the selected mod provider(s)") };
m_failed_metadata.emplace_back(mod, reason); m_failed_metadata.append({mod, reason});
} }
} }
@ -390,9 +390,9 @@ void ModUpdateDialog::appendMod(CheckUpdateTask::UpdatableMod const& info)
ui->modTreeWidget->addTopLevelItem(item_top); ui->modTreeWidget->addTopLevelItem(item_top);
} }
auto ModUpdateDialog::getTasks() -> const std::list<ModDownloadTask*> auto ModUpdateDialog::getTasks() -> const QList<ModDownloadTask*>
{ {
std::list<ModDownloadTask*> list; QList<ModDownloadTask*> list;
auto* item = ui->modTreeWidget->topLevelItem(0); auto* item = ui->modTreeWidget->topLevelItem(0);

View File

@ -19,13 +19,13 @@ class ModUpdateDialog final : public ReviewMessageBox {
explicit ModUpdateDialog(QWidget* parent, explicit ModUpdateDialog(QWidget* parent,
BaseInstance* instance, BaseInstance* instance,
const std::shared_ptr<ModFolderModel> mod_model, const std::shared_ptr<ModFolderModel> mod_model,
std::list<Mod::Ptr>& search_for); QList<Mod::Ptr>& search_for);
void checkCandidates(); void checkCandidates();
void appendMod(const CheckUpdateTask::UpdatableMod& info); void appendMod(const CheckUpdateTask::UpdatableMod& info);
const std::list<ModDownloadTask*> getTasks(); const QList<ModDownloadTask*> getTasks();
auto indexDir() const -> QDir { return m_mod_model->indexDir(); } auto indexDir() const -> QDir { return m_mod_model->indexDir(); }
auto noUpdates() const -> bool { return m_no_updates; }; auto noUpdates() const -> bool { return m_no_updates; };
@ -46,13 +46,13 @@ class ModUpdateDialog final : public ReviewMessageBox {
const std::shared_ptr<ModFolderModel> m_mod_model; const std::shared_ptr<ModFolderModel> m_mod_model;
std::list<Mod::Ptr>& m_candidates; QList<Mod::Ptr>& m_candidates;
std::list<Mod*> m_modrinth_to_update; QList<Mod*> m_modrinth_to_update;
std::list<Mod*> m_flame_to_update; QList<Mod*> m_flame_to_update;
ConcurrentTask* m_second_try_metadata; ConcurrentTask* m_second_try_metadata;
std::list<std::tuple<Mod*, QString>> m_failed_metadata; QList<std::tuple<Mod*, QString>> m_failed_metadata;
std::list<std::tuple<Mod*, QString, QUrl>> m_failed_check_update; QList<std::tuple<Mod*, QString, QUrl>> m_failed_check_update;
QHash<QString, ModDownloadTask*> m_tasks; QHash<QString, ModDownloadTask*> m_tasks;
BaseInstance* m_instance; BaseInstance* m_instance;

View File

@ -180,7 +180,7 @@ void ModFolderPage::updateMods()
auto mods_list = m_model->selectedMods(selection); auto mods_list = m_model->selectedMods(selection);
bool use_all = mods_list.empty(); bool use_all = mods_list.empty();
if (use_all) if (use_all)
mods_list = m_model->allMods().toStdList(); mods_list = m_model->allMods();
ModUpdateDialog update_dialog(this, m_instance, m_model, mods_list); ModUpdateDialog update_dialog(this, m_instance, m_model, mods_list);
update_dialog.checkCandidates(); update_dialog.checkCandidates();