chore: fix shadowed member and signed/unsigned mismatch

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: supress unused with [[maybe_unused]]

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: unshadow ^&^& static_cast implicit return

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: deshadow and mark unused in parse task

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: mark unused in folder models

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: deshadow and mark unused with instances

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: more deshadow and unused

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: remove uneeded simicolons

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: mark unused

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: prevent shadow

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-06-30 23:51:15 -07:00
parent 98d6904e4a
commit 8d7dcdfc5b
No known key found for this signature in database
GPG Key ID: E10E321EB160949B
96 changed files with 409 additions and 413 deletions

View File

@ -104,7 +104,7 @@ bool IndirectOpen(T callable, qint64 *pid_forked = nullptr)
#endif #endif
namespace DesktopServices { namespace DesktopServices {
bool openDirectory(const QString &path, bool ensureExists) bool openDirectory(const QString &path, [[maybe_unused]] bool ensureExists)
{ {
qDebug() << "Opening directory" << path; qDebug() << "Opening directory" << path;
QDir parentPath; QDir parentPath;

View File

@ -41,9 +41,9 @@
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QMimeData> #include <QMimeData>
#include <QPair>
#include <QSet> #include <QSet>
#include <QStack> #include <QStack>
#include <QPair>
#include <QTextStream> #include <QTextStream>
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>
@ -96,7 +96,11 @@ Qt::DropActions InstanceList::supportedDropActions() const
return Qt::MoveAction; return Qt::MoveAction;
} }
bool InstanceList::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const bool InstanceList::canDropMimeData(const QMimeData* data,
[[maybe_unused]] Qt::DropAction action,
[[maybe_unused]] int row,
[[maybe_unused]] int column,
[[maybe_unused]] const QModelIndex& parent) const
{ {
if (data && data->hasFormat("application/x-instanceid")) { if (data && data->hasFormat("application/x-instanceid")) {
return true; return true;
@ -104,7 +108,11 @@ bool InstanceList::canDropMimeData(const QMimeData* data, Qt::DropAction action,
return false; return false;
} }
bool InstanceList::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) bool InstanceList::dropMimeData(const QMimeData* data,
[[maybe_unused]] Qt::DropAction action,
[[maybe_unused]] int row,
[[maybe_unused]] int column,
[[maybe_unused]] const QModelIndex& parent)
{ {
if (data && data->hasFormat("application/x-instanceid")) { if (data && data->hasFormat("application/x-instanceid")) {
return true; return true;
@ -129,7 +137,7 @@ QMimeData* InstanceList::mimeData(const QModelIndexList& indexes) const
return mimeData; return mimeData;
} }
QStringList InstanceList::getLinkedInstancesById(const QString &id) const QStringList InstanceList::getLinkedInstancesById(const QString& id) const
{ {
QStringList linkedInstances; QStringList linkedInstances;
for (auto inst : m_instances) { for (auto inst : m_instances) {
@ -158,42 +166,34 @@ QVariant InstanceList::data(const QModelIndex& index, int role) const
if (!index.isValid()) { if (!index.isValid()) {
return QVariant(); return QVariant();
} }
BaseInstance *pdata = static_cast<BaseInstance *>(index.internalPointer()); BaseInstance* pdata = static_cast<BaseInstance*>(index.internalPointer());
switch (role) switch (role) {
{ case InstancePointerRole: {
case InstancePointerRole: QVariant v = QVariant::fromValue((void*)pdata);
{ return v;
QVariant v = QVariant::fromValue((void *)pdata); }
return v; case InstanceIDRole: {
} return pdata->id();
case InstanceIDRole: }
{ case Qt::EditRole:
return pdata->id(); case Qt::DisplayRole: {
} return pdata->name();
case Qt::EditRole: }
case Qt::DisplayRole: case Qt::AccessibleTextRole: {
{ return tr("%1 Instance").arg(pdata->name());
return pdata->name(); }
} case Qt::ToolTipRole: {
case Qt::AccessibleTextRole: return pdata->instanceRoot();
{ }
return tr("%1 Instance").arg(pdata->name()); case Qt::DecorationRole: {
} return pdata->iconKey();
case Qt::ToolTipRole: }
{ // HACK: see InstanceView.h in gui!
return pdata->instanceRoot(); case GroupRole: {
} return getInstanceGroup(pdata->id());
case Qt::DecorationRole: }
{ default:
return pdata->iconKey(); break;
}
// HACK: see InstanceView.h in gui!
case GroupRole:
{
return getInstanceGroup(pdata->id());
}
default:
break;
} }
return QVariant(); return QVariant();
} }
@ -320,16 +320,18 @@ bool InstanceList::trashInstance(const InstanceId& id)
} }
qDebug() << "Instance" << id << "has been trashed by the launcher."; qDebug() << "Instance" << id << "has been trashed by the launcher.";
m_trashHistory.push({id, inst->instanceRoot(), trashedLoc, cachedGroupId}); m_trashHistory.push({ id, inst->instanceRoot(), trashedLoc, cachedGroupId });
return true; return true;
} }
bool InstanceList::trashedSomething() { bool InstanceList::trashedSomething()
{
return !m_trashHistory.empty(); return !m_trashHistory.empty();
} }
void InstanceList::undoTrashInstance() { void InstanceList::undoTrashInstance()
{
if (m_trashHistory.empty()) { if (m_trashHistory.empty()) {
qWarning() << "Nothing to recover from trash."; qWarning() << "Nothing to recover from trash.";
return; return;
@ -558,7 +560,7 @@ InstancePtr InstanceList::getInstanceByManagedName(const QString& managed_name)
return {}; return {};
} }
QModelIndex InstanceList::getInstanceIndexById(const QString &id) const QModelIndex InstanceList::getInstanceIndexById(const QString& id) const
{ {
return index(getInstIndex(getInstanceById(id).get())); return index(getInstIndex(getInstanceById(id).get()));
} }
@ -597,13 +599,11 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id)
QString inst_type = instanceSettings->get("InstanceType").toString(); QString inst_type = instanceSettings->get("InstanceType").toString();
// NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix instance // NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix
if (inst_type == "OneSix" || inst_type.isEmpty()) // instance
{ if (inst_type == "OneSix" || inst_type.isEmpty()) {
inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
} } else {
else
{
inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot)); inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot));
} }
qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot();
@ -759,7 +759,7 @@ void InstanceList::instanceDirContentsChanged(const QString& path)
emit instancesChanged(); emit instancesChanged();
} }
void InstanceList::on_InstFolderChanged(const Setting& setting, QVariant value) void InstanceList::on_InstFolderChanged( [[maybe_unused]] const Setting& setting, QVariant value)
{ {
QString newInstDir = QDir(value.toString()).canonicalPath(); QString newInstDir = QDir(value.toString()).canonicalPath();
if (newInstDir != m_instDir) { if (newInstDir != m_instDir) {
@ -820,21 +820,17 @@ class InstanceStaging : public Task {
return Task::abort(); return Task::abort();
} }
bool canAbort() const override bool canAbort() const override { return (m_child && m_child->canAbort()); }
{
return (m_child && m_child->canAbort());
}
protected: protected:
virtual void executeTask() override { m_child->start(); } virtual void executeTask() override { m_child->start(); }
QStringList warnings() const override { return m_child->warnings(); } QStringList warnings() const override { return m_child->warnings(); }
private slots: private slots:
void childSucceded() void childSucceeded()
{ {
unsigned sleepTime = backoff(); unsigned sleepTime = backoff();
if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, *m_child.get())) if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, *m_child.get())) {
{
emitSucceeded(); emitSucceeded();
return; return;
} }
@ -852,13 +848,10 @@ class InstanceStaging : public Task {
emitFailed(reason); emitFailed(reason);
} }
void childAborted() void childAborted() { emitAborted(); }
{
emitAborted();
}
private: private:
InstanceList * m_parent; InstanceList* m_parent;
/* /*
* WHY: the whole reason why this uses an exponential backoff retry scheme is antivirus on Windows. * WHY: the whole reason why this uses an exponential backoff retry scheme is antivirus on Windows.
* Basically, it starts messing things up while the launcher is extracting/creating instances * Basically, it starts messing things up while the launcher is extracting/creating instances
@ -897,7 +890,10 @@ QString InstanceList::getStagedInstancePath()
return path; return path;
} }
bool InstanceList::commitStagedInstance(const QString& path, InstanceName const& instanceName, const QString& groupName, InstanceTask const& commiting) bool InstanceList::commitStagedInstance(const QString& path,
InstanceName const& instanceName,
const QString& groupName,
InstanceTask const& commiting)
{ {
QDir dir; QDir dir;
QString instID; QString instID;

View File

@ -70,7 +70,7 @@ public:
{ {
return nullptr; return nullptr;
} }
shared_qobject_ptr< Task > createUpdateTask(Net::Mode mode) override shared_qobject_ptr< Task > createUpdateTask([[maybe_unused]] Net::Mode mode) override
{ {
return nullptr; return nullptr;
} }

View File

@ -105,7 +105,7 @@ void RecursiveFileSystemWatcher::fileChange(const QString &path)
{ {
emit fileChanged(path); emit fileChanged(path);
} }
void RecursiveFileSystemWatcher::directoryChange(const QString &path) void RecursiveFileSystemWatcher::directoryChange([[maybe_unused]] const QString& path)
{ {
setFiles(scanRecursive(m_root)); setFiles(scanRecursive(m_root));
} }

View File

@ -199,16 +199,12 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
{ {
if(hasRecommended) if(hasRecommended)
{ {
auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); auto recommended = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
if(value.toBool()) if (recommended.toBool()) {
{
return tr("Recommended"); return tr("Recommended");
} } else if (hasLatest) {
else if(hasLatest) auto latest = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
{ if (latest.toBool()) {
auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
if(value.toBool())
{
return tr("Latest"); return tr("Latest");
} }
} }
@ -228,16 +224,12 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
{ {
if(hasRecommended) if(hasRecommended)
{ {
auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); auto recommenced = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
if(value.toBool()) if (recommenced.toBool()) {
{
return APPLICATION->getThemedIcon("star"); return APPLICATION->getThemedIcon("star");
} } else if (hasLatest) {
else if(hasLatest) auto latest = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
{ if (latest.toBool()) {
auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
if(value.toBool())
{
return APPLICATION->getThemedIcon("bug"); return APPLICATION->getThemedIcon("bug");
} }
} }
@ -270,7 +262,7 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
} }
} }
QModelIndex VersionProxyModel::parent(const QModelIndex &child) const QModelIndex VersionProxyModel::parent([[maybe_unused]] const QModelIndex& child) const
{ {
return QModelIndex(); return QModelIndex();
} }
@ -469,7 +461,9 @@ void VersionProxyModel::sourceRowsAboutToBeInserted(const QModelIndex& parent, i
beginInsertRows(parent, first, last); beginInsertRows(parent, first, last);
} }
void VersionProxyModel::sourceRowsInserted(const QModelIndex& parent, int first, int last) void VersionProxyModel::sourceRowsInserted([[maybe_unused]] const QModelIndex& parent,
[[maybe_unused]] int first,
[[maybe_unused]] int last)
{ {
endInsertRows(); endInsertRows();
} }
@ -479,7 +473,7 @@ void VersionProxyModel::sourceRowsAboutToBeRemoved(const QModelIndex& parent, in
beginRemoveRows(parent, first, last); beginRemoveRows(parent, first, last);
} }
void VersionProxyModel::sourceRowsRemoved(const QModelIndex& parent, int first, int last) void VersionProxyModel::sourceRowsRemoved([[maybe_unused]] const QModelIndex& parent, [[maybe_unused]] int first, [[maybe_unused]] int last)
{ {
endRemoveRows(); endRemoveRows();
} }

View File

@ -248,7 +248,7 @@ void FileLinkApp::readPathPairs()
in >> numLinks; in >> numLinks;
qDebug() << "numLinks" << numLinks; qDebug() << "numLinks" << numLinks;
for (int i = 0; i < numLinks; i++) { for (quint32 i = 0; i < numLinks; i++) {
FS::LinkPair pair; FS::LinkPair pair;
in >> pair.src; in >> pair.src;
in >> pair.dst; in >> pair.dst;

View File

@ -19,7 +19,7 @@ std::array<const char *, 6> validIconExtensions = {{
namespace IconUtils{ namespace IconUtils{
QString findBestIconIn(const QString &folder, const QString & iconKey) { QString findBestIconIn(const QString &folder, const QString & iconKey) {
int best_found = validIconExtensions.size(); size_t best_found = validIconExtensions.size();
QString best_filename; QString best_filename;
QDirIterator it(folder, QDir::NoDotAndDotDot | QDir::Files, QDirIterator::NoIteratorFlags); QDirIterator it(folder, QDir::NoDotAndDotDot | QDir::Files, QDirIterator::NoIteratorFlags);
@ -32,7 +32,7 @@ QString findBestIconIn(const QString &folder, const QString & iconKey) {
auto extension = fileInfo.suffix(); auto extension = fileInfo.suffix();
for(int i = 0; i < best_found; i++) { for(size_t i = 0; i < best_found; i++) {
if(extension == validIconExtensions[i]) { if(extension == validIconExtensions[i]) {
best_found = i; best_found = i;
qDebug() << i << " : " << fileInfo.fileName(); qDebug() << i << " : " << fileInfo.fileName();

View File

@ -40,7 +40,7 @@ public: /* methods */
} }
bool write(QByteArray & data) override bool write(QByteArray & data) override
{ {
this->data.append(data); this->m_data.append(data);
return true; return true;
} }
bool abort() override bool abort() override
@ -52,7 +52,7 @@ public: /* methods */
auto fname = m_entity->localFilename(); auto fname = m_entity->localFilename();
try try
{ {
auto doc = Json::requireDocument(data, fname); auto doc = Json::requireDocument(m_data, fname);
auto obj = Json::requireObject(doc, fname); auto obj = Json::requireObject(doc, fname);
m_entity->parse(obj); m_entity->parse(obj);
return true; return true;
@ -65,7 +65,7 @@ public: /* methods */
} }
private: /* data */ private: /* data */
QByteArray data; QByteArray m_data;
Meta::BaseEntity *m_entity; Meta::BaseEntity *m_entity;
}; };

View File

@ -1061,8 +1061,8 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
{ {
// actually launch the game // actually launch the game
auto method = launchMethod(); auto launch_method = launchMethod();
if(method == "LauncherPart") if(launch_method == "LauncherPart")
{ {
auto step = makeShared<LauncherPartLaunch>(pptr); auto step = makeShared<LauncherPartLaunch>(pptr);
step->setWorkingDirectory(gameRoot()); step->setWorkingDirectory(gameRoot());
@ -1070,7 +1070,7 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
step->setServerToJoin(serverToJoin); step->setServerToJoin(serverToJoin);
process->appendStep(step); process->appendStep(step);
} }
else if (method == "DirectJava") else if (launch_method == "DirectJava")
{ {
auto step = makeShared<DirectJavaLaunch>(pptr); auto step = makeShared<DirectJavaLaunch>(pptr);
step->setWorkingDirectory(gameRoot()); step->setWorkingDirectory(gameRoot());

View File

@ -23,7 +23,7 @@ struct MojangDownloadInfo
struct MojangLibraryDownloadInfo struct MojangLibraryDownloadInfo
{ {
MojangLibraryDownloadInfo(MojangDownloadInfo::Ptr artifact): artifact(artifact) {} MojangLibraryDownloadInfo(MojangDownloadInfo::Ptr artifact_): artifact(artifact_) {}
MojangLibraryDownloadInfo() {} MojangLibraryDownloadInfo() {}
// types // types
@ -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 // HACK: ignore assets from other version files than Minecraft
// workaround for stupid assets issue caused by amazon: // workaround for stupid assets issue caused by amazon:
// https://www.theregister.co.uk/2017/02/28/aws_is_awol_as_s3_goes_haywire/ // 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"; url = "https://piston-meta.mojang.com/mc/assets/legacy/c0fd82e8ce9fbc93119e40d96d5a4e62cfa3f729/legacy.json";
} }
// HACK // HACK
else else
{ {
url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json"; url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id_ + ".json";
} }
known = false; known = false;
} }

View File

@ -413,7 +413,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
} }
LibraryPtr OneSixVersionFormat::plusJarModFromJson( LibraryPtr OneSixVersionFormat::plusJarModFromJson(
ProblemContainer & problems, [[maybe_unused]] ProblemContainer & problems,
const QJsonObject &libObj, const QJsonObject &libObj,
const QString &filename, const QString &filename,
const QString &originalName const QString &originalName

View File

@ -225,11 +225,11 @@ static bool loadPackProfile(PackProfile * parent, const QString & filename, cons
auto orderArray = Json::requireArray(obj.value("components")); auto orderArray = Json::requireArray(obj.value("components"));
for(auto item: orderArray) for(auto item: orderArray)
{ {
auto obj = Json::requireObject(item, "Component must be an object."); auto comp_obj = Json::requireObject(item, "Component must be an object.");
container.append(componentFromJsonV1(parent, componentJsonPattern, obj)); 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"; qCritical() << "Couldn't parse" << componentsFile.fileName() << ": bad file format";
container.clear(); container.clear();
@ -414,7 +414,7 @@ void PackProfile::insertComponent(size_t index, ComponentPtr component)
qWarning() << "Attempt to add a component that is already present!"; qWarning() << "Attempt to add a component that is already present!";
return; return;
} }
beginInsertRows(QModelIndex(), index, index); beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index));
d->components.insert(index, component); d->components.insert(index, component);
d->componentIndex[id] = component; d->componentIndex[id] = component;
endInsertRows(); endInsertRows();
@ -427,7 +427,7 @@ void PackProfile::componentDataChanged()
auto objPtr = qobject_cast<Component *>(sender()); auto objPtr = qobject_cast<Component *>(sender());
if(!objPtr) if(!objPtr)
{ {
qWarning() << "PackProfile got dataChenged signal from a non-Component!"; qWarning() << "PackProfile got dataChanged signal from a non-Component!";
return; return;
} }
if(objPtr->getID() == "net.minecraft") { if(objPtr->getID() == "net.minecraft") {
@ -445,7 +445,7 @@ void PackProfile::componentDataChanged()
} }
index++; 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) bool PackProfile::remove(const int index)
@ -532,9 +532,9 @@ ComponentPtr PackProfile::getComponent(const QString &id)
return (*iter); 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; return nullptr;
} }
@ -615,7 +615,7 @@ QVariant PackProfile::data(const QModelIndex &index, int role) const
return QVariant(); 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())) if (!index.isValid() || index.row() < 0 || index.row() >= rowCount(index.parent()))
{ {

View File

@ -145,7 +145,7 @@ public:
ComponentPtr getComponent(const QString &id); ComponentPtr getComponent(const QString &id);
/// get the profile component by index /// get the profile component by index
ComponentPtr getComponent(int index); ComponentPtr getComponent(size_t index);
/// Add the component to the internal list of patches /// Add the component to the internal list of patches
// todo(merged): is this the best approach // todo(merged): is this the best approach

View File

@ -92,7 +92,7 @@ bool readOverrideOrders(QString path, PatchOrder &order)
order.append(Json::requireString(item)); order.append(Json::requireString(item));
} }
} }
catch (const JSONValidationError &err) catch ([[maybe_unused]] const JSONValidationError &err)
{ {
qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format"; qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format";
qWarning() << "Ignoring overriden order"; qWarning() << "Ignoring overriden order";

View File

@ -408,13 +408,13 @@ optional<QString> read_string (nbt::value& parent, const char * name)
auto & tag_str = namedValue.as<nbt::tag_string>(); auto & tag_str = namedValue.as<nbt::tag_string>();
return QString::fromStdString(tag_str.get()); 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 // fallback for old world formats
qWarning() << "String NBT tag" << name << "could not be found."; qWarning() << "String NBT tag" << name << "could not be found.";
return nullopt; return nullopt;
} }
catch (const std::bad_cast &e) catch ([[maybe_unused]] const std::bad_cast &e)
{ {
// type mismatch // type mismatch
qWarning() << "NBT tag" << name << "could not be converted to string."; 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>(); auto & tag_str = namedValue.as<nbt::tag_long>();
return tag_str.get(); 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 // fallback for old world formats
qWarning() << "Long NBT tag" << name << "could not be found."; qWarning() << "Long NBT tag" << name << "could not be found.";
return nullopt; return nullopt;
} }
catch (const std::bad_cast &e) catch ([[maybe_unused]] const std::bad_cast &e)
{ {
// type mismatch // type mismatch
qWarning() << "NBT tag" << name << "could not be converted to long."; 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>(); auto & tag_str = namedValue.as<nbt::tag_int>();
return tag_str.get(); 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 // fallback for old world formats
qWarning() << "Int NBT tag" << name << "could not be found."; qWarning() << "Int NBT tag" << name << "could not be found.";
return nullopt; return nullopt;
} }
catch (const std::bad_cast &e) catch ([[maybe_unused]] const std::bad_cast &e)
{ {
// type mismatch // type mismatch
qWarning() << "NBT tag" << name << "could not be converted to int."; qWarning() << "NBT tag" << name << "could not be converted to int.";

View File

@ -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) switch (role)
{ {
@ -320,7 +320,6 @@ QVariant WorldList::headerData(int section, Qt::Orientation orientation, int rol
default: default:
return QVariant(); return QVariant();
} }
return QVariant();
} }
QStringList WorldList::mimeTypes() const QStringList WorldList::mimeTypes() const
@ -373,7 +372,7 @@ QMimeData *WorldList::mimeData(const QModelIndexList &indexes) const
if (indexes.size() == 0) if (indexes.size() == 0)
return new QMimeData(); return new QMimeData();
QList<World> worlds; QList<World> worlds_;
for(auto idx : indexes) for(auto idx : indexes)
{ {
if(idx.column() != 0) if(idx.column() != 0)
@ -381,13 +380,13 @@ QMimeData *WorldList::mimeData(const QModelIndexList &indexes) const
int row = idx.row(); int row = idx.row();
if (row < 0 || row >= this->worlds.size()) if (row < 0 || row >= this->worlds.size())
continue; continue;
worlds.append(this->worlds[row]); worlds_.append(this->worlds[row]);
} }
if(!worlds.size()) if(!worlds_.size())
{ {
return new QMimeData(); return new QMimeData();
} }
return new WorldMimeData(worlds); return new WorldMimeData(worlds_);
} }
Qt::ItemFlags WorldList::flags(const QModelIndex &index) const Qt::ItemFlags WorldList::flags(const QModelIndex &index) const

View File

@ -310,7 +310,7 @@ bool AccountData::resumeStateFromV2(QJsonObject data) {
QJsonObject profileObject = profileVal.toObject(); QJsonObject profileObject = profileVal.toObject();
QString id = profileObject.value("id").toString(""); QString id = profileObject.value("id").toString("");
QString name = profileObject.value("name").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()) if (id.isEmpty() || name.isEmpty())
{ {
qWarning() << "Unable to load a profile" << name << "because it was missing an ID or a name."; 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) { if(id == currentProfile) {
currentProfileIndex = index; currentProfileIndex = index;
} }
profiles.append({id, name, legacy}); profiles.append({id, name, legacy_});
} }
auto & profile = profiles[currentProfileIndex]; auto & profile = profiles[currentProfileIndex];

View File

@ -365,7 +365,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) switch (role)
{ {

View File

@ -107,16 +107,16 @@ bool parseXTokenResponse(QByteArray & data, Katabasis::Token &output, QString na
if(!item.isObject()) { if(!item.isObject()) {
continue; continue;
} }
auto obj = item.toObject(); auto obj_ = item.toObject();
if(obj.contains("uhs")) { if(obj_.contains("uhs")) {
foundUHS = true; foundUHS = true;
} else { } else {
continue; continue;
} }
// consume all 'display claims' ... whatever that means // 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; 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..."; qWarning() << "display claim " << iter.key() << " is not a string...";
return false; return false;
} }

View File

@ -35,9 +35,9 @@ void EntitlementsStep::rehydrate() {
} }
void EntitlementsStep::onRequestDone( void EntitlementsStep::onRequestDone(
QNetworkReply::NetworkError error, [[maybe_unused]] QNetworkReply::NetworkError error,
QByteArray data, QByteArray data,
QList<QNetworkReply::RawHeaderPair> headers [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) { ) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender()); auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater(); requestor->deleteLater();

View File

@ -112,12 +112,11 @@ QVariant GameOptions::data(const QModelIndex& index, int role) const
default: default:
return QVariant(); return QVariant();
} }
return QVariant();
} }
int GameOptions::rowCount(const QModelIndex&) const int GameOptions::rowCount(const QModelIndex&) const
{ {
return contents.size(); return static_cast<int>(contents.size());
} }
int GameOptions::columnCount(const QModelIndex&) const int GameOptions::columnCount(const QModelIndex&) const

View File

@ -54,7 +54,7 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
if (instance->settings()->get("CloseAfterLaunch").toBool()) if (instance->settings()->get("CloseAfterLaunch").toBool())
{ {
std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection}; 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; qDebug() << lines;
if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0) if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0)
{ {

View File

@ -72,7 +72,7 @@ public:
auto issueTracker() const -> QString; auto issueTracker() const -> QString;
/** Get the intneral path to the mod's icon file*/ /** 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. */ /** 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; [[nodiscard]] QPixmap icon(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const;
/** Thread-safe. */ /** Thread-safe. */

View File

@ -59,17 +59,17 @@ struct ModLicense {
ModLicense() {} ModLicense() {}
ModLicense(const QString license) { 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/ // handle SPDX identifiers? https://spdx.org/licenses/
auto parts = license.split(' '); auto parts = license.split(' ');
QStringList notNameParts = {}; QStringList notNameParts = {};
for (auto part : parts) { for (auto part : parts) {
auto url = QUrl(part); auto _url = QUrl(part);
if (part.startsWith("(") && part.endsWith(")")) 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()) { if (_url.isValid() && !_url.scheme().isEmpty() && !_url.host().isEmpty()) {
this->url = url.toString(); this->url = _url.toString();
notNameParts.append(part); notNameParts.append(part);
continue; continue;
} }
@ -89,12 +89,9 @@ struct ModLicense {
} }
ModLicense(const QString name, const QString id, const QString url, const QString description) { ModLicense(const QString& name_, const QString& id_, const QString& url_, const QString& description_)
this->name = name; : name(name_), id(id_), url(url_), description(description_)
this->id = id; {}
this->url = url;
this->description = description;
}
ModLicense(const ModLicense& other) ModLicense(const ModLicense& other)
: name(other.name) : name(other.name)

View File

@ -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) switch (role)
{ {

View File

@ -457,7 +457,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(); int row = index.row();
if (row < 0 || row >= rowCount(index.parent()) || !index.isValid()) if (row < 0 || row >= rowCount(index.parent()) || !index.isValid())
@ -469,7 +469,7 @@ bool ResourceFolderModel::setData(const QModelIndex& index, const QVariant& valu
return false; 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) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
@ -594,7 +594,7 @@ void ResourceFolderModel::enableInteraction(bool enabled)
} }
/* Standard Proxy Model for createFilterProxyModel */ /* 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()); auto* model = qobject_cast<ResourceFolderModel*>(sourceModel());
if (!model) if (!model)

View File

@ -97,9 +97,9 @@ class ResourceFolderModel : public QAbstractListModel {
/* Basic columns */ /* Basic columns */
enum Columns { ACTIVE_COLUMN = 0, NAME_COLUMN, DATE_COLUMN, NUM_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 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]] int columnCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : NUM_COLUMNS; }
[[nodiscard]] Qt::DropActions supportedDropActions() const override; [[nodiscard]] Qt::DropActions supportedDropActions() const override;

View File

@ -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) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
@ -165,7 +165,6 @@ QVariant ResourcePackFolderModel::headerData(int section, Qt::Orientation orient
default: default:
return {}; return {};
} }
return {};
} }
int ResourcePackFolderModel::columnCount(const QModelIndex& parent) const int ResourcePackFolderModel::columnCount(const QModelIndex& parent) const

View File

@ -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) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:

View File

@ -61,7 +61,7 @@ GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
if (auto meta = mod->metadata(); meta) if (auto meta = mod->metadata(); meta)
m_mods.append(meta); m_mods.append(meta);
prepare(); prepare();
}; }
void GetModDependenciesTask::prepare() void GetModDependenciesTask::prepare()
{ {
@ -130,7 +130,7 @@ QList<ModPlatform::Dependency> GetModDependenciesTask::getDependenciesForVersion
c_dependencies.append(getOverride(ver_dep, providerName)); c_dependencies.append(getOverride(ver_dep, providerName));
} }
return c_dependencies; return c_dependencies;
}; }
Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDependency> pDep) 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::DependencySearchArgs args = { dep, m_version, m_loaderType };
ResourceAPI::DependencySearchCallbacks callbacks; 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 { try {
QJsonArray arr; QJsonArray arr;
if (dep.version.length() != 0 && doc.isObject()) { if (dep.version.length() != 0 && doc.isObject()) {
@ -215,27 +215,27 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
return; return;
} }
if (level == 0) { if (level == 0) {
qWarning() << "Dependency cycle exeeded"; qWarning() << "Dependency cycle exceeded";
return; return;
} }
if (dep.addonId.toString().isEmpty() && !pDep->version.addonId.toString().isEmpty()) { if (dep.addonId.toString().isEmpty() && !pDep->version.addonId.toString().isEmpty()) {
pDep->pack->addonId = pDep->version.addonId; pDep->pack->addonId = pDep->version.addonId;
auto dep = getOverride({ pDep->version.addonId, pDep->dependency.type }, provider.name); auto dep_ = getOverride({ pDep->version.addonId, pDep->dependency.type }, provider.name);
if (dep.addonId != pDep->version.addonId) { if (dep_.addonId != pDep->version.addonId) {
removePack(pDep->version.addonId); removePack(pDep->version.addonId);
addTask(prepareDependencyTask(dep, provider.name, level)); addTask(prepareDependencyTask(dep_, provider.name, level));
} else } else
addTask(getProjectInfoTask(pDep)); addTask(getProjectInfoTask(pDep));
} }
for (auto dep : getDependenciesForVersion(pDep->version, provider.name)) { for (auto dep_ : getDependenciesForVersion(pDep->version, provider.name)) {
addTask(prepareDependencyTask(dep, provider.name, level - 1)); addTask(prepareDependencyTask(dep_, provider.name, level - 1));
} }
}; };
auto version = provider.api->getDependencyVersion(std::move(args), std::move(callbacks)); auto version = provider.api->getDependencyVersion(std::move(args), std::move(callbacks));
tasks->addTask(version); tasks->addTask(version);
return tasks; return tasks;
}; }
void GetModDependenciesTask::removePack(const QVariant addonId) void GetModDependenciesTask::removePack(const QVariant addonId)
{ {

View File

@ -152,8 +152,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString authors = ""; QString authors = "";
if (auto authorsDatum = tomlData["authors"].as_string()) { if (auto authorsDatum = tomlData["authors"].as_string()) {
authors = QString::fromStdString(authorsDatum->get()); authors = QString::fromStdString(authorsDatum->get());
} else if (auto authorsDatum = (*modsTable)["authors"].as_string()) { } else if (auto authorsDatumMods = (*modsTable)["authors"].as_string()) {
authors = QString::fromStdString(authorsDatum->get()); authors = QString::fromStdString(authorsDatumMods->get());
} }
if (!authors.isEmpty()) { if (!authors.isEmpty()) {
details.authors.append(authors); details.authors.append(authors);
@ -162,8 +162,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString homeurl = ""; QString homeurl = "";
if (auto homeurlDatum = tomlData["displayURL"].as_string()) { if (auto homeurlDatum = tomlData["displayURL"].as_string()) {
homeurl = QString::fromStdString(homeurlDatum->get()); homeurl = QString::fromStdString(homeurlDatum->get());
} else if (auto homeurlDatum = (*modsTable)["displayURL"].as_string()) { } else if (auto homeurlDatumMods = (*modsTable)["displayURL"].as_string()) {
homeurl = QString::fromStdString(homeurlDatum->get()); homeurl = QString::fromStdString(homeurlDatumMods->get());
} }
// fix up url. // fix up url.
if (!homeurl.isEmpty() && !homeurl.startsWith("http://") && !homeurl.startsWith("https://") && !homeurl.startsWith("ftp://")) { if (!homeurl.isEmpty() && !homeurl.startsWith("http://") && !homeurl.startsWith("https://") && !homeurl.startsWith("ftp://")) {
@ -174,16 +174,16 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString issueTrackerURL = ""; QString issueTrackerURL = "";
if (auto issueTrackerURLDatum = tomlData["issueTrackerURL"].as_string()) { if (auto issueTrackerURLDatum = tomlData["issueTrackerURL"].as_string()) {
issueTrackerURL = QString::fromStdString(issueTrackerURLDatum->get()); issueTrackerURL = QString::fromStdString(issueTrackerURLDatum->get());
} else if (auto issueTrackerURLDatum = (*modsTable)["issueTrackerURL"].as_string()) { } else if (auto issueTrackerURLDatumMods = (*modsTable)["issueTrackerURL"].as_string()) {
issueTrackerURL = QString::fromStdString(issueTrackerURLDatum->get()); issueTrackerURL = QString::fromStdString(issueTrackerURLDatumMods->get());
} }
details.issue_tracker = issueTrackerURL; details.issue_tracker = issueTrackerURL;
QString license = ""; QString license = "";
if (auto licenseDatum = tomlData["license"].as_string()) { if (auto licenseDatum = tomlData["license"].as_string()) {
license = QString::fromStdString(licenseDatum->get()); license = QString::fromStdString(licenseDatum->get());
} else if (auto licenseDatum =(*modsTable)["license"].as_string()) { } else if (auto licenseDatumMods =(*modsTable)["license"].as_string()) {
license = QString::fromStdString(licenseDatum->get()); license = QString::fromStdString(licenseDatumMods->get());
} }
if (!license.isEmpty()) if (!license.isEmpty())
details.licenses.append(ModLicense(license)); details.licenses.append(ModLicense(license));
@ -191,8 +191,8 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString logoFile = ""; QString logoFile = "";
if (auto logoFileDatum = tomlData["logoFile"].as_string()) { if (auto logoFileDatum = tomlData["logoFile"].as_string()) {
logoFile = QString::fromStdString(logoFileDatum->get()); logoFile = QString::fromStdString(logoFileDatum->get());
} else if (auto logoFileDatum =(*modsTable)["logoFile"].as_string()) { } else if (auto logoFileDatumMods =(*modsTable)["logoFile"].as_string()) {
logoFile = QString::fromStdString(logoFileDatum->get()); logoFile = QString::fromStdString(logoFileDatumMods->get());
} }
details.icon_file = logoFile; details.icon_file = logoFile;
@ -460,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; ModDetails details;
@ -593,7 +593,7 @@ bool processZIP(Mod& mod, ProcessingLevel level)
return false; // no valid mod found in archive return false; // no valid mod found in archive
} }
bool processFolder(Mod& mod, ProcessingLevel level) bool processFolder(Mod& mod, [[maybe_unused]] ProcessingLevel level)
{ {
ModDetails details; ModDetails details;
@ -614,7 +614,7 @@ bool processFolder(Mod& mod, ProcessingLevel level)
return false; // no valid mcmod.info file found return false; // no valid mcmod.info file found
} }
bool processLitemod(Mod& mod, ProcessingLevel level) bool processLitemod(Mod& mod, [[maybe_unused]] ProcessingLevel level)
{ {
ModDetails details; ModDetails details;

View File

@ -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")); QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/capes/active"));
auto requestString = QString("{\"capeId\":\"%1\"}").arg(m_capeId); auto requestString = QString("{\"capeId\":\"%1\"}").arg(m_capeId);
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_token).toLocal8Bit()); request.setRawHeader("Authorization", QString("Bearer %1").arg(m_token).toLocal8Bit());

View File

@ -143,7 +143,7 @@ inline auto getOverrideDeps() -> QList<OverrideDep>
{ "qvIfYCYJ", "P7dR8mSH", "API", ModPlatform::ResourceProvider::MODRINTH }, { "qvIfYCYJ", "P7dR8mSH", "API", ModPlatform::ResourceProvider::MODRINTH },
{ "lwVhp9o5", "Ha28R6CL", "KotlinLibraries", ModPlatform::ResourceProvider::MODRINTH } }; { "lwVhp9o5", "Ha28R6CL", "KotlinLibraries", ModPlatform::ResourceProvider::MODRINTH } };
}; }
} // namespace ModPlatform } // namespace ModPlatform

View File

@ -131,12 +131,12 @@ class ResourceAPI {
qWarning() << "TODO: ResourceAPI::searchProjects"; qWarning() << "TODO: ResourceAPI::searchProjects";
return nullptr; return nullptr;
} }
[[nodiscard]] virtual Task::Ptr getProject(QString addonId, std::shared_ptr<QByteArray> response) const [[nodiscard]] virtual Task::Ptr getProject([[maybe_unused]] QString addonId, [[maybe_unused]] std::shared_ptr<QByteArray> response) const
{ {
qWarning() << "TODO: ResourceAPI::getProject"; qWarning() << "TODO: ResourceAPI::getProject";
return nullptr; return nullptr;
} }
[[nodiscard]] virtual Task::Ptr getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const [[nodiscard]] virtual Task::Ptr getProjects([[maybe_unused]] QStringList addonIds, [[maybe_unused]] std::shared_ptr<QByteArray> response) const
{ {
qWarning() << "TODO: ResourceAPI::getProjects"; qWarning() << "TODO: ResourceAPI::getProjects";
return nullptr; return nullptr;

View File

@ -89,7 +89,7 @@ void Flame::FileResolvingTask::netJobFinished()
auto& out = m_toProcess.files[fileid]; auto& out = m_toProcess.files[fileid];
try { try {
out.parseFromObject(Json::requireObject(file)); out.parseFromObject(Json::requireObject(file));
} catch (const JSONValidationError& e) { } catch ([[maybe_unused]] const JSONValidationError& e) {
qDebug() << "Blocked mod on curseforge" << out.fileName; qDebug() << "Blocked mod on curseforge" << out.fileName;
auto hash = out.hash; auto hash = out.hash;
if (!hash.isEmpty()) { if (!hash.isEmpty()) {

View File

@ -54,7 +54,7 @@ void FlameMod::loadURLs(ModPlatform::IndexedPack& pack, QJsonObject& obj)
pack.extraDataLoaded = true; pack.extraDataLoaded = true;
} }
void FlameMod::loadBody(ModPlatform::IndexedPack& pack, QJsonObject& obj) void FlameMod::loadBody(ModPlatform::IndexedPack& pack, [[maybe_unused]] QJsonObject& obj)
{ {
pack.extraData.body = api.getModDescription(pack.addonId.toInt()); pack.extraData.body = api.getModDescription(pack.addonId.toInt());
@ -75,7 +75,7 @@ static QString enumToString(int hash_algorithm)
void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr, QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network, [[maybe_unused]] const shared_qobject_ptr<QNetworkAccessManager>& network,
const BaseInstance* inst) const BaseInstance* inst)
{ {
QVector<ModPlatform::IndexedVersion> unsortedVersions; QVector<ModPlatform::IndexedVersion> unsortedVersions;
@ -193,4 +193,5 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
}; };
std::sort(versions.begin(), versions.end(), orderSortPredicate); std::sort(versions.begin(), versions.end(), orderSortPredicate);
return versions.front(); return versions.front();
}; }

View File

@ -145,4 +145,5 @@ Task::Ptr NetworkResourceAPI::getDependencyVersion(DependencySearchArgs&& args,
}); });
return netJob; return netJob;
}; }

View File

@ -180,10 +180,10 @@ void ModrinthPackExportTask::parseApiResponse(const std::shared_ptr<QByteArray>
if (obj.isEmpty()) if (obj.isEmpty())
continue; continue;
const QJsonArray files = obj["files"].toArray(); const QJsonArray files_array = obj["files"].toArray();
if (auto fileIter = std::find_if(files.begin(), files.end(), if (auto fileIter = std::find_if(files_array.begin(), files_array.end(),
[&iterator](const QJsonValue& file) { return file["hashes"]["sha512"] == iterator.value(); }); [&iterator](const QJsonValue& file) { return file["hashes"]["sha512"] == iterator.value(); });
fileIter != files.end()) { fileIter != files_array.end()) {
// map the file to the url // map the file to the url
resolvedFiles[iterator.key()] = resolvedFiles[iterator.key()] =
ResolvedFile{ fileIter->toObject()["hashes"].toObject()["sha1"].toString(), iterator.value(), ResolvedFile{ fileIter->toObject()["hashes"].toObject()["sha1"].toString(), iterator.value(),
@ -293,7 +293,7 @@ QByteArray ModrinthPackExportTask::generateIndex()
obj["dependencies"] = dependencies; obj["dependencies"] = dependencies;
} }
QJsonArray files; QJsonArray files_array;
QMapIterator<QString, ResolvedFile> iterator(resolvedFiles); QMapIterator<QString, ResolvedFile> iterator(resolvedFiles);
while (iterator.hasNext()) { while (iterator.hasNext()) {
iterator.next(); iterator.next();
@ -311,9 +311,9 @@ QByteArray ModrinthPackExportTask::generateIndex()
file["hashes"] = hashes; file["hashes"] = hashes;
file["fileSize"] = value.size; file["fileSize"] = value.size;
files << file; files_array << file;
} }
obj["files"] = files; obj["files"] = files_array;
return QJsonDocument(obj).toJson(QJsonDocument::Compact); return QJsonDocument(obj).toJson(QJsonDocument::Compact);
} }

View File

@ -95,7 +95,7 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr, QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network, [[maybe_unused]] const shared_qobject_ptr<QNetworkAccessManager>& network,
const BaseInstance* inst) const BaseInstance* inst)
{ {
QVector<ModPlatform::IndexedVersion> unsortedVersions; QVector<ModPlatform::IndexedVersion> unsortedVersions;
@ -218,7 +218,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
return {}; return {};
} }
auto Modrinth::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{ {
QVector<ModPlatform::IndexedVersion> versions; QVector<ModPlatform::IndexedVersion> versions;
@ -235,4 +235,4 @@ auto Modrinth::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArr
}; };
std::sort(versions.begin(), versions.end(), orderSortPredicate); std::sort(versions.begin(), versions.end(), orderSortPredicate);
return versions.length() != 0 ? versions.front() : ModPlatform::IndexedVersion(); return versions.length() != 0 ? versions.front() : ModPlatform::IndexedVersion();
} }

View File

@ -89,7 +89,8 @@ auto intEntry(toml::table table, QString entry_name) -> int
return node.value_or(0); return node.value_or(0);
} }
auto V1::createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> Mod auto V1::createModFormat([[maybe_unused]] QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version)
-> Mod
{ {
Mod mod; Mod mod;
@ -114,7 +115,7 @@ auto V1::createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, Mo
return mod; return mod;
} }
auto V1::createModFormat(QDir& index_dir, ::Mod& internal_mod, QString slug) -> Mod auto V1::createModFormat(QDir& index_dir, [[maybe_unused]] ::Mod& internal_mod, QString slug) -> Mod
{ {
// Try getting metadata if it exists // Try getting metadata if it exists
Mod mod{ getIndexForMod(index_dir, slug) }; Mod mod{ getIndexForMod(index_dir, slug) };

View File

@ -26,7 +26,12 @@
#include <memory> #include <memory>
void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings, const QString &instName, const QString &instIcon, const QString &stagingPath, const QString &minecraftVersion, const bool isSolder) void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings,
const QString& instName,
const QString& instIcon,
const QString& stagingPath,
const QString& minecraftVersion,
[[maybe_unused]] const bool isSolder)
{ {
QString minecraftPath = FS::PathCombine(stagingPath, ".minecraft"); QString minecraftPath = FS::PathCombine(stagingPath, ".minecraft");
QString configPath = FS::PathCombine(stagingPath, "instance.cfg"); QString configPath = FS::PathCombine(stagingPath, "instance.cfg");
@ -151,17 +156,16 @@ void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings, const
{ {
QJsonDocument doc = Json::requireDocument(data); QJsonDocument doc = Json::requireDocument(data);
QJsonObject root = Json::requireObject(doc, "version.json"); QJsonObject root = Json::requireObject(doc, "version.json");
QString minecraftVersion = Json::ensureString(root, "inheritsFrom", QString(), ""); QString packMinecraftVersion = Json::ensureString(root, "inheritsFrom", QString(), "");
if (minecraftVersion.isEmpty()) if (packMinecraftVersion.isEmpty()) {
{
if (fmlMinecraftVersion.isEmpty()) if (fmlMinecraftVersion.isEmpty())
{ {
emit failed(tr("Could not understand \"version.json\":\ninheritsFrom is missing")); emit failed(tr("Could not understand \"version.json\":\ninheritsFrom is missing"));
return; return;
} }
minecraftVersion = fmlMinecraftVersion; packMinecraftVersion = fmlMinecraftVersion;
} }
components->setComponentVersion("net.minecraft", minecraftVersion, true); components->setComponentVersion("net.minecraft", packMinecraftVersion, true);
for (auto library: Json::ensureArray(root, "libraries", {})) for (auto library: Json::ensureArray(root, "libraries", {}))
{ {
if (!library.isObject()) if (!library.isObject())

View File

@ -42,8 +42,8 @@ inline QString childValue(const QDomElement& element, const QString& childName,
QDomNodeList nodes = element.elementsByTagName(childName); QDomNodeList nodes = element.elementsByTagName(childName);
if (nodes.count() > 0) if (nodes.count() > 0)
{ {
QDomElement element = nodes.at(0).toElement(); QDomElement elem = nodes.at(0).toElement();
return element.text(); return elem.text();
} }
else else
{ {
@ -51,7 +51,7 @@ inline QString childValue(const QDomElement& element, const QString& childName,
} }
} }
bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, QString* errorMsg) bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, [[maybe_unused]] QString* errorMsg)
{ {
QString title = childValue(element, "title", tr("Untitled")); QString title = childValue(element, "title", tr("Untitled"));
QString content = childValue(element, "content", tr("No content.")); QString content = childValue(element, "content", tr("No content."));
@ -62,4 +62,3 @@ bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, QSt
entry->link = link; entry->link = link;
return true; return true;
} }

View File

@ -82,7 +82,7 @@ void ImgurAlbumCreation::executeTask()
connect(rep, &QNetworkReply::sslErrors, this, &ImgurAlbumCreation::sslErrors); connect(rep, &QNetworkReply::sslErrors, this, &ImgurAlbumCreation::sslErrors);
} }
void ImgurAlbumCreation::downloadError(QNetworkReply::NetworkError error) void ImgurAlbumCreation::downloadError([[maybe_unused]] QNetworkReply::NetworkError error)
{ {
qDebug() << m_reply->errorString(); qDebug() << m_reply->errorString();
m_state = State::Failed; m_state = State::Failed;

View File

@ -97,7 +97,7 @@ void ImgurUpload::executeTask()
connect(rep, &QNetworkReply::sslErrors, this, &ImgurUpload::sslErrors); connect(rep, &QNetworkReply::sslErrors, this, &ImgurUpload::sslErrors);
} }
void ImgurUpload::downloadError(QNetworkReply::NetworkError error) void ImgurUpload::downloadError([[maybe_unused]] QNetworkReply::NetworkError error)
{ {
qCritical() << "ImgurUpload failed with error" << m_reply->errorString() << "Server reply:\n" << m_reply->readAll(); qCritical() << "ImgurUpload failed with error" << m_reply->errorString() << "Server reply:\n" << m_reply->readAll();
if(finished) if(finished)

View File

@ -171,7 +171,7 @@ void ConcurrentTask::subTaskSucceeded(Task::Ptr task)
startNext(); startNext();
} }
void ConcurrentTask::subTaskFailed(Task::Ptr task, const QString& msg) void ConcurrentTask::subTaskFailed(Task::Ptr task, [[maybe_unused]] const QString& msg)
{ {
m_done.insert(task.get(), task); m_done.insert(task.get(), task);
m_failed.insert(task.get(), task); m_failed.insert(task.get(), task);

View File

@ -64,12 +64,13 @@ struct TaskStepProgress {
QString status = ""; QString status = "";
QString details = ""; QString details = "";
TaskStepState state = TaskStepState::Waiting; TaskStepState state = TaskStepState::Waiting;
TaskStepProgress() { TaskStepProgress() {
this->uid = QUuid::createUuid(); this->uid = QUuid::createUuid();
} }
TaskStepProgress(QUuid uid) {
this->uid = uid; TaskStepProgress(QUuid uid_): uid(uid_) {}
}
bool isDone() const { return (state == TaskStepState::Failed) || (state == TaskStepState::Succeeded); } bool isDone() const { return (state == TaskStepState::Failed) || (state == TaskStepState::Succeeded); }
void update(qint64 new_current, qint64 new_total) { void update(qint64 new_current, qint64 new_total) {
this->old_current = this->current; this->old_current = this->current;

View File

@ -34,7 +34,7 @@ void JProfiler::profilerStarted()
emit readyToLaunch(tr("Listening on port: %1").arg(listeningPort)); emit readyToLaunch(tr("Listening on port: %1").arg(listeningPort));
} }
void JProfiler::profilerFinished(int exit, QProcess::ExitStatus status) void JProfiler::profilerFinished([[maybe_unused]] int exit, QProcess::ExitStatus status)
{ {
if (status == QProcess::CrashExit) if (status == QProcess::CrashExit)
{ {

View File

@ -32,7 +32,7 @@ void JVisualVM::profilerStarted()
emit readyToLaunch(tr("JVisualVM started")); emit readyToLaunch(tr("JVisualVM started"));
} }
void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status) void JVisualVM::profilerFinished([[maybe_unused]] int exit, QProcess::ExitStatus status)
{ {
if (status == QProcess::CrashExit) if (status == QProcess::CrashExit)
{ {

View File

@ -334,7 +334,7 @@ POTranslator::~POTranslator()
delete d; delete d;
} }
QString POTranslator::translate(const char* context, const char* sourceText, const char* disambiguation, int n) const QString POTranslator::translate(const char* context, const char* sourceText, const char* disambiguation, [[maybe_unused]] int n) const
{ {
if(disambiguation) if(disambiguation)
{ {

View File

@ -267,9 +267,7 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
try try
{ {
data = FS::read(path); data = FS::read(path);
} } catch ([[maybe_unused]] const Exception& e) {
catch (const Exception &e)
{
qCritical() << "Translations Download Failed: index file not readable"; qCritical() << "Translations Download Failed: index file not readable";
return; return;
} }
@ -307,9 +305,7 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
languages.insert(lang.key, lang); languages.insert(lang.key, lang);
} }
} } catch ([[maybe_unused]] Json::JsonException& e) {
catch (Json::JsonException & e)
{
qCritical() << "Translations Download Failed: index file could not be parsed as json"; qCritical() << "Translations Download Failed: index file could not be parsed as json";
} }
} }
@ -498,12 +494,12 @@ QVariant TranslationsModel::headerData(int section, Qt::Orientation orientation,
return QAbstractListModel::headerData(section, orientation, role); return QAbstractListModel::headerData(section, orientation, role);
} }
int TranslationsModel::rowCount(const QModelIndex& parent) const int TranslationsModel::rowCount([[maybe_unused]] const QModelIndex& parent) const
{ {
return d->m_languages.size(); return d->m_languages.size();
} }
int TranslationsModel::columnCount(const QModelIndex& parent) const int TranslationsModel::columnCount([[maybe_unused]] const QModelIndex& parent) const
{ {
return 2; return 2;
} }

View File

@ -537,9 +537,9 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip()); actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip());
if(!group.isNull()) if(!group.isNull())
{ {
QVariantMap data; QVariantMap instance_action_data;
data["group"] = group; instance_action_data["group"] = group;
actionCreateInstance->setData(data); actionCreateInstance->setData(instance_action_data);
} }
connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered())); connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered()));
@ -550,9 +550,9 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
if(!group.isNull()) if(!group.isNull())
{ {
QAction *actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this); QAction *actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this);
QVariantMap data; QVariantMap delete_group_action_data;
data["group"] = group; delete_group_action_data["group"] = group;
actionDeleteGroup->setData(data); actionDeleteGroup->setData(delete_group_action_data);
connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup())); connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup()));
actions.append(actionDeleteGroup); actions.append(actionDeleteGroup);
} }
@ -799,9 +799,9 @@ void MainWindow::changeActiveAccount()
if (sAction->data().type() != QVariant::Type::Int) if (sAction->data().type() != QVariant::Type::Int)
return; return;
QVariant data = sAction->data(); QVariant action_data = sAction->data();
bool valid = false; bool valid = false;
int index = data.toInt(&valid); int index = action_data.toInt(&valid);
if(!valid) { if(!valid) {
index = -1; index = -1;
} }
@ -1158,9 +1158,9 @@ void MainWindow::iconUpdated(QString icon)
{ {
if (icon == m_currentInstIcon) if (icon == m_currentInstIcon)
{ {
auto icon = APPLICATION->icons()->getIcon(m_currentInstIcon); auto new_icon = APPLICATION->icons()->getIcon(m_currentInstIcon);
ui->actionChangeInstIcon->setIcon(icon); ui->actionChangeInstIcon->setIcon(new_icon);
changeIconButton->setIcon(icon); changeIconButton->setIcon(new_icon);
} }
} }
@ -1636,7 +1636,7 @@ void MainWindow::startTask(Task *task)
task->start(); task->start();
} }
void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &previous) void MainWindow::instanceChanged(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{ {
if (!current.isValid()) if (!current.isValid())
{ {
@ -1782,8 +1782,9 @@ void MainWindow::setInstanceActionsEnabled(bool enabled)
ui->actionCreateInstanceShortcut->setEnabled(enabled); ui->actionCreateInstanceShortcut->setEnabled(enabled);
} }
void MainWindow::refreshCurrentInstance(bool running) void MainWindow::refreshCurrentInstance([[maybe_unused]] bool running)
{ {
auto current = view->selectionModel()->currentIndex(); auto current = view->selectionModel()->currentIndex();
instanceChanged(current, current); instanceChanged(current, current);
} }

View File

@ -220,7 +220,7 @@ void CopyInstanceDialog::on_iconButton_clicked()
} }
} }
void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString& arg1) void CopyInstanceDialog::on_instNameTextBox_textChanged([[maybe_unused]] const QString& arg1)
{ {
updateDialogState(); updateDialogState();
} }

View File

@ -203,8 +203,8 @@ void ExportInstanceDialog::loadPackIgnore()
{ {
return; return;
} }
auto data = ignoreFile.readAll(); auto ignoreData = ignoreFile.readAll();
auto string = QString::fromUtf8(data); auto string = QString::fromUtf8(ignoreData);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
proxyModel->setBlockedPaths(string.split('\n', Qt::SkipEmptyParts)); proxyModel->setBlockedPaths(string.split('\n', Qt::SkipEmptyParts));
#else #else
@ -214,11 +214,11 @@ void ExportInstanceDialog::loadPackIgnore()
void ExportInstanceDialog::savePackIgnore() void ExportInstanceDialog::savePackIgnore()
{ {
auto data = proxyModel->blockedPaths().toStringList().join('\n').toUtf8(); auto ignoreData = proxyModel->blockedPaths().toStringList().join('\n').toUtf8();
auto filename = ignoreFileName(); auto filename = ignoreFileName();
try try
{ {
FS::write(filename, data); FS::write(filename, ignoreData);
} }
catch (const Exception &e) catch (const Exception &e)
{ {

View File

@ -296,7 +296,7 @@ void NewInstanceDialog::on_iconButton_clicked()
} }
} }
void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) void NewInstanceDialog::on_instNameTextBox_textChanged([[maybe_unused]] const QString &arg1)
{ {
updateDialogState(); updateDialogState();
} }

View File

@ -167,14 +167,14 @@ void ProfileSetupDialog::checkName(const QString &name) {
void ProfileSetupDialog::checkFinished( void ProfileSetupDialog::checkFinished(
QNetworkReply::NetworkError error, QNetworkReply::NetworkError error,
QByteArray data, QByteArray profileData,
QList<QNetworkReply::RawHeaderPair> headers [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) { ) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender()); auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater(); requestor->deleteLater();
if(error == QNetworkReply::NoError) { if(error == QNetworkReply::NoError) {
auto doc = QJsonDocument::fromJson(data); auto doc = QJsonDocument::fromJson(profileData);
auto root = doc.object(); auto root = doc.object();
auto statusValue = root.value("status").toString("INVALID"); auto statusValue = root.value("status").toString("INVALID");
if(statusValue == "AVAILABLE") { if(statusValue == "AVAILABLE") {
@ -210,11 +210,11 @@ void ProfileSetupDialog::setupProfile(const QString &profileName) {
request.setRawHeader("Authorization", QString("Bearer %1").arg(token).toUtf8()); request.setRawHeader("Authorization", QString("Bearer %1").arg(token).toUtf8());
QString payloadTemplate("{\"profileName\":\"%1\"}"); QString payloadTemplate("{\"profileName\":\"%1\"}");
auto data = payloadTemplate.arg(profileName).toUtf8(); auto profileData = payloadTemplate.arg(profileName).toUtf8();
AuthRequest *requestor = new AuthRequest(this); AuthRequest *requestor = new AuthRequest(this);
connect(requestor, &AuthRequest::finished, this, &ProfileSetupDialog::setupProfileFinished); connect(requestor, &AuthRequest::finished, this, &ProfileSetupDialog::setupProfileFinished);
requestor->post(request, data); requestor->post(request, profileData);
isWorking = true; isWorking = true;
auto button = ui->buttonBox->button(QDialogButtonBox::Cancel); auto button = ui->buttonBox->button(QDialogButtonBox::Cancel);
@ -251,8 +251,8 @@ struct MojangError{
void ProfileSetupDialog::setupProfileFinished( void ProfileSetupDialog::setupProfileFinished(
QNetworkReply::NetworkError error, QNetworkReply::NetworkError error,
QByteArray data, QByteArray errorData,
QList<QNetworkReply::RawHeaderPair> headers [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) { ) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender()); auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater(); requestor->deleteLater();
@ -266,7 +266,7 @@ void ProfileSetupDialog::setupProfileFinished(
accept(); accept();
} }
else { else {
auto parsedError = MojangError::fromJSON(data); auto parsedError = MojangError::fromJSON(errorData);
ui->errorLabel->setVisible(true); ui->errorLabel->setVisible(true);
ui->errorLabel->setText(tr("The server returned the following error:") + "\n\n" + parsedError.errorMessage); ui->errorLabel->setText(tr("The server returned the following error:") + "\n\n" + parsedError.errorMessage);
qDebug() << parsedError.rawError; qDebug() << parsedError.rawError;

View File

@ -85,7 +85,7 @@ void ProgressDialog::on_skipButton_clicked(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
if (ui->skipButton->isEnabled()) // prevent other triggers from aborting if (ui->skipButton->isEnabled()) // prevent other triggers from aborting
task->abort(); m_task->abort();
} }
ProgressDialog::~ProgressDialog() ProgressDialog::~ProgressDialog()
@ -116,7 +116,7 @@ void ProgressDialog::updateSize()
int ProgressDialog::execWithTask(Task* task) int ProgressDialog::execWithTask(Task* task)
{ {
this->task = task; this->m_task = task;
if (!task) { if (!task) {
qDebug() << "Programmer error: Progress dialog created with null task."; qDebug() << "Programmer error: Progress dialog created with null task.";
@ -168,8 +168,8 @@ int ProgressDialog::execWithTask(std::unique_ptr<Task>& task)
bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result) bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result)
{ {
if (task->isFinished()) { if (m_task->isFinished()) {
if (task->wasSuccessful()) { if (m_task->wasSuccessful()) {
result = QDialog::Accepted; result = QDialog::Accepted;
} else { } else {
result = QDialog::Rejected; result = QDialog::Rejected;
@ -181,12 +181,12 @@ bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result)
Task* ProgressDialog::getTask() Task* ProgressDialog::getTask()
{ {
return task; return m_task;
} }
void ProgressDialog::onTaskStarted() {} void ProgressDialog::onTaskStarted() {}
void ProgressDialog::onTaskFailed(QString failure) void ProgressDialog::onTaskFailed([[maybe_unused]] QString failure)
{ {
reject(); reject();
hide(); hide();
@ -198,10 +198,10 @@ void ProgressDialog::onTaskSucceeded()
hide(); hide();
} }
void ProgressDialog::changeStatus(const QString& status) void ProgressDialog::changeStatus([[maybe_unused]] const QString& status)
{ {
ui->globalStatusLabel->setText(task->getStatus()); ui->globalStatusLabel->setText(m_task->getStatus());
ui->globalStatusDetailsLabel->setText(task->getDetails()); ui->globalStatusDetailsLabel->setText(m_task->getDetails());
updateSize(); updateSize();
} }
@ -269,7 +269,7 @@ void ProgressDialog::keyPressEvent(QKeyEvent* e)
void ProgressDialog::closeEvent(QCloseEvent* e) void ProgressDialog::closeEvent(QCloseEvent* e)
{ {
if (task && task->isRunning()) { if (m_task && m_task->isRunning()) {
e->ignore(); e->ignore();
} else { } else {
QDialog::closeEvent(e); QDialog::closeEvent(e);

View File

@ -98,7 +98,7 @@ private:
private: private:
Ui::ProgressDialog *ui; Ui::ProgressDialog *ui;
Task *task; Task *m_task;
bool m_is_multi_step = false; bool m_is_multi_step = false;
QHash<QUuid, SubTaskProgressBar*> taskProgress; QHash<QUuid, SubTaskProgressBar*> taskProgress;

View File

@ -301,7 +301,7 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
return makeShared<GetModDependenciesTask>(this, m_instance, model, selectedVers); return makeShared<GetModDependenciesTask>(this, m_instance, model, selectedVers);
} }
return nullptr; return nullptr;
}; }
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent, ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
const std::shared_ptr<ResourcePackFolderModel>& resource_packs, const std::shared_ptr<ResourcePackFolderModel>& resource_packs,

View File

@ -5,7 +5,7 @@
#include <QPushButton> #include <QPushButton>
ReviewMessageBox::ReviewMessageBox(QWidget* parent, QString const& title, QString const& icon) ReviewMessageBox::ReviewMessageBox(QWidget* parent, [[maybe_unused]] QString const& title, [[maybe_unused]] QString const& icon)
: QDialog(parent), ui(new Ui::ReviewMessageBox) : QDialog(parent), ui(new Ui::ReviewMessageBox)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -155,15 +155,15 @@ SkinUploadDialog::SkinUploadDialog(MinecraftAccountPtr acct, QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
// FIXME: add a model for this, download/refresh the capes on demand // FIXME: add a model for this, download/refresh the capes on demand
auto &data = *acct->accountData(); auto &accountData = *acct->accountData();
int index = 0; int index = 0;
ui->capeCombo->addItem(tr("No Cape"), QVariant()); ui->capeCombo->addItem(tr("No Cape"), QVariant());
auto currentCape = data.minecraftProfile.currentCape; auto currentCape = accountData.minecraftProfile.currentCape;
if(currentCape.isEmpty()) { if(currentCape.isEmpty()) {
ui->capeCombo->setCurrentIndex(index); ui->capeCombo->setCurrentIndex(index);
} }
for(auto & cape: data.minecraftProfile.capes) { for(auto & cape: accountData.minecraftProfile.capes) {
index++; index++;
if(cape.data.size()) { if(cape.data.size()) {
QPixmap capeImage; QPixmap capeImage;

View File

@ -400,7 +400,9 @@ signals:
void editingDone(); void editingDone();
}; };
void ListViewDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const void ListViewDelegate::updateEditorGeometry(QWidget* editor,
const QStyleOptionViewItem& option,
[[maybe_unused]] const QModelIndex& index) const
{ {
const int iconSize = 48; const int iconSize = 48;
QRect textRect = option.rect; QRect textRect = option.rect;
@ -412,17 +414,17 @@ void ListViewDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionV
void ListViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const void ListViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{ {
auto text = index.data(Qt::EditRole).toString(); auto text = index.data(Qt::EditRole).toString();
QTextEdit * realeditor = qobject_cast<NoReturnTextEdit *>(editor); QTextEdit* realEditor = qobject_cast<NoReturnTextEdit*>(editor);
realeditor->setAlignment(Qt::AlignHCenter | Qt::AlignTop); realEditor->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
realeditor->append(text); realEditor->append(text);
realeditor->selectAll(); realEditor->selectAll();
realeditor->document()->clearUndoRedoStacks(); realEditor->document()->clearUndoRedoStacks();
} }
void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{ {
QTextEdit * realeditor = qobject_cast<NoReturnTextEdit *>(editor); QTextEdit * realEditor = qobject_cast<NoReturnTextEdit *>(editor);
QString text = realeditor->toPlainText(); QString text = realEditor->toPlainText();
text.replace(QChar('\n'), QChar(' ')); text.replace(QChar('\n'), QChar(' '));
text = text.trimmed(); text = text.trimmed();
// Prevent instance names longer than 128 chars // Prevent instance names longer than 128 chars
@ -433,7 +435,9 @@ void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
} }
} }
QWidget * ListViewDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const QWidget* ListViewDelegate::createEditor(QWidget* parent,
[[maybe_unused]] const QStyleOptionViewItem& option,
[[maybe_unused]] const QModelIndex& index) const
{ {
auto editor = new NoReturnTextEdit(parent); auto editor = new NoReturnTextEdit(parent);
connect(editor, &NoReturnTextEdit::editingDone, this, &ListViewDelegate::editingDone); connect(editor, &NoReturnTextEdit::editingDone, this, &ListViewDelegate::editingDone);

View File

@ -88,16 +88,18 @@ void InstanceView::setModel(QAbstractItemModel *model)
connect(model, &QAbstractItemModel::rowsRemoved, this, &InstanceView::rowsRemoved); connect(model, &QAbstractItemModel::rowsRemoved, this, &InstanceView::rowsRemoved);
} }
void InstanceView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) void InstanceView::dataChanged([[maybe_unused]] const QModelIndex& topLeft,
[[maybe_unused]] const QModelIndex& bottomRight,
[[maybe_unused]] const QVector<int>& roles)
{ {
scheduleDelayedItemsLayout(); scheduleDelayedItemsLayout();
} }
void InstanceView::rowsInserted(const QModelIndex &parent, int start, int end) void InstanceView::rowsInserted([[maybe_unused]] const QModelIndex& parent, [[maybe_unused]] int start, [[maybe_unused]] int end)
{ {
scheduleDelayedItemsLayout(); scheduleDelayedItemsLayout();
} }
void InstanceView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) void InstanceView::rowsAboutToBeRemoved([[maybe_unused]] const QModelIndex& parent, [[maybe_unused]] int start, [[maybe_unused]] int end)
{ {
scheduleDelayedItemsLayout(); scheduleDelayedItemsLayout();
} }
@ -263,9 +265,9 @@ QString InstanceView::groupNameAt(const QPoint &point)
{ {
executeDelayedItemsLayout(); executeDelayedItemsLayout();
VisualGroup::HitResults hitresult; VisualGroup::HitResults hitResult;
auto group = categoryAt(point + offset(), hitresult); auto group = categoryAt(point + offset(), hitResult);
if(group && (hitresult & (VisualGroup::HeaderHit | VisualGroup::BodyHit))) if(group && (hitResult & (VisualGroup::HeaderHit | VisualGroup::BodyHit)))
{ {
return group->text; return group->text;
} }
@ -300,9 +302,9 @@ void InstanceView::mousePressEvent(QMouseEvent *event)
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex); m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
m_pressedPosition = geometryPos; m_pressedPosition = geometryPos;
VisualGroup::HitResults hitresult; VisualGroup::HitResults hitResult;
m_pressedCategory = categoryAt(geometryPos, hitresult); m_pressedCategory = categoryAt(geometryPos, hitResult);
if (m_pressedCategory && hitresult & VisualGroup::CheckboxHit) if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit)
{ {
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState); setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
event->accept(); event->accept();
@ -402,10 +404,10 @@ void InstanceView::mouseReleaseEvent(QMouseEvent *event)
QPoint geometryPos = event->pos() + offset(); QPoint geometryPos = event->pos() + offset();
QPersistentModelIndex index = indexAt(visualPos); QPersistentModelIndex index = indexAt(visualPos);
VisualGroup::HitResults hitresult; VisualGroup::HitResults hitResult;
bool click = (index == m_pressedIndex && index.isValid()) || bool click = (index == m_pressedIndex && index.isValid()) ||
(m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitresult)); (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitResult));
if (click && m_pressedCategory) if (click && m_pressedCategory)
{ {
@ -498,7 +500,7 @@ void InstanceView::mouseDoubleClickEvent(QMouseEvent *event)
} }
} }
void InstanceView::paintEvent(QPaintEvent *event) void InstanceView::paintEvent([[maybe_unused]] QPaintEvent *event)
{ {
executeDelayedItemsLayout(); executeDelayedItemsLayout();
@ -589,7 +591,7 @@ void InstanceView::paintEvent(QPaintEvent *event)
#endif #endif
} }
void InstanceView::resizeEvent(QResizeEvent *event) void InstanceView::resizeEvent([[maybe_unused]] QResizeEvent *event)
{ {
int newItemsPerRow = calculateItemsPerRow(); int newItemsPerRow = calculateItemsPerRow();
if(newItemsPerRow != m_currentItemsPerRow) if(newItemsPerRow != m_currentItemsPerRow)
@ -630,7 +632,7 @@ void InstanceView::dragMoveEvent(QDragMoveEvent *event)
event->accept(); event->accept();
} }
void InstanceView::dragLeaveEvent(QDragLeaveEvent *event) void InstanceView::dragLeaveEvent([[maybe_unused]] QDragLeaveEvent *event)
{ {
executeDelayedItemsLayout(); executeDelayedItemsLayout();
@ -655,9 +657,9 @@ void InstanceView::dropEvent(QDropEvent *event)
{ {
std::pair<VisualGroup *, VisualGroup::HitResults> dropPos = rowDropPos(event->pos()); std::pair<VisualGroup *, VisualGroup::HitResults> dropPos = rowDropPos(event->pos());
const VisualGroup *group = dropPos.first; const VisualGroup *group = dropPos.first;
auto hitresult = dropPos.second; auto hitResult = dropPos.second;
if (hitresult == VisualGroup::HitResult::NoHit) if (hitResult == VisualGroup::HitResult::NoHit)
{ {
viewport()->update(); viewport()->update();
return; return;
@ -697,8 +699,8 @@ void InstanceView::startDrag(Qt::DropActions supportedActions)
if(indexes.count() == 0) if(indexes.count() == 0)
return; return;
QMimeData *data = model()->mimeData(indexes); QMimeData *mimeData = model()->mimeData(indexes);
if (!data) if (!mimeData)
{ {
return; return;
} }
@ -706,7 +708,7 @@ void InstanceView::startDrag(Qt::DropActions supportedActions)
QPixmap pixmap = renderToPixmap(indexes, &rect); QPixmap pixmap = renderToPixmap(indexes, &rect);
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
drag->setPixmap(pixmap); drag->setPixmap(pixmap);
drag->setMimeData(data); drag->setMimeData(mimeData);
drag->setHotSpot(m_pressedPosition - rect.topLeft()); drag->setHotSpot(m_pressedPosition - rect.topLeft());
Qt::DropAction defaultDropAction = Qt::IgnoreAction; Qt::DropAction defaultDropAction = Qt::IgnoreAction;
if (this->defaultDropAction() != Qt::IgnoreAction && (supportedActions & this->defaultDropAction())) if (this->defaultDropAction() != Qt::IgnoreAction && (supportedActions & this->defaultDropAction()))
@ -833,16 +835,16 @@ QList<std::pair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QMo
return ret; return ret;
} }
bool InstanceView::isDragEventAccepted(QDropEvent *event) bool InstanceView::isDragEventAccepted([[maybe_unused]] QDropEvent *event)
{ {
return true; return true;
} }
std::pair<VisualGroup *, VisualGroup::HitResults> InstanceView::rowDropPos(const QPoint &pos) std::pair<VisualGroup *, VisualGroup::HitResults> InstanceView::rowDropPos(const QPoint &pos)
{ {
VisualGroup::HitResults hitresult; VisualGroup::HitResults hitResult;
auto group = categoryAt(pos + offset(), hitresult); auto group = categoryAt(pos + offset(), hitResult);
return std::make_pair(group, hitresult); return std::make_pair(group, hitResult);
} }
QPoint InstanceView::offset() const QPoint InstanceView::offset() const
@ -871,7 +873,7 @@ QRegion InstanceView::visualRegionForSelection(const QItemSelection &selection)
return region; return region;
} }
QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorAction, [[maybe_unused]] Qt::KeyboardModifiers modifiers)
{ {
auto current = currentIndex(); auto current = currentIndex();
if(!current.isValid()) if(!current.isValid())
@ -896,23 +898,23 @@ QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorActio
{ {
if(row == 0) if(row == 0)
{ {
int prevgroupindex = group_index-1; int prevGroupIndex = group_index-1;
while(prevgroupindex >= 0) while(prevGroupIndex >= 0)
{ {
auto prevgroup = m_groups[prevgroupindex]; auto prevGroup = m_groups[prevGroupIndex];
if(prevgroup->collapsed) if(prevGroup->collapsed)
{ {
prevgroupindex--; prevGroupIndex--;
continue; continue;
} }
int newRow = prevgroup->numRows() - 1; int newRow = prevGroup->numRows() - 1;
int newRowSize = prevgroup->rows[newRow].size(); int newRowSize = prevGroup->rows[newRow].size();
int newColumn = m_currentCursorColumn; int newColumn = m_currentCursorColumn;
if (m_currentCursorColumn >= newRowSize) if (m_currentCursorColumn >= newRowSize)
{ {
newColumn = newRowSize - 1; newColumn = newRowSize - 1;
} }
return prevgroup->rows[newRow][newColumn]; return prevGroup->rows[newRow][newColumn];
} }
} }
else else
@ -932,22 +934,22 @@ QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorActio
{ {
if(row == cat->rows.size() - 1) if(row == cat->rows.size() - 1)
{ {
int nextgroupindex = group_index+1; int nextGroupIndex = group_index+1;
while (nextgroupindex < m_groups.size()) while (nextGroupIndex < m_groups.size())
{ {
auto nextgroup = m_groups[nextgroupindex]; auto nextGroup = m_groups[nextGroupIndex];
if(nextgroup->collapsed) if(nextGroup->collapsed)
{ {
nextgroupindex++; nextGroupIndex++;
continue; continue;
} }
int newRowSize = nextgroup->rows[0].size(); int newRowSize = nextGroup->rows[0].size();
int newColumn = m_currentCursorColumn; int newColumn = m_currentCursorColumn;
if (m_currentCursorColumn >= newRowSize) if (m_currentCursorColumn >= newRowSize)
{ {
newColumn = newRowSize - 1; newColumn = newRowSize - 1;
} }
return nextgroup->rows[0][newColumn]; return nextGroup->rows[0][newColumn];
} }
} }
else else
@ -1031,7 +1033,7 @@ void InstanceView::scrollTo(const QModelIndex &index, ScrollHint hint)
verticalScrollBar()->setValue(verticalScrollToValue(index, rect, hint)); verticalScrollBar()->setValue(verticalScrollToValue(index, rect, hint));
} }
int InstanceView::verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const int InstanceView::verticalScrollToValue([[maybe_unused]] const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const
{ {
const QRect area = viewport()->rect(); const QRect area = viewport()->rect();
const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top()); const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());

View File

@ -165,7 +165,7 @@ void VisualGroup::drawHeader(QPainter *painter, const QStyleOptionViewItem &opti
const QFontMetrics fontMetrics = QFontMetrics(font); const QFontMetrics fontMetrics = QFontMetrics(font);
QColor outlineColor = option.palette.text().color(); QColor outlineColor = option.palette.text().color();
outlineColor.setAlphaF(0.35); outlineColor.setAlphaF(static_cast<float>(0.35));
//BEGIN: top left corner //BEGIN: top left corner
{ {
@ -234,7 +234,7 @@ void VisualGroup::drawHeader(QPainter *painter, const QStyleOptionViewItem &opti
painter->setRenderHint(QPainter::Antialiasing, false); painter->setRenderHint(QPainter::Antialiasing, false);
painter->setFont(font); painter->setFont(font);
QColor penColor(option.palette.text().color()); QColor penColor(option.palette.text().color());
penColor.setAlphaF(0.6); penColor.setAlphaF(static_cast<float>(0.6));
painter->setPen(penColor); painter->setPen(penColor);
QRect iconSubRect(option.rect); QRect iconSubRect(option.rect);
iconSubRect.setTop(iconSubRect.top() + 7); iconSubRect.setTop(iconSubRect.top() + 7);
@ -278,7 +278,7 @@ void VisualGroup::drawHeader(QPainter *painter, const QStyleOptionViewItem &opti
painter->save(); painter->save();
painter->setFont(font); painter->setFont(font);
QColor penColor(option.palette.text().color()); QColor penColor(option.palette.text().color());
penColor.setAlphaF(0.6); penColor.setAlphaF(static_cast<float>(0.6));
painter->setPen(penColor); painter->setPen(penColor);
painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text); painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text);
painter->restore(); painter->restore();

View File

@ -84,9 +84,8 @@ AccountListPage::AccountListPage(QWidget *parent)
QItemSelectionModel *selectionModel = ui->listView->selectionModel(); QItemSelectionModel *selectionModel = ui->listView->selectionModel();
connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) { connect(selectionModel, &QItemSelectionModel::selectionChanged,
updateButtonStates(); [this]([[maybe_unused]] const QItemSelection& sel, [[maybe_unused]] const QItemSelection& dsel) { updateButtonStates(); });
});
connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu); connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu);
connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged); connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged);

View File

@ -176,7 +176,7 @@ void JavaPage::on_javaTestBtn_clicked()
checker->run(); checker->run();
} }
void JavaPage::on_maxMemSpinBox_valueChanged(int i) void JavaPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i)
{ {
updateThresholds(); updateThresholds();
} }

View File

@ -73,7 +73,7 @@ void ProxyPage::updateCheckboxStuff()
ui->proxyAuthBox->setEnabled(enableEditing); ui->proxyAuthBox->setEnabled(enableEditing);
} }
void ProxyPage::proxyGroupChanged(QAbstractButton *button) void ProxyPage::proxyGroupChanged([[maybe_unused]] QAbstractButton *button)
{ {
updateCheckboxStuff(); updateCheckboxStuff();
} }

View File

@ -300,7 +300,7 @@ bool ExternalResourcesPage::current(const QModelIndex& current, const QModelInde
return onSelectionChanged(current, previous); return onSelectionChanged(current, previous);
} }
bool ExternalResourcesPage::onSelectionChanged(const QModelIndex& current, const QModelIndex& previous) bool ExternalResourcesPage::onSelectionChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous)
{ {
auto sourceCurrent = m_filterModel->mapToSource(current); auto sourceCurrent = m_filterModel->mapToSource(current);
int row = sourceCurrent.row(); int row = sourceCurrent.row();

View File

@ -482,7 +482,7 @@ void InstanceSettingsPage::changeInstanceAccount(int index)
} }
} }
void InstanceSettingsPage::on_maxMemSpinBox_valueChanged(int i) void InstanceSettingsPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i)
{ {
updateThresholds(); updateThresholds();
} }

View File

@ -122,7 +122,7 @@ bool ModFolderPage::shouldDisplay() const
return true; return true;
} }
bool ModFolderPage::onSelectionChanged(const QModelIndex& current, const QModelIndex& previous) bool ModFolderPage::onSelectionChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous)
{ {
auto sourceCurrent = m_filterModel->mapToSource(current); auto sourceCurrent = m_filterModel->mapToSource(current);
int row = sourceCurrent.row(); int row = sourceCurrent.row();

View File

@ -287,23 +287,23 @@ void OtherLogsPage::on_btnClean_clicked()
} }
if(!failed.empty()) if(!failed.empty())
{ {
QMessageBox *messageBox = new QMessageBox(this); QMessageBox *messageBoxFailure = new QMessageBox(this);
messageBox->setWindowTitle(tr("Error")); messageBoxFailure->setWindowTitle(tr("Error"));
if(failed.size() > 5) if(failed.size() > 5)
{ {
messageBox->setText(tr("Couldn't delete some files!")); messageBoxFailure->setText(tr("Couldn't delete some files!"));
messageBox->setDetailedText(failed.join('\n')); messageBoxFailure->setDetailedText(failed.join('\n'));
} }
else else
{ {
messageBox->setText(tr("Couldn't delete some files:\n%1").arg(failed.join('\n'))); messageBoxFailure->setText(tr("Couldn't delete some files:\n%1").arg(failed.join('\n')));
} }
messageBox->setStandardButtons(QMessageBox::Ok); messageBoxFailure->setStandardButtons(QMessageBox::Ok);
messageBox->setDefaultButton(QMessageBox::Ok); messageBoxFailure->setDefaultButton(QMessageBox::Ok);
messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse); messageBoxFailure->setTextInteractionFlags(Qt::TextSelectableByMouse);
messageBox->setIcon(QMessageBox::Critical); messageBoxFailure->setIcon(QMessageBox::Critical);
messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction); messageBoxFailure->setTextInteractionFlags(Qt::TextBrowserInteraction);
messageBox->exec(); messageBoxFailure->exec();
} }
} }

View File

@ -55,7 +55,7 @@ ResourcePackPage::ResourcePackPage(MinecraftInstance* instance, std::shared_ptr<
ui->actionViewConfigs->setVisible(false); ui->actionViewConfigs->setVisible(false);
} }
bool ResourcePackPage::onSelectionChanged(const QModelIndex& current, const QModelIndex& previous) bool ResourcePackPage::onSelectionChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous)
{ {
auto sourceCurrent = m_filterModel->mapToSource(current); auto sourceCurrent = m_filterModel->mapToSource(current);
int row = sourceCurrent.row(); int row = sourceCurrent.row();

View File

@ -684,7 +684,7 @@ void ServersPage::runningStateChanged(bool running)
updateState(); updateState();
} }
void ServersPage::currentChanged(const QModelIndex &current, const QModelIndex &previous) void ServersPage::currentChanged(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{ {
int nextServer = -1; int nextServer = -1;
if (!current.isValid()) if (!current.isValid())
@ -700,7 +700,7 @@ void ServersPage::currentChanged(const QModelIndex &current, const QModelIndex &
} }
// WARNING: this is here because currentChanged is not accurate when removing rows. the current item needs to be fixed up after removal. // WARNING: this is here because currentChanged is not accurate when removing rows. the current item needs to be fixed up after removal.
void ServersPage::rowsRemoved(const QModelIndex& parent, int first, int last) void ServersPage::rowsRemoved([[maybe_unused]] const QModelIndex& parent, int first, int last)
{ {
if(currentServer < first) if(currentServer < first)
{ {

View File

@ -57,7 +57,7 @@ TexturePackPage::TexturePackPage(MinecraftInstance* instance, std::shared_ptr<Te
ui->actionViewConfigs->setVisible(false); ui->actionViewConfigs->setVisible(false);
} }
bool TexturePackPage::onSelectionChanged(const QModelIndex& current, const QModelIndex& previous) bool TexturePackPage::onSelectionChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous)
{ {
auto sourceCurrent = m_filterModel->mapToSource(current); auto sourceCurrent = m_filterModel->mapToSource(current);
int row = sourceCurrent.row(); int row = sourceCurrent.row();

View File

@ -202,7 +202,7 @@ void VersionPage::showContextMenu(const QPoint& pos)
delete menu; delete menu;
} }
void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &previous) void VersionPage::packageCurrent(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{ {
if (!current.isValid()) if (!current.isValid())
{ {
@ -647,7 +647,7 @@ void VersionPage::on_actionMinecraftFolder_triggered()
DesktopServices::openDirectory(m_inst->gameRoot(), true); DesktopServices::openDirectory(m_inst->gameRoot(), true);
} }
void VersionPage::versionCurrent(const QModelIndex &current, const QModelIndex &previous) void VersionPage::versionCurrent(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{ {
currentIdx = current.row(); currentIdx = current.row();
updateButtons(currentIdx); updateButtons(currentIdx);

View File

@ -352,7 +352,7 @@ void WorldListPage::mceditState(LoggedProcess::State state)
} }
} }
void WorldListPage::worldChanged(const QModelIndex &current, const QModelIndex &previous) void WorldListPage::worldChanged([[maybe_unused]] const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{ {
QModelIndex index = getSelectedWorld(); QModelIndex index = getSelectedWorld();
bool enable = index.isValid(); bool enable = index.isValid();

View File

@ -50,7 +50,7 @@ class UrlValidator : public QValidator
public: public:
using QValidator::QValidator; using QValidator::QValidator;
State validate(QString &in, int &pos) const State validate(QString &in, [[maybe_unused]] int &pos) const
{ {
const QUrl url(in); const QUrl url(in);
if (url.isValid() && !url.isRelative() && !url.isEmpty()) if (url.isValid() && !url.isRelative() && !url.isEmpty())
@ -118,8 +118,8 @@ void ImportPage::updateState()
if(fi.exists() && (isZip || isMRPack)) if(fi.exists() && (isZip || isMRPack))
{ {
QFileInfo fi(url.fileName()); QFileInfo file_info(url.fileName());
dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url,this)); dialog->setSuggestedPack(file_info.completeBaseName(), new InstanceImportTask(url,this));
dialog->setSuggestedIcon("default"); dialog->setSuggestedIcon("default");
} }
} }

View File

@ -102,7 +102,7 @@ QHash<int, QByteArray> ResourceModel::roleNames() const
return roles; return roles;
} }
bool ResourceModel::setData(const QModelIndex& index, const QVariant& value, int role) bool ResourceModel::setData(const QModelIndex& index, const QVariant& value, [[maybe_unused]] int role)
{ {
int pos = index.row(); int pos = index.row();
if (pos >= m_packs.size() || pos < 0 || !index.isValid()) if (pos >= m_packs.size() || pos < 0 || !index.isValid())
@ -310,7 +310,7 @@ std::optional<QIcon> ResourceModel::getIcon(QModelIndex& index, const QUrl& url)
#define NEED_FOR_CALLBACK_ASSERT(name) \ #define NEED_FOR_CALLBACK_ASSERT(name) \
Q_ASSERT_X(0 != 0, #name, "You NEED to re-implement this if you intend on using the default callbacks.") Q_ASSERT_X(0 != 0, #name, "You NEED to re-implement this if you intend on using the default callbacks.")
QJsonArray ResourceModel::documentToArray(QJsonDocument& doc) const QJsonArray ResourceModel::documentToArray([[maybe_unused]] QJsonDocument& doc) const
{ {
NEED_FOR_CALLBACK_ASSERT("documentToArray"); NEED_FOR_CALLBACK_ASSERT("documentToArray");
return {}; return {};
@ -372,7 +372,7 @@ void ResourceModel::searchRequestSucceeded(QJsonDocument& doc)
endInsertRows(); endInsertRows();
} }
void ResourceModel::searchRequestFailed(QString reason, int network_error_code) void ResourceModel::searchRequestFailed([[maybe_unused]] QString reason, int network_error_code)
{ {
switch (network_error_code) { switch (network_error_code) {
default: default:

View File

@ -9,7 +9,8 @@
namespace ResourceDownload { namespace ResourceDownload {
ResourcePackResourceModel::ResourcePackResourceModel(BaseInstance const& base_inst, ResourceAPI* api) ResourcePackResourceModel::ResourcePackResourceModel(BaseInstance const& base_inst, ResourceAPI* api)
: ResourceModel(api), m_base_instance(base_inst){}; : ResourceModel(api), m_base_instance(base_inst)
{}
/******** Make data requests ********/ /******** Make data requests ********/

View File

@ -279,7 +279,7 @@ void ResourcePage::updateVersionList()
updateSelectionButton(); updateSelectionButton();
} }
void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev) void ResourcePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelIndex prev)
{ {
if (!curr.isValid()) { if (!curr.isValid()) {
return; return;
@ -306,9 +306,9 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
updateUi(); updateUi();
} }
void ResourcePage::onVersionSelectionChanged(QString data) void ResourcePage::onVersionSelectionChanged(QString versionData)
{ {
if (data.isNull() || data.isEmpty()) { if (versionData.isNull() || versionData.isEmpty()) {
m_selected_version_index = -1; m_selected_version_index = -1;
return; return;
} }

View File

@ -97,7 +97,10 @@ class ResourcePage : public QWidget, public BasePage {
virtual void openUrl(const QUrl&); virtual void openUrl(const QUrl&);
/** Whether the version is opted out or not. Currently only makes sense in CF. */ /** Whether the version is opted out or not. Currently only makes sense in CF. */
virtual bool optedOut(ModPlatform::IndexedVersion& ver) const { return false; }; virtual bool optedOut(ModPlatform::IndexedVersion& ver) const {
Q_UNUSED(ver);
return false;
};
public: public:
BaseInstance& m_base_instance; BaseInstance& m_base_instance;

View File

@ -9,7 +9,8 @@
namespace ResourceDownload { namespace ResourceDownload {
ShaderPackResourceModel::ShaderPackResourceModel(BaseInstance const& base_inst, ResourceAPI* api) ShaderPackResourceModel::ShaderPackResourceModel(BaseInstance const& base_inst, ResourceAPI* api)
: ResourceModel(api), m_base_instance(base_inst){}; : ResourceModel(api), m_base_instance(base_inst)
{}
/******** Make data requests ********/ /******** Make data requests ********/

View File

@ -114,7 +114,7 @@ QVariant AtlOptionalModListModel::data(const QModelIndex &index, int role) const
return {}; return {};
} }
bool AtlOptionalModListModel::setData(const QModelIndex &index, const QVariant &value, int role) { bool AtlOptionalModListModel::setData(const QModelIndex &index, [[maybe_unused]] const QVariant &value, int role) {
if (role == Qt::CheckStateRole) { if (role == Qt::CheckStateRole) {
auto row = index.row(); auto row = index.row();
auto mod = m_mods.at(row); auto mod = m_mods.at(row);
@ -206,7 +206,7 @@ void AtlOptionalModListModel::shareCodeSuccess() {
AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn)); AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn));
} }
void AtlOptionalModListModel::shareCodeFailure(const QString& reason) { void AtlOptionalModListModel::shareCodeFailure([[maybe_unused]] const QString& reason) {
m_jobPtr.reset(); m_jobPtr.reset();
// fixme: plumb in an error message // fixme: plumb in an error message
@ -277,16 +277,16 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
// if the dependency is 'effectively hidden', then track which mods // if the dependency is 'effectively hidden', then track which mods
// depend on it - so we can efficiently disable it when no more dependents // depend on it - so we can efficiently disable it when no more dependents
// depend on it. // depend on it.
auto dependants = m_dependants[dependencyName]; auto dependents = m_dependents[dependencyName];
if (enable) { if (enable) {
dependants.append(mod.name); dependents.append(mod.name);
} }
else { else {
dependants.removeAll(mod.name); dependents.removeAll(mod.name);
// if there are no longer any dependents, let's disable the mod // if there are no longer any dependents, let's disable the mod
if (dependencyMod.effectively_hidden && dependants.isEmpty()) { if (dependencyMod.effectively_hidden && dependents.isEmpty()) {
setMod(dependencyMod, dependencyIndex, false, shouldEmit); setMod(dependencyMod, dependencyIndex, false, shouldEmit);
} }
} }
@ -294,8 +294,8 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
// disable mods that depend on this one, if disabling // disable mods that depend on this one, if disabling
if (!enable) { if (!enable) {
auto dependants = m_dependants[mod.name]; auto dependents = m_dependents[mod.name];
for (const auto& dependencyName : dependants) { for (const auto& dependencyName : dependents) {
auto dependencyIndex = m_index[dependencyName]; auto dependencyIndex = m_index[dependencyName];
auto dependencyMod = m_mods.at(dependencyIndex); auto dependencyMod = m_mods.at(dependencyIndex);

View File

@ -91,7 +91,7 @@ private:
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_dependants; QMap<QString, QVector<QString>> m_dependents;
}; };
class AtlOptionalModDialog : public QDialog { class AtlOptionalModDialog : public QDialog {

View File

@ -132,13 +132,13 @@ void AtlPage::triggerSearch()
filterModel->setSearchTerm(ui->searchEdit->text()); filterModel->setSearchTerm(ui->searchEdit->text());
} }
void AtlPage::onSortingSelectionChanged(QString data) void AtlPage::onSortingSelectionChanged(QString sort)
{ {
auto toSet = filterModel->getAvailableSortings().value(data); auto toSet = filterModel->getAvailableSortings().value(sort);
filterModel->setSorting(toSet); filterModel->setSorting(toSet);
} }
void AtlPage::onSelectionChanged(QModelIndex first, QModelIndex second) void AtlPage::onSelectionChanged(QModelIndex first, [[maybe_unused]] QModelIndex second)
{ {
ui->versionSelectionBox->clear(); ui->versionSelectionBox->clear();
@ -162,14 +162,14 @@ void AtlPage::onSelectionChanged(QModelIndex first, QModelIndex second)
suggestCurrent(); suggestCurrent();
} }
void AtlPage::onVersionSelectionChanged(QString data) void AtlPage::onVersionSelectionChanged(QString version)
{ {
if(data.isNull() || data.isEmpty()) if(version.isNull() || version.isEmpty())
{ {
selectedVersion = ""; selectedVersion = "";
return; return;
} }
selectedVersion = data; selectedVersion = version;
suggestCurrent(); suggestCurrent();
} }

View File

@ -68,7 +68,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return QVariant(); return QVariant();
} }
bool ListModel::setData(const QModelIndex &index, const QVariant &value, int role) bool ListModel::setData(const QModelIndex &index, const QVariant &value, [[maybe_unused]] int role)
{ {
int pos = index.row(); int pos = index.row();
if (pos >= modpacks.size() || pos < 0 || !index.isValid()) if (pos >= modpacks.size() || pos < 0 || !index.isValid())
@ -139,7 +139,7 @@ Qt::ItemFlags ListModel::flags(const QModelIndex& index) const
return QAbstractListModel::flags(index); return QAbstractListModel::flags(index);
} }
bool ListModel::canFetchMore(const QModelIndex& parent) const bool ListModel::canFetchMore([[maybe_unused]] const QModelIndex& parent) const
{ {
return searchState == CanPossiblyFetchMore; return searchState == CanPossiblyFetchMore;
} }

View File

@ -114,7 +114,7 @@ void FlamePage::triggerSearch()
listModel->searchWithTerm(ui->searchEdit->text(), ui->sortByBox->currentIndex()); listModel->searchWithTerm(ui->searchEdit->text(), ui->sortByBox->currentIndex());
} }
void FlamePage::onSelectionChanged(QModelIndex curr, QModelIndex prev) void FlamePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelIndex prev)
{ {
ui->versionSelectionBox->clear(); ui->versionSelectionBox->clear();
@ -212,12 +212,12 @@ void FlamePage::suggestCurrent()
[this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); }); [this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); });
} }
void FlamePage::onVersionSelectionChanged(QString data) void FlamePage::onVersionSelectionChanged(QString version)
{ {
bool is_blocked = false; bool is_blocked = false;
ui->versionSelectionBox->currentData().toInt(&is_blocked); ui->versionSelectionBox->currentData().toInt(&is_blocked);
if (data.isNull() || data.isEmpty() || is_blocked) { if (version.isNull() || version.isEmpty() || is_blocked) {
m_selected_version_index = -1; m_selected_version_index = -1;
return; return;
} }

View File

@ -32,7 +32,7 @@ void FlameModModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonAr
auto FlameModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion auto FlameModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{ {
return FlameMod::loadDependencyVersions(m, arr); return FlameMod::loadDependencyVersions(m, arr);
}; }
auto FlameModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray auto FlameModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
{ {

View File

@ -76,7 +76,7 @@ bool FilterModel::lessThan(const QModelIndex& left, const QModelIndex& right) co
return true; return true;
} }
bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const bool FilterModel::filterAcceptsRow([[maybe_unused]] int sourceRow, [[maybe_unused]] const QModelIndex& sourceParent) const
{ {
return true; return true;
} }
@ -173,10 +173,10 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return QVariant(); return QVariant();
} }
void ListModel::fill(ModpackList modpacks) void ListModel::fill(ModpackList modpacks_)
{ {
beginResetModel(); beginResetModel();
this->modpacks = modpacks; this->modpacks = modpacks_;
endResetModel(); endResetModel();
} }

View File

@ -234,7 +234,7 @@ void Page::ftbPrivatePackDataDownloadSuccessfully(Modpack pack)
privateListModel->addPack(pack); privateListModel->addPack(pack);
} }
void Page::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode) void Page::ftbPrivatePackDataDownloadFailed([[maybe_unused]] QString reason, QString packCode)
{ {
auto reply = QMessageBox::question( auto reply = QMessageBox::question(
this, this,
@ -247,7 +247,7 @@ void Page::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode)
} }
} }
void Page::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev) void Page::onPublicPackSelectionChanged(QModelIndex now, [[maybe_unused]] QModelIndex prev)
{ {
if(!now.isValid()) if(!now.isValid())
{ {
@ -258,7 +258,7 @@ void Page::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev)
onPackSelectionChanged(&selectedPack); onPackSelectionChanged(&selectedPack);
} }
void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev) void Page::onThirdPartyPackSelectionChanged(QModelIndex now, [[maybe_unused]] QModelIndex prev)
{ {
if(!now.isValid()) if(!now.isValid())
{ {
@ -269,7 +269,7 @@ void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev)
onPackSelectionChanged(&selectedPack); onPackSelectionChanged(&selectedPack);
} }
void Page::onPrivatePackSelectionChanged(QModelIndex now, QModelIndex prev) void Page::onPrivatePackSelectionChanged(QModelIndex now, [[maybe_unused]] QModelIndex prev)
{ {
if(!now.isValid()) if(!now.isValid())
{ {
@ -318,21 +318,21 @@ void Page::onPackSelectionChanged(Modpack* pack)
suggestCurrent(); suggestCurrent();
} }
void Page::onVersionSelectionItemChanged(QString data) void Page::onVersionSelectionItemChanged(QString version)
{ {
if(data.isNull() || data.isEmpty()) if(version.isNull() || version.isEmpty())
{ {
selectedVersion = ""; selectedVersion = "";
return; return;
} }
selectedVersion = data; selectedVersion = version;
suggestCurrent(); suggestCurrent();
} }
void Page::onSortingSelectionChanged(QString data) void Page::onSortingSelectionChanged(QString sort)
{ {
FilterModel::Sorting toSet = publicFilterModel->getAvailableSortings().value(data); FilterModel::Sorting toSet = publicFilterModel->getAvailableSortings().value(sort);
publicFilterModel->setSorting(toSet); publicFilterModel->setSorting(toSet);
thirdPartyFilterModel->setSorting(toSet); thirdPartyFilterModel->setSorting(toSet);
privateFilterModel->setSorting(toSet); privateFilterModel->setSorting(toSet);

View File

@ -115,7 +115,7 @@ auto ModpackListModel::data(const QModelIndex& index, int role) const -> QVarian
return {}; return {};
} }
bool ModpackListModel::setData(const QModelIndex &index, const QVariant &value, int role) bool ModpackListModel::setData(const QModelIndex &index, const QVariant &value, [[maybe_unused]] int role)
{ {
int pos = index.row(); int pos = index.row();
if (pos >= modpacks.size() || pos < 0 || !index.isValid()) if (pos >= modpacks.size() || pos < 0 || !index.isValid())
@ -194,8 +194,6 @@ static auto sortFromIndex(int index) -> QString
case 4: case 4:
return "updated"; return "updated";
} }
return {};
} }
void ModpackListModel::searchWithTerm(const QString& term, const int sort) void ModpackListModel::searchWithTerm(const QString& term, const int sort)

View File

@ -105,7 +105,7 @@ bool ModrinthPage::eventFilter(QObject* watched, QEvent* event)
return QObject::eventFilter(watched, event); return QObject::eventFilter(watched, event);
} }
void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev) void ModrinthPage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelIndex prev)
{ {
ui->versionSelectionBox->clear(); ui->versionSelectionBox->clear();
@ -309,9 +309,9 @@ void ModrinthPage::triggerSearch()
m_model->searchWithTerm(ui->searchEdit->text(), ui->sortByBox->currentIndex()); m_model->searchWithTerm(ui->searchEdit->text(), ui->sortByBox->currentIndex());
} }
void ModrinthPage::onVersionSelectionChanged(QString data) void ModrinthPage::onVersionSelectionChanged(QString version)
{ {
if (data.isNull() || data.isEmpty()) { if (version.isNull() || version.isEmpty()) {
selectedVersion = ""; selectedVersion = "";
return; return;
} }

View File

@ -45,7 +45,7 @@ void ModrinthModModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJso
auto ModrinthModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion auto ModrinthModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{ {
return ::Modrinth::loadDependencyVersions(m, arr); return ::Modrinth::loadDependencyVersions(m, arr);
}; }
auto ModrinthModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray auto ModrinthModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
{ {

View File

@ -100,7 +100,7 @@ void TechnicPage::triggerSearch() {
model->searchWithTerm(ui->searchEdit->text()); model->searchWithTerm(ui->searchEdit->text());
} }
void TechnicPage::onSelectionChanged(QModelIndex first, QModelIndex second) void TechnicPage::onSelectionChanged(QModelIndex first, [[maybe_unused]] QModelIndex second)
{ {
ui->versionSelectionBox->clear(); ui->versionSelectionBox->clear();
@ -319,12 +319,12 @@ void TechnicPage::onSolderLoaded() {
metadataLoaded(); metadataLoaded();
} }
void TechnicPage::onVersionSelectionChanged(QString data) { void TechnicPage::onVersionSelectionChanged(QString version) {
if (data.isNull() || data.isEmpty()) { if (version.isNull() || version.isEmpty()) {
selectedVersion = ""; selectedVersion = "";
return; return;
} }
selectedVersion = data; selectedVersion = version;
selectVersion(); selectVersion();
} }

View File

@ -148,7 +148,7 @@ static bool writeThemeJson(const QString& path,
try { try {
Json::write(rootObj, path); Json::write(rootObj, path);
return true; return true;
} catch (const Exception& e) { } catch ([[maybe_unused]] const Exception& e) {
themeWarningLog() << "Failed to write theme json to" << path; themeWarningLog() << "Failed to write theme json to" << path;
return false; return false;
} }

View File

@ -357,7 +357,7 @@ void InfoFrame::setImage(QPixmap img)
} }
} }
void InfoFrame::descriptionEllipsisHandler(QString link) void InfoFrame::descriptionEllipsisHandler([[maybe_unused]] QString link)
{ {
if(!m_current_box) if(!m_current_box)
{ {
@ -371,7 +371,7 @@ void InfoFrame::descriptionEllipsisHandler(QString link)
} }
} }
void InfoFrame::licenseEllipsisHandler(QString link) void InfoFrame::licenseEllipsisHandler([[maybe_unused]] QString link)
{ {
if(!m_current_box) if(!m_current_box)
{ {
@ -385,7 +385,7 @@ void InfoFrame::licenseEllipsisHandler(QString link)
} }
} }
void InfoFrame::boxClosed(int result) void InfoFrame::boxClosed([[maybe_unused]] int result)
{ {
m_current_box = nullptr; m_current_box = nullptr;
} }

View File

@ -27,7 +27,7 @@ unique_qobject_ptr<SubTaskProgressBar> SubTaskProgressBar::create(QWidget* paren
} }
SubTaskProgressBar::SubTaskProgressBar(QWidget* parent) SubTaskProgressBar::SubTaskProgressBar(QWidget* parent)
: ui(new Ui::SubTaskProgressBar) : QWidget(parent), ui(new Ui::SubTaskProgressBar)
{ {
ui->setupUi(this); ui->setupUi(this);
} }