replace qvector with qlist (#3519)

This commit is contained in:
Alexandru Ionut Tripon 2025-04-29 00:32:40 +03:00 committed by GitHub
commit d6bba50d86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 102 additions and 107 deletions

View File

@ -188,10 +188,10 @@ T ensureIsType(const QJsonObject& parent, const QString& key, const T default_ =
} }
template <typename T> template <typename T>
QVector<T> requireIsArrayOf(const QJsonDocument& doc) QList<T> requireIsArrayOf(const QJsonDocument& doc)
{ {
const QJsonArray array = requireArray(doc); const QJsonArray array = requireArray(doc);
QVector<T> out; QList<T> out;
for (const QJsonValue val : array) { for (const QJsonValue val : array) {
out.append(requireIsType<T>(val, "Document")); out.append(requireIsType<T>(val, "Document"));
} }
@ -199,10 +199,10 @@ QVector<T> requireIsArrayOf(const QJsonDocument& doc)
} }
template <typename T> template <typename T>
QVector<T> ensureIsArrayOf(const QJsonValue& value, const QString& what = "Value") QList<T> ensureIsArrayOf(const QJsonValue& value, const QString& what = "Value")
{ {
const QJsonArray array = ensureIsType<QJsonArray>(value, QJsonArray(), what); const QJsonArray array = ensureIsType<QJsonArray>(value, QJsonArray(), what);
QVector<T> out; QList<T> out;
for (const QJsonValue val : array) { for (const QJsonValue val : array) {
out.append(requireIsType<T>(val, what)); out.append(requireIsType<T>(val, what));
} }
@ -210,7 +210,7 @@ QVector<T> ensureIsArrayOf(const QJsonValue& value, const QString& what = "Value
} }
template <typename T> template <typename T>
QVector<T> ensureIsArrayOf(const QJsonValue& value, const QVector<T> default_, const QString& what = "Value") QList<T> ensureIsArrayOf(const QJsonValue& value, const QList<T> default_, const QString& what = "Value")
{ {
if (value.isUndefined()) { if (value.isUndefined()) {
return default_; return default_;
@ -220,7 +220,7 @@ QVector<T> ensureIsArrayOf(const QJsonValue& value, const QVector<T> default_, c
/// @throw JsonException /// @throw JsonException
template <typename T> template <typename T>
QVector<T> requireIsArrayOf(const QJsonObject& parent, const QString& key, const QString& what = "__placeholder__") QList<T> requireIsArrayOf(const QJsonObject& parent, const QString& key, const QString& what = "__placeholder__")
{ {
const QString localWhat = QString(what).replace("__placeholder__", '\'' + key + '\''); const QString localWhat = QString(what).replace("__placeholder__", '\'' + key + '\'');
if (!parent.contains(key)) { if (!parent.contains(key)) {
@ -230,10 +230,10 @@ QVector<T> requireIsArrayOf(const QJsonObject& parent, const QString& key, const
} }
template <typename T> template <typename T>
QVector<T> ensureIsArrayOf(const QJsonObject& parent, QList<T> ensureIsArrayOf(const QJsonObject& parent,
const QString& key, const QString& key,
const QVector<T>& default_ = QVector<T>(), const QList<T>& default_ = QList<T>(),
const QString& what = "__placeholder__") const QString& what = "__placeholder__")
{ {
const QString localWhat = QString(what).replace("__placeholder__", '\'' + key + '\''); const QString localWhat = QString(what).replace("__placeholder__", '\'' + key + '\'');
if (!parent.contains(key)) { if (!parent.contains(key)) {

View File

@ -106,6 +106,6 @@ class IconList : public QAbstractListModel {
shared_qobject_ptr<QFileSystemWatcher> m_watcher; shared_qobject_ptr<QFileSystemWatcher> m_watcher;
bool m_isWatching; bool m_isWatching;
QMap<QString, int> m_nameIndex; QMap<QString, int> m_nameIndex;
QVector<MMCIcon> m_icons; QList<MMCIcon> m_icons;
QDir m_dir; QDir m_dir;
}; };

View File

@ -100,7 +100,7 @@ void LogModel::setMaxLines(int maxLines)
return; return;
} }
// otherwise, we need to reorganize the data because it crosses the wrap boundary // otherwise, we need to reorganize the data because it crosses the wrap boundary
QVector<entry> newContent; QList<entry> newContent;
newContent.resize(maxLines); newContent.resize(maxLines);
if (m_numLines <= maxLines) { if (m_numLines <= maxLines) {
// if it all fits in the new buffer, just copy it over // if it all fits in the new buffer, just copy it over

View File

@ -42,7 +42,7 @@ class LogModel : public QAbstractListModel {
}; };
private: /* data */ private: /* data */
QVector<entry> m_content; QList<entry> m_content;
int m_maxLines = 1000; int m_maxLines = 1000;
// first line in the circular buffer // first line in the circular buffer
int m_firstLine = 0; int m_firstLine = 0;

View File

@ -23,7 +23,7 @@
namespace Meta { namespace Meta {
Index::Index(QObject* parent) : QAbstractListModel(parent) {} Index::Index(QObject* parent) : QAbstractListModel(parent) {}
Index::Index(const QVector<VersionList::Ptr>& lists, QObject* parent) : QAbstractListModel(parent), m_lists(lists) Index::Index(const QList<VersionList::Ptr>& lists, QObject* parent) : QAbstractListModel(parent), m_lists(lists)
{ {
for (int i = 0; i < m_lists.size(); ++i) { for (int i = 0; i < m_lists.size(); ++i) {
m_uids.insert(m_lists.at(i)->uid(), m_lists.at(i)); m_uids.insert(m_lists.at(i)->uid(), m_lists.at(i));
@ -103,7 +103,7 @@ void Index::parse(const QJsonObject& obj)
void Index::merge(const std::shared_ptr<Index>& other) void Index::merge(const std::shared_ptr<Index>& other)
{ {
const QVector<VersionList::Ptr> lists = other->m_lists; const QList<VersionList::Ptr> lists = other->m_lists;
// initial load, no need to merge // initial load, no need to merge
if (m_lists.isEmpty()) { if (m_lists.isEmpty()) {
beginResetModel(); beginResetModel();

View File

@ -29,7 +29,7 @@ class Index : public QAbstractListModel, public BaseEntity {
Q_OBJECT Q_OBJECT
public: public:
explicit Index(QObject* parent = nullptr); explicit Index(QObject* parent = nullptr);
explicit Index(const QVector<VersionList::Ptr>& lists, QObject* parent = nullptr); explicit Index(const QList<VersionList::Ptr>& lists, QObject* parent = nullptr);
virtual ~Index() = default; virtual ~Index() = default;
enum { UidRole = Qt::UserRole, NameRole, ListPtrRole }; enum { UidRole = Qt::UserRole, NameRole, ListPtrRole };
@ -46,7 +46,7 @@ class Index : public QAbstractListModel, public BaseEntity {
Version::Ptr get(const QString& uid, const QString& version); Version::Ptr get(const QString& uid, const QString& version);
bool hasUid(const QString& uid) const; bool hasUid(const QString& uid) const;
QVector<VersionList::Ptr> lists() const { return m_lists; } QList<VersionList::Ptr> lists() const { return m_lists; }
Task::Ptr loadVersion(const QString& uid, const QString& version = {}, Net::Mode mode = Net::Mode::Online, bool force = false); Task::Ptr loadVersion(const QString& uid, const QString& version = {}, Net::Mode mode = Net::Mode::Online, bool force = false);
@ -60,7 +60,7 @@ class Index : public QAbstractListModel, public BaseEntity {
void parse(const QJsonObject& obj) override; void parse(const QJsonObject& obj) override;
private: private:
QVector<VersionList::Ptr> m_lists; QList<VersionList::Ptr> m_lists;
QHash<QString, VersionList::Ptr> m_uids; QHash<QString, VersionList::Ptr> m_uids;
void connectVersionList(int row, const VersionList::Ptr& list); void connectVersionList(int row, const VersionList::Ptr& list);

View File

@ -35,8 +35,8 @@ MetadataVersion currentFormatVersion()
// Index // Index
static std::shared_ptr<Index> parseIndexInternal(const QJsonObject& obj) static std::shared_ptr<Index> parseIndexInternal(const QJsonObject& obj)
{ {
const QVector<QJsonObject> objects = requireIsArrayOf<QJsonObject>(obj, "packages"); const QList<QJsonObject> objects = requireIsArrayOf<QJsonObject>(obj, "packages");
QVector<VersionList::Ptr> lists; QList<VersionList::Ptr> lists;
lists.reserve(objects.size()); lists.reserve(objects.size());
std::transform(objects.begin(), objects.end(), std::back_inserter(lists), [](const QJsonObject& obj) { std::transform(objects.begin(), objects.end(), std::back_inserter(lists), [](const QJsonObject& obj) {
VersionList::Ptr list = std::make_shared<VersionList>(requireString(obj, "uid")); VersionList::Ptr list = std::make_shared<VersionList>(requireString(obj, "uid"));
@ -79,8 +79,8 @@ static VersionList::Ptr parseVersionListInternal(const QJsonObject& obj)
{ {
const QString uid = requireString(obj, "uid"); const QString uid = requireString(obj, "uid");
const QVector<QJsonObject> versionsRaw = requireIsArrayOf<QJsonObject>(obj, "versions"); const QList<QJsonObject> versionsRaw = requireIsArrayOf<QJsonObject>(obj, "versions");
QVector<Version::Ptr> versions; QList<Version::Ptr> versions;
versions.reserve(versionsRaw.size()); versions.reserve(versionsRaw.size());
std::transform(versionsRaw.begin(), versionsRaw.end(), std::back_inserter(versions), [uid](const QJsonObject& vObj) { std::transform(versionsRaw.begin(), versionsRaw.end(), std::back_inserter(versions), [uid](const QJsonObject& vObj) {
auto version = parseCommonVersion(uid, vObj); auto version = parseCommonVersion(uid, vObj);

View File

@ -19,8 +19,8 @@
#include "BaseVersion.h" #include "BaseVersion.h"
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QStringList> #include <QStringList>
#include <QVector>
#include <memory> #include <memory>
#include "minecraft/VersionFile.h" #include "minecraft/VersionFile.h"

View File

@ -169,7 +169,7 @@ void VersionList::setName(const QString& name)
emit nameChanged(name); emit nameChanged(name);
} }
void VersionList::setVersions(const QVector<Version::Ptr>& versions) void VersionList::setVersions(const QList<Version::Ptr>& versions)
{ {
beginResetModel(); beginResetModel();
m_versions = versions; m_versions = versions;
@ -265,7 +265,7 @@ void VersionList::setupAddedVersion(const int row, const Version::Ptr& version)
disconnect(version.get(), &Version::typeChanged, this, nullptr); disconnect(version.get(), &Version::typeChanged, this, nullptr);
connect(version.get(), &Version::requiresChanged, this, connect(version.get(), &Version::requiresChanged, this,
[this, row]() { emit dataChanged(index(row), index(row), QVector<int>() << RequiresRole); }); [this, row]() { emit dataChanged(index(row), index(row), QList<int>() << RequiresRole); });
connect(version.get(), &Version::timeChanged, this, connect(version.get(), &Version::timeChanged, this,
[this, row]() { emit dataChanged(index(row), index(row), { TimeRole, SortRole }); }); [this, row]() { emit dataChanged(index(row), index(row), { TimeRole, SortRole }); });
connect(version.get(), &Version::typeChanged, this, [this, row]() { emit dataChanged(index(row), index(row), { TypeRole }); }); connect(version.get(), &Version::typeChanged, this, [this, row]() { emit dataChanged(index(row), index(row), { TypeRole }); });

View File

@ -61,14 +61,14 @@ class VersionList : public BaseVersionList, public BaseEntity {
Version::Ptr getVersion(const QString& version); Version::Ptr getVersion(const QString& version);
bool hasVersion(QString version) const; bool hasVersion(QString version) const;
QVector<Version::Ptr> versions() const { return m_versions; } QList<Version::Ptr> versions() const { return m_versions; }
// this blocks until the version list is loaded // this blocks until the version list is loaded
void waitToLoad(); void waitToLoad();
public: // for usage only by parsers public: // for usage only by parsers
void setName(const QString& name); void setName(const QString& name);
void setVersions(const QVector<Version::Ptr>& versions); void setVersions(const QList<Version::Ptr>& versions);
void merge(const VersionList::Ptr& other); void merge(const VersionList::Ptr& other);
void mergeFromIndex(const VersionList::Ptr& other); void mergeFromIndex(const VersionList::Ptr& other);
void parse(const QJsonObject& obj) override; void parse(const QJsonObject& obj) override;
@ -82,7 +82,7 @@ class VersionList : public BaseVersionList, public BaseEntity {
void updateListData(QList<BaseVersion::Ptr>) override {} void updateListData(QList<BaseVersion::Ptr>) override {}
private: private:
QVector<Version::Ptr> m_versions; QList<Version::Ptr> m_versions;
QStringList m_externalRecommendsVersions; QStringList m_externalRecommendsVersions;
QHash<QString, Version::Ptr> m_lookup; QHash<QString, Version::Ptr> m_lookup;
QString m_uid; QString m_uid;

View File

@ -36,8 +36,8 @@
#pragma once #pragma once
#include <QByteArray> #include <QByteArray>
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QString> #include <QString>
#include <QVector>
#include <QDateTime> #include <QDateTime>
#include <QMap> #include <QMap>

View File

@ -5,7 +5,6 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QObject> #include <QObject>
#include <QSet> #include <QSet>
#include <QVector>
#include "minecraft/auth/AccountData.h" #include "minecraft/auth/AccountData.h"
#include "minecraft/auth/AuthStep.h" #include "minecraft/auth/AuthStep.h"

View File

@ -67,7 +67,7 @@ void SkinList::stopWatching()
bool SkinList::update() bool SkinList::update()
{ {
QVector<SkinModel> newSkins; QList<SkinModel> newSkins;
m_dir.refresh(); m_dir.refresh();
auto manifestInfo = QFileInfo(m_dir.absoluteFilePath("index.json")); auto manifestInfo = QFileInfo(m_dir.absoluteFilePath("index.json"));

View File

@ -74,7 +74,7 @@ class SkinList : public QAbstractListModel {
private: private:
shared_qobject_ptr<QFileSystemWatcher> m_watcher; shared_qobject_ptr<QFileSystemWatcher> m_watcher;
bool m_isWatching; bool m_isWatching;
QVector<SkinModel> m_skinList; QList<SkinModel> m_skinList;
QDir m_dir; QDir m_dir;
MinecraftAccountPtr m_acct; MinecraftAccountPtr m_acct;
}; };

View File

@ -23,7 +23,6 @@
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
#include <QVariant> #include <QVariant>
#include <QVector>
#include <memory> #include <memory>
class QIODevice; class QIODevice;
@ -141,7 +140,7 @@ struct IndexedPack {
QString side; QString side;
bool versionsLoaded = false; bool versionsLoaded = false;
QVector<IndexedVersion> versions; QList<IndexedVersion> versions;
// Don't load by default, since some modplatform don't have that info // Don't load by default, since some modplatform don't have that info
bool extraDataLoaded = true; bool extraDataLoaded = true;

View File

@ -18,9 +18,9 @@
#include "ATLPackManifest.h" #include "ATLPackManifest.h"
#include <QList>
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
#include <QVector>
namespace ATLauncher { namespace ATLauncher {
@ -34,7 +34,7 @@ struct IndexedPack {
int position; int position;
QString name; QString name;
PackType type; PackType type;
QVector<IndexedVersion> versions; QList<IndexedVersion> versions;
bool system; bool system;
QString description; QString description;

View File

@ -689,7 +689,7 @@ void PackInstallTask::downloadMods()
{ {
qDebug() << "PackInstallTask::installMods: " << QThread::currentThreadId(); qDebug() << "PackInstallTask::installMods: " << QThread::currentThreadId();
QVector<ATLauncher::VersionMod> optionalMods; QList<ATLauncher::VersionMod> optionalMods;
for (const auto& mod : m_version.mods) { for (const auto& mod : m_version.mods) {
if (mod.optional) { if (mod.optional) {
optionalMods.push_back(mod); optionalMods.push_back(mod);
@ -697,7 +697,7 @@ void PackInstallTask::downloadMods()
} }
// Select optional mods, if pack contains any // Select optional mods, if pack contains any
QVector<QString> selectedMods; QList<QString> selectedMods;
if (!optionalMods.isEmpty()) { if (!optionalMods.isEmpty()) {
setStatus(tr("Selecting optional mods...")); setStatus(tr("Selecting optional mods..."));
auto mods = m_support->chooseOptionalMods(m_version, optionalMods); auto mods = m_support->chooseOptionalMods(m_version, optionalMods);

View File

@ -62,7 +62,7 @@ class UserInteractionSupport {
/** /**
* Requests a user interaction to select which optional mods should be installed. * Requests a user interaction to select which optional mods should be installed.
*/ */
virtual std::optional<QVector<QString>> chooseOptionalMods(const PackVersion& version, QVector<ATLauncher::VersionMod> mods) = 0; virtual std::optional<QList<QString>> chooseOptionalMods(const PackVersion& version, QList<ATLauncher::VersionMod> mods) = 0;
/** /**
* Requests a user interaction to select a component version from a given version list * Requests a user interaction to select a component version from a given version list

View File

@ -36,9 +36,9 @@
#pragma once #pragma once
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QMap> #include <QMap>
#include <QString> #include <QString>
#include <QVector>
namespace ATLauncher { namespace ATLauncher {
@ -113,7 +113,7 @@ struct VersionMod {
bool hidden; bool hidden;
bool library; bool library;
QString group; QString group;
QVector<QString> depends; QStringList depends;
QString colour; QString colour;
QString warning; QString warning;
@ -139,8 +139,8 @@ struct VersionKeep {
}; };
struct VersionKeeps { struct VersionKeeps {
QVector<VersionKeep> files; QList<VersionKeep> files;
QVector<VersionKeep> folders; QList<VersionKeep> folders;
}; };
struct VersionDelete { struct VersionDelete {
@ -149,8 +149,8 @@ struct VersionDelete {
}; };
struct VersionDeletes { struct VersionDeletes {
QVector<VersionDelete> files; QList<VersionDelete> files;
QVector<VersionDelete> folders; QList<VersionDelete> folders;
}; };
struct PackVersionMainClass { struct PackVersionMainClass {
@ -171,8 +171,8 @@ struct PackVersion {
PackVersionExtraArguments extraArguments; PackVersionExtraArguments extraArguments;
VersionLoader loader; VersionLoader loader;
QVector<VersionLibrary> libraries; QList<VersionLibrary> libraries;
QVector<VersionMod> mods; QList<VersionMod> mods;
VersionConfigs configs; VersionConfigs configs;
QMap<QString, QString> colours; QMap<QString, QString> colours;

View File

@ -19,8 +19,8 @@
#pragma once #pragma once
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QString> #include <QString>
#include <QVector>
namespace ATLauncher { namespace ATLauncher {
@ -32,7 +32,7 @@ struct ShareCodeMod {
struct ShareCode { struct ShareCode {
QString pack; QString pack;
QString version; QString version;
QVector<ShareCodeMod> mods; QList<ShareCodeMod> mods;
}; };
struct ShareCodeResponse { struct ShareCodeResponse {

View File

@ -215,7 +215,7 @@ QList<ModPlatform::Category> FlameAPI::loadModCategories(std::shared_ptr<QByteAr
return categories; return categories;
}; };
std::optional<ModPlatform::IndexedVersion> FlameAPI::getLatestVersion(QVector<ModPlatform::IndexedVersion> versions, std::optional<ModPlatform::IndexedVersion> FlameAPI::getLatestVersion(QList<ModPlatform::IndexedVersion> versions,
QList<ModPlatform::ModLoaderType> instanceLoaders, QList<ModPlatform::ModLoaderType> instanceLoaders,
ModPlatform::ModLoaderTypes modLoaders) ModPlatform::ModLoaderTypes modLoaders)
{ {

View File

@ -15,7 +15,7 @@ class FlameAPI : public NetworkResourceAPI {
QString getModFileChangelog(int modId, int fileId); QString getModFileChangelog(int modId, int fileId);
QString getModDescription(int modId); QString getModDescription(int modId);
std::optional<ModPlatform::IndexedVersion> getLatestVersion(QVector<ModPlatform::IndexedVersion> versions, std::optional<ModPlatform::IndexedVersion> getLatestVersion(QList<ModPlatform::IndexedVersion> versions,
QList<ModPlatform::ModLoaderType> instanceLoaders, QList<ModPlatform::ModLoaderType> instanceLoaders,
ModPlatform::ModLoaderTypes fallback); ModPlatform::ModLoaderTypes fallback);

View File

@ -78,7 +78,7 @@ static QString enumToString(int hash_algorithm)
void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr) void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr)
{ {
QVector<ModPlatform::IndexedVersion> unsortedVersions; QList<ModPlatform::IndexedVersion> unsortedVersions;
for (auto versionIter : arr) { for (auto versionIter : arr) {
auto obj = versionIter.toObject(); auto obj = versionIter.toObject();
@ -208,7 +208,7 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
auto profile = (dynamic_cast<const MinecraftInstance*>(inst))->getPackProfile(); auto profile = (dynamic_cast<const MinecraftInstance*>(inst))->getPackProfile();
QString mcVersion = profile->getComponentVersion("net.minecraft"); QString mcVersion = profile->getComponentVersion("net.minecraft");
auto loaders = profile->getSupportedModLoaders(); auto loaders = profile->getSupportedModLoaders();
QVector<ModPlatform::IndexedVersion> versions; QList<ModPlatform::IndexedVersion> versions;
for (auto versionIter : arr) { for (auto versionIter : arr) {
auto obj = versionIter.toObject(); auto obj = versionIter.toObject();

View File

@ -77,7 +77,7 @@ void Flame::loadIndexedInfo(IndexedPack& pack, QJsonObject& obj)
void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr) void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
{ {
QVector<Flame::IndexedVersion> unsortedVersions; QList<Flame::IndexedVersion> unsortedVersions;
for (auto versionIter : arr) { for (auto versionIter : arr) {
auto version = Json::requireObject(versionIter); auto version = Json::requireObject(versionIter);
Flame::IndexedVersion file; Flame::IndexedVersion file;

View File

@ -3,7 +3,6 @@
#include <QList> #include <QList>
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
#include <QVector>
#include "modplatform/ModIndex.h" #include "modplatform/ModIndex.h"
namespace Flame { namespace Flame {
@ -39,7 +38,7 @@ struct IndexedPack {
QString logoUrl; QString logoUrl;
bool versionsLoaded = false; bool versionsLoaded = false;
QVector<IndexedVersion> versions; QList<IndexedVersion> versions;
bool extraInfoLoaded = false; bool extraInfoLoaded = false;
ModpackExtra extra; ModpackExtra extra;

View File

@ -36,10 +36,10 @@
#pragma once #pragma once
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QMap> #include <QMap>
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <QVector>
#include "minecraft/mod/tasks/LocalResourceParse.h" #include "minecraft/mod/tasks/LocalResourceParse.h"
#include "modplatform/ModIndex.h" #include "modplatform/ModIndex.h"
@ -66,7 +66,7 @@ struct Modloader {
struct Minecraft { struct Minecraft {
QString version; QString version;
QString libraries; QString libraries;
QVector<Flame::Modloader> modLoaders; QList<Flame::Modloader> modLoaders;
}; };
struct Manifest { struct Manifest {

View File

@ -114,7 +114,7 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr) void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr)
{ {
QVector<ModPlatform::IndexedVersion> unsortedVersions; QList<ModPlatform::IndexedVersion> unsortedVersions;
for (auto versionIter : arr) { for (auto versionIter : arr) {
auto obj = versionIter.toObject(); auto obj = versionIter.toObject();
auto file = loadIndexedPackVersion(obj); auto file = loadIndexedPackVersion(obj);
@ -253,7 +253,7 @@ ModPlatform::IndexedVersion Modrinth::loadDependencyVersions([[maybe_unused]] co
QString mcVersion = profile->getComponentVersion("net.minecraft"); QString mcVersion = profile->getComponentVersion("net.minecraft");
auto loaders = profile->getSupportedModLoaders(); auto loaders = profile->getSupportedModLoaders();
QVector<ModPlatform::IndexedVersion> versions; QList<ModPlatform::IndexedVersion> versions;
for (auto versionIter : arr) { for (auto versionIter : arr) {
auto obj = versionIter.toObject(); auto obj = versionIter.toObject();
auto file = loadIndexedPackVersion(obj); auto file = loadIndexedPackVersion(obj);

View File

@ -99,7 +99,7 @@ void loadIndexedInfo(Modpack& pack, QJsonObject& obj)
void loadIndexedVersions(Modpack& pack, QJsonDocument& doc) void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
{ {
QVector<ModpackVersion> unsortedVersions; QList<ModpackVersion> unsortedVersions;
auto arr = Json::requireArray(doc); auto arr = Json::requireArray(doc);

View File

@ -40,10 +40,10 @@
#include <QByteArray> #include <QByteArray>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QList>
#include <QQueue> #include <QQueue>
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <QVector>
#include "modplatform/ModIndex.h" #include "modplatform/ModIndex.h"
@ -110,7 +110,7 @@ struct Modpack {
bool extraInfoLoaded = false; bool extraInfoLoaded = false;
ModpackExtra extra; ModpackExtra extra;
QVector<ModpackVersion> versions; QList<ModpackVersion> versions;
}; };
void loadIndexedPack(Modpack&, QJsonObject&); void loadIndexedPack(Modpack&, QJsonObject&);

View File

@ -19,15 +19,15 @@
#pragma once #pragma once
#include <QJsonObject> #include <QJsonObject>
#include <QList>
#include <QString> #include <QString>
#include <QVector>
namespace TechnicSolder { namespace TechnicSolder {
struct Pack { struct Pack {
QString recommended; QString recommended;
QString latest; QString latest;
QVector<QString> builds; QList<QString> builds;
}; };
void loadPack(Pack& v, QJsonObject& obj); void loadPack(Pack& v, QJsonObject& obj);
@ -41,7 +41,7 @@ struct PackBuildMod {
struct PackBuild { struct PackBuild {
QString minecraft; QString minecraft;
QVector<PackBuildMod> mods; QList<PackBuildMod> mods;
}; };
void loadPackBuild(PackBuild& v, QJsonObject& obj); void loadPackBuild(PackBuild& v, QJsonObject& obj);

View File

@ -153,7 +153,7 @@ struct TranslationsModel::Private {
QDir m_dir; QDir m_dir;
// initial state is just english // initial state is just english
QVector<Language> m_languages = { Language(defaultLangCode) }; QList<Language> m_languages = { Language(defaultLangCode) };
QString m_selectedLanguage = defaultLangCode; QString m_selectedLanguage = defaultLangCode;
std::unique_ptr<QTranslator> m_qt_translator; std::unique_ptr<QTranslator> m_qt_translator;
@ -417,7 +417,7 @@ int TranslationsModel::columnCount([[maybe_unused]] const QModelIndex& parent) c
return 2; return 2;
} }
QVector<Language>::Iterator TranslationsModel::findLanguage(const QString& key) QList<Language>::Iterator TranslationsModel::findLanguage(const QString& key)
{ {
return std::find_if(d->m_languages.begin(), d->m_languages.end(), [key](Language& lang) { return lang.key == key; }); return std::find_if(d->m_languages.begin(), d->m_languages.end(), [key](Language& lang) { return lang.key == key; });
} }

View File

@ -41,7 +41,7 @@ class TranslationsModel : public QAbstractListModel {
void setUseSystemLocale(bool useSystemLocale); void setUseSystemLocale(bool useSystemLocale);
private: private:
QVector<Language>::Iterator findLanguage(const QString& key); QList<Language>::Iterator findLanguage(const QString& key);
std::optional<Language> findLanguageAsOptional(const QString& key); std::optional<Language> findLanguageAsOptional(const QString& key);
void reloadLocalFiles(); void reloadLocalFiles();
void downloadTranslation(QString key); void downloadTranslation(QString key);

View File

@ -18,10 +18,10 @@
#include "BoxGeometry.h" #include "BoxGeometry.h"
#include <QList>
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QVector2D> #include <QVector2D>
#include <QVector3D> #include <QVector3D>
#include <QVector>
struct VertexData { struct VertexData {
QVector4D position; QVector4D position;
@ -32,7 +32,7 @@ struct VertexData {
// For cube we would need only 8 vertices but we have to // For cube we would need only 8 vertices but we have to
// duplicate vertex for each face because texture coordinate // duplicate vertex for each face because texture coordinate
// is different. // is different.
static const QVector<QVector4D> vertices = { static const QList<QVector4D> vertices = {
// Vertex data for face 0 // Vertex data for face 0
QVector4D(-0.5f, -0.5f, 0.5f, 1.0f), // v0 QVector4D(-0.5f, -0.5f, 0.5f, 1.0f), // v0
QVector4D(0.5f, -0.5f, 0.5f, 1.0f), // v1 QVector4D(0.5f, -0.5f, 0.5f, 1.0f), // v1
@ -76,7 +76,7 @@ static const QVector<QVector4D> vertices = {
// index of the second strip needs to be duplicated. If // index of the second strip needs to be duplicated. If
// connecting strips have same vertex order then only last // connecting strips have same vertex order then only last
// index of the first strip needs to be duplicated. // index of the first strip needs to be duplicated.
static const QVector<GLushort> indices = { static const QList<GLushort> indices = {
0, 1, 2, 3, 3, // Face 0 - triangle strip ( v0, v1, v2, v3) 0, 1, 2, 3, 3, // Face 0 - triangle strip ( v0, v1, v2, v3)
4, 4, 5, 6, 7, 7, // Face 1 - triangle strip ( v4, v5, v6, v7) 4, 4, 5, 6, 7, 7, // Face 1 - triangle strip ( v4, v5, v6, v7)
8, 8, 9, 10, 11, 11, // Face 2 - triangle strip ( v8, v9, v10, v11) 8, 8, 9, 10, 11, 11, // Face 2 - triangle strip ( v8, v9, v10, v11)
@ -85,19 +85,19 @@ static const QVector<GLushort> indices = {
20, 20, 21, 22, 23 // Face 5 - triangle strip (v20, v21, v22, v23) 20, 20, 21, 22, 23 // Face 5 - triangle strip (v20, v21, v22, v23)
}; };
static const QVector<VertexData> planeVertices = { static const QList<VertexData> planeVertices = {
{ QVector4D(-1.0f, -1.0f, -0.5f, 1.0f), QVector2D(0.0f, 0.0f) }, // Bottom-left { QVector4D(-1.0f, -1.0f, -0.5f, 1.0f), QVector2D(0.0f, 0.0f) }, // Bottom-left
{ QVector4D(1.0f, -1.0f, -0.5f, 1.0f), QVector2D(1.0f, 0.0f) }, // Bottom-right { QVector4D(1.0f, -1.0f, -0.5f, 1.0f), QVector2D(1.0f, 0.0f) }, // Bottom-right
{ QVector4D(-1.0f, 1.0f, -0.5f, 1.0f), QVector2D(0.0f, 1.0f) }, // Top-left { QVector4D(-1.0f, 1.0f, -0.5f, 1.0f), QVector2D(0.0f, 1.0f) }, // Top-left
{ QVector4D(1.0f, 1.0f, -0.5f, 1.0f), QVector2D(1.0f, 1.0f) }, // Top-right { QVector4D(1.0f, 1.0f, -0.5f, 1.0f), QVector2D(1.0f, 1.0f) }, // Top-right
}; };
static const QVector<GLushort> planeIndices = { static const QList<GLushort> planeIndices = {
0, 1, 2, 3, 3 // Face 0 - triangle strip ( v0, v1, v2, v3) 0, 1, 2, 3, 3 // Face 0 - triangle strip ( v0, v1, v2, v3)
}; };
QVector<QVector4D> transformVectors(const QMatrix4x4& matrix, const QVector<QVector4D>& vectors) QList<QVector4D> transformVectors(const QMatrix4x4& matrix, const QList<QVector4D>& vectors)
{ {
QVector<QVector4D> transformedVectors; QList<QVector4D> transformedVectors;
transformedVectors.reserve(vectors.size()); transformedVectors.reserve(vectors.size());
for (const QVector4D& vec : vectors) { for (const QVector4D& vec : vectors) {
@ -113,9 +113,9 @@ QVector<QVector4D> transformVectors(const QMatrix4x4& matrix, const QVector<QVec
// Function to calculate UV coordinates // Function to calculate UV coordinates
// this is pure magic (if something is wrong with textures this is at fault) // this is pure magic (if something is wrong with textures this is at fault)
QVector<QVector2D> getCubeUVs(float u, float v, float width, float height, float depth, float textureWidth, float textureHeight) QList<QVector2D> getCubeUVs(float u, float v, float width, float height, float depth, float textureWidth, float textureHeight)
{ {
auto toFaceVertices = [textureHeight, textureWidth](float x1, float y1, float x2, float y2) -> QVector<QVector2D> { auto toFaceVertices = [textureHeight, textureWidth](float x1, float y1, float x2, float y2) -> QList<QVector2D> {
return { return {
QVector2D(x1 / textureWidth, 1.0 - y2 / textureHeight), QVector2D(x1 / textureWidth, 1.0 - y2 / textureHeight),
QVector2D(x2 / textureWidth, 1.0 - y2 / textureHeight), QVector2D(x2 / textureWidth, 1.0 - y2 / textureHeight),
@ -168,7 +168,7 @@ QVector<QVector2D> getCubeUVs(float u, float v, float width, float height, float
back[2], back[2],
}; };
// Create a new array to hold the modified UV data // Create a new array to hold the modified UV data
QVector<QVector2D> uvData; QList<QVector2D> uvData;
uvData.reserve(24); uvData.reserve(24);
// Iterate over the arrays and copy the data to newUVData // Iterate over the arrays and copy the data to newUVData
@ -237,7 +237,7 @@ void BoxGeometry::initGeometry(float u, float v, float width, float height, floa
transformation.scale(m_size); transformation.scale(m_size);
auto positions = transformVectors(transformation, vertices); auto positions = transformVectors(transformation, vertices);
QVector<VertexData> verticesData; QList<VertexData> verticesData;
verticesData.reserve(positions.size()); // Reserve space for efficiency verticesData.reserve(positions.size()); // Reserve space for efficiency
for (int i = 0; i < positions.size(); ++i) { for (int i = 0; i < positions.size(); ++i) {

View File

@ -34,9 +34,9 @@ class Scene {
void setCapeVisible(bool visible); void setCapeVisible(bool visible);
private: private:
QVector<BoxGeometry*> m_staticComponents; QList<BoxGeometry*> m_staticComponents;
QVector<BoxGeometry*> m_normalArms; QList<BoxGeometry*> m_normalArms;
QVector<BoxGeometry*> m_slimArms; QList<BoxGeometry*> m_slimArms;
BoxGeometry* m_cape = nullptr; BoxGeometry* m_cape = nullptr;
QOpenGLTexture* m_skinTexture = nullptr; QOpenGLTexture* m_skinTexture = nullptr;
QOpenGLTexture* m_capeTexture = nullptr; QOpenGLTexture* m_capeTexture = nullptr;

View File

@ -89,7 +89,7 @@ void InstanceView::setModel(QAbstractItemModel* model)
void InstanceView::dataChanged([[maybe_unused]] const QModelIndex& topLeft, void InstanceView::dataChanged([[maybe_unused]] const QModelIndex& topLeft,
[[maybe_unused]] const QModelIndex& bottomRight, [[maybe_unused]] const QModelIndex& bottomRight,
[[maybe_unused]] const QVector<int>& roles) [[maybe_unused]] const QList<int>& roles)
{ {
scheduleDelayedItemsLayout(); scheduleDelayedItemsLayout();
} }

View File

@ -83,7 +83,7 @@ class InstanceView : public QAbstractItemView {
virtual void updateGeometries() override; virtual void updateGeometries() override;
protected slots: protected slots:
virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles) override; virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QList<int>& roles) override;
virtual void rowsInserted(const QModelIndex& parent, int start, int end) override; virtual void rowsInserted(const QModelIndex& parent, int start, int end) override;
virtual void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override; virtual void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
void modelReset(); void modelReset();

View File

@ -55,7 +55,7 @@ void VisualGroup::update()
auto itemsPerRow = view->itemsPerRow(); auto itemsPerRow = view->itemsPerRow();
int numRows = qMax(1, qCeil((qreal)temp_items.size() / (qreal)itemsPerRow)); int numRows = qMax(1, qCeil((qreal)temp_items.size() / (qreal)itemsPerRow));
rows = QVector<VisualRow>(numRows); rows = QList<VisualRow>(numRows);
int maxRowHeight = 0; int maxRowHeight = 0;
int positionInRow = 0; int positionInRow = 0;

View File

@ -35,10 +35,10 @@
#pragma once #pragma once
#include <QList>
#include <QRect> #include <QRect>
#include <QString> #include <QString>
#include <QStyleOption> #include <QStyleOption>
#include <QVector>
class InstanceView; class InstanceView;
class QPainter; class QPainter;
@ -61,7 +61,7 @@ struct VisualGroup {
InstanceView* view = nullptr; InstanceView* view = nullptr;
QString text; QString text;
bool collapsed = false; bool collapsed = false;
QVector<VisualRow> rows; QList<VisualRow> rows;
int firstItemIndex = 0; int firstItemIndex = 0;
int m_verticalPosition = 0; int m_verticalPosition = 0;

View File

@ -47,7 +47,7 @@
AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent, AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent,
const ATLauncher::PackVersion& version, const ATLauncher::PackVersion& version,
QVector<ATLauncher::VersionMod> mods) QList<ATLauncher::VersionMod> mods)
: QAbstractListModel(parent), m_version(version), m_mods(mods) : QAbstractListModel(parent), m_version(version), m_mods(mods)
{ {
// fill mod index // fill mod index
@ -64,9 +64,9 @@ AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent,
} }
} }
QVector<QString> AtlOptionalModListModel::getResult() QList<QString> AtlOptionalModListModel::getResult()
{ {
QVector<QString> result; QList<QString> result;
for (const auto& mod : m_mods) { for (const auto& mod : m_mods) {
if (m_selection[mod.name]) { if (m_selection[mod.name]) {
@ -315,7 +315,7 @@ void AtlOptionalModListModel::setMod(const ATLauncher::VersionMod& mod, int inde
} }
} }
AtlOptionalModDialog::AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods) AtlOptionalModDialog::AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QList<ATLauncher::VersionMod> mods)
: QDialog(parent), ui(new Ui::AtlOptionalModDialog) : QDialog(parent), ui(new Ui::AtlOptionalModDialog)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -55,9 +55,9 @@ class AtlOptionalModListModel : public QAbstractListModel {
DescriptionColumn, DescriptionColumn,
}; };
AtlOptionalModListModel(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods); AtlOptionalModListModel(QWidget* parent, const ATLauncher::PackVersion& version, QList<ATLauncher::VersionMod> mods);
QVector<QString> getResult(); QList<QString> getResult();
int rowCount(const QModelIndex& parent) const override; int rowCount(const QModelIndex& parent) const override;
int columnCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override;
@ -86,21 +86,21 @@ class AtlOptionalModListModel : public QAbstractListModel {
std::shared_ptr<QByteArray> m_response = std::make_shared<QByteArray>(); std::shared_ptr<QByteArray> m_response = std::make_shared<QByteArray>();
ATLauncher::PackVersion m_version; ATLauncher::PackVersion m_version;
QVector<ATLauncher::VersionMod> m_mods; QList<ATLauncher::VersionMod> m_mods;
QMap<QString, bool> m_selection; QMap<QString, bool> m_selection;
QMap<QString, int> m_index; QMap<QString, int> m_index;
QMap<QString, QVector<QString>> m_dependents; QMap<QString, QList<QString>> m_dependents;
}; };
class AtlOptionalModDialog : public QDialog { class AtlOptionalModDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QVector<ATLauncher::VersionMod> mods); AtlOptionalModDialog(QWidget* parent, const ATLauncher::PackVersion& version, QList<ATLauncher::VersionMod> mods);
~AtlOptionalModDialog() override; ~AtlOptionalModDialog() override;
QVector<QString> getResult() { return listModel->getResult(); } QList<QString> getResult() { return listModel->getResult(); }
void useShareCode(); void useShareCode();

View File

@ -41,8 +41,8 @@
AtlUserInteractionSupportImpl::AtlUserInteractionSupportImpl(QWidget* parent) : m_parent(parent) {} AtlUserInteractionSupportImpl::AtlUserInteractionSupportImpl(QWidget* parent) : m_parent(parent) {}
std::optional<QVector<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(const ATLauncher::PackVersion& version, std::optional<QList<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(const ATLauncher::PackVersion& version,
QVector<ATLauncher::VersionMod> mods) QList<ATLauncher::VersionMod> mods)
{ {
AtlOptionalModDialog optionalModDialog(m_parent, version, mods); AtlOptionalModDialog optionalModDialog(m_parent, version, mods);
auto result = optionalModDialog.exec(); auto result = optionalModDialog.exec();

View File

@ -48,8 +48,7 @@ class AtlUserInteractionSupportImpl : public QObject, public ATLauncher::UserInt
private: private:
QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) override; QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) override;
std::optional<QVector<QString>> chooseOptionalMods(const ATLauncher::PackVersion& version, std::optional<QList<QString>> chooseOptionalMods(const ATLauncher::PackVersion& version, QList<ATLauncher::VersionMod> mods) override;
QVector<ATLauncher::VersionMod> mods) override;
void displayMessage(QString message) override; void displayMessage(QString message) override;
private: private:

View File

@ -95,7 +95,7 @@ void FlameTexturePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m,
{ {
FlameMod::loadIndexedPackVersions(m, arr); FlameMod::loadIndexedPackVersions(m, arr);
QVector<ModPlatform::IndexedVersion> filtered_versions(m.versions.size()); QList<ModPlatform::IndexedVersion> filtered_versions(m.versions.size());
// FIXME: Client-side version filtering. This won't take into account any user-selected filtering. // FIXME: Client-side version filtering. This won't take into account any user-selected filtering.
for (auto const& version : m.versions) { for (auto const& version : m.versions) {

View File

@ -37,7 +37,6 @@
#include <QList> #include <QList>
#include <QString> #include <QString>
#include <QVector>
namespace Technic { namespace Technic {
struct Modpack { struct Modpack {
@ -61,7 +60,7 @@ struct Modpack {
bool versionsLoaded = false; bool versionsLoaded = false;
QString recommended; QString recommended;
QVector<QString> versions; QList<QString> versions;
}; };
} // namespace Technic } // namespace Technic

View File

@ -42,7 +42,7 @@
#include <QFile> #include <QFile>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <QVector> #include <QList>
#endif #endif
class LockedFile : public QFile { class LockedFile : public QFile {
@ -64,7 +64,7 @@ class LockedFile : public QFile {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
Qt::HANDLE wmutex; Qt::HANDLE wmutex;
Qt::HANDLE rmutex; Qt::HANDLE rmutex;
QVector<Qt::HANDLE> rmutexes; QList<Qt::HANDLE> rmutexes;
QString mutexname; QString mutexname;
Qt::HANDLE getMutexHandle(int idx, bool doCreate); Qt::HANDLE getMutexHandle(int idx, bool doCreate);