mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-29 14:14:34 +02:00
replace qvector with qlist (#3519)
This commit is contained in:
commit
d6bba50d86
@ -188,10 +188,10 @@ T ensureIsType(const QJsonObject& parent, const QString& key, const T default_ =
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QVector<T> requireIsArrayOf(const QJsonDocument& doc)
|
||||
QList<T> requireIsArrayOf(const QJsonDocument& doc)
|
||||
{
|
||||
const QJsonArray array = requireArray(doc);
|
||||
QVector<T> out;
|
||||
QList<T> out;
|
||||
for (const QJsonValue val : array) {
|
||||
out.append(requireIsType<T>(val, "Document"));
|
||||
}
|
||||
@ -199,10 +199,10 @@ QVector<T> requireIsArrayOf(const QJsonDocument& doc)
|
||||
}
|
||||
|
||||
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);
|
||||
QVector<T> out;
|
||||
QList<T> out;
|
||||
for (const QJsonValue val : array) {
|
||||
out.append(requireIsType<T>(val, what));
|
||||
}
|
||||
@ -210,7 +210,7 @@ QVector<T> ensureIsArrayOf(const QJsonValue& value, const QString& what = "Value
|
||||
}
|
||||
|
||||
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()) {
|
||||
return default_;
|
||||
@ -220,7 +220,7 @@ QVector<T> ensureIsArrayOf(const QJsonValue& value, const QVector<T> default_, c
|
||||
|
||||
/// @throw JsonException
|
||||
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 + '\'');
|
||||
if (!parent.contains(key)) {
|
||||
@ -230,10 +230,10 @@ QVector<T> requireIsArrayOf(const QJsonObject& parent, const QString& key, const
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QVector<T> ensureIsArrayOf(const QJsonObject& parent,
|
||||
const QString& key,
|
||||
const QVector<T>& default_ = QVector<T>(),
|
||||
const QString& what = "__placeholder__")
|
||||
QList<T> ensureIsArrayOf(const QJsonObject& parent,
|
||||
const QString& key,
|
||||
const QList<T>& default_ = QList<T>(),
|
||||
const QString& what = "__placeholder__")
|
||||
{
|
||||
const QString localWhat = QString(what).replace("__placeholder__", '\'' + key + '\'');
|
||||
if (!parent.contains(key)) {
|
||||
|
@ -106,6 +106,6 @@ class IconList : public QAbstractListModel {
|
||||
shared_qobject_ptr<QFileSystemWatcher> m_watcher;
|
||||
bool m_isWatching;
|
||||
QMap<QString, int> m_nameIndex;
|
||||
QVector<MMCIcon> m_icons;
|
||||
QList<MMCIcon> m_icons;
|
||||
QDir m_dir;
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ void LogModel::setMaxLines(int maxLines)
|
||||
return;
|
||||
}
|
||||
// otherwise, we need to reorganize the data because it crosses the wrap boundary
|
||||
QVector<entry> newContent;
|
||||
QList<entry> newContent;
|
||||
newContent.resize(maxLines);
|
||||
if (m_numLines <= maxLines) {
|
||||
// if it all fits in the new buffer, just copy it over
|
||||
|
@ -42,7 +42,7 @@ class LogModel : public QAbstractListModel {
|
||||
};
|
||||
|
||||
private: /* data */
|
||||
QVector<entry> m_content;
|
||||
QList<entry> m_content;
|
||||
int m_maxLines = 1000;
|
||||
// first line in the circular buffer
|
||||
int m_firstLine = 0;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
namespace Meta {
|
||||
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) {
|
||||
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)
|
||||
{
|
||||
const QVector<VersionList::Ptr> lists = other->m_lists;
|
||||
const QList<VersionList::Ptr> lists = other->m_lists;
|
||||
// initial load, no need to merge
|
||||
if (m_lists.isEmpty()) {
|
||||
beginResetModel();
|
||||
|
@ -29,7 +29,7 @@ class Index : public QAbstractListModel, public BaseEntity {
|
||||
Q_OBJECT
|
||||
public:
|
||||
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;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
@ -60,7 +60,7 @@ class Index : public QAbstractListModel, public BaseEntity {
|
||||
void parse(const QJsonObject& obj) override;
|
||||
|
||||
private:
|
||||
QVector<VersionList::Ptr> m_lists;
|
||||
QList<VersionList::Ptr> m_lists;
|
||||
QHash<QString, VersionList::Ptr> m_uids;
|
||||
|
||||
void connectVersionList(int row, const VersionList::Ptr& list);
|
||||
|
@ -35,8 +35,8 @@ MetadataVersion currentFormatVersion()
|
||||
// Index
|
||||
static std::shared_ptr<Index> parseIndexInternal(const QJsonObject& obj)
|
||||
{
|
||||
const QVector<QJsonObject> objects = requireIsArrayOf<QJsonObject>(obj, "packages");
|
||||
QVector<VersionList::Ptr> lists;
|
||||
const QList<QJsonObject> objects = requireIsArrayOf<QJsonObject>(obj, "packages");
|
||||
QList<VersionList::Ptr> lists;
|
||||
lists.reserve(objects.size());
|
||||
std::transform(objects.begin(), objects.end(), std::back_inserter(lists), [](const QJsonObject& obj) {
|
||||
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 QVector<QJsonObject> versionsRaw = requireIsArrayOf<QJsonObject>(obj, "versions");
|
||||
QVector<Version::Ptr> versions;
|
||||
const QList<QJsonObject> versionsRaw = requireIsArrayOf<QJsonObject>(obj, "versions");
|
||||
QList<Version::Ptr> versions;
|
||||
versions.reserve(versionsRaw.size());
|
||||
std::transform(versionsRaw.begin(), versionsRaw.end(), std::back_inserter(versions), [uid](const QJsonObject& vObj) {
|
||||
auto version = parseCommonVersion(uid, vObj);
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "BaseVersion.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
#include "minecraft/VersionFile.h"
|
||||
|
@ -169,7 +169,7 @@ void VersionList::setName(const QString& name)
|
||||
emit nameChanged(name);
|
||||
}
|
||||
|
||||
void VersionList::setVersions(const QVector<Version::Ptr>& versions)
|
||||
void VersionList::setVersions(const QList<Version::Ptr>& versions)
|
||||
{
|
||||
beginResetModel();
|
||||
m_versions = versions;
|
||||
@ -265,7 +265,7 @@ void VersionList::setupAddedVersion(const int row, const Version::Ptr& version)
|
||||
disconnect(version.get(), &Version::typeChanged, this, nullptr);
|
||||
|
||||
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,
|
||||
[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 }); });
|
||||
|
@ -61,14 +61,14 @@ class VersionList : public BaseVersionList, public BaseEntity {
|
||||
Version::Ptr getVersion(const QString& version);
|
||||
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
|
||||
void waitToLoad();
|
||||
|
||||
public: // for usage only by parsers
|
||||
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 mergeFromIndex(const VersionList::Ptr& other);
|
||||
void parse(const QJsonObject& obj) override;
|
||||
@ -82,7 +82,7 @@ class VersionList : public BaseVersionList, public BaseEntity {
|
||||
void updateListData(QList<BaseVersion::Ptr>) override {}
|
||||
|
||||
private:
|
||||
QVector<Version::Ptr> m_versions;
|
||||
QList<Version::Ptr> m_versions;
|
||||
QStringList m_externalRecommendsVersions;
|
||||
QHash<QString, Version::Ptr> m_lookup;
|
||||
QString m_uid;
|
||||
|
@ -36,8 +36,8 @@
|
||||
#pragma once
|
||||
#include <QByteArray>
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "minecraft/auth/AccountData.h"
|
||||
#include "minecraft/auth/AuthStep.h"
|
||||
|
@ -67,7 +67,7 @@ void SkinList::stopWatching()
|
||||
|
||||
bool SkinList::update()
|
||||
{
|
||||
QVector<SkinModel> newSkins;
|
||||
QList<SkinModel> newSkins;
|
||||
m_dir.refresh();
|
||||
|
||||
auto manifestInfo = QFileInfo(m_dir.absoluteFilePath("index.json"));
|
||||
|
@ -74,7 +74,7 @@ class SkinList : public QAbstractListModel {
|
||||
private:
|
||||
shared_qobject_ptr<QFileSystemWatcher> m_watcher;
|
||||
bool m_isWatching;
|
||||
QVector<SkinModel> m_skinList;
|
||||
QList<SkinModel> m_skinList;
|
||||
QDir m_dir;
|
||||
MinecraftAccountPtr m_acct;
|
||||
};
|
@ -23,7 +23,6 @@
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
class QIODevice;
|
||||
@ -141,7 +140,7 @@ struct IndexedPack {
|
||||
QString side;
|
||||
|
||||
bool versionsLoaded = false;
|
||||
QVector<IndexedVersion> versions;
|
||||
QList<IndexedVersion> versions;
|
||||
|
||||
// Don't load by default, since some modplatform don't have that info
|
||||
bool extraDataLoaded = true;
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#include "ATLPackManifest.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace ATLauncher {
|
||||
|
||||
@ -34,7 +34,7 @@ struct IndexedPack {
|
||||
int position;
|
||||
QString name;
|
||||
PackType type;
|
||||
QVector<IndexedVersion> versions;
|
||||
QList<IndexedVersion> versions;
|
||||
bool system;
|
||||
QString description;
|
||||
|
||||
|
@ -689,7 +689,7 @@ void PackInstallTask::downloadMods()
|
||||
{
|
||||
qDebug() << "PackInstallTask::installMods: " << QThread::currentThreadId();
|
||||
|
||||
QVector<ATLauncher::VersionMod> optionalMods;
|
||||
QList<ATLauncher::VersionMod> optionalMods;
|
||||
for (const auto& mod : m_version.mods) {
|
||||
if (mod.optional) {
|
||||
optionalMods.push_back(mod);
|
||||
@ -697,7 +697,7 @@ void PackInstallTask::downloadMods()
|
||||
}
|
||||
|
||||
// Select optional mods, if pack contains any
|
||||
QVector<QString> selectedMods;
|
||||
QList<QString> selectedMods;
|
||||
if (!optionalMods.isEmpty()) {
|
||||
setStatus(tr("Selecting optional mods..."));
|
||||
auto mods = m_support->chooseOptionalMods(m_version, optionalMods);
|
||||
|
@ -62,7 +62,7 @@ class UserInteractionSupport {
|
||||
/**
|
||||
* 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
|
||||
|
@ -36,9 +36,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace ATLauncher {
|
||||
|
||||
@ -113,7 +113,7 @@ struct VersionMod {
|
||||
bool hidden;
|
||||
bool library;
|
||||
QString group;
|
||||
QVector<QString> depends;
|
||||
QStringList depends;
|
||||
QString colour;
|
||||
QString warning;
|
||||
|
||||
@ -139,8 +139,8 @@ struct VersionKeep {
|
||||
};
|
||||
|
||||
struct VersionKeeps {
|
||||
QVector<VersionKeep> files;
|
||||
QVector<VersionKeep> folders;
|
||||
QList<VersionKeep> files;
|
||||
QList<VersionKeep> folders;
|
||||
};
|
||||
|
||||
struct VersionDelete {
|
||||
@ -149,8 +149,8 @@ struct VersionDelete {
|
||||
};
|
||||
|
||||
struct VersionDeletes {
|
||||
QVector<VersionDelete> files;
|
||||
QVector<VersionDelete> folders;
|
||||
QList<VersionDelete> files;
|
||||
QList<VersionDelete> folders;
|
||||
};
|
||||
|
||||
struct PackVersionMainClass {
|
||||
@ -171,8 +171,8 @@ struct PackVersion {
|
||||
PackVersionExtraArguments extraArguments;
|
||||
|
||||
VersionLoader loader;
|
||||
QVector<VersionLibrary> libraries;
|
||||
QVector<VersionMod> mods;
|
||||
QList<VersionLibrary> libraries;
|
||||
QList<VersionMod> mods;
|
||||
VersionConfigs configs;
|
||||
|
||||
QMap<QString, QString> colours;
|
||||
|
@ -19,8 +19,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace ATLauncher {
|
||||
|
||||
@ -32,7 +32,7 @@ struct ShareCodeMod {
|
||||
struct ShareCode {
|
||||
QString pack;
|
||||
QString version;
|
||||
QVector<ShareCodeMod> mods;
|
||||
QList<ShareCodeMod> mods;
|
||||
};
|
||||
|
||||
struct ShareCodeResponse {
|
||||
|
@ -215,7 +215,7 @@ QList<ModPlatform::Category> FlameAPI::loadModCategories(std::shared_ptr<QByteAr
|
||||
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,
|
||||
ModPlatform::ModLoaderTypes modLoaders)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ class FlameAPI : public NetworkResourceAPI {
|
||||
QString getModFileChangelog(int modId, int fileId);
|
||||
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,
|
||||
ModPlatform::ModLoaderTypes fallback);
|
||||
|
||||
|
@ -78,7 +78,7 @@ static QString enumToString(int hash_algorithm)
|
||||
|
||||
void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr)
|
||||
{
|
||||
QVector<ModPlatform::IndexedVersion> unsortedVersions;
|
||||
QList<ModPlatform::IndexedVersion> unsortedVersions;
|
||||
for (auto versionIter : arr) {
|
||||
auto obj = versionIter.toObject();
|
||||
|
||||
@ -208,7 +208,7 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
|
||||
auto profile = (dynamic_cast<const MinecraftInstance*>(inst))->getPackProfile();
|
||||
QString mcVersion = profile->getComponentVersion("net.minecraft");
|
||||
auto loaders = profile->getSupportedModLoaders();
|
||||
QVector<ModPlatform::IndexedVersion> versions;
|
||||
QList<ModPlatform::IndexedVersion> versions;
|
||||
for (auto versionIter : arr) {
|
||||
auto obj = versionIter.toObject();
|
||||
|
||||
|
@ -77,7 +77,7 @@ void Flame::loadIndexedInfo(IndexedPack& pack, QJsonObject& obj)
|
||||
|
||||
void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
|
||||
{
|
||||
QVector<Flame::IndexedVersion> unsortedVersions;
|
||||
QList<Flame::IndexedVersion> unsortedVersions;
|
||||
for (auto versionIter : arr) {
|
||||
auto version = Json::requireObject(versionIter);
|
||||
Flame::IndexedVersion file;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
namespace Flame {
|
||||
@ -39,7 +38,7 @@ struct IndexedPack {
|
||||
QString logoUrl;
|
||||
|
||||
bool versionsLoaded = false;
|
||||
QVector<IndexedVersion> versions;
|
||||
QList<IndexedVersion> versions;
|
||||
|
||||
bool extraInfoLoaded = false;
|
||||
ModpackExtra extra;
|
||||
|
@ -36,10 +36,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
@ -66,7 +66,7 @@ struct Modloader {
|
||||
struct Minecraft {
|
||||
QString version;
|
||||
QString libraries;
|
||||
QVector<Flame::Modloader> modLoaders;
|
||||
QList<Flame::Modloader> modLoaders;
|
||||
};
|
||||
|
||||
struct Manifest {
|
||||
|
@ -114,7 +114,7 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
|
||||
|
||||
void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr)
|
||||
{
|
||||
QVector<ModPlatform::IndexedVersion> unsortedVersions;
|
||||
QList<ModPlatform::IndexedVersion> unsortedVersions;
|
||||
for (auto versionIter : arr) {
|
||||
auto obj = versionIter.toObject();
|
||||
auto file = loadIndexedPackVersion(obj);
|
||||
@ -253,7 +253,7 @@ ModPlatform::IndexedVersion Modrinth::loadDependencyVersions([[maybe_unused]] co
|
||||
QString mcVersion = profile->getComponentVersion("net.minecraft");
|
||||
auto loaders = profile->getSupportedModLoaders();
|
||||
|
||||
QVector<ModPlatform::IndexedVersion> versions;
|
||||
QList<ModPlatform::IndexedVersion> versions;
|
||||
for (auto versionIter : arr) {
|
||||
auto obj = versionIter.toObject();
|
||||
auto file = loadIndexedPackVersion(obj);
|
||||
|
@ -99,7 +99,7 @@ void loadIndexedInfo(Modpack& pack, QJsonObject& obj)
|
||||
|
||||
void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
|
||||
{
|
||||
QVector<ModpackVersion> unsortedVersions;
|
||||
QList<ModpackVersion> unsortedVersions;
|
||||
|
||||
auto arr = Json::requireArray(doc);
|
||||
|
||||
|
@ -40,10 +40,10 @@
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QCryptographicHash>
|
||||
#include <QList>
|
||||
#include <QQueue>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
@ -110,7 +110,7 @@ struct Modpack {
|
||||
bool extraInfoLoaded = false;
|
||||
|
||||
ModpackExtra extra;
|
||||
QVector<ModpackVersion> versions;
|
||||
QList<ModpackVersion> versions;
|
||||
};
|
||||
|
||||
void loadIndexedPack(Modpack&, QJsonObject&);
|
||||
|
@ -19,15 +19,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace TechnicSolder {
|
||||
|
||||
struct Pack {
|
||||
QString recommended;
|
||||
QString latest;
|
||||
QVector<QString> builds;
|
||||
QList<QString> builds;
|
||||
};
|
||||
|
||||
void loadPack(Pack& v, QJsonObject& obj);
|
||||
@ -41,7 +41,7 @@ struct PackBuildMod {
|
||||
|
||||
struct PackBuild {
|
||||
QString minecraft;
|
||||
QVector<PackBuildMod> mods;
|
||||
QList<PackBuildMod> mods;
|
||||
};
|
||||
|
||||
void loadPackBuild(PackBuild& v, QJsonObject& obj);
|
||||
|
@ -153,7 +153,7 @@ struct TranslationsModel::Private {
|
||||
QDir m_dir;
|
||||
|
||||
// initial state is just english
|
||||
QVector<Language> m_languages = { Language(defaultLangCode) };
|
||||
QList<Language> m_languages = { Language(defaultLangCode) };
|
||||
|
||||
QString m_selectedLanguage = defaultLangCode;
|
||||
std::unique_ptr<QTranslator> m_qt_translator;
|
||||
@ -417,7 +417,7 @@ int TranslationsModel::columnCount([[maybe_unused]] const QModelIndex& parent) c
|
||||
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; });
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class TranslationsModel : public QAbstractListModel {
|
||||
void setUseSystemLocale(bool useSystemLocale);
|
||||
|
||||
private:
|
||||
QVector<Language>::Iterator findLanguage(const QString& key);
|
||||
QList<Language>::Iterator findLanguage(const QString& key);
|
||||
std::optional<Language> findLanguageAsOptional(const QString& key);
|
||||
void reloadLocalFiles();
|
||||
void downloadTranslation(QString key);
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
#include "BoxGeometry.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMatrix4x4>
|
||||
#include <QVector2D>
|
||||
#include <QVector3D>
|
||||
#include <QVector>
|
||||
|
||||
struct VertexData {
|
||||
QVector4D position;
|
||||
@ -32,7 +32,7 @@ struct VertexData {
|
||||
// For cube we would need only 8 vertices but we have to
|
||||
// duplicate vertex for each face because texture coordinate
|
||||
// is different.
|
||||
static const QVector<QVector4D> vertices = {
|
||||
static const QList<QVector4D> vertices = {
|
||||
// Vertex data for face 0
|
||||
QVector4D(-0.5f, -0.5f, 0.5f, 1.0f), // v0
|
||||
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
|
||||
// connecting strips have same vertex order then only last
|
||||
// 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)
|
||||
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)
|
||||
@ -85,19 +85,19 @@ static const QVector<GLushort> indices = {
|
||||
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(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(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)
|
||||
};
|
||||
|
||||
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());
|
||||
|
||||
for (const QVector4D& vec : vectors) {
|
||||
@ -113,9 +113,9 @@ QVector<QVector4D> transformVectors(const QMatrix4x4& matrix, const QVector<QVec
|
||||
|
||||
// Function to calculate UV coordinates
|
||||
// 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 {
|
||||
QVector2D(x1 / 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],
|
||||
};
|
||||
// Create a new array to hold the modified UV data
|
||||
QVector<QVector2D> uvData;
|
||||
QList<QVector2D> uvData;
|
||||
uvData.reserve(24);
|
||||
|
||||
// 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);
|
||||
auto positions = transformVectors(transformation, vertices);
|
||||
|
||||
QVector<VertexData> verticesData;
|
||||
QList<VertexData> verticesData;
|
||||
verticesData.reserve(positions.size()); // Reserve space for efficiency
|
||||
|
||||
for (int i = 0; i < positions.size(); ++i) {
|
||||
|
@ -34,9 +34,9 @@ class Scene {
|
||||
void setCapeVisible(bool visible);
|
||||
|
||||
private:
|
||||
QVector<BoxGeometry*> m_staticComponents;
|
||||
QVector<BoxGeometry*> m_normalArms;
|
||||
QVector<BoxGeometry*> m_slimArms;
|
||||
QList<BoxGeometry*> m_staticComponents;
|
||||
QList<BoxGeometry*> m_normalArms;
|
||||
QList<BoxGeometry*> m_slimArms;
|
||||
BoxGeometry* m_cape = nullptr;
|
||||
QOpenGLTexture* m_skinTexture = nullptr;
|
||||
QOpenGLTexture* m_capeTexture = nullptr;
|
||||
|
@ -89,7 +89,7 @@ void InstanceView::setModel(QAbstractItemModel* model)
|
||||
|
||||
void InstanceView::dataChanged([[maybe_unused]] const QModelIndex& topLeft,
|
||||
[[maybe_unused]] const QModelIndex& bottomRight,
|
||||
[[maybe_unused]] const QVector<int>& roles)
|
||||
[[maybe_unused]] const QList<int>& roles)
|
||||
{
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class InstanceView : public QAbstractItemView {
|
||||
virtual void updateGeometries() override;
|
||||
|
||||
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 rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
|
||||
void modelReset();
|
||||
|
@ -55,7 +55,7 @@ void VisualGroup::update()
|
||||
auto itemsPerRow = view->itemsPerRow();
|
||||
|
||||
int numRows = qMax(1, qCeil((qreal)temp_items.size() / (qreal)itemsPerRow));
|
||||
rows = QVector<VisualRow>(numRows);
|
||||
rows = QList<VisualRow>(numRows);
|
||||
|
||||
int maxRowHeight = 0;
|
||||
int positionInRow = 0;
|
||||
|
@ -35,10 +35,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
#include <QRect>
|
||||
#include <QString>
|
||||
#include <QStyleOption>
|
||||
#include <QVector>
|
||||
|
||||
class InstanceView;
|
||||
class QPainter;
|
||||
@ -61,7 +61,7 @@ struct VisualGroup {
|
||||
InstanceView* view = nullptr;
|
||||
QString text;
|
||||
bool collapsed = false;
|
||||
QVector<VisualRow> rows;
|
||||
QList<VisualRow> rows;
|
||||
int firstItemIndex = 0;
|
||||
int m_verticalPosition = 0;
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent,
|
||||
const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods)
|
||||
QList<ATLauncher::VersionMod> mods)
|
||||
: QAbstractListModel(parent), m_version(version), m_mods(mods)
|
||||
{
|
||||
// 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) {
|
||||
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)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -55,9 +55,9 @@ class AtlOptionalModListModel : public QAbstractListModel {
|
||||
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 columnCount(const QModelIndex& parent) const override;
|
||||
@ -86,21 +86,21 @@ class AtlOptionalModListModel : public QAbstractListModel {
|
||||
std::shared_ptr<QByteArray> m_response = std::make_shared<QByteArray>();
|
||||
|
||||
ATLauncher::PackVersion m_version;
|
||||
QVector<ATLauncher::VersionMod> m_mods;
|
||||
QList<ATLauncher::VersionMod> m_mods;
|
||||
|
||||
QMap<QString, bool> m_selection;
|
||||
QMap<QString, int> m_index;
|
||||
QMap<QString, QVector<QString>> m_dependents;
|
||||
QMap<QString, QList<QString>> m_dependents;
|
||||
};
|
||||
|
||||
class AtlOptionalModDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
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;
|
||||
|
||||
QVector<QString> getResult() { return listModel->getResult(); }
|
||||
QList<QString> getResult() { return listModel->getResult(); }
|
||||
|
||||
void useShareCode();
|
||||
|
||||
|
@ -41,8 +41,8 @@
|
||||
|
||||
AtlUserInteractionSupportImpl::AtlUserInteractionSupportImpl(QWidget* parent) : m_parent(parent) {}
|
||||
|
||||
std::optional<QVector<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods)
|
||||
std::optional<QList<QString>> AtlUserInteractionSupportImpl::chooseOptionalMods(const ATLauncher::PackVersion& version,
|
||||
QList<ATLauncher::VersionMod> mods)
|
||||
{
|
||||
AtlOptionalModDialog optionalModDialog(m_parent, version, mods);
|
||||
auto result = optionalModDialog.exec();
|
||||
|
@ -48,8 +48,7 @@ class AtlUserInteractionSupportImpl : public QObject, public ATLauncher::UserInt
|
||||
|
||||
private:
|
||||
QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) override;
|
||||
std::optional<QVector<QString>> chooseOptionalMods(const ATLauncher::PackVersion& version,
|
||||
QVector<ATLauncher::VersionMod> mods) override;
|
||||
std::optional<QList<QString>> chooseOptionalMods(const ATLauncher::PackVersion& version, QList<ATLauncher::VersionMod> mods) override;
|
||||
void displayMessage(QString message) override;
|
||||
|
||||
private:
|
||||
|
@ -95,7 +95,7 @@ void FlameTexturePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m,
|
||||
{
|
||||
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.
|
||||
for (auto const& version : m.versions) {
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace Technic {
|
||||
struct Modpack {
|
||||
@ -61,7 +60,7 @@ struct Modpack {
|
||||
|
||||
bool versionsLoaded = false;
|
||||
QString recommended;
|
||||
QVector<QString> versions;
|
||||
QList<QString> versions;
|
||||
};
|
||||
} // namespace Technic
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
#endif
|
||||
|
||||
class LockedFile : public QFile {
|
||||
@ -64,7 +64,7 @@ class LockedFile : public QFile {
|
||||
#ifdef Q_OS_WIN
|
||||
Qt::HANDLE wmutex;
|
||||
Qt::HANDLE rmutex;
|
||||
QVector<Qt::HANDLE> rmutexes;
|
||||
QList<Qt::HANDLE> rmutexes;
|
||||
QString mutexname;
|
||||
|
||||
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
|
||||
|
Loading…
x
Reference in New Issue
Block a user