NOISSUE fix all clang warnings

This commit is contained in:
Petr Mrázek
2015-09-26 04:04:09 +02:00
parent 0af04dc060
commit cca6700134
52 changed files with 132 additions and 161 deletions

View File

@ -250,7 +250,7 @@ void ConsoleWindow::onProgressRequested(Task* task)
{
ProgressDialog progDialog(this);
m_proc->proceed();
progDialog.exec(task);
progDialog.execWithTask(task);
}

View File

@ -26,7 +26,7 @@ void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
return;
}
dialog.exec(paste.get());
dialog.execWithTask(paste.get());
if (!paste->successful())
{
CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"),

View File

@ -93,7 +93,7 @@ void LaunchController::login()
ProgressDialog progDialog(m_parentWidget);
if (m_online)
progDialog.setSkipButton(true, tr("Play Offline"));
progDialog.exec(task.get());
progDialog.execWithTask(task.get());
if (!task->successful())
{
auto failReasonNew = task->failReason();

View File

@ -972,7 +972,7 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
}
GoUpdate::DownloadTask updateTask(status, dlPath, &updateDlg);
// If the task succeeds, install the updates.
if (updateDlg.exec(&updateTask))
if (updateDlg.execWithTask(&updateTask))
{
MMC->installUpdates(updateTask.updateFilesDir(), updateTask.operations());
}
@ -1065,7 +1065,7 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup,
// FIXME: possibly causes endless loop problems
ProgressDialog dlDialog(this);
if (dlDialog.exec(&job) != QDialog::Accepted)
if (dlDialog.execWithTask(&job) != QDialog::Accepted)
{
return nullptr;
}
@ -1199,7 +1199,7 @@ void MainWindow::finalizeInstance(InstancePtr inst)
CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)
->show();
});
loadDialog.exec(update.get());
loadDialog.execWithTask(update.get());
}
else
{
@ -1289,7 +1289,7 @@ void MainWindow::on_actionChangeInstIcon_triggered()
return;
IconPickerDialog dlg(this);
dlg.exec(m_selectedInstance->iconKey());
dlg.execWithSelection(m_selectedInstance->iconKey());
if (dlg.result() == QDialog::Accepted)
{
m_selectedInstance->setIconKey(dlg.selectedIconKey);

View File

@ -309,8 +309,9 @@ void VersionProxyModel::sourceDataChanged(const QModelIndex &source_top_left,
emit dataChanged(topLeft, bottomRight);
}
void VersionProxyModel::setSourceModel(BaseVersionList *replacing)
void VersionProxyModel::setSourceModel(QAbstractItemModel *replacingRaw)
{
auto replacing = dynamic_cast<BaseVersionList *>(replacingRaw);
beginResetModel();
if(!replacing)

View File

@ -36,7 +36,7 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual QModelIndex parent(const QModelIndex &child) const override;
void setSourceModel(BaseVersionList *sourceModel);
virtual void setSourceModel(QAbstractItemModel *sourceModel) override;
const FilterMap &filters() const;
void setFilter(const BaseVersionList::ModelRoles column, const QString &filter, const bool exact);

View File

@ -82,7 +82,7 @@ QString CopyInstanceDialog::instGroup() const
void CopyInstanceDialog::on_iconButton_clicked()
{
IconPickerDialog dlg(this);
dlg.exec(InstIconKey);
dlg.execWithSelection(InstIconKey);
if (dlg.result() == QDialog::Accepted)
{

View File

@ -126,7 +126,7 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection
selectedIconKey = key;
}
int IconPickerDialog::exec(QString selection)
int IconPickerDialog::execWithSelection(QString selection)
{
auto list = ENV.icons();
auto contentsWidget = ui->iconView;

View File

@ -29,7 +29,7 @@ class IconPickerDialog : public QDialog
public:
explicit IconPickerDialog(QWidget *parent = 0);
~IconPickerDialog();
int exec(QString selection);
int execWithSelection(QString selection);
QString selectedIconKey;
protected:

View File

@ -122,9 +122,10 @@ void NewInstanceDialog::updateDialogState()
{
ui->instNameTextBox->setPlaceholderText(suggestedName);
}
bool allowOK = !instName().isEmpty() &&
(ui->versionBox->isChecked() && m_selectedVersion ||
(ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput()));
bool allowOK = !instName().isEmpty() && (
(ui->versionBox->isChecked() && m_selectedVersion) ||
(ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput())
);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK);
}
@ -206,7 +207,7 @@ void NewInstanceDialog::on_btnChangeVersion_clicked()
void NewInstanceDialog::on_iconButton_clicked()
{
IconPickerDialog dlg(this);
dlg.exec(InstIconKey);
dlg.execWithSelection(InstIconKey);
if (dlg.result() == QDialog::Accepted)
{

View File

@ -52,7 +52,7 @@ void ProgressDialog::updateSize()
resize(QSize(480, minimumSizeHint().height()));
}
int ProgressDialog::exec(Task *task)
int ProgressDialog::execWithTask(Task *task)
{
this->task = task;
QDialog::DialogCode result;

View File

@ -34,7 +34,7 @@ public:
void updateSize();
int exec(Task *task);
int execWithTask(Task *task);
void setSkipButton(bool present, QString label = QString());

View File

@ -49,12 +49,12 @@ public:
{
return "settings";
}
virtual bool apply();
virtual bool apply() override;
virtual QString helpPage() const override
{
return "Instance-settings";
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
private slots:
void on_javaDetectBtn_clicked();

View File

@ -36,15 +36,15 @@ public:
explicit LegacyJarModPage(LegacyInstance *inst, QWidget *parent = 0);
virtual ~LegacyJarModPage();
virtual QString displayName() const
virtual QString displayName() const override
{
return tr("Jar Mods");
}
virtual QIcon icon() const
virtual QIcon icon() const override
{
return MMC->getThemedIcon("jarmods");
}
virtual QString id() const
virtual QString id() const override
{
return "jarmods";
}
@ -52,7 +52,7 @@ public:
{
return "Legacy-jar-mods";
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
private
slots:

View File

@ -49,7 +49,7 @@ public:
{
return "Legacy-upgrade";
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
private
slots:
void on_upgradeButton_clicked();

View File

@ -48,13 +48,13 @@ public:
{
return "console";
}
virtual bool apply();
virtual bool apply() override;
virtual QString helpPage() const override
{
return "Minecraft-Logs";
}
virtual bool shouldDisplay() const;
virtual void setParentContainer(BasePageContainer *);
virtual bool shouldDisplay() const override;
virtual void setParentContainer(BasePageContainer *) override;
private slots:
/**

View File

@ -58,12 +58,12 @@ public:
{
return m_helpName;
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
virtual void opened();
virtual void closed();
virtual void opened() override;
virtual void closed() override;
protected:
bool eventFilter(QObject *obj, QEvent *ev);
bool eventFilter(QObject *obj, QEvent *ev) override;
bool modListFilter(QKeyEvent *ev);
protected:

View File

@ -48,7 +48,7 @@ public:
{
return "notes";
}
virtual bool apply();
virtual bool apply() override;
virtual QString helpPage() const override
{
return "Notes";

View File

@ -73,7 +73,6 @@ public:
small = image.scaledToWidth(512).scaledToWidth(256, Qt::SmoothTransformation);
else
small = image.scaledToHeight(512).scaledToHeight(256, Qt::SmoothTransformation);
auto smallSize = small.size();
QPoint offset((256 - small.width()) / 2, (256 - small.height()) / 2);
QImage square(QSize(256, 256), QImage::Format_ARGB32);
square.fill(Qt::transparent);
@ -302,7 +301,7 @@ void ScreenshotsPage::on_uploadBtn_clicked()
task.addTask(job.unwrap());
task.addTask(albumTask.unwrap());
ProgressDialog prog(this);
if (prog.exec(&task) != QDialog::Accepted)
if (prog.execWithTask(&task) != QDialog::Accepted)
{
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"),
tr("Unknown error"), QMessageBox::Warning)->exec();

View File

@ -46,7 +46,7 @@ public:
NothingDone = 0x42
};
virtual bool eventFilter(QObject *, QEvent *);
virtual bool eventFilter(QObject *, QEvent *) override;
virtual QString displayName() const override
{
return tr("Screenshots");

View File

@ -275,7 +275,7 @@ int VersionPage::doUpdate()
}
ProgressDialog tDialog(this);
connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
int ret = tDialog.exec(updateTask.get());
int ret = tDialog.execWithTask(updateTask.get());
updateButtons();
return ret;
}
@ -290,7 +290,7 @@ void VersionPage::on_forgeBtn_clicked()
if (vselect.exec() && vselect.selectedVersion())
{
ProgressDialog dialog(this);
dialog.exec(
dialog.execWithTask(
ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
preselect(m_version->rowCount(QModelIndex())-1);
}
@ -307,7 +307,7 @@ void VersionPage::on_liteloaderBtn_clicked()
if (vselect.exec() && vselect.selectedVersion())
{
ProgressDialog dialog(this);
dialog.exec(
dialog.execWithTask(
LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
preselect(m_version->rowCount(QModelIndex())-1);
}
@ -447,7 +447,7 @@ void VersionPage::on_revertBtn_clicked()
return;
}
}
if(!m_version->revert(version))
if(!m_version->revertToBase(version))
{
// TODO: some error box here
}

View File

@ -45,9 +45,9 @@ public:
{
return "Instance-Versions";
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
virtual void setParentContainer(BasePageContainer *);
virtual void setParentContainer(BasePageContainer *) override;
private slots:
void on_forgeBtn_clicked();

View File

@ -31,7 +31,7 @@
WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worlds, QString id,
QString iconName, QString displayName, QString helpPage,
QWidget *parent)
: QWidget(parent), ui(new Ui::WorldListPage), m_worlds(worlds), m_inst(inst), m_id(id), m_displayName(displayName), m_iconName(iconName), m_helpName(helpPage)
: QWidget(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds), m_iconName(iconName), m_id(id), m_displayName(displayName), m_helpName(helpPage)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();

View File

@ -54,13 +54,13 @@ public:
{
return m_helpName;
}
virtual bool shouldDisplay() const;
virtual bool shouldDisplay() const override;
virtual void opened();
virtual void closed();
virtual void opened() override;
virtual void closed() override;
protected:
bool eventFilter(QObject *obj, QEvent *ev);
bool eventFilter(QObject *obj, QEvent *ev) override;
bool worldListFilter(QKeyEvent *ev);
protected:

View File

@ -53,7 +53,7 @@ public:
{
return "Tools";
}
virtual bool apply();
virtual bool apply() override;
private:
void loadSettings();

View File

@ -25,7 +25,7 @@ public:
explicit VersionListView(QWidget *parent = 0);
virtual void paintEvent(QPaintEvent *event) override;
virtual void setModel ( QAbstractItemModel* model );
virtual void setModel(QAbstractItemModel* model) override;
enum EmptyMode
{