summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-09-05 20:12:36 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-06 12:42:54 (GMT)
commit62c5f9afc3bbe1e83ee63a1a8b9fe56b30c4849c (patch)
treecd026021827cb17c148aeee234fb957ac6f4fc86
parentbfdf1322e7638687c96b323b1df20fd9c08b3044 (diff)
downloadCMake-62c5f9afc3bbe1e83ee63a1a8b9fe56b30c4849c.zip
CMake-62c5f9afc3bbe1e83ee63a1a8b9fe56b30c4849c.tar.gz
CMake-62c5f9afc3bbe1e83ee63a1a8b9fe56b30c4849c.tar.bz2
QtDialog: fix clang-tidy warnings
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx3
-rw-r--r--Source/QtDialog/CMakeSetup.cxx15
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx4
-rw-r--r--Source/QtDialog/Compilers.h4
-rw-r--r--Source/QtDialog/FirstConfigure.cxx21
-rw-r--r--Source/QtDialog/QCMake.h4
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx20
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx6
-rw-r--r--Source/QtDialog/QCMakeWidgets.h7
9 files changed, 51 insertions, 33 deletions
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index dc7a4b0..a94c54b 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -64,7 +64,8 @@ QVariant AddCacheEntry::value() const
QWidget* w = this->StackedWidget->currentWidget();
if (qobject_cast<QLineEdit*>(w)) {
return static_cast<QLineEdit*>(w)->text();
- } else if (qobject_cast<QCheckBox*>(w)) {
+ }
+ if (qobject_cast<QCheckBox*>(w)) {
return static_cast<QCheckBox*>(w)->isChecked();
}
return QVariant();
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 5a8a5be..4de4bef 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -29,18 +29,19 @@
#include "cmSystemTools.h" // IWYU pragma: keep
-static const char* cmDocumentationName[][2] = { { 0,
+static const char* cmDocumentationName[][2] = { { CM_NULLPTR,
" cmake-gui - CMake GUI." },
- { 0, 0 } };
+ { CM_NULLPTR, CM_NULLPTR } };
static const char* cmDocumentationUsage[][2] = {
- { 0, " cmake-gui [options]\n"
- " cmake-gui [options] <path-to-source>\n"
- " cmake-gui [options] <path-to-existing-build>" },
- { 0, 0 }
+ { CM_NULLPTR, " cmake-gui [options]\n"
+ " cmake-gui [options] <path-to-source>\n"
+ " cmake-gui [options] <path-to-existing-build>" },
+ { CM_NULLPTR, CM_NULLPTR }
};
-static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
+static const char* cmDocumentationOptions[]
+ [2] = { { CM_NULLPTR, CM_NULLPTR } };
#if defined(Q_OS_MAC)
static int cmOSXInstall(std::string dir);
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index fda3e58..5b84597 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -41,7 +41,7 @@
QCMakeThread::QCMakeThread(QObject* p)
: QThread(p)
- , CMakeInstance(NULL)
+ , CMakeInstance(CM_NULLPTR)
{
}
@@ -57,7 +57,7 @@ void QCMakeThread::run()
emit this->cmakeInitialized();
this->exec();
delete this->CMakeInstance;
- this->CMakeInstance = NULL;
+ this->CMakeInstance = CM_NULLPTR;
}
CMakeSetupDialog::CMakeSetupDialog()
diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h
index bdb1962..276e2a5 100644
--- a/Source/QtDialog/Compilers.h
+++ b/Source/QtDialog/Compilers.h
@@ -3,6 +3,8 @@
#ifndef COMPILERS_HPP
#define COMPILERS_HPP
+#include <cmConfigure.h>
+
#include <QWidget>
#include <ui_Compilers.h>
@@ -11,7 +13,7 @@ class Compilers : public QWidget, public Ui::Compilers
{
Q_OBJECT
public:
- Compilers(QWidget* p = NULL)
+ Compilers(QWidget* p = CM_NULLPTR)
: QWidget(p)
{
this->setupUi(this);
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index ca5e3b5..c34751a 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -129,8 +129,9 @@ bool StartCompilerSetup::crossCompilerSetup() const
void StartCompilerSetup::onSelectionChanged(bool on)
{
- if (on)
+ if (on) {
selectionChanged();
+ }
}
void StartCompilerSetup::onGeneratorChanged(QString const& name)
@@ -144,12 +145,15 @@ void StartCompilerSetup::onGeneratorChanged(QString const& name)
int StartCompilerSetup::nextId() const
{
- if (compilerSetup())
+ if (compilerSetup()) {
return NativeSetup;
- if (crossCompilerSetup())
+ }
+ if (crossCompilerSetup()) {
return CrossSetup;
- if (crossCompilerToolChainFile())
+ }
+ if (crossCompilerToolChainFile()) {
return ToolchainSetup;
+ }
return -1;
}
@@ -515,7 +519,8 @@ QString FirstConfigure::getCCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCCompiler();
- } else if (this->crossCompilerSetup()) {
+ }
+ if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCCompiler();
}
return QString();
@@ -525,7 +530,8 @@ QString FirstConfigure::getCXXCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCXXCompiler();
- } else if (this->crossCompilerSetup()) {
+ }
+ if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCXXCompiler();
}
return QString();
@@ -535,7 +541,8 @@ QString FirstConfigure::getFortranCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getFortranCompiler();
- } else if (this->crossCompilerSetup()) {
+ }
+ if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getFortranCompiler();
}
return QString();
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index a818c6b..7eadb09 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -13,6 +13,8 @@
#ifndef QCMake_h
#define QCMake_h
+#include <cmConfigure.h>
+
#include "cmake.h"
#ifdef _MSC_VER
@@ -71,7 +73,7 @@ class QCMake : public QObject
{
Q_OBJECT
public:
- QCMake(QObject* p = 0);
+ QCMake(QObject* p = CM_NULLPTR);
~QCMake();
public slots:
/// load the cache file in a directory
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index cc1f4aa..88ea049 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -33,7 +33,7 @@ public:
}
protected:
- bool filterAcceptsRow(int row, const QModelIndex& p) const
+ bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE
{
QStringList strs;
const QAbstractItemModel* m = this->sourceModel();
@@ -87,7 +87,7 @@ public:
protected:
bool ShowAdvanced;
- bool filterAcceptsRow(int row, const QModelIndex& p) const
+ bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE
{
const QAbstractItemModel* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
@@ -160,7 +160,8 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
// want home/end to go to begin/end of rows, not columns
if (act == MoveHome) {
return this->model()->index(0, 1);
- } else if (act == MoveEnd) {
+ }
+ if (act == MoveEnd) {
return this->model()->index(this->model()->rowCount() - 1, 1);
}
return QTreeView::moveCursor(act, mod);
@@ -538,15 +539,16 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f)
this->FileDialogFlag = f;
}
-QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p,
- const QStyleOptionViewItem&,
- const QModelIndex& idx) const
+QWidget* QCMakeCacheModelDelegate::createEditor(
+ QWidget* p, const QStyleOptionViewItem& /*option*/,
+ const QModelIndex& idx) const
{
QModelIndex var = idx.sibling(idx.row(), 0);
int type = var.data(QCMakeCacheModel::TypeRole).toInt();
if (type == QCMakeProperty::BOOL) {
- return NULL;
- } else if (type == QCMakeProperty::PATH) {
+ return CM_NULLPTR;
+ }
+ if (type == QCMakeProperty::PATH) {
QCMakePathEditor* editor =
new QCMakePathEditor(p, var.data(Qt::DisplayRole).toString());
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
@@ -645,7 +647,7 @@ QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option,
QStyleOptionButton opt;
opt.QStyleOption::operator=(option);
sz = sz.expandedTo(
- style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, NULL)
+ style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, CM_NULLPTR)
.size());
return sz;
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index 4b3eb34..fc481b8 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -67,7 +67,7 @@ void QCMakeFilePathEditor::chooseFile()
this->fileDialogExists(true);
path =
QFileDialog::getOpenFileName(this, title, info.absolutePath(), QString(),
- NULL, QFileDialog::DontResolveSymlinks);
+ CM_NULLPTR, QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
if (!path.isEmpty()) {
@@ -99,7 +99,7 @@ void QCMakePathEditor::chooseFile()
// use same QDirModel for all completers
static QDirModel* fileDirModel()
{
- static QDirModel* m = NULL;
+ static QDirModel* m = CM_NULLPTR;
if (!m) {
m = new QDirModel();
}
@@ -107,7 +107,7 @@ static QDirModel* fileDirModel()
}
static QDirModel* pathDirModel()
{
- static QDirModel* m = NULL;
+ static QDirModel* m = CM_NULLPTR;
if (!m) {
m = new QDirModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index f1e87ce..0d95e63 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -13,6 +13,8 @@
#ifndef QCMakeWidgets_h
#define QCMakeWidgets_h
+#include <cmConfigure.h>
+
#include <QComboBox>
#include <QCompleter>
#include <QLineEdit>
@@ -43,7 +45,7 @@ class QCMakePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
- QCMakePathEditor(QWidget* p = NULL, const QString& var = QString());
+ QCMakePathEditor(QWidget* p = CM_NULLPTR, const QString& var = QString());
void chooseFile();
};
@@ -52,7 +54,8 @@ class QCMakeFilePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
- QCMakeFilePathEditor(QWidget* p = NULL, const QString& var = QString());
+ QCMakeFilePathEditor(QWidget* p = CM_NULLPTR,
+ const QString& var = QString());
void chooseFile();
};