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
96 changed files with 409 additions and 413 deletions

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();
}

View File

@ -203,8 +203,8 @@ void ExportInstanceDialog::loadPackIgnore()
{
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
@ -214,11 +214,11 @@ 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)
{

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();
}

View File

@ -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;

View File

@ -85,7 +85,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()
@ -116,7 +116,7 @@ void ProgressDialog::updateSize()
int ProgressDialog::execWithTask(Task* task)
{
this->task = task;
this->m_task = task;
if (!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)
{
if (task->isFinished()) {
if (task->wasSuccessful()) {
if (m_task->isFinished()) {
if (m_task->wasSuccessful()) {
result = QDialog::Accepted;
} else {
result = QDialog::Rejected;
@ -181,12 +181,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();
@ -198,10 +198,10 @@ void ProgressDialog::onTaskSucceeded()
hide();
}
void ProgressDialog::changeStatus(const QString& status)
void ProgressDialog::changeStatus([[maybe_unused]] const QString& status)
{
ui->globalStatusLabel->setText(task->getStatus());
ui->globalStatusDetailsLabel->setText(task->getDetails());
ui->globalStatusLabel->setText(m_task->getStatus());
ui->globalStatusDetailsLabel->setText(m_task->getDetails());
updateSize();
}
@ -269,7 +269,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);

View File

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

View File

@ -301,7 +301,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,

View File

@ -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);

View File

@ -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;