aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft')
-rw-r--r--launcher/minecraft/Component.h3
-rw-r--r--launcher/minecraft/LaunchProfile.h2
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp6
-rw-r--r--launcher/minecraft/MinecraftLoadAndCheck.cpp2
-rw-r--r--launcher/minecraft/MinecraftUpdate.cpp4
-rw-r--r--launcher/minecraft/MojangDownloadInfo.h12
-rw-r--r--launcher/minecraft/OneSixVersionFormat.cpp2
-rw-r--r--launcher/minecraft/PackProfile.cpp18
-rw-r--r--launcher/minecraft/PackProfile.h2
-rw-r--r--launcher/minecraft/ProfileUtils.cpp2
-rw-r--r--launcher/minecraft/Rule.h2
-rw-r--r--launcher/minecraft/World.cpp12
-rw-r--r--launcher/minecraft/WorldList.cpp11
-rw-r--r--launcher/minecraft/auth/AccountData.cpp4
-rw-r--r--launcher/minecraft/auth/AccountList.cpp2
-rw-r--r--launcher/minecraft/auth/Parsers.cpp8
-rw-r--r--launcher/minecraft/auth/steps/EntitlementsStep.cpp4
-rw-r--r--launcher/minecraft/gameoptions/GameOptions.cpp3
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp2
-rw-r--r--launcher/minecraft/mod/Mod.h2
-rw-r--r--launcher/minecraft/mod/ModDetails.h19
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp2
-rw-r--r--launcher/minecraft/mod/ResourceFolderModel.cpp6
-rw-r--r--launcher/minecraft/mod/ResourceFolderModel.h20
-rw-r--r--launcher/minecraft/mod/ResourcePackFolderModel.cpp3
-rw-r--r--launcher/minecraft/mod/TexturePackFolderModel.cpp2
-rw-r--r--launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp20
-rw-r--r--launcher/minecraft/mod/tasks/LocalModParseTask.cpp33
-rw-r--r--launcher/minecraft/services/CapeChange.cpp2
-rw-r--r--launcher/minecraft/update/AssetUpdateTask.cpp4
-rw-r--r--launcher/minecraft/update/FMLLibrariesTask.cpp2
-rw-r--r--launcher/minecraft/update/LibrariesTask.cpp2
32 files changed, 107 insertions, 111 deletions
diff --git a/launcher/minecraft/Component.h b/launcher/minecraft/Component.h
index ef7c9947..e7419c41 100644
--- a/launcher/minecraft/Component.h
+++ b/launcher/minecraft/Component.h
@@ -27,7 +27,8 @@ public:
Component(PackProfile * parent, std::shared_ptr<Meta::Version> version);
Component(PackProfile * parent, const QString & uid, std::shared_ptr<VersionFile> file);
- virtual ~Component(){};
+ virtual ~Component(){}
+
void applyTo(LaunchProfile *profile);
bool isEnabled();
diff --git a/launcher/minecraft/LaunchProfile.h b/launcher/minecraft/LaunchProfile.h
index 49c1217d..79e68824 100644
--- a/launcher/minecraft/LaunchProfile.h
+++ b/launcher/minecraft/LaunchProfile.h
@@ -42,7 +42,7 @@
class LaunchProfile: public ProblemProvider
{
public:
- virtual ~LaunchProfile() {};
+ virtual ~LaunchProfile() {}
public: /* application of profile variables from patches */
void applyMinecraftVersion(const QString& id);
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index 4867cc7a..637ebc91 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -1061,8 +1061,8 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
{
// actually launch the game
- auto method = launchMethod();
- if(method == "LauncherPart")
+ auto launch_method = launchMethod();
+ if(launch_method == "LauncherPart")
{
auto step = makeShared<LauncherPartLaunch>(pptr);
step->setWorkingDirectory(gameRoot());
@@ -1070,7 +1070,7 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
step->setServerToJoin(serverToJoin);
process->appendStep(step);
}
- else if (method == "DirectJava")
+ else if (launch_method == "DirectJava")
{
auto step = makeShared<DirectJavaLaunch>(pptr);
step->setWorkingDirectory(gameRoot());
diff --git a/launcher/minecraft/MinecraftLoadAndCheck.cpp b/launcher/minecraft/MinecraftLoadAndCheck.cpp
index 1c3f6fb7..2a369879 100644
--- a/launcher/minecraft/MinecraftLoadAndCheck.cpp
+++ b/launcher/minecraft/MinecraftLoadAndCheck.cpp
@@ -22,7 +22,7 @@ void MinecraftLoadAndCheck::executeTask()
connect(m_task.get(), &Task::failed, this, &MinecraftLoadAndCheck::subtaskFailed);
connect(m_task.get(), &Task::aborted, this, [this]{ subtaskFailed(tr("Aborted")); });
connect(m_task.get(), &Task::progress, this, &MinecraftLoadAndCheck::progress);
- connect(m_task.get(), &Task::stepProgress, this, &MinecraftLoadAndCheck::propogateStepProgress);
+ connect(m_task.get(), &Task::stepProgress, this, &MinecraftLoadAndCheck::propagateStepProgress);
connect(m_task.get(), &Task::status, this, &MinecraftLoadAndCheck::setStatus);
}
diff --git a/launcher/minecraft/MinecraftUpdate.cpp b/launcher/minecraft/MinecraftUpdate.cpp
index 35430bb0..236d0224 100644
--- a/launcher/minecraft/MinecraftUpdate.cpp
+++ b/launcher/minecraft/MinecraftUpdate.cpp
@@ -100,7 +100,7 @@ void MinecraftUpdate::next()
disconnect(task.get(), &Task::failed, this, &MinecraftUpdate::subtaskFailed);
disconnect(task.get(), &Task::aborted, this, &Task::abort);
disconnect(task.get(), &Task::progress, this, &MinecraftUpdate::progress);
- disconnect(task.get(), &Task::stepProgress, this, &MinecraftUpdate::propogateStepProgress);
+ disconnect(task.get(), &Task::stepProgress, this, &MinecraftUpdate::propagateStepProgress);
disconnect(task.get(), &Task::status, this, &MinecraftUpdate::setStatus);
disconnect(task.get(), &Task::details, this, &MinecraftUpdate::setDetails);
}
@@ -120,7 +120,7 @@ void MinecraftUpdate::next()
connect(task.get(), &Task::failed, this, &MinecraftUpdate::subtaskFailed);
connect(task.get(), &Task::aborted, this, &Task::abort);
connect(task.get(), &Task::progress, this, &MinecraftUpdate::progress);
- connect(task.get(), &Task::stepProgress, this, &MinecraftUpdate::propogateStepProgress);
+ connect(task.get(), &Task::stepProgress, this, &MinecraftUpdate::propagateStepProgress);
connect(task.get(), &Task::status, this, &MinecraftUpdate::setStatus);
connect(task.get(), &Task::details, this, &MinecraftUpdate::setDetails);
// if the task is already running, do not start it again
diff --git a/launcher/minecraft/MojangDownloadInfo.h b/launcher/minecraft/MojangDownloadInfo.h
index 13e27e15..6831d8d8 100644
--- a/launcher/minecraft/MojangDownloadInfo.h
+++ b/launcher/minecraft/MojangDownloadInfo.h
@@ -23,8 +23,8 @@ struct MojangDownloadInfo
struct MojangLibraryDownloadInfo
{
- MojangLibraryDownloadInfo(MojangDownloadInfo::Ptr artifact): artifact(artifact) {};
- MojangLibraryDownloadInfo() {};
+ MojangLibraryDownloadInfo(MojangDownloadInfo::Ptr artifact_): artifact(artifact_) {}
+ MojangLibraryDownloadInfo() {}
// types
typedef std::shared_ptr<MojangLibraryDownloadInfo> Ptr;
@@ -57,20 +57,20 @@ struct MojangAssetIndexInfo : public MojangDownloadInfo
{
}
- MojangAssetIndexInfo(QString id)
+ MojangAssetIndexInfo(QString id_)
{
- this->id = id;
+ this->id = id_;
// HACK: ignore assets from other version files than Minecraft
// workaround for stupid assets issue caused by amazon:
// https://www.theregister.co.uk/2017/02/28/aws_is_awol_as_s3_goes_haywire/
- if(id == "legacy")
+ if(id_ == "legacy")
{
url = "https://piston-meta.mojang.com/mc/assets/legacy/c0fd82e8ce9fbc93119e40d96d5a4e62cfa3f729/legacy.json";
}
// HACK
else
{
- url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json";
+ url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id_ + ".json";
}
known = false;
}
diff --git a/launcher/minecraft/OneSixVersionFormat.cpp b/launcher/minecraft/OneSixVersionFormat.cpp
index b586198b..ddd98110 100644
--- a/launcher/minecraft/OneSixVersionFormat.cpp
+++ b/launcher/minecraft/OneSixVersionFormat.cpp
@@ -413,7 +413,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
}
LibraryPtr OneSixVersionFormat::plusJarModFromJson(
- ProblemContainer & problems,
+ [[maybe_unused]] ProblemContainer & problems,
const QJsonObject &libObj,
const QString &filename,
const QString &originalName
diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp
index e8fd2157..ea5ebdb1 100644
--- a/launcher/minecraft/PackProfile.cpp
+++ b/launcher/minecraft/PackProfile.cpp
@@ -226,11 +226,11 @@ static bool loadPackProfile(PackProfile * parent, const QString & filename, cons
auto orderArray = Json::requireArray(obj.value("components"));
for(auto item: orderArray)
{
- auto obj = Json::requireObject(item, "Component must be an object.");
- container.append(componentFromJsonV1(parent, componentJsonPattern, obj));
+ auto comp_obj = Json::requireObject(item, "Component must be an object.");
+ container.append(componentFromJsonV1(parent, componentJsonPattern, comp_obj));
}
}
- catch (const JSONValidationError &err)
+ catch ([[maybe_unused]] const JSONValidationError &err)
{
qCritical() << "Couldn't parse" << componentsFile.fileName() << ": bad file format";
container.clear();
@@ -415,7 +415,7 @@ void PackProfile::insertComponent(size_t index, ComponentPtr component)
qWarning() << "Attempt to add a component that is already present!";
return;
}
- beginInsertRows(QModelIndex(), index, index);
+ beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index));
d->components.insert(index, component);
d->componentIndex[id] = component;
endInsertRows();
@@ -428,7 +428,7 @@ void PackProfile::componentDataChanged()
auto objPtr = qobject_cast<Component *>(sender());
if(!objPtr)
{
- qWarning() << "PackProfile got dataChenged signal from a non-Component!";
+ qWarning() << "PackProfile got dataChanged signal from a non-Component!";
return;
}
if(objPtr->getID() == "net.minecraft") {
@@ -446,7 +446,7 @@ void PackProfile::componentDataChanged()
}
index++;
}
- qWarning() << "PackProfile got dataChenged signal from a Component which does not belong to it!";
+ qWarning() << "PackProfile got dataChanged signal from a Component which does not belong to it!";
}
bool PackProfile::remove(const int index)
@@ -533,9 +533,9 @@ ComponentPtr PackProfile::getComponent(const QString &id)
return (*iter);
}
-ComponentPtr PackProfile::getComponent(int index)
+ComponentPtr PackProfile::getComponent(size_t index)
{
- if(index < 0 || index >= d->components.size())
+ if(index < 0 || index >= static_cast<size_t>(d->components.size()))
{
return nullptr;
}
@@ -616,7 +616,7 @@ QVariant PackProfile::data(const QModelIndex &index, int role) const
return QVariant();
}
-bool PackProfile::setData(const QModelIndex& index, const QVariant& value, int role)
+bool PackProfile::setData(const QModelIndex& index, [[maybe_unused]] const QVariant& value, int role)
{
if (!index.isValid() || index.row() < 0 || index.row() >= rowCount(index.parent()))
{
diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h
index d144d875..06741c2d 100644
--- a/launcher/minecraft/PackProfile.h
+++ b/launcher/minecraft/PackProfile.h
@@ -145,7 +145,7 @@ public:
ComponentPtr getComponent(const QString &id);
/// get the profile component by index
- ComponentPtr getComponent(int index);
+ ComponentPtr getComponent(size_t index);
/// Add the component to the internal list of patches
// todo(merged): is this the best approach
diff --git a/launcher/minecraft/ProfileUtils.cpp b/launcher/minecraft/ProfileUtils.cpp
index 03f8c198..14557003 100644
--- a/launcher/minecraft/ProfileUtils.cpp
+++ b/launcher/minecraft/ProfileUtils.cpp
@@ -92,7 +92,7 @@ bool readOverrideOrders(QString path, PatchOrder &order)
order.append(Json::requireString(item));
}
}
- catch (const JSONValidationError &err)
+ catch ([[maybe_unused]] const JSONValidationError &err)
{
qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format";
qWarning() << "Ignoring overriden order";
diff --git a/launcher/minecraft/Rule.h b/launcher/minecraft/Rule.h
index 846e8e42..70fd70b6 100644
--- a/launcher/minecraft/Rule.h
+++ b/launcher/minecraft/Rule.h
@@ -63,7 +63,7 @@ public:
Rule(RuleAction result) : m_result(result)
{
}
- virtual ~Rule() {};
+ virtual ~Rule() {}
virtual QJsonObject toJson() = 0;
RuleAction apply(const Library *parent, const RuntimeContext & runtimeContext)
{
diff --git a/launcher/minecraft/World.cpp b/launcher/minecraft/World.cpp
index 54fb9434..21f2c439 100644
--- a/launcher/minecraft/World.cpp
+++ b/launcher/minecraft/World.cpp
@@ -408,13 +408,13 @@ optional<QString> read_string (nbt::value& parent, const char * name)
auto & tag_str = namedValue.as<nbt::tag_string>();
return QString::fromStdString(tag_str.get());
}
- catch (const std::out_of_range &e)
+ catch ([[maybe_unused]] const std::out_of_range &e)
{
// fallback for old world formats
qWarning() << "String NBT tag" << name << "could not be found.";
return nullopt;
}
- catch (const std::bad_cast &e)
+ catch ([[maybe_unused]] const std::bad_cast &e)
{
// type mismatch
qWarning() << "NBT tag" << name << "could not be converted to string.";
@@ -434,13 +434,13 @@ optional<int64_t> read_long (nbt::value& parent, const char * name)
auto & tag_str = namedValue.as<nbt::tag_long>();
return tag_str.get();
}
- catch (const std::out_of_range &e)
+ catch ([[maybe_unused]] const std::out_of_range &e)
{
// fallback for old world formats
qWarning() << "Long NBT tag" << name << "could not be found.";
return nullopt;
}
- catch (const std::bad_cast &e)
+ catch ([[maybe_unused]] const std::bad_cast &e)
{
// type mismatch
qWarning() << "NBT tag" << name << "could not be converted to long.";
@@ -460,13 +460,13 @@ optional<int> read_int (nbt::value& parent, const char * name)
auto & tag_str = namedValue.as<nbt::tag_int>();
return tag_str.get();
}
- catch (const std::out_of_range &e)
+ catch ([[maybe_unused]] const std::out_of_range &e)
{
// fallback for old world formats
qWarning() << "Int NBT tag" << name << "could not be found.";
return nullopt;
}
- catch (const std::bad_cast &e)
+ catch ([[maybe_unused]] const std::bad_cast &e)
{
// type mismatch
qWarning() << "NBT tag" << name << "could not be converted to int.";
diff --git a/launcher/minecraft/WorldList.cpp b/launcher/minecraft/WorldList.cpp
index 0feee299..fe089378 100644
--- a/launcher/minecraft/WorldList.cpp
+++ b/launcher/minecraft/WorldList.cpp
@@ -278,7 +278,7 @@ QVariant WorldList::data(const QModelIndex &index, int role) const
}
}
-QVariant WorldList::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant WorldList::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role)
{
@@ -320,7 +320,6 @@ QVariant WorldList::headerData(int section, Qt::Orientation orientation, int rol
default:
return QVariant();
}
- return QVariant();
}
QStringList WorldList::mimeTypes() const
@@ -373,7 +372,7 @@ QMimeData *WorldList::mimeData(const QModelIndexList &indexes) const
if (indexes.size() == 0)
return new QMimeData();
- QList<World> worlds;
+ QList<World> worlds_;
for(auto idx : indexes)
{
if(idx.column() != 0)
@@ -381,13 +380,13 @@ QMimeData *WorldList::mimeData(const QModelIndexList &indexes) const
int row = idx.row();
if (row < 0 || row >= this->worlds.size())
continue;
- worlds.append(this->worlds[row]);
+ worlds_.append(this->worlds[row]);
}
- if(!worlds.size())
+ if(!worlds_.size())
{
return new QMimeData();
}
- return new WorldMimeData(worlds);
+ return new WorldMimeData(worlds_);
}
Qt::ItemFlags WorldList::flags(const QModelIndex &index) const
diff --git a/launcher/minecraft/auth/AccountData.cpp b/launcher/minecraft/auth/AccountData.cpp
index 44f7e256..334c63b5 100644
--- a/launcher/minecraft/auth/AccountData.cpp
+++ b/launcher/minecraft/auth/AccountData.cpp
@@ -310,7 +310,7 @@ bool AccountData::resumeStateFromV2(QJsonObject data) {
QJsonObject profileObject = profileVal.toObject();
QString id = profileObject.value("id").toString("");
QString name = profileObject.value("name").toString("");
- bool legacy = profileObject.value("legacy").toBool(false);
+ bool legacy_ = profileObject.value("legacy").toBool(false);
if (id.isEmpty() || name.isEmpty())
{
qWarning() << "Unable to load a profile" << name << "because it was missing an ID or a name.";
@@ -319,7 +319,7 @@ bool AccountData::resumeStateFromV2(QJsonObject data) {
if(id == currentProfile) {
currentProfileIndex = index;
}
- profiles.append({id, name, legacy});
+ profiles.append({id, name, legacy_});
}
auto & profile = profiles[currentProfileIndex];
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp
index d6f42b75..14e3ca7c 100644
--- a/launcher/minecraft/auth/AccountList.cpp
+++ b/launcher/minecraft/auth/AccountList.cpp
@@ -369,7 +369,7 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
}
}
-QVariant AccountList::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant AccountList::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role)
{
diff --git a/launcher/minecraft/auth/Parsers.cpp b/launcher/minecraft/auth/Parsers.cpp
index f3d9ad56..98326272 100644
--- a/launcher/minecraft/auth/Parsers.cpp
+++ b/launcher/minecraft/auth/Parsers.cpp
@@ -107,16 +107,16 @@ bool parseXTokenResponse(QByteArray & data, Katabasis::Token &output, QString na
if(!item.isObject()) {
continue;
}
- auto obj = item.toObject();
- if(obj.contains("uhs")) {
+ auto obj_ = item.toObject();
+ if(obj_.contains("uhs")) {
foundUHS = true;
} else {
continue;
}
// consume all 'display claims' ... whatever that means
- for(auto iter = obj.begin(); iter != obj.end(); iter++) {
+ for(auto iter = obj_.begin(); iter != obj_.end(); iter++) {
QString claim;
- if(!getString(obj.value(iter.key()), claim)) {
+ if(!getString(obj_.value(iter.key()), claim)) {
qWarning() << "display claim " << iter.key() << " is not a string...";
return false;
}
diff --git a/launcher/minecraft/auth/steps/EntitlementsStep.cpp b/launcher/minecraft/auth/steps/EntitlementsStep.cpp
index bd604292..b5682708 100644
--- a/launcher/minecraft/auth/steps/EntitlementsStep.cpp
+++ b/launcher/minecraft/auth/steps/EntitlementsStep.cpp
@@ -35,9 +35,9 @@ void EntitlementsStep::rehydrate() {
}
void EntitlementsStep::onRequestDone(
- QNetworkReply::NetworkError error,
+ [[maybe_unused]] QNetworkReply::NetworkError error,
QByteArray data,
- QList<QNetworkReply::RawHeaderPair> headers
+ [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater();
diff --git a/launcher/minecraft/gameoptions/GameOptions.cpp b/launcher/minecraft/gameoptions/GameOptions.cpp
index e547b32a..ce0988cc 100644
--- a/launcher/minecraft/gameoptions/GameOptions.cpp
+++ b/launcher/minecraft/gameoptions/GameOptions.cpp
@@ -112,12 +112,11 @@ QVariant GameOptions::data(const QModelIndex& index, int role) const
default:
return QVariant();
}
- return QVariant();
}
int GameOptions::rowCount(const QModelIndex&) const
{
- return contents.size();
+ return static_cast<int>(contents.size());
}
int GameOptions::columnCount(const QModelIndex&) const
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp
index 8ecf715d..01df8543 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.cpp
+++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp
@@ -54,7 +54,7 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
if (instance->settings()->get("CloseAfterLaunch").toBool())
{
std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
- *connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
+ *connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, [[maybe_unused]] MessageLevel::Enum level) {
qDebug() << lines;
if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0)
{
diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h
index b67bd465..ef1895e1 100644
--- a/launcher/minecraft/mod/Mod.h
+++ b/launcher/minecraft/mod/Mod.h
@@ -73,7 +73,7 @@ public:
auto metaurl() const -> QString;
/** Get the intneral path to the mod's icon file*/
- QString iconPath() const { return m_local_details.icon_file; };
+ QString iconPath() const { return m_local_details.icon_file; }
/** Gets the icon of the mod, converted to a QPixmap for drawing, and scaled to size. */
[[nodiscard]] QPixmap icon(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const;
/** Thread-safe. */
diff --git a/launcher/minecraft/mod/ModDetails.h b/launcher/minecraft/mod/ModDetails.h
index b4e59d52..ae36baa8 100644
--- a/launcher/minecraft/mod/ModDetails.h
+++ b/launcher/minecraft/mod/ModDetails.h
@@ -59,17 +59,17 @@ struct ModLicense {
ModLicense() {}
ModLicense(const QString license) {
- // FIXME: come up with a better license parseing.
+ // FIXME: come up with a better license parsing.
// handle SPDX identifiers? https://spdx.org/licenses/
auto parts = license.split(' ');
QStringList notNameParts = {};
for (auto part : parts) {
- auto url = QUrl(part);
+ auto _url = QUrl(part);
if (part.startsWith("(") && part.endsWith(")"))
- url = QUrl(part.mid(1, part.size() - 2));
+ _url = QUrl(part.mid(1, part.size() - 2));
- if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
- this->url = url.toString();
+ if (_url.isValid() && !_url.scheme().isEmpty() && !_url.host().isEmpty()) {
+ this->url = _url.toString();
notNameParts.append(part);
continue;
}
@@ -89,12 +89,9 @@ struct ModLicense {
}
- ModLicense(const QString name, const QString id, const QString url, const QString description) {
- this->name = name;
- this->id = id;
- this->url = url;
- this->description = description;
- }
+ ModLicense(const QString& name_, const QString& id_, const QString& url_, const QString& description_)
+ : name(name_), id(id_), url(url_), description(description_)
+ {}
ModLicense(const ModLicense& other)
: name(other.name)
diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp
index 51383edf..8e4486fd 100644
--- a/launcher/minecraft/mod/ModFolderModel.cpp
+++ b/launcher/minecraft/mod/ModFolderModel.cpp
@@ -139,7 +139,7 @@ QVariant ModFolderModel::data(const QModelIndex &index, int role) const
}
}
-QVariant ModFolderModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant ModFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role)
{
diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp
index 39a61067..3c58c5eb 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourceFolderModel.cpp
@@ -447,7 +447,7 @@ QVariant ResourceFolderModel::data(const QModelIndex& index, int role) const
}
}
-bool ResourceFolderModel::setData(const QModelIndex& index, const QVariant& value, int role)
+bool ResourceFolderModel::setData(const QModelIndex& index, [[maybe_unused]] const QVariant& value, int role)
{
int row = index.row();
if (row < 0 || row >= rowCount(index.parent()) || !index.isValid())
@@ -471,7 +471,7 @@ bool ResourceFolderModel::setData(const QModelIndex& index, const QVariant& valu
return false;
}
-QVariant ResourceFolderModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant ResourceFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role) {
case Qt::DisplayRole:
@@ -586,7 +586,7 @@ SortType ResourceFolderModel::columnToSortKey(size_t column) const
}
/* Standard Proxy Model for createFilterProxyModel */
-[[nodiscard]] bool ResourceFolderModel::ProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
+[[nodiscard]] bool ResourceFolderModel::ProxyModel::filterAcceptsRow(int source_row, [[maybe_unused]] const QModelIndex& source_parent) const
{
auto* model = qobject_cast<ResourceFolderModel*>(sourceModel());
if (!model)
diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h
index 454b84c3..ee905e3b 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.h
+++ b/launcher/minecraft/mod/ResourceFolderModel.h
@@ -49,8 +49,8 @@ class ResourceFolderModel : public QAbstractListModel {
bool stopWatching(const QStringList paths);
/* Helper methods for subclasses, using a predetermined list of paths. */
- virtual bool startWatching() { return startWatching({ m_dir.absolutePath() }); };
- virtual bool stopWatching() { return stopWatching({ m_dir.absolutePath() }); };
+ virtual bool startWatching() { return startWatching({ m_dir.absolutePath() }); }
+ virtual bool stopWatching() { return stopWatching({ m_dir.absolutePath() }); }
/** Given a path in the system, install that resource, moving it to its place in the
* instance file hierarchy.
@@ -78,7 +78,7 @@ class ResourceFolderModel : public QAbstractListModel {
/** Creates a new parse task, if needed, for 'res' and start it.*/
virtual void resolveResource(Resource* res);
- [[nodiscard]] size_t size() const { return m_resources.size(); };
+ [[nodiscard]] int size() const { return m_resources.size(); }
[[nodiscard]] bool empty() const { return size() == 0; }
[[nodiscard]] Resource& at(int index) { return *m_resources.at(index); }
[[nodiscard]] Resource const& at(int index) const { return *m_resources.at(index); }
@@ -97,10 +97,10 @@ class ResourceFolderModel : public QAbstractListModel {
/* Basic columns */
enum Columns { ACTIVE_COLUMN = 0, NAME_COLUMN, DATE_COLUMN, NUM_COLUMNS };
- QStringList columnNames(bool translated = true) const { return translated ? m_column_names_translated : m_column_names; };
+ QStringList columnNames(bool translated = true) const { return translated ? m_column_names_translated : m_column_names; }
- [[nodiscard]] int rowCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : static_cast<int>(size()); }
- [[nodiscard]] int columnCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : NUM_COLUMNS; };
+ [[nodiscard]] int rowCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : size(); }
+ [[nodiscard]] int columnCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : NUM_COLUMNS; }
[[nodiscard]] Qt::DropActions supportedDropActions() const override;
@@ -159,7 +159,7 @@ class ResourceFolderModel : public QAbstractListModel {
* This task should load and parse all heavy info needed by a resource, such as parsing a manifest. It gets executed
* in the background, so it slowly updates the UI as tasks get done.
*/
- [[nodiscard]] virtual Task* createParseTask(Resource&) { return nullptr; };
+ [[nodiscard]] virtual Task* createParseTask(Resource&) { return nullptr; }
/** Standard implementation of the model update logic.
*
@@ -223,15 +223,15 @@ class ResourceFolderModel : public QAbstractListModel {
/* A macro to define useful functions to handle Resource* -> T* more easily on derived classes */
#define RESOURCE_HELPERS(T) \
- [[nodiscard]] T* operator[](size_t index) \
+ [[nodiscard]] T* operator[](int index) \
{ \
return static_cast<T*>(m_resources[index].get()); \
} \
- [[nodiscard]] T* at(size_t index) \
+ [[nodiscard]] T* at(int index) \
{ \
return static_cast<T*>(m_resources[index].get()); \
} \
- [[nodiscard]] const T* at(size_t index) const \
+ [[nodiscard]] const T* at(int index) const \
{ \
return static_cast<const T*>(m_resources.at(index).get()); \
} \
diff --git a/launcher/minecraft/mod/ResourcePackFolderModel.cpp b/launcher/minecraft/mod/ResourcePackFolderModel.cpp
index 41455599..f1a0572a 100644
--- a/launcher/minecraft/mod/ResourcePackFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourcePackFolderModel.cpp
@@ -128,7 +128,7 @@ QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
}
}
-QVariant ResourcePackFolderModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant ResourcePackFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role) {
case Qt::DisplayRole:
@@ -165,7 +165,6 @@ QVariant ResourcePackFolderModel::headerData(int section, Qt::Orientation orient
default:
return {};
}
- return {};
}
int ResourcePackFolderModel::columnCount(const QModelIndex& parent) const
diff --git a/launcher/minecraft/mod/TexturePackFolderModel.cpp b/launcher/minecraft/mod/TexturePackFolderModel.cpp
index 531a7023..3795db58 100644
--- a/launcher/minecraft/mod/TexturePackFolderModel.cpp
+++ b/launcher/minecraft/mod/TexturePackFolderModel.cpp
@@ -114,7 +114,7 @@ QVariant TexturePackFolderModel::data(const QModelIndex& index, int role) const
}
}
-QVariant TexturePackFolderModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant TexturePackFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
{
switch (role) {
case Qt::DisplayRole:
diff --git a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
index f8ecdb33..0a0f57bf 100644
--- a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
+++ b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
@@ -61,7 +61,7 @@ GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
if (auto meta = mod->metadata(); meta)
m_mods.append(meta);
prepare();
-};
+}
void GetModDependenciesTask::prepare()
{
@@ -130,7 +130,7 @@ QList<ModPlatform::Dependency> GetModDependenciesTask::getDependenciesForVersion
c_dependencies.append(getOverride(ver_dep, providerName));
}
return c_dependencies;
-};
+}
Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDependency> pDep)
{
@@ -181,7 +181,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
ResourceAPI::DependencySearchArgs args = { dep, m_version, m_loaderType };
ResourceAPI::DependencySearchCallbacks callbacks;
- callbacks.on_succeed = [dep, provider, pDep, level, this](auto& doc, auto& pack) {
+ callbacks.on_succeed = [dep, provider, pDep, level, this](auto& doc, [[maybe_unused]] auto& pack) {
try {
QJsonArray arr;
if (dep.version.length() != 0 && doc.isObject()) {
@@ -215,27 +215,27 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
return;
}
if (level == 0) {
- qWarning() << "Dependency cycle exeeded";
+ qWarning() << "Dependency cycle exceeded";
return;
}
if (dep.addonId.toString().isEmpty() && !pDep->version.addonId.toString().isEmpty()) {
pDep->pack->addonId = pDep->version.addonId;
- auto dep = getOverride({ pDep->version.addonId, pDep->dependency.type }, provider.name);
- if (dep.addonId != pDep->version.addonId) {
+ auto dep_ = getOverride({ pDep->version.addonId, pDep->dependency.type }, provider.name);
+ if (dep_.addonId != pDep->version.addonId) {
removePack(pDep->version.addonId);
- addTask(prepareDependencyTask(dep, provider.name, level));
+ addTask(prepareDependencyTask(dep_, provider.name, level));
} else
addTask(getProjectInfoTask(pDep));
}
- for (auto dep : getDependenciesForVersion(pDep->version, provider.name)) {
- addTask(prepareDependencyTask(dep, provider.name, level - 1));
+ for (auto dep_ : getDependenciesForVersion(pDep->version, provider.name)) {
+ addTask(prepareDependencyTask(dep_, provider.name, level - 1));
}
};
auto version = provider.api->getDependencyVersion(std::move(args), std::move(callbacks));
tasks->addTask(version);
return tasks;
-};
+}
void GetModDependenciesTask::removePack(const QVariant addonId)
{
diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
index 264019f8..ea23947f 100644
--- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
@@ -104,14 +104,15 @@ ModDetails ReadMCModTOML(QByteArray contents)
#if TOML_EXCEPTIONS
try {
tomlData = toml::parse(contents.toStdString());
- } catch (const toml::parse_error& err) {
+ } catch ([[maybe_unused]] const toml::parse_error& err) {
return {};
}
#else
- tomlData = toml::parse(contents.toStdString());
- if (!tomlData) {
+ toml::parse_result result = toml::parse(contents.toStdString());
+ if (!result) {
return {};
}
+ tomlData = result.table();
#endif
// array defined by [[mods]]
@@ -151,8 +152,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString authors = "";
if (auto authorsDatum = tomlData["authors"].as_string()) {
authors = QString::fromStdString(authorsDatum->get());
- } else if (auto authorsDatum = (*modsTable)["authors"].as_string()) {
- authors = QString::fromStdString(authorsDatum->get());
+ } else if (auto authorsDatumMods = (*modsTable)["authors"].as_string()) {
+ authors = QString::fromStdString(authorsDatumMods->get());
}
if (!authors.isEmpty()) {
details.authors.append(authors);
@@ -161,8 +162,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString homeurl = "";
if (auto homeurlDatum = tomlData["displayURL"].as_string()) {
homeurl = QString::fromStdString(homeurlDatum->get());
- } else if (auto homeurlDatum = (*modsTable)["displayURL"].as_string()) {
- homeurl = QString::fromStdString(homeurlDatum->get());
+ } else if (auto homeurlDatumMods = (*modsTable)["displayURL"].as_string()) {
+ homeurl = QString::fromStdString(homeurlDatumMods->get());
}
// fix up url.
if (!homeurl.isEmpty() && !homeurl.startsWith("http://") && !homeurl.startsWith("https://") && !homeurl.startsWith("ftp://")) {
@@ -173,16 +174,16 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString issueTrackerURL = "";
if (auto issueTrackerURLDatum = tomlData["issueTrackerURL"].as_string()) {
issueTrackerURL = QString::fromStdString(issueTrackerURLDatum->get());
- } else if (auto issueTrackerURLDatum = (*modsTable)["issueTrackerURL"].as_string()) {
- issueTrackerURL = QString::fromStdString(issueTrackerURLDatum->get());
+ } else if (auto issueTrackerURLDatumMods = (*modsTable)["issueTrackerURL"].as_string()) {
+ issueTrackerURL = QString::fromStdString(issueTrackerURLDatumMods->get());
}
details.issue_tracker = issueTrackerURL;
QString license = "";
if (auto licenseDatum = tomlData["license"].as_string()) {
license = QString::fromStdString(licenseDatum->get());
- } else if (auto licenseDatum =(*modsTable)["license"].as_string()) {
- license = QString::fromStdString(licenseDatum->get());
+ } else if (auto licenseDatumMods =(*modsTable)["license"].as_string()) {
+ license = QString::fromStdString(licenseDatumMods->get());
}
if (!license.isEmpty())
details.licenses.append(ModLicense(license));
@@ -190,8 +191,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString logoFile = "";
if (auto logoFileDatum = tomlData["logoFile"].as_string()) {
logoFile = QString::fromStdString(logoFileDatum->get());
- } else if (auto logoFileDatum =(*modsTable)["logoFile"].as_string()) {
- logoFile = QString::fromStdString(logoFileDatum->get());
+ } else if (auto logoFileDatumMods =(*modsTable)["logoFile"].as_string()) {
+ logoFile = QString::fromStdString(logoFileDatumMods->get());
}
details.icon_file = logoFile;
@@ -459,7 +460,7 @@ bool process(Mod& mod, ProcessingLevel level)
}
}
-bool processZIP(Mod& mod, ProcessingLevel level)
+bool processZIP(Mod& mod, [[maybe_unused]] ProcessingLevel level)
{
ModDetails details;
@@ -592,7 +593,7 @@ bool processZIP(Mod& mod, ProcessingLevel level)
return false; // no valid mod found in archive
}
-bool processFolder(Mod& mod, ProcessingLevel level)
+bool processFolder(Mod& mod, [[maybe_unused]] ProcessingLevel level)
{
ModDetails details;
@@ -613,7 +614,7 @@ bool processFolder(Mod& mod, ProcessingLevel level)
return false; // no valid mcmod.info file found
}
-bool processLitemod(Mod& mod, ProcessingLevel level)
+bool processLitemod(Mod& mod, [[maybe_unused]] ProcessingLevel level)
{
ModDetails details;
diff --git a/launcher/minecraft/services/CapeChange.cpp b/launcher/minecraft/services/CapeChange.cpp
index 1d5ea36d..30155055 100644
--- a/launcher/minecraft/services/CapeChange.cpp
+++ b/launcher/minecraft/services/CapeChange.cpp
@@ -45,7 +45,7 @@ CapeChange::CapeChange(QObject *parent, QString token, QString cape)
{
}
-void CapeChange::setCape(QString& cape) {
+void CapeChange::setCape([[maybe_unused]] QString& cape) {
QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/capes/active"));
auto requestString = QString("{\"capeId\":\"%1\"}").arg(m_capeId);
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_token).toLocal8Bit());
diff --git a/launcher/minecraft/update/AssetUpdateTask.cpp b/launcher/minecraft/update/AssetUpdateTask.cpp
index 31fd5eb1..fda85ba8 100644
--- a/launcher/minecraft/update/AssetUpdateTask.cpp
+++ b/launcher/minecraft/update/AssetUpdateTask.cpp
@@ -45,7 +45,7 @@ void AssetUpdateTask::executeTask()
connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetIndexFailed);
connect(downloadJob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
- connect(downloadJob.get(), &NetJob::stepProgress, this, &AssetUpdateTask::propogateStepProgress);
+ connect(downloadJob.get(), &NetJob::stepProgress, this, &AssetUpdateTask::propagateStepProgress);
qDebug() << m_inst->name() << ": Starting asset index download";
downloadJob->start();
@@ -84,7 +84,7 @@ void AssetUpdateTask::assetIndexFinished()
connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed);
connect(downloadJob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
- connect(downloadJob.get(), &NetJob::stepProgress, this, &AssetUpdateTask::propogateStepProgress);
+ connect(downloadJob.get(), &NetJob::stepProgress, this, &AssetUpdateTask::propagateStepProgress);
downloadJob->start();
return;
}
diff --git a/launcher/minecraft/update/FMLLibrariesTask.cpp b/launcher/minecraft/update/FMLLibrariesTask.cpp
index 75e5c572..d9fa0595 100644
--- a/launcher/minecraft/update/FMLLibrariesTask.cpp
+++ b/launcher/minecraft/update/FMLLibrariesTask.cpp
@@ -75,7 +75,7 @@ void FMLLibrariesTask::executeTask()
connect(dljob.get(), &NetJob::failed, this, &FMLLibrariesTask::fmllibsFailed);
connect(dljob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
connect(dljob.get(), &NetJob::progress, this, &FMLLibrariesTask::progress);
- connect(dljob.get(), &NetJob::stepProgress, this, &FMLLibrariesTask::propogateStepProgress);
+ connect(dljob.get(), &NetJob::stepProgress, this, &FMLLibrariesTask::propagateStepProgress);
downloadJob.reset(dljob);
downloadJob->start();
}
diff --git a/launcher/minecraft/update/LibrariesTask.cpp b/launcher/minecraft/update/LibrariesTask.cpp
index 415b9a66..9d1c0295 100644
--- a/launcher/minecraft/update/LibrariesTask.cpp
+++ b/launcher/minecraft/update/LibrariesTask.cpp
@@ -70,7 +70,7 @@ void LibrariesTask::executeTask()
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
connect(downloadJob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
- connect(downloadJob.get(), &NetJob::stepProgress, this, &LibrariesTask::propogateStepProgress);
+ connect(downloadJob.get(), &NetJob::stepProgress, this, &LibrariesTask::propagateStepProgress);
downloadJob->start();
}