aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-08-13 13:10:58 +0100
committerGitHub <noreply@github.com>2023-08-13 13:10:58 +0100
commita44cb6430eac81e6e89283c50b57142ca7f05747 (patch)
treef51678d129432b0a68d22de0178ccb8fd4f9a927 /launcher/ui
parent44153a28e369943ea16545146fec81f7a62e44dd (diff)
parent35358f8180468af1572c35425b1f60c899d6b07d (diff)
downloadPrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.tar.gz
PrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.tar.bz2
PrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.zip
Merge pull request #1107 from Ryex/chore/add-compiler-warnings
Introduce more strict compiler warnings and fix them
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/MainWindow.cpp40
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.cpp2
-rw-r--r--launcher/ui/dialogs/ExportInstanceDialog.cpp8
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.cpp2
-rw-r--r--launcher/ui/dialogs/ProfileSetupDialog.cpp16
-rw-r--r--launcher/ui/dialogs/ProgressDialog.cpp21
-rw-r--r--launcher/ui/dialogs/ProgressDialog.h2
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.cpp2
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.cpp2
-rw-r--r--launcher/ui/dialogs/SkinUploadDialog.cpp6
-rw-r--r--launcher/ui/instanceview/InstanceDelegate.cpp22
-rw-r--r--launcher/ui/instanceview/InstanceView.cpp83
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp5
-rw-r--r--launcher/ui/pages/global/JavaPage.cpp2
-rw-r--r--launcher/ui/pages/global/ProxyPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.cpp2
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp2
-rw-r--r--launcher/ui/pages/instance/OtherLogsPage.cpp22
-rw-r--r--launcher/ui/pages/instance/ResourcePackPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ServersPage.cpp4
-rw-r--r--launcher/ui/pages/instance/TexturePackPage.cpp2
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp5
-rw-r--r--launcher/ui/pages/instance/WorldListPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/ImportPage.cpp6
-rw-r--r--launcher/ui/pages/modplatform/ResourceModel.cpp6
-rw-r--r--launcher/ui/pages/modplatform/ResourcePackModel.cpp3
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.cpp6
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.h5
-rw-r--r--launcher/ui/pages/modplatform/ShaderPackModel.cpp3
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp16
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h2
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp12
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.cpp4
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp6
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameResourceModels.cpp2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp6
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.cpp18
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp4
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp6
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp2
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.cpp8
-rw-r--r--launcher/ui/themes/CatPack.h4
-rw-r--r--launcher/ui/themes/CustomTheme.cpp2
-rw-r--r--launcher/ui/widgets/InfoFrame.cpp6
-rw-r--r--launcher/ui/widgets/SubTaskProgressBar.cpp2
46 files changed, 201 insertions, 186 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index e342e833..423cd48d 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -514,10 +514,11 @@ void MainWindow::showInstanceContextMenu(const QPoint& pos)
QAction* actionCreateInstance = new QAction(tr("Create instance"), this);
actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip());
- if (!group.isNull()) {
- QVariantMap data;
- data["group"] = group;
- actionCreateInstance->setData(data);
+ if(!group.isNull())
+ {
+ QVariantMap instance_action_data;
+ instance_action_data["group"] = group;
+ actionCreateInstance->setData(instance_action_data);
}
connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered()));
@@ -525,11 +526,12 @@ void MainWindow::showInstanceContextMenu(const QPoint& pos)
actions.prepend(actionSep);
actions.prepend(actionVoid);
actions.append(actionCreateInstance);
- if (!group.isNull()) {
- QAction* actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this);
- QVariantMap data;
- data["group"] = group;
- actionDeleteGroup->setData(data);
+ if(!group.isNull())
+ {
+ QAction *actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this);
+ QVariantMap delete_group_action_data;
+ delete_group_action_data["group"] = group;
+ actionDeleteGroup->setData(delete_group_action_data);
connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup()));
actions.append(actionDeleteGroup);
}
@@ -744,10 +746,10 @@ void MainWindow::changeActiveAccount()
if (sAction->data().type() != QVariant::Type::Int)
return;
- QVariant data = sAction->data();
+ QVariant action_data = sAction->data();
bool valid = false;
- int index = data.toInt(&valid);
- if (!valid) {
+ int index = action_data.toInt(&valid);
+ if(!valid) {
index = -1;
}
auto accounts = APPLICATION->accounts();
@@ -1060,10 +1062,11 @@ void MainWindow::on_actionChangeInstIcon_triggered()
void MainWindow::iconUpdated(QString icon)
{
- if (icon == m_currentInstIcon) {
- auto icon = APPLICATION->icons()->getIcon(m_currentInstIcon);
- ui->actionChangeInstIcon->setIcon(icon);
- changeIconButton->setIcon(icon);
+ if (icon == m_currentInstIcon)
+ {
+ auto new_icon = APPLICATION->icons()->getIcon(m_currentInstIcon);
+ ui->actionChangeInstIcon->setIcon(new_icon);
+ changeIconButton->setIcon(new_icon);
}
}
@@ -1590,7 +1593,7 @@ void MainWindow::startTask(Task* task)
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()) {
APPLICATION->settings()->set("SelectedInstance", QString());
@@ -1725,8 +1728,9 @@ void MainWindow::setInstanceActionsEnabled(bool enabled)
ui->actionCreateInstanceShortcut->setEnabled(enabled);
}
-void MainWindow::refreshCurrentInstance(bool running)
+void MainWindow::refreshCurrentInstance([[maybe_unused]] bool running)
{
auto current = view->selectionModel()->currentIndex();
instanceChanged(current, current);
}
+
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp
index d75bb5fe..ffa1e31b 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.cpp
+++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp
@@ -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();
}
diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp
index d6a503cc..703736d6 100644
--- a/launcher/ui/dialogs/ExportInstanceDialog.cpp
+++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp
@@ -195,8 +195,8 @@ void ExportInstanceDialog::loadPackIgnore()
if (!ignoreFile.open(QIODevice::ReadOnly)) {
return;
}
- auto data = ignoreFile.readAll();
- auto string = QString::fromUtf8(data);
+ auto ignoreData = ignoreFile.readAll();
+ auto string = QString::fromUtf8(ignoreData);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
proxyModel->setBlockedPaths(string.split('\n', Qt::SkipEmptyParts));
#else
@@ -206,10 +206,10 @@ void ExportInstanceDialog::loadPackIgnore()
void ExportInstanceDialog::savePackIgnore()
{
- auto data = proxyModel->blockedPaths().toStringList().join('\n').toUtf8();
+ auto ignoreData = proxyModel->blockedPaths().toStringList().join('\n').toUtf8();
auto filename = ignoreFileName();
try {
- FS::write(filename, data);
+ FS::write(filename, ignoreData);
} catch (const Exception& e) {
qWarning() << e.cause();
}
diff --git a/launcher/ui/dialogs/NewInstanceDialog.cpp b/launcher/ui/dialogs/NewInstanceDialog.cpp
index 2f1854d8..3e6456bc 100644
--- a/launcher/ui/dialogs/NewInstanceDialog.cpp
+++ b/launcher/ui/dialogs/NewInstanceDialog.cpp
@@ -295,7 +295,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();
}
diff --git a/launcher/ui/dialogs/ProfileSetupDialog.cpp b/launcher/ui/dialogs/ProfileSetupDialog.cpp
index 64c0b924..758f7f23 100644
--- a/launcher/ui/dialogs/ProfileSetupDialog.cpp
+++ b/launcher/ui/dialogs/ProfileSetupDialog.cpp
@@ -167,14 +167,14 @@ void ProfileSetupDialog::checkName(const QString &name) {
void ProfileSetupDialog::checkFinished(
QNetworkReply::NetworkError error,
- QByteArray data,
- QList<QNetworkReply::RawHeaderPair> headers
+ QByteArray profileData,
+ [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater();
if(error == QNetworkReply::NoError) {
- auto doc = QJsonDocument::fromJson(data);
+ auto doc = QJsonDocument::fromJson(profileData);
auto root = doc.object();
auto statusValue = root.value("status").toString("INVALID");
if(statusValue == "AVAILABLE") {
@@ -210,11 +210,11 @@ void ProfileSetupDialog::setupProfile(const QString &profileName) {
request.setRawHeader("Authorization", QString("Bearer %1").arg(token).toUtf8());
QString payloadTemplate("{\"profileName\":\"%1\"}");
- auto data = payloadTemplate.arg(profileName).toUtf8();
+ auto profileData = payloadTemplate.arg(profileName).toUtf8();
AuthRequest *requestor = new AuthRequest(this);
connect(requestor, &AuthRequest::finished, this, &ProfileSetupDialog::setupProfileFinished);
- requestor->post(request, data);
+ requestor->post(request, profileData);
isWorking = true;
auto button = ui->buttonBox->button(QDialogButtonBox::Cancel);
@@ -251,8 +251,8 @@ struct MojangError{
void ProfileSetupDialog::setupProfileFinished(
QNetworkReply::NetworkError error,
- QByteArray data,
- QList<QNetworkReply::RawHeaderPair> headers
+ QByteArray errorData,
+ [[maybe_unused]] QList<QNetworkReply::RawHeaderPair> headers
) {
auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
requestor->deleteLater();
@@ -266,7 +266,7 @@ void ProfileSetupDialog::setupProfileFinished(
accept();
}
else {
- auto parsedError = MojangError::fromJSON(data);
+ auto parsedError = MojangError::fromJSON(errorData);
ui->errorLabel->setVisible(true);
ui->errorLabel->setText(tr("The server returned the following error:") + "\n\n" + parsedError.errorMessage);
qDebug() << parsedError.rawError;
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 4243e291..222ce973 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -87,7 +87,7 @@ void ProgressDialog::on_skipButton_clicked(bool checked)
{
Q_UNUSED(checked);
if (ui->skipButton->isEnabled()) // prevent other triggers from aborting
- task->abort();
+ m_task->abort();
}
ProgressDialog::~ProgressDialog()
@@ -132,7 +132,7 @@ void ProgressDialog::updateSize(bool recenterParent)
int ProgressDialog::execWithTask(Task* task)
{
- this->task = task;
+ this->m_task = task;
if (!task) {
qDebug() << "Programmer error: Progress dialog created with null task.";
@@ -184,8 +184,8 @@ int ProgressDialog::execWithTask(std::unique_ptr<Task>& task)
bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result)
{
- if (task->isFinished()) {
- if (task->wasSuccessful()) {
+ if (m_task->isFinished()) {
+ if (m_task->wasSuccessful()) {
result = QDialog::Accepted;
} else {
result = QDialog::Rejected;
@@ -197,12 +197,12 @@ bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result)
Task* ProgressDialog::getTask()
{
- return task;
+ return m_task;
}
void ProgressDialog::onTaskStarted() {}
-void ProgressDialog::onTaskFailed(QString failure)
+void ProgressDialog::onTaskFailed([[maybe_unused]] QString failure)
{
reject();
hide();
@@ -214,13 +214,14 @@ void ProgressDialog::onTaskSucceeded()
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->globalStatusLabel->adjustSize();
- ui->globalStatusDetailsLabel->setText(task->getDetails());
+ ui->globalStatusDetailsLabel->setText(m_task->getDetails());
ui->globalStatusDetailsLabel->adjustSize();
+
updateSize();
}
@@ -287,7 +288,7 @@ void ProgressDialog::keyPressEvent(QKeyEvent* e)
void ProgressDialog::closeEvent(QCloseEvent* e)
{
- if (task && task->isRunning()) {
+ if (m_task && m_task->isRunning()) {
e->ignore();
} else {
QDialog::closeEvent(e);
diff --git a/launcher/ui/dialogs/ProgressDialog.h b/launcher/ui/dialogs/ProgressDialog.h
index f062be08..51700d87 100644
--- a/launcher/ui/dialogs/ProgressDialog.h
+++ b/launcher/ui/dialogs/ProgressDialog.h
@@ -98,7 +98,7 @@ private:
private:
Ui::ProgressDialog *ui;
- Task *task;
+ Task *m_task;
bool m_is_multi_step = false;
QHash<QUuid, SubTaskProgressBar*> taskProgress;
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index c243ce28..4b82c0c5 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -300,7 +300,7 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
return makeShared<GetModDependenciesTask>(this, m_instance, model, selectedVers);
}
return nullptr;
-};
+}
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
const std::shared_ptr<ResourcePackFolderModel>& resource_packs,
diff --git a/launcher/ui/dialogs/ReviewMessageBox.cpp b/launcher/ui/dialogs/ReviewMessageBox.cpp
index 7b33765f..78c2542f 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.cpp
+++ b/launcher/ui/dialogs/ReviewMessageBox.cpp
@@ -5,7 +5,7 @@
#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)
{
ui->setupUi(this);
diff --git a/launcher/ui/dialogs/SkinUploadDialog.cpp b/launcher/ui/dialogs/SkinUploadDialog.cpp
index 8180ac1f..1ff15c87 100644
--- a/launcher/ui/dialogs/SkinUploadDialog.cpp
+++ b/launcher/ui/dialogs/SkinUploadDialog.cpp
@@ -155,15 +155,15 @@ SkinUploadDialog::SkinUploadDialog(MinecraftAccountPtr acct, QWidget *parent)
ui->setupUi(this);
// FIXME: add a model for this, download/refresh the capes on demand
- auto &data = *acct->accountData();
+ auto &accountData = *acct->accountData();
int index = 0;
ui->capeCombo->addItem(tr("No Cape"), QVariant());
- auto currentCape = data.minecraftProfile.currentCape;
+ auto currentCape = accountData.minecraftProfile.currentCape;
if(currentCape.isEmpty()) {
ui->capeCombo->setCurrentIndex(index);
}
- for(auto & cape: data.minecraftProfile.capes) {
+ for(auto & cape: accountData.minecraftProfile.capes) {
index++;
if(cape.data.size()) {
QPixmap capeImage;
diff --git a/launcher/ui/instanceview/InstanceDelegate.cpp b/launcher/ui/instanceview/InstanceDelegate.cpp
index 137cc8d5..384c33f3 100644
--- a/launcher/ui/instanceview/InstanceDelegate.cpp
+++ b/launcher/ui/instanceview/InstanceDelegate.cpp
@@ -400,7 +400,9 @@ signals:
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;
QRect textRect = option.rect;
@@ -412,17 +414,17 @@ void ListViewDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionV
void ListViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
auto text = index.data(Qt::EditRole).toString();
- QTextEdit * realeditor = qobject_cast<NoReturnTextEdit *>(editor);
- realeditor->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
- realeditor->append(text);
- realeditor->selectAll();
- realeditor->document()->clearUndoRedoStacks();
+ QTextEdit* realEditor = qobject_cast<NoReturnTextEdit*>(editor);
+ realEditor->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+ realEditor->append(text);
+ realEditor->selectAll();
+ realEditor->document()->clearUndoRedoStacks();
}
void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
- QTextEdit * realeditor = qobject_cast<NoReturnTextEdit *>(editor);
- QString text = realeditor->toPlainText();
+ QTextEdit * realEditor = qobject_cast<NoReturnTextEdit *>(editor);
+ QString text = realEditor->toPlainText();
text.replace(QChar('\n'), QChar(' '));
text = text.trimmed();
// 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);
connect(editor, &NoReturnTextEdit::editingDone, this, &ListViewDelegate::editingDone);
diff --git a/launcher/ui/instanceview/InstanceView.cpp b/launcher/ui/instanceview/InstanceView.cpp
index 05f0004d..6cbada3e 100644
--- a/launcher/ui/instanceview/InstanceView.cpp
+++ b/launcher/ui/instanceview/InstanceView.cpp
@@ -89,16 +89,18 @@ void InstanceView::setModel(QAbstractItemModel *model)
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();
}
-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();
}
-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();
}
@@ -264,9 +266,9 @@ QString InstanceView::groupNameAt(const QPoint &point)
{
executeDelayedItemsLayout();
- VisualGroup::HitResults hitresult;
- auto group = categoryAt(point + offset(), hitresult);
- if(group && (hitresult & (VisualGroup::HeaderHit | VisualGroup::BodyHit)))
+ VisualGroup::HitResults hitResult;
+ auto group = categoryAt(point + offset(), hitResult);
+ if(group && (hitResult & (VisualGroup::HeaderHit | VisualGroup::BodyHit)))
{
return group->text;
}
@@ -301,9 +303,9 @@ void InstanceView::mousePressEvent(QMouseEvent *event)
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
m_pressedPosition = geometryPos;
- VisualGroup::HitResults hitresult;
- m_pressedCategory = categoryAt(geometryPos, hitresult);
- if (m_pressedCategory && hitresult & VisualGroup::CheckboxHit)
+ VisualGroup::HitResults hitResult;
+ m_pressedCategory = categoryAt(geometryPos, hitResult);
+ if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit)
{
setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
event->accept();
@@ -403,10 +405,10 @@ void InstanceView::mouseReleaseEvent(QMouseEvent *event)
QPoint geometryPos = event->pos() + offset();
QPersistentModelIndex index = indexAt(visualPos);
- VisualGroup::HitResults hitresult;
+ VisualGroup::HitResults hitResult;
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)
{
@@ -499,6 +501,7 @@ void InstanceView::mouseDoubleClickEvent(QMouseEvent *event)
}
}
+
void InstanceView::setPaintCat(bool visible)
{
m_catVisible = visible;
@@ -508,7 +511,7 @@ void InstanceView::setPaintCat(bool visible)
m_catPixmap = QPixmap();
}
-void InstanceView::paintEvent(QPaintEvent* event)
+void InstanceView::paintEvent([[maybe_unused]] QPaintEvent *event)
{
executeDelayedItemsLayout();
@@ -612,7 +615,7 @@ void InstanceView::paintEvent(QPaintEvent* event)
#endif
}
-void InstanceView::resizeEvent(QResizeEvent *event)
+void InstanceView::resizeEvent([[maybe_unused]] QResizeEvent *event)
{
int newItemsPerRow = calculateItemsPerRow();
if(newItemsPerRow != m_currentItemsPerRow)
@@ -653,7 +656,7 @@ void InstanceView::dragMoveEvent(QDragMoveEvent *event)
event->accept();
}
-void InstanceView::dragLeaveEvent(QDragLeaveEvent *event)
+void InstanceView::dragLeaveEvent([[maybe_unused]] QDragLeaveEvent *event)
{
executeDelayedItemsLayout();
@@ -678,9 +681,9 @@ void InstanceView::dropEvent(QDropEvent *event)
{
std::pair<VisualGroup *, VisualGroup::HitResults> dropPos = rowDropPos(event->pos());
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();
return;
@@ -720,8 +723,8 @@ void InstanceView::startDrag(Qt::DropActions supportedActions)
if(indexes.count() == 0)
return;
- QMimeData *data = model()->mimeData(indexes);
- if (!data)
+ QMimeData *mimeData = model()->mimeData(indexes);
+ if (!mimeData)
{
return;
}
@@ -729,7 +732,7 @@ void InstanceView::startDrag(Qt::DropActions supportedActions)
QPixmap pixmap = renderToPixmap(indexes, &rect);
QDrag *drag = new QDrag(this);
drag->setPixmap(pixmap);
- drag->setMimeData(data);
+ drag->setMimeData(mimeData);
drag->setHotSpot(m_pressedPosition - rect.topLeft());
Qt::DropAction defaultDropAction = Qt::IgnoreAction;
if (this->defaultDropAction() != Qt::IgnoreAction && (supportedActions & this->defaultDropAction()))
@@ -856,16 +859,16 @@ QList<std::pair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QMo
return ret;
}
-bool InstanceView::isDragEventAccepted(QDropEvent *event)
+bool InstanceView::isDragEventAccepted([[maybe_unused]] QDropEvent *event)
{
return true;
}
std::pair<VisualGroup *, VisualGroup::HitResults> InstanceView::rowDropPos(const QPoint &pos)
{
- VisualGroup::HitResults hitresult;
- auto group = categoryAt(pos + offset(), hitresult);
- return std::make_pair(group, hitresult);
+ VisualGroup::HitResults hitResult;
+ auto group = categoryAt(pos + offset(), hitResult);
+ return std::make_pair(group, hitResult);
}
QPoint InstanceView::offset() const
@@ -894,7 +897,7 @@ QRegion InstanceView::visualRegionForSelection(const QItemSelection &selection)
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();
if(!current.isValid())
@@ -919,23 +922,23 @@ QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorActio
{
if(row == 0)
{
- int prevgroupindex = group_index-1;
- while(prevgroupindex >= 0)
+ int prevGroupIndex = group_index-1;
+ while(prevGroupIndex >= 0)
{
- auto prevgroup = m_groups[prevgroupindex];
- if(prevgroup->collapsed)
+ auto prevGroup = m_groups[prevGroupIndex];
+ if(prevGroup->collapsed)
{
- prevgroupindex--;
+ prevGroupIndex--;
continue;
}
- int newRow = prevgroup->numRows() - 1;
- int newRowSize = prevgroup->rows[newRow].size();
+ int newRow = prevGroup->numRows() - 1;
+ int newRowSize = prevGroup->rows[newRow].size();
int newColumn = m_currentCursorColumn;
if (m_currentCursorColumn >= newRowSize)
{
newColumn = newRowSize - 1;
}
- return prevgroup->rows[newRow][newColumn];
+ return prevGroup->rows[newRow][newColumn];
}
}
else
@@ -955,22 +958,22 @@ QModelIndex InstanceView::moveCursor(QAbstractItemView::CursorAction cursorActio
{
if(row == cat->rows.size() - 1)
{
- int nextgroupindex = group_index+1;
- while (nextgroupindex < m_groups.size())
+ int nextGroupIndex = group_index+1;
+ while (nextGroupIndex < m_groups.size())
{
- auto nextgroup = m_groups[nextgroupindex];
- if(nextgroup->collapsed)
+ auto nextGroup = m_groups[nextGroupIndex];
+ if(nextGroup->collapsed)
{
- nextgroupindex++;
+ nextGroupIndex++;
continue;
}
- int newRowSize = nextgroup->rows[0].size();
+ int newRowSize = nextGroup->rows[0].size();
int newColumn = m_currentCursorColumn;
if (m_currentCursorColumn >= newRowSize)
{
newColumn = newRowSize - 1;
}
- return nextgroup->rows[0][newColumn];
+ return nextGroup->rows[0][newColumn];
}
}
else
@@ -1054,7 +1057,7 @@ void InstanceView::scrollTo(const QModelIndex &index, ScrollHint 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 bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index fced5ff4..37df1a31 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -84,9 +84,8 @@ AccountListPage::AccountListPage(QWidget *parent)
QItemSelectionModel *selectionModel = ui->listView->selectionModel();
- connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) {
- updateButtonStates();
- });
+ connect(selectionModel, &QItemSelectionModel::selectionChanged,
+ [this]([[maybe_unused]] const QItemSelection& sel, [[maybe_unused]] const QItemSelection& dsel) { updateButtonStates(); });
connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu);
connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged);
diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp
index 81dd4cc1..1f4dcc8d 100644
--- a/launcher/ui/pages/global/JavaPage.cpp
+++ b/launcher/ui/pages/global/JavaPage.cpp
@@ -176,7 +176,7 @@ void JavaPage::on_javaTestBtn_clicked()
checker->run();
}
-void JavaPage::on_maxMemSpinBox_valueChanged(int i)
+void JavaPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i)
{
updateThresholds();
}
diff --git a/launcher/ui/pages/global/ProxyPage.cpp b/launcher/ui/pages/global/ProxyPage.cpp
index ffff8456..5ccdb152 100644
--- a/launcher/ui/pages/global/ProxyPage.cpp
+++ b/launcher/ui/pages/global/ProxyPage.cpp
@@ -73,7 +73,7 @@ void ProxyPage::updateCheckboxStuff()
ui->proxyAuthBox->setEnabled(enableEditing);
}
-void ProxyPage::proxyGroupChanged(QAbstractButton *button)
+void ProxyPage::proxyGroupChanged([[maybe_unused]] QAbstractButton *button)
{
updateCheckboxStuff();
}
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index 12038f88..719db879 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -305,7 +305,7 @@ bool ExternalResourcesPage::current(const QModelIndex& current, const QModelInde
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);
int row = sourceCurrent.row();
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
index 25cc1a0d..718c628c 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
@@ -491,7 +491,7 @@ void InstanceSettingsPage::changeInstanceAccount(int index)
}
}
-void InstanceSettingsPage::on_maxMemSpinBox_valueChanged(int i)
+void InstanceSettingsPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i)
{
updateThresholds();
}
diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp
index cef292bd..0f5e29cb 100644
--- a/launcher/ui/pages/instance/ModFolderPage.cpp
+++ b/launcher/ui/pages/instance/ModFolderPage.cpp
@@ -127,7 +127,7 @@ bool ModFolderPage::shouldDisplay() const
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);
int row = sourceCurrent.row();
diff --git a/launcher/ui/pages/instance/OtherLogsPage.cpp b/launcher/ui/pages/instance/OtherLogsPage.cpp
index bbdd7324..f2b13f32 100644
--- a/launcher/ui/pages/instance/OtherLogsPage.cpp
+++ b/launcher/ui/pages/instance/OtherLogsPage.cpp
@@ -287,23 +287,23 @@ void OtherLogsPage::on_btnClean_clicked()
}
if(!failed.empty())
{
- QMessageBox *messageBox = new QMessageBox(this);
- messageBox->setWindowTitle(tr("Error"));
+ QMessageBox *messageBoxFailure = new QMessageBox(this);
+ messageBoxFailure->setWindowTitle(tr("Error"));
if(failed.size() > 5)
{
- messageBox->setText(tr("Couldn't delete some files!"));
- messageBox->setDetailedText(failed.join('\n'));
+ messageBoxFailure->setText(tr("Couldn't delete some files!"));
+ messageBoxFailure->setDetailedText(failed.join('\n'));
}
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);
- messageBox->setDefaultButton(QMessageBox::Ok);
- messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
- messageBox->setIcon(QMessageBox::Critical);
- messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction);
- messageBox->exec();
+ messageBoxFailure->setStandardButtons(QMessageBox::Ok);
+ messageBoxFailure->setDefaultButton(QMessageBox::Ok);
+ messageBoxFailure->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ messageBoxFailure->setIcon(QMessageBox::Critical);
+ messageBoxFailure->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ messageBoxFailure->exec();
}
}
diff --git a/launcher/ui/pages/instance/ResourcePackPage.cpp b/launcher/ui/pages/instance/ResourcePackPage.cpp
index 12b371df..26c14ca4 100644
--- a/launcher/ui/pages/instance/ResourcePackPage.cpp
+++ b/launcher/ui/pages/instance/ResourcePackPage.cpp
@@ -55,7 +55,7 @@ ResourcePackPage::ResourcePackPage(MinecraftInstance* instance, std::shared_ptr<
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);
int row = sourceCurrent.row();
diff --git a/launcher/ui/pages/instance/ServersPage.cpp b/launcher/ui/pages/instance/ServersPage.cpp
index 4b1fa08a..09ed9e40 100644
--- a/launcher/ui/pages/instance/ServersPage.cpp
+++ b/launcher/ui/pages/instance/ServersPage.cpp
@@ -684,7 +684,7 @@ void ServersPage::runningStateChanged(bool running)
updateState();
}
-void ServersPage::currentChanged(const QModelIndex &current, const QModelIndex &previous)
+void ServersPage::currentChanged(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{
int nextServer = -1;
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.
-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)
{
diff --git a/launcher/ui/pages/instance/TexturePackPage.cpp b/launcher/ui/pages/instance/TexturePackPage.cpp
index e477ceda..fa478a9a 100644
--- a/launcher/ui/pages/instance/TexturePackPage.cpp
+++ b/launcher/ui/pages/instance/TexturePackPage.cpp
@@ -57,7 +57,7 @@ TexturePackPage::TexturePackPage(MinecraftInstance* instance, std::shared_ptr<Te
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);
int row = sourceCurrent.row();
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp
index 9e34f766..1cc036ac 100644
--- a/launcher/ui/pages/instance/VersionPage.cpp
+++ b/launcher/ui/pages/instance/VersionPage.cpp
@@ -189,7 +189,8 @@ void VersionPage::showContextMenu(const QPoint& pos)
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()) {
ui->frame->clear();
@@ -459,7 +460,7 @@ void VersionPage::on_actionMinecraftFolder_triggered()
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();
updateButtons(currentIdx);
diff --git a/launcher/ui/pages/instance/WorldListPage.cpp b/launcher/ui/pages/instance/WorldListPage.cpp
index b2200b1a..8eb681d2 100644
--- a/launcher/ui/pages/instance/WorldListPage.cpp
+++ b/launcher/ui/pages/instance/WorldListPage.cpp
@@ -353,7 +353,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();
bool enable = index.isValid();
diff --git a/launcher/ui/pages/modplatform/ImportPage.cpp b/launcher/ui/pages/modplatform/ImportPage.cpp
index 30196aad..8f30781e 100644
--- a/launcher/ui/pages/modplatform/ImportPage.cpp
+++ b/launcher/ui/pages/modplatform/ImportPage.cpp
@@ -50,7 +50,7 @@ class UrlValidator : public QValidator
public:
using QValidator::QValidator;
- State validate(QString &in, int &pos) const
+ State validate(QString &in, [[maybe_unused]] int &pos) const
{
const QUrl url(in);
if (url.isValid() && !url.isRelative() && !url.isEmpty())
@@ -118,8 +118,8 @@ void ImportPage::updateState()
if(fi.exists() && (isZip || isMRPack))
{
- QFileInfo fi(url.fileName());
- dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url,this));
+ QFileInfo file_info(url.fileName());
+ dialog->setSuggestedPack(file_info.completeBaseName(), new InstanceImportTask(url,this));
dialog->setSuggestedIcon("default");
}
}
diff --git a/launcher/ui/pages/modplatform/ResourceModel.cpp b/launcher/ui/pages/modplatform/ResourceModel.cpp
index 3e0c0257..0a7edb7b 100644
--- a/launcher/ui/pages/modplatform/ResourceModel.cpp
+++ b/launcher/ui/pages/modplatform/ResourceModel.cpp
@@ -102,7 +102,7 @@ QHash<int, QByteArray> ResourceModel::roleNames() const
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();
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) \
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");
return {};
@@ -372,7 +372,7 @@ void ResourceModel::searchRequestSucceeded(QJsonDocument& doc)
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) {
default:
diff --git a/launcher/ui/pages/modplatform/ResourcePackModel.cpp b/launcher/ui/pages/modplatform/ResourcePackModel.cpp
index 18c14bf8..d436f320 100644
--- a/launcher/ui/pages/modplatform/ResourcePackModel.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePackModel.cpp
@@ -9,7 +9,8 @@
namespace ResourceDownload {
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 ********/
diff --git a/launcher/ui/pages/modplatform/ResourcePage.cpp b/launcher/ui/pages/modplatform/ResourcePage.cpp
index d16ac6fd..c087e2be 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePage.cpp
@@ -280,7 +280,7 @@ void ResourcePage::updateVersionList()
updateSelectionButton();
}
-void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
+void ResourcePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelIndex prev)
{
if (!curr.isValid()) {
return;
@@ -307,9 +307,9 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
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;
return;
}
diff --git a/launcher/ui/pages/modplatform/ResourcePage.h b/launcher/ui/pages/modplatform/ResourcePage.h
index b4a87f57..3e8bb7d8 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.h
+++ b/launcher/ui/pages/modplatform/ResourcePage.h
@@ -97,7 +97,10 @@ class ResourcePage : public QWidget, public BasePage {
virtual void openUrl(const QUrl&);
/** 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:
BaseInstance& m_base_instance;
diff --git a/launcher/ui/pages/modplatform/ShaderPackModel.cpp b/launcher/ui/pages/modplatform/ShaderPackModel.cpp
index aabd3be6..8c913657 100644
--- a/launcher/ui/pages/modplatform/ShaderPackModel.cpp
+++ b/launcher/ui/pages/modplatform/ShaderPackModel.cpp
@@ -9,7 +9,8 @@
namespace ResourceDownload {
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 ********/
diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp b/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp
index 267894bf..d9f3274d 100644
--- a/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp
+++ b/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp
@@ -116,7 +116,7 @@ QVariant AtlOptionalModListModel::data(const QModelIndex &index, int role) const
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) {
auto row = index.row();
auto mod = m_mods.at(row);
@@ -208,7 +208,7 @@ void AtlOptionalModListModel::shareCodeSuccess() {
AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn));
}
-void AtlOptionalModListModel::shareCodeFailure(const QString& reason) {
+void AtlOptionalModListModel::shareCodeFailure([[maybe_unused]] const QString& reason) {
m_jobPtr.reset();
// fixme: plumb in an error message
@@ -279,16 +279,16 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
// 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.
- auto dependants = m_dependants[dependencyName];
+ auto dependents = m_dependents[dependencyName];
if (enable) {
- dependants.append(mod.name);
+ dependents.append(mod.name);
}
else {
- dependants.removeAll(mod.name);
+ dependents.removeAll(mod.name);
// 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);
}
}
@@ -296,8 +296,8 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
// disable mods that depend on this one, if disabling
if (!enable) {
- auto dependants = m_dependants[mod.name];
- for (const auto& dependencyName : dependants) {
+ auto dependents = m_dependents[mod.name];
+ for (const auto& dependencyName : dependents) {
auto dependencyIndex = m_index[dependencyName];
auto dependencyMod = m_mods.at(dependencyIndex);
diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h b/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h
index 639f0d48..fe24d821 100644
--- a/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h
+++ b/launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h
@@ -91,7 +91,7 @@ private:
QMap<QString, bool> m_selection;
QMap<QString, int> m_index;
- QMap<QString, QVector<QString>> m_dependants;
+ QMap<QString, QVector<QString>> m_dependents;
};
class AtlOptionalModDialog : public QDialog {
diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp b/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp
index 87544445..7c80ed2d 100644
--- a/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp
+++ b/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp
@@ -132,13 +132,13 @@ void AtlPage::triggerSearch()
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);
}
-void AtlPage::onSelectionChanged(QModelIndex first, QModelIndex second)
+void AtlPage::onSelectionChanged(QModelIndex first, [[maybe_unused]] QModelIndex second)
{
ui->versionSelectionBox->clear();
@@ -162,14 +162,14 @@ void AtlPage::onSelectionChanged(QModelIndex first, QModelIndex second)
suggestCurrent();
}
-void AtlPage::onVersionSelectionChanged(QString data)
+void AtlPage::onVersionSelectionChanged(QString version)
{
- if(data.isNull() || data.isEmpty())
+ if(version.isNull() || version.isEmpty())
{
selectedVersion = "";
return;
}
- selectedVersion = data;
+ selectedVersion = version;
suggestCurrent();
}
diff --git a/launcher/ui/pages/modplatform/flame/FlameModel.cpp b/launcher/ui/pages/modplatform/flame/FlameModel.cpp
index e32024c4..ff21d010 100644
--- a/launcher/ui/pages/modplatform/flame/FlameModel.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameModel.cpp
@@ -72,7 +72,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
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();
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
@@ -143,7 +143,7 @@ Qt::ItemFlags ListModel::flags(const QModelIndex& index) const
return QAbstractListModel::flags(index);
}
-bool ListModel::canFetchMore(const QModelIndex& parent) const
+bool ListModel::canFetchMore([[maybe_unused]] const QModelIndex& parent) const
{
return searchState == CanPossiblyFetchMore;
}
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
index ada67644..ead79c6c 100644
--- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
@@ -116,7 +116,7 @@ void FlamePage::triggerSearch()
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();
@@ -214,12 +214,12 @@ void FlamePage::suggestCurrent()
[this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); });
}
-void FlamePage::onVersionSelectionChanged(QString data)
+void FlamePage::onVersionSelectionChanged(QString version)
{
bool is_blocked = false;
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;
return;
}
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourceModels.cpp b/launcher/ui/pages/modplatform/flame/FlameResourceModels.cpp
index 0fb67c50..2b020c48 100644
--- a/launcher/ui/pages/modplatform/flame/FlameResourceModels.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameResourceModels.cpp
@@ -32,7 +32,7 @@ void FlameModModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonAr
auto FlameModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{
return FlameMod::loadDependencyVersions(m, arr);
-};
+}
auto FlameModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
{
diff --git a/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp b/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
index a42d4dad..29b17ab7 100644
--- a/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
+++ b/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
@@ -77,7 +77,7 @@ bool FilterModel::lessThan(const QModelIndex& left, const QModelIndex& right) co
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;
}
@@ -174,10 +174,10 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
-void ListModel::fill(ModpackList modpacks)
+void ListModel::fill(ModpackList modpacks_)
{
beginResetModel();
- this->modpacks = modpacks;
+ this->modpacks = modpacks_;
endResetModel();
}
diff --git a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
index b3f6261f..d4174ff1 100644
--- a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
+++ b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
@@ -234,7 +234,7 @@ void Page::ftbPrivatePackDataDownloadSuccessfully(Modpack pack)
privateListModel->addPack(pack);
}
-void Page::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode)
+void Page::ftbPrivatePackDataDownloadFailed([[maybe_unused]] QString reason, QString packCode)
{
auto reply = QMessageBox::question(
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())
{
@@ -258,7 +258,7 @@ void Page::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev)
onPackSelectionChanged(&selectedPack);
}
-void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev)
+void Page::onThirdPartyPackSelectionChanged(QModelIndex now, [[maybe_unused]] QModelIndex prev)
{
if(!now.isValid())
{
@@ -269,7 +269,7 @@ void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev)
onPackSelectionChanged(&selectedPack);
}
-void Page::onPrivatePackSelectionChanged(QModelIndex now, QModelIndex prev)
+void Page::onPrivatePackSelectionChanged(QModelIndex now, [[maybe_unused]] QModelIndex prev)
{
if(!now.isValid())
{
@@ -318,21 +318,21 @@ void Page::onPackSelectionChanged(Modpack* pack)
suggestCurrent();
}
-void Page::onVersionSelectionItemChanged(QString data)
+void Page::onVersionSelectionItemChanged(QString version)
{
- if(data.isNull() || data.isEmpty())
+ if(version.isNull() || version.isEmpty())
{
selectedVersion = "";
return;
}
- selectedVersion = data;
+ selectedVersion = version;
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);
thirdPartyFilterModel->setSorting(toSet);
privateFilterModel->setSorting(toSet);
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
index ee498743..823439d3 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
@@ -117,7 +117,7 @@ auto ModpackListModel::data(const QModelIndex& index, int role) const -> QVarian
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();
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
@@ -196,8 +196,6 @@ static auto sortFromIndex(int index) -> QString
case 4:
return "updated";
}
-
- return {};
}
void ModpackListModel::searchWithTerm(const QString& term, const int sort)
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
index e7d75dcf..d5c089b4 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
@@ -107,7 +107,7 @@ bool ModrinthPage::eventFilter(QObject* watched, QEvent* 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();
@@ -311,9 +311,9 @@ void ModrinthPage::triggerSearch()
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 = "";
return;
}
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
index 8aa64989..512eb027 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthResourceModels.cpp
@@ -45,7 +45,7 @@ void ModrinthModModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJso
auto ModrinthModModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{
return ::Modrinth::loadDependencyVersions(m, arr);
-};
+}
auto ModrinthModModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
{
diff --git a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
index e066fa6f..93390454 100644
--- a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
+++ b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
@@ -102,7 +102,7 @@ void TechnicPage::triggerSearch() {
model->searchWithTerm(ui->searchEdit->text());
}
-void TechnicPage::onSelectionChanged(QModelIndex first, QModelIndex second)
+void TechnicPage::onSelectionChanged(QModelIndex first, [[maybe_unused]] QModelIndex second)
{
ui->versionSelectionBox->clear();
@@ -318,12 +318,12 @@ void TechnicPage::onSolderLoaded() {
metadataLoaded();
}
-void TechnicPage::onVersionSelectionChanged(QString data) {
- if (data.isNull() || data.isEmpty()) {
+void TechnicPage::onVersionSelectionChanged(QString version) {
+ if (version.isNull() || version.isEmpty()) {
selectedVersion = "";
return;
}
- selectedVersion = data;
+ selectedVersion = version;
selectVersion();
}
diff --git a/launcher/ui/themes/CatPack.h b/launcher/ui/themes/CatPack.h
index b03a19f0..fdd117a7 100644
--- a/launcher/ui/themes/CatPack.h
+++ b/launcher/ui/themes/CatPack.h
@@ -52,8 +52,8 @@ class BasicCatPack : public CatPack {
public:
BasicCatPack(QString id, QString name) : m_id(id), m_name(name) {}
BasicCatPack(QString id) : BasicCatPack(id, id) {}
- virtual QString id() { return m_id; };
- virtual QString name() { return m_name; };
+ virtual QString id() { return m_id; }
+ virtual QString name() { return m_name; }
virtual QString path();
protected:
diff --git a/launcher/ui/themes/CustomTheme.cpp b/launcher/ui/themes/CustomTheme.cpp
index 177edefa..8e28ba4f 100644
--- a/launcher/ui/themes/CustomTheme.cpp
+++ b/launcher/ui/themes/CustomTheme.cpp
@@ -148,7 +148,7 @@ static bool writeThemeJson(const QString& path,
try {
Json::write(rootObj, path);
return true;
- } catch (const Exception& e) {
+ } catch ([[maybe_unused]] const Exception& e) {
themeWarningLog() << "Failed to write theme json to" << path;
return false;
}
diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp
index a0fda952..1f03f9ea 100644
--- a/launcher/ui/widgets/InfoFrame.cpp
+++ b/launcher/ui/widgets/InfoFrame.cpp
@@ -348,7 +348,7 @@ void InfoFrame::setImage(QPixmap img)
}
}
-void InfoFrame::descriptionEllipsisHandler(QString link)
+void InfoFrame::descriptionEllipsisHandler([[maybe_unused]] QString link)
{
if (!m_current_box) {
m_current_box = CustomMessageBox::selectable(this, "", m_description);
@@ -359,7 +359,7 @@ void InfoFrame::descriptionEllipsisHandler(QString link)
}
}
-void InfoFrame::licenseEllipsisHandler(QString link)
+void InfoFrame::licenseEllipsisHandler([[maybe_unused]] QString link)
{
if (!m_current_box) {
m_current_box = CustomMessageBox::selectable(this, "", m_license);
@@ -370,7 +370,7 @@ void InfoFrame::licenseEllipsisHandler(QString link)
}
}
-void InfoFrame::boxClosed(int result)
+void InfoFrame::boxClosed([[maybe_unused]] int result)
{
m_current_box = nullptr;
}
diff --git a/launcher/ui/widgets/SubTaskProgressBar.cpp b/launcher/ui/widgets/SubTaskProgressBar.cpp
index 84ea5f20..96f4fe24 100644
--- a/launcher/ui/widgets/SubTaskProgressBar.cpp
+++ b/launcher/ui/widgets/SubTaskProgressBar.cpp
@@ -27,7 +27,7 @@ unique_qobject_ptr<SubTaskProgressBar> SubTaskProgressBar::create(QWidget* paren
}
SubTaskProgressBar::SubTaskProgressBar(QWidget* parent)
- : ui(new Ui::SubTaskProgressBar)
+ : QWidget(parent), ui(new Ui::SubTaskProgressBar)
{
ui->setupUi(this);
}