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
12 changed files with 28 additions and 28 deletions

View File

@ -36,7 +36,7 @@ static ModAPI::ModLoaderTypes mcLoaders(BaseInstance* inst)
ModUpdateDialog::ModUpdateDialog(QWidget* parent,
BaseInstance* instance,
const std::shared_ptr<ModFolderModel> mods,
std::list<Mod::Ptr>& search_for)
QList<Mod::Ptr>& search_for)
: ReviewMessageBox(parent, tr("Confirm mods to update"), "")
, m_parent(parent)
, m_mod_model(mods)
@ -88,14 +88,14 @@ void ModUpdateDialog::checkCandidates()
if (!m_modrinth_to_update.empty()) {
m_modrinth_check_task = new ModrinthCheckUpdate(m_modrinth_to_update, versions, loaders, m_mod_model);
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);
}
if (!m_flame_to_update.empty()) {
m_flame_check_task = new FlameCheckUpdate(m_flame_to_update, versions, loaders, m_mod_model);
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);
}
@ -205,8 +205,8 @@ auto ModUpdateDialog::ensureMetadata() -> bool
// A better use of data structures here could remove the need for this QHash
QHash<QString, bool> should_try_others;
std::list<Mod*> modrinth_tmp;
std::list<Mod*> flame_tmp;
QList<Mod*> modrinth_tmp;
QList<Mod*> flame_tmp;
bool confirm_rest = false;
bool try_others_rest = false;
@ -332,7 +332,7 @@ void ModUpdateDialog::onMetadataFailed(Mod* mod, bool try_others, ModPlatform::P
} else {
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);
}
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);

View File

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

View File

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