diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2016-04-13 15:52:14 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2016-04-15 09:40:53 +0000 |
commit | 95ac4edfd4276c73f0304651fe032d511a5a7c16 (patch) | |
tree | c1ebcef6ecff1292f9fa670111c39043b0f67837 /src/plugins | |
parent | 79da8a45860940f98333517c60ac388cc0b1af3a (diff) |
Projectexplorer: Modernize codebase
Change-Id: I4793b58aa77bcd46af99f8b843c0f7439cdc9269
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
Diffstat (limited to 'src/plugins')
207 files changed, 1047 insertions, 1292 deletions
diff --git a/src/plugins/android/androidgdbserverkitinformation.cpp b/src/plugins/android/androidgdbserverkitinformation.cpp index d5f7b1591b..b35c551076 100644 --- a/src/plugins/android/androidgdbserverkitinformation.cpp +++ b/src/plugins/android/androidgdbserverkitinformation.cpp @@ -105,7 +105,7 @@ FileName AndroidGdbServerKitInformation::autoDetect(const Kit *kit) ToolChain *tc = ToolChainKitInformation::toolChain(kit); if (!tc || tc->typeId() != Constants::ANDROID_TOOLCHAIN_ID) return FileName(); - AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc); + auto atc = static_cast<AndroidToolChain *>(tc); return atc->suggestedGdbServer(); } @@ -114,13 +114,13 @@ FileName AndroidGdbServerKitInformation::autoDetect(const Kit *kit) /////////////// -AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(Kit *kit, const KitInformation *ki) - : KitConfigWidget(kit, ki), - m_label(new ElidingLabel), - m_button(new QPushButton(tr("Manage..."))) +AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(Kit *kit, const KitInformation *ki) : + KitConfigWidget(kit, ki), + m_label(new ElidingLabel), + m_button(new QPushButton(tr("Manage..."))) { // ToolButton with Menu, defaulting to 'Autodetect'. - QMenu *buttonMenu = new QMenu(m_button); + auto buttonMenu = new QMenu(m_button); QAction *autoDetectAction = buttonMenu->addAction(tr("Auto-detect")); connect(autoDetectAction, SIGNAL(triggered()), this, SLOT(autoDetectDebugger())); QAction *changeAction = buttonMenu->addAction(tr("Edit...")); @@ -179,19 +179,19 @@ void AndroidGdbServerKitInformationWidget::autoDetectDebugger() void AndroidGdbServerKitInformationWidget::showDialog() { QDialog dialog; - QVBoxLayout *layout = new QVBoxLayout(&dialog); - QFormLayout *formLayout = new QFormLayout; + auto layout = new QVBoxLayout(&dialog); + auto formLayout = new QFormLayout; formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); - QLabel *binaryLabel = new QLabel(tr("&Binary:")); - PathChooser *chooser = new PathChooser; + auto binaryLabel = new QLabel(tr("&Binary:")); + auto chooser = new PathChooser; chooser->setExpectedKind(PathChooser::ExistingCommand); chooser->setPath(AndroidGdbServerKitInformation::gdbServer(m_kit).toString()); binaryLabel->setBuddy(chooser); formLayout->addRow(binaryLabel, chooser); layout->addLayout(formLayout); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); layout->addWidget(buttonBox); diff --git a/src/plugins/android/androidpotentialkit.cpp b/src/plugins/android/androidpotentialkit.cpp index 0f72930dfb..f323feecad 100644 --- a/src/plugins/android/androidpotentialkit.cpp +++ b/src/plugins/android/androidpotentialkit.cpp @@ -56,7 +56,7 @@ void AndroidPotentialKit::executeFromMenu() QWidget *AndroidPotentialKit::createWidget(QWidget *parent) const { if (!isEnabled()) - return 0; + return nullptr; return new AndroidPotentialKitWidget(parent); } @@ -89,18 +89,18 @@ AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent) setSummaryText(QLatin1String("<b>Android has not been configured. Create Android kits.</b>")); setIcon(Core::Icons::WARNING.icon()); //detailsWidget->setState(Utils::DetailsWidget::NoSummary); - QWidget *mainWidget = new QWidget(this); + auto mainWidget = new QWidget(this); setWidget(mainWidget); - QGridLayout *layout = new QGridLayout(mainWidget); + auto layout = new QGridLayout(mainWidget); layout->setMargin(0); - QLabel *label = new QLabel; + auto label = new QLabel; label->setText(tr("Qt Creator needs additional settings to enable Android support." " You can configure those settings in the Options dialog.")); label->setWordWrap(true); layout->addWidget(label, 0, 0, 1, 2); - QPushButton *openOptions = new QPushButton; + auto openOptions = new QPushButton; openOptions->setText(Core::ICore::msgShowOptionsDialog()); openOptions->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(openOptions, 1, 1); diff --git a/src/plugins/android/androidpotentialkit.h b/src/plugins/android/androidpotentialkit.h index fe10550f4d..54341de033 100644 --- a/src/plugins/android/androidpotentialkit.h +++ b/src/plugins/android/androidpotentialkit.h @@ -35,10 +35,10 @@ class AndroidPotentialKit : public ProjectExplorer::IPotentialKit { Q_OBJECT public: - QString displayName() const; - void executeFromMenu(); - QWidget *createWidget(QWidget *parent) const; - bool isEnabled() const; + QString displayName() const override; + void executeFromMenu() override; + QWidget *createWidget(QWidget *parent) const override; + bool isEnabled() const override; }; class AndroidPotentialKitWidget : public Utils::DetailsWidget diff --git a/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp b/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp index 6422e93105..39e0689be6 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp @@ -339,7 +339,7 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges() m_dialog = new QDialog(m_summaryLabel->window()); m_dialog->setWindowTitle(tr("Edit CMake Configuration")); - QVBoxLayout *layout = new QVBoxLayout(m_dialog); + auto layout = new QVBoxLayout(m_dialog); m_editor = new QPlainTextEdit; m_editor->setToolTip(tr("Enter one variable per line with the variable name " "separated from the variable value by \"=\".<br>" diff --git a/src/plugins/help/searchtaskhandler.h b/src/plugins/help/searchtaskhandler.h index 4f117510ba..54ca8cf9ba 100644 --- a/src/plugins/help/searchtaskhandler.h +++ b/src/plugins/help/searchtaskhandler.h @@ -37,11 +37,9 @@ class SearchTaskHandler : public ProjectExplorer::ITaskHandler Q_OBJECT public: - SearchTaskHandler() {} - - bool canHandle(const ProjectExplorer::Task &task) const; - void handle(const ProjectExplorer::Task &task); - QAction *createAction(QObject *parent) const; + bool canHandle(const ProjectExplorer::Task &task) const override; + void handle(const ProjectExplorer::Task &task) override; + QAction *createAction(QObject *parent) const override; signals: void search(const QUrl &url); diff --git a/src/plugins/projectexplorer/abiwidget.cpp b/src/plugins/projectexplorer/abiwidget.cpp index 4f773c54b5..278a37a378 100644 --- a/src/plugins/projectexplorer/abiwidget.cpp +++ b/src/plugins/projectexplorer/abiwidget.cpp @@ -68,8 +68,7 @@ public: // AbiWidget // -------------------------------------------------------------------------- -AbiWidget::AbiWidget(QWidget *parent) : - QWidget(parent), +AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d(new Internal::AbiWidgetPrivate) { QHBoxLayout *layout = new QHBoxLayout(this); diff --git a/src/plugins/projectexplorer/abiwidget.h b/src/plugins/projectexplorer/abiwidget.h index 7c34a8519f..55a27134e0 100644 --- a/src/plugins/projectexplorer/abiwidget.h +++ b/src/plugins/projectexplorer/abiwidget.h @@ -43,7 +43,7 @@ class PROJECTEXPLORER_EXPORT AbiWidget : public QWidget Q_OBJECT public: - AbiWidget(QWidget *parent = 0); + AbiWidget(QWidget *parent = nullptr); ~AbiWidget() override; void setAbis(const QList<Abi> &, const Abi ¤t); diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 922918081e..15400eab85 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -41,12 +41,10 @@ enum { debug = 0 }; namespace ProjectExplorer { namespace Internal { - AbstractMsvcToolChain::AbstractMsvcToolChain(Core::Id typeId, Detection d, const Abi &abi, - const QString& vcvarsBat) : - ToolChain(typeId, d), + const QString& vcvarsBat) : ToolChain(typeId, d), m_lastEnvironment(Utils::Environment::systemEnvironment()), m_abi(abi), m_vcvarsBat(vcvarsBat) @@ -232,7 +230,6 @@ QByteArray AbstractMsvcToolChain::msvcPredefinedMacros(const QStringList cxxflag return predefinedMacros; } - bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, const QString &batchFile, const QString &batchArgs, @@ -401,7 +398,6 @@ bool AbstractMsvcToolChain::WarningFlagAdder::triggered() const return m_triggered; } - } // namespace Internal } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index c26a9442d3..227a979793 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -83,19 +83,13 @@ using namespace ProjectExplorer; */ AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, Core::Id id) : - BuildStep(bsl, id), m_timer(0), m_futureInterface(0), - m_ignoreReturnValue(false), m_process(0), - m_outputParserChain(0), m_skipFlush(false) -{ -} + BuildStep(bsl, id) +{ } AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs) : - BuildStep(bsl, bs), m_timer(0), m_futureInterface(0), - m_ignoreReturnValue(bs->m_ignoreReturnValue), - m_process(0), m_outputParserChain(0), m_skipFlush(false) -{ -} + BuildStep(bsl, bs), m_ignoreReturnValue(bs->m_ignoreReturnValue) +{ } AbstractProcessStep::~AbstractProcessStep() { @@ -226,7 +220,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi) if (!m_process->waitForStarted()) { processStartupFailed(); delete m_process; - m_process = 0; + m_process = nullptr; fi.reportResult(false); emit finished(); return; @@ -248,13 +242,13 @@ void AbstractProcessStep::cleanUp() // Clean up output parsers if (m_outputParserChain) { delete m_outputParserChain; - m_outputParserChain = 0; + m_outputParserChain = nullptr; } delete m_process; - m_process = 0; + m_process = nullptr; m_futureInterface->reportResult(returnValue); - m_futureInterface = 0; + m_futureInterface = nullptr; emit finished(); } @@ -451,7 +445,7 @@ void AbstractProcessStep::slotProcessFinished(int, QProcess::ExitStatus) { m_timer->stop(); delete m_timer; - m_timer = 0; + m_timer = nullptr; QString line = QString::fromLocal8Bit(m_process->readAllStandardError()); if (!line.isEmpty()) diff --git a/src/plugins/projectexplorer/abstractprocessstep.h b/src/plugins/projectexplorer/abstractprocessstep.h index cd32d2716a..4cdec6adf7 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.h +++ b/src/plugins/projectexplorer/abstractprocessstep.h @@ -88,14 +88,14 @@ private: void outputAdded(const QString &string, BuildStep::OutputFormat format); - QTimer *m_timer; - QFutureInterface<bool> *m_futureInterface; + QTimer *m_timer = nullptr; + QFutureInterface<bool> *m_futureInterface = nullptr; ProcessParameters m_param; - bool m_ignoreReturnValue; - Utils::QtcProcess *m_process; - IOutputParser *m_outputParserChain; - bool m_killProcess; - bool m_skipFlush; + bool m_ignoreReturnValue = false; + bool m_killProcess = false; + bool m_skipFlush = false; + Utils::QtcProcess *m_process = nullptr; + IOutputParser *m_outputParserChain = nullptr; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp index a994b83016..fa82b38052 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.cpp +++ b/src/plugins/projectexplorer/allprojectsfilter.cpp @@ -50,7 +50,7 @@ AllProjectsFilter::AllProjectsFilter() void AllProjectsFilter::markFilesAsOutOfDate() { - setFileIterator(0); + setFileIterator(nullptr); } void AllProjectsFilter::prepareSearch(const QString &entry) diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp index 076097f2dd..7ce05f7495 100644 --- a/src/plugins/projectexplorer/allprojectsfind.cpp +++ b/src/plugins/projectexplorer/allprojectsfind.cpp @@ -46,8 +46,7 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using namespace TextEditor; -AllProjectsFind::AllProjectsFind() - : m_configWidget(0) +AllProjectsFind::AllProjectsFind() : m_configWidget(nullptr) { connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged, this, &AllProjectsFind::handleFileListChanged); @@ -138,10 +137,10 @@ QWidget *AllProjectsFind::createConfigWidget() { if (!m_configWidget) { m_configWidget = new QWidget; - QGridLayout * const gridLayout = new QGridLayout(m_configWidget); + auto gridLayout = new QGridLayout(m_configWidget); gridLayout->setMargin(0); m_configWidget->setLayout(gridLayout); - QLabel * const filePatternLabel = new QLabel(tr("Fi&le pattern:")); + auto filePatternLabel = new QLabel(tr("Fi&le pattern:")); filePatternLabel->setMinimumWidth(80); filePatternLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); filePatternLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index a3d8b4534b..e397454803 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -88,8 +88,8 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate() : { } -ApplicationLauncher::ApplicationLauncher(QObject *parent) - : QObject(parent), d(new ApplicationLauncherPrivate) +ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent), + d(new ApplicationLauncherPrivate) { if (ProjectExplorerPlugin::projectExplorerSettings().mergeStdErrAndStdOut){ d->m_guiProcess.setReadChannelMode(QProcess::MergedChannels); diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h index ae62cb857d..e27729722b 100644 --- a/src/plugins/projectexplorer/applicationlauncher.h +++ b/src/plugins/projectexplorer/applicationlauncher.h @@ -47,7 +47,7 @@ public: Gui }; - explicit ApplicationLauncher(QObject *parent = 0); + explicit ApplicationLauncher(QObject *parent = nullptr); ~ApplicationLauncher() override; void setProcessChannelMode(QProcess::ProcessChannelMode mode); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 8346697f6c..c95226b794 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -85,7 +85,7 @@ class TabWidget : public QTabWidget { Q_OBJECT public: - TabWidget(QWidget *parent = 0); + TabWidget(QWidget *parent = nullptr); signals: void contextMenuRequested(const QPoint &pos, const int index); protected: @@ -139,8 +139,7 @@ void TabWidget::slotContextMenuRequested(const QPoint &pos) AppOutputPane::RunControlTab::RunControlTab(RunControl *rc, Core::OutputWindow *w) : runControl(rc), window(w), asyncClosing(false), behaviorOnOutput(Flash) -{ -} +{ } AppOutputPane::AppOutputPane() : m_mainWidget(new QWidget), @@ -627,7 +626,7 @@ void AppOutputPane::zoomOut() m_zoom = m_runControlTabs.first().window->fontZoom(); } -void AppOutputPane::enableButtons(const RunControl *rc /* = 0 */, bool isRunning /* = false */) +void AppOutputPane::enableButtons(const RunControl *rc, bool isRunning) { if (rc) { m_reRunButton->setEnabled(!isRunning && rc->supportsReRunning()); diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h index a68349b8df..efe56fc26f 100644 --- a/src/plugins/projectexplorer/appoutputpane.h +++ b/src/plugins/projectexplorer/appoutputpane.h @@ -120,8 +120,8 @@ private: void enableButtons(const RunControl *rc, bool isRunning); struct RunControlTab { - explicit RunControlTab(RunControl *runControl = 0, - Core::OutputWindow *window = 0); + explicit RunControlTab(RunControl *runControl = nullptr, + Core::OutputWindow *window = nullptr); RunControl* runControl; Core::OutputWindow *window; // Is the run control stopping asynchronously, close the tab once it finishes diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 135a415183..15b505804c 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -56,7 +56,7 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) : m_clearSystemEnvironment(false) { Q_ASSERT(target); - BuildStepList *bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD)); + auto bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD)); //: Display name of the build build step list. Used as part of the labels in the project window. bsl->setDefaultDisplayName(tr("Build")); m_stepLists.append(bsl); @@ -173,7 +173,7 @@ bool BuildConfiguration::fromMap(const QVariantMap &map) qWarning() << "No data for build step list" << i << "found!"; continue; } - BuildStepList *list = new BuildStepList(this, data); + auto list = new BuildStepList(this, data); if (list->isNull()) { qWarning() << "Failed to restore build step list" << i; delete list; @@ -282,7 +282,7 @@ void BuildConfiguration::cloneSteps(BuildConfiguration *source) qDeleteAll(m_stepLists); m_stepLists.clear(); foreach (BuildStepList *bsl, source->m_stepLists) { - BuildStepList *newBsl = new BuildStepList(this, bsl); + auto newBsl = new BuildStepList(this, bsl); newBsl->cloneSteps(bsl); m_stepLists.append(newBsl); } diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index 53408c1fc9..925740834e 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -119,7 +119,7 @@ class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject Q_OBJECT public: - explicit IBuildConfigurationFactory(QObject *parent = 0); + explicit IBuildConfigurationFactory(QObject *parent = nullptr); ~IBuildConfigurationFactory() override; // The priority is negative if this factory can not create anything for the target. diff --git a/src/plugins/projectexplorer/buildconfigurationmodel.cpp b/src/plugins/projectexplorer/buildconfigurationmodel.cpp index 340f0cef2d..b8ef079f38 100644 --- a/src/plugins/projectexplorer/buildconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/buildconfigurationmodel.cpp @@ -81,7 +81,7 @@ int BuildConfigurationModel::columnCount(const QModelIndex &parent) const void BuildConfigurationModel::displayNameChanged() { - BuildConfiguration *rc = qobject_cast<BuildConfiguration *>(sender()); + auto rc = qobject_cast<BuildConfiguration *>(sender()); if (!rc) return; diff --git a/src/plugins/projectexplorer/buildconfigurationmodel.h b/src/plugins/projectexplorer/buildconfigurationmodel.h index c267facd04..b5712f85fc 100644 --- a/src/plugins/projectexplorer/buildconfigurationmodel.h +++ b/src/plugins/projectexplorer/buildconfigurationmodel.h @@ -36,7 +36,7 @@ class BuildConfigurationModel : public QAbstractListModel { Q_OBJECT public: - explicit BuildConfigurationModel(Target *target, QObject *parent = 0); + explicit BuildConfigurationModel(Target *target, QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.cpp b/src/plugins/projectexplorer/buildenvironmentwidget.cpp index aea3e9b9f2..f7f253d94b 100644 --- a/src/plugins/projectexplorer/buildenvironmentwidget.cpp +++ b/src/plugins/projectexplorer/buildenvironmentwidget.cpp @@ -35,10 +35,10 @@ using namespace ProjectExplorer; -BuildEnvironmentWidget::BuildEnvironmentWidget(BuildConfiguration *bc) - : m_buildConfiguration(0) +BuildEnvironmentWidget::BuildEnvironmentWidget(BuildConfiguration *bc) : + m_buildConfiguration(nullptr) { - QVBoxLayout *vbox = new QVBoxLayout(this); + auto vbox = new QVBoxLayout(this); vbox->setMargin(0); m_clearSystemEnvironmentCheckBox = new QCheckBox(this); m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment")); diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 0a28ed31b3..9c0a8f176b 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -107,8 +107,8 @@ BuildManagerPrivate::BuildManagerPrivate() : { } -static BuildManagerPrivate *d = 0; -static BuildManager *m_instance = 0; +static BuildManagerPrivate *d = nullptr; +static BuildManager *m_instance = nullptr; BuildManager::BuildManager(QObject *parent, QAction *cancelBuildAction) : QObject(parent) @@ -168,7 +168,7 @@ void BuildManager::extensionsInitialized() BuildManager::~BuildManager() { cancel(); - m_instance = 0; + m_instance = nullptr; ExtensionSystem::PluginManager::removeObject(d->m_taskWindow); delete d->m_taskWindow; @@ -256,15 +256,15 @@ void BuildManager::clearBuildQueue() d->m_buildQueue.clear(); d->m_enabledState.clear(); d->m_running = false; - d->m_previousBuildStepProject = 0; - d->m_currentBuildStep = 0; + d->m_previousBuildStepProject = nullptr; + d->m_currentBuildStep = nullptr; d->m_progressFutureInterface->reportCanceled(); d->m_progressFutureInterface->reportFinished(); d->m_progressWatcher.setFuture(QFuture<void>()); delete d->m_progressFutureInterface; - d->m_progressFutureInterface = 0; - d->m_futureProgress = 0; + d->m_progressFutureInterface = nullptr; + d->m_futureProgress = nullptr; d->m_maxProgress = 0; emit m_instance->buildQueueFinished(false); @@ -464,12 +464,12 @@ void BuildManager::nextStep() } } else { d->m_running = false; - d->m_previousBuildStepProject = 0; + d->m_previousBuildStepProject = nullptr; d->m_progressFutureInterface->reportFinished(); d->m_progressWatcher.setFuture(QFuture<void>()); - d->m_currentBuildStep = 0; + d->m_currentBuildStep = nullptr; delete d->m_progressFutureInterface; - d->m_progressFutureInterface = 0; + d->m_progressFutureInterface = nullptr; d->m_maxProgress = 0; emit m_instance->buildQueueFinished(true); } diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp index 24d191cd1e..f42790b7ff 100644 --- a/src/plugins/projectexplorer/buildprogress.cpp +++ b/src/plugins/projectexplorer/buildprogress.cpp @@ -27,27 +27,27 @@ #include "projectexplorerconstants.h" #include <coreplugin/coreicons.h> + #include <utils/stylehelper.h> -#include <QVBoxLayout> -#include <QHBoxLayout> -#include <QLabel> #include <QFont> +#include <QLabel> +#include <QHBoxLayout> #include <QPixmap> -#include <QDebug> +#include <QVBoxLayout> using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation) - : m_contentWidget(new QWidget), - m_errorIcon(new QLabel), - m_warningIcon(new QLabel), - m_errorLabel(new QLabel), - m_warningLabel(new QLabel), - m_taskWindow(taskWindow) +BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation) : + m_contentWidget(new QWidget), + m_errorIcon(new QLabel), + m_warningIcon(new QLabel), + m_errorLabel(new QLabel), + m_warningLabel(new QLabel), + m_taskWindow(taskWindow) { - QHBoxLayout *contentLayout = new QHBoxLayout; + auto contentLayout = new QHBoxLayout; contentLayout->setContentsMargins(0, 0, 0, 0); contentLayout->setSpacing(0); setLayout(contentLayout); @@ -60,12 +60,12 @@ BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation layout->setContentsMargins(8, 2, 0, 2); layout->setSpacing(2); m_contentWidget->setLayout(layout); - QHBoxLayout *errorLayout = new QHBoxLayout; + auto errorLayout = new QHBoxLayout; errorLayout->setSpacing(2); layout->addLayout(errorLayout); errorLayout->addWidget(m_errorIcon); errorLayout->addWidget(m_errorLabel); - QHBoxLayout *warningLayout = new QHBoxLayout; + auto warningLayout = new QHBoxLayout; warningLayout->setSpacing(2); layout->addLayout(warningLayout); warningLayout->addWidget(m_warningIcon); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index 27b81cd8bb..665ffe132f 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -61,16 +61,15 @@ BuildSettingsWidget::~BuildSettingsWidget() } BuildSettingsWidget::BuildSettingsWidget(Target *target) : - m_target(target), - m_buildConfiguration(0) + m_target(target) { Q_ASSERT(m_target); - QVBoxLayout *vbox = new QVBoxLayout(this); + auto vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); if (!IBuildConfigurationFactory::find(m_target)) { - QLabel *noSettingsLabel = new QLabel(this); + auto noSettingsLabel = new QLabel(this); noSettingsLabel->setText(tr("No build settings available")); QFont f = noSettingsLabel->font(); f.setPointSizeF(f.pointSizeF() * 1.2); @@ -80,7 +79,7 @@ BuildSettingsWidget::BuildSettingsWidget(Target *target) : } { // Edit Build Configuration row - QHBoxLayout *hbox = new QHBoxLayout(); + auto hbox = new QHBoxLayout(); hbox->setContentsMargins(0, 0, 0, 0); hbox->addWidget(new QLabel(tr("Edit build configuration:"), this)); m_buildConfigurationComboBox = new QComboBox(this); @@ -110,7 +109,7 @@ BuildSettingsWidget::BuildSettingsWidget(Target *target) : } m_buildConfiguration = m_target->activeBuildConfiguration(); - BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); + auto model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); m_buildConfigurationComboBox->setCurrentIndex(model->indexFor(m_buildConfiguration).row()); updateAddButtonMenu(); @@ -135,7 +134,7 @@ void BuildSettingsWidget::addSubWidget(NamedWidget *widget) { widget->setContentsMargins(0, 10, 0, 0); - QLabel *label = new QLabel(this); + auto label = new QLabel(this); label->setText(widget->displayName()); connect(widget, &NamedWidget::displayNameChanged, label, &QLabel::setText); @@ -218,7 +217,7 @@ void BuildSettingsWidget::updateBuildSettings() void BuildSettingsWidget::currentIndexChanged(int index) { - BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); + auto model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); BuildConfiguration *buildConfiguration = model->buildConfigurationAt(index); SessionManager::setActiveBuildConfiguration(m_target, buildConfiguration, SetActive::Cascade); } @@ -230,7 +229,7 @@ void BuildSettingsWidget::updateActiveConfiguration() m_buildConfiguration = m_target->activeBuildConfiguration(); - BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); + auto model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model()); m_buildConfigurationComboBox->setCurrentIndex(model->indexFor(m_buildConfiguration).row()); updateBuildSettings(); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index e2e5c5a6da..ca7a6d0187 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -69,7 +69,7 @@ private: QString uniqueName(const QString &name); Target *m_target; - BuildConfiguration *m_buildConfiguration; + BuildConfiguration *m_buildConfiguration = nullptr; QPushButton *m_addButton; QPushButton *m_removeButton; diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index 727c4ee3ba..e4a19efbdc 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -89,6 +89,7 @@ signals: void finished(); void enabledChanged(); + private: bool m_enabled; }; @@ -98,7 +99,7 @@ class PROJECTEXPLORER_EXPORT IBuildStepFactory : public QObject Q_OBJECT public: - explicit IBuildStepFactory(QObject *parent = 0); + explicit IBuildStepFactory(QObject *parent = nullptr); // used to show the list of possible additons to a target, returns a list of types virtual QList<Core::Id> availableCreationIds(BuildStepList *parent) const = 0; diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index 49991c45ed..a79572a43a 100644 --- a/src/plugins/projectexplorer/buildsteplist.cpp +++ b/src/plugins/projectexplorer/buildsteplist.cpp @@ -61,8 +61,7 @@ const char STEPS_PREFIX[] = "ProjectExplorer.BuildStepList.Step."; } // namespace BuildStepList::BuildStepList(QObject *parent, Core::Id id) : - ProjectConfiguration(parent, id), - m_isNull(false) + ProjectConfiguration(parent, id) { Q_ASSERT(parent); } @@ -202,10 +201,10 @@ BuildStep *BuildStepList::at(int position) Target *BuildStepList::target() const { Q_ASSERT(parent()); - BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(parent()); + auto bc = qobject_cast<BuildConfiguration *>(parent()); if (bc) return bc->target(); - DeployConfiguration *dc = qobject_cast<DeployConfiguration *>(parent()); + auto dc = qobject_cast<DeployConfiguration *>(parent()); if (dc) return dc->target(); return 0; diff --git a/src/plugins/projectexplorer/buildsteplist.h b/src/plugins/projectexplorer/buildsteplist.h index 57e34ef8a9..313c67f130 100644 --- a/src/plugins/projectexplorer/buildsteplist.h +++ b/src/plugins/projectexplorer/buildsteplist.h @@ -74,7 +74,7 @@ protected: private: QList<BuildStep *> m_steps; - bool m_isNull; + bool m_isNull = false; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 066eb20271..feb2ee5888 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -52,16 +52,16 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using namespace Utils; -ToolWidget::ToolWidget(QWidget *parent) - : FadingPanel(parent), m_buildStepEnabled(true), m_targetOpacity(1.0f) +ToolWidget::ToolWidget(QWidget *parent) : FadingPanel(parent), + m_targetOpacity(1.0f) { - QHBoxLayout *layout = new QHBoxLayout; + auto layout = new QHBoxLayout; layout->setMargin(4); layout->setSpacing(4); setLayout(layout); m_firstWidget = new FadingWidget(this); m_firstWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - QHBoxLayout *hbox = new QHBoxLayout(); + auto hbox = new QHBoxLayout(); hbox->setContentsMargins(0, 0, 0, 0); hbox->setSpacing(0); m_firstWidget->setLayout(hbox); @@ -209,7 +209,7 @@ BuildStepListWidget::~BuildStepListWidget() void BuildStepListWidget::updateSummary() { - BuildStepConfigWidget *widget = qobject_cast<BuildStepConfigWidget *>(sender()); + auto widget = qobject_cast<BuildStepConfigWidget *>(sender()); if (widget) { foreach (const BuildStepsWidgetData *s, m_buildStepsData) { if (s->widget == widget) { @@ -222,7 +222,7 @@ void BuildStepListWidget::updateSummary() void BuildStepListWidget::updateAdditionalSummary() { - BuildStepConfigWidget *widget = qobject_cast<BuildStepConfigWidget *>(sender()); + auto widget = qobject_cast<BuildStepConfigWidget *>(sender()); if (widget) { foreach (const BuildStepsWidgetData *s, m_buildStepsData) { if (s->widget == widget) { @@ -235,7 +235,7 @@ void BuildStepListWidget::updateAdditionalSummary() void BuildStepListWidget::updateEnabledState() { - BuildStep *step = qobject_cast<BuildStep *>(sender()); + auto step = qobject_cast<BuildStep *>(sender()); if (step) { foreach (const BuildStepsWidgetData *s, m_buildStepsData) { if (s->step == step) { @@ -324,7 +324,7 @@ void BuildStepListWidget::updateAddBuildStepMenu() void BuildStepListWidget::addBuildStepWidget(int pos, BuildStep *step) { // create everything - BuildStepsWidgetData *s = new BuildStepsWidgetData(step); + auto s = new BuildStepsWidgetData(step); m_buildStepsData.insert(pos, s); m_vbox->insertWidget(pos, s->detailsWidget); @@ -412,7 +412,7 @@ void BuildStepListWidget::triggerDisable(int pos) void BuildStepListWidget::setupUi() { - if (0 != m_addButton) + if (m_addButton) return; m_disableMapper = new QSignalMapper(this); @@ -436,7 +436,7 @@ void BuildStepListWidget::setupUi() m_noStepsLabel->setContentsMargins(0, 0, 0, 0); m_vbox->addWidget(m_noStepsLabel); - QHBoxLayout *hboxLayout = new QHBoxLayout(); + auto hboxLayout = new QHBoxLayout(); hboxLayout->setContentsMargins(0, 4, 0, 0); m_addButton = new QPushButton(this); m_addButton->setMenu(new QMenu(this)); @@ -479,11 +479,10 @@ void BuildStepListWidget::updateBuildStepButtonsState() } BuildStepsPage::BuildStepsPage(BuildConfiguration *bc, Core::Id id) : - NamedWidget(), m_id(id), m_widget(new BuildStepListWidget(this)) { - QVBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(m_widget); @@ -495,6 +494,3 @@ BuildStepsPage::BuildStepsPage(BuildConfiguration *bc, Core::Id id) : if (m_id == Constants::BUILDSTEPS_CLEAN) setDisplayName(tr("Clean Steps")); } - -BuildStepsPage::~BuildStepsPage() -{ } diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h index e315d77c43..bbb1396710 100644 --- a/src/plugins/projectexplorer/buildstepspage.h +++ b/src/plugins/projectexplorer/buildstepspage.h @@ -51,7 +51,7 @@ class ToolWidget : public Utils::FadingPanel { Q_OBJECT public: - explicit ToolWidget(QWidget *parent = 0); + explicit ToolWidget(QWidget *parent = nullptr); void fadeTo(qreal value); void setOpacity(qreal value); @@ -75,7 +75,7 @@ private: QToolButton *m_downButton; QToolButton *m_removeButton; - bool m_buildStepEnabled; + bool m_buildStepEnabled = true; Utils::FadingWidget *m_firstWidget; Utils::FadingWidget *m_secondWidget; qreal m_targetOpacity; @@ -98,7 +98,7 @@ class BuildStepListWidget : public NamedWidget Q_OBJECT public: - BuildStepListWidget(QWidget *parent = 0); + BuildStepListWidget(QWidget *parent = nullptr); virtual ~BuildStepListWidget(); void init(BuildStepList *bsl); @@ -145,11 +145,10 @@ class BuildStepsPage : public NamedWidget public: BuildStepsPage(BuildConfiguration *bc, Core::Id id); - virtual ~BuildStepsPage(); private: Core::Id m_id; - BuildStepListWidget *m_widget; + BuildStepListWidget *m_widget = nullptr; }; } // Internal diff --git a/src/plugins/projectexplorer/cesdkhandler.cpp b/src/plugins/projectexplorer/cesdkhandler.cpp index 5ddd17d436..1048c2ff13 100644 --- a/src/plugins/projectexplorer/cesdkhandler.cpp +++ b/src/plugins/projectexplorer/cesdkhandler.cpp @@ -35,11 +35,6 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using Utils::Environment; -CeSdkInfo::CeSdkInfo() - : m_major(0), m_minor(0) -{ -} - void CeSdkInfo::addToEnvironment(Environment &env) { // qDebug() << "adding " << name() << "to Environment"; diff --git a/src/plugins/projectexplorer/cesdkhandler.h b/src/plugins/projectexplorer/cesdkhandler.h index dbbb5356a6..ec3e65eed7 100644 --- a/src/plugins/projectexplorer/cesdkhandler.h +++ b/src/plugins/projectexplorer/cesdkhandler.h @@ -36,36 +36,26 @@ namespace ProjectExplorer { class PROJECTEXPLORER_EXPORT CeSdkInfo { public: - CeSdkInfo(); - - inline QString name() const; - inline QString binPath() const; - inline QString includePath() const; - inline QString libPath() const; - void addToEnvironment(Utils::Environment &env); - inline bool isValid() const; - inline int majorVersion() const; - inline int minorVersion() const; - inline bool isSupported() const; + QString name() const { return m_name; } + QString binPath() const { return m_bin; } + QString includePath() const { return m_include; } + QString libPath() const { return m_lib; } + void addToEnvironment(Utils::Environment &env); + bool isValid() const { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); } + int majorVersion() const { return m_major; } + int minorVersion() const { return m_minor; } + bool isSupported() const { return m_major >= 5; } private: - friend class CeSdkHandler; - QString m_name; - QString m_bin; - QString m_include; - QString m_lib; - int m_major; - int m_minor; -}; + friend class CeSdkHandler; -inline QString CeSdkInfo::name() const { return m_name; } -inline QString CeSdkInfo::binPath() const { return m_bin; } -inline QString CeSdkInfo::includePath() const { return m_include; } -inline QString CeSdkInfo::libPath() const { return m_lib; } -inline bool CeSdkInfo::isValid() const { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); } -inline int CeSdkInfo::majorVersion() const { return m_major; } -inline int CeSdkInfo::minorVersion() const { return m_minor; } -inline bool CeSdkInfo::isSupported() const { return m_major >= 5; } + QString m_name; + QString m_bin; + QString m_include; + QString m_lib; + int m_major = 0; + int m_minor = 0; +}; class PROJECTEXPLORER_EXPORT CeSdkHandler { @@ -74,6 +64,7 @@ public: inline QList<CeSdkInfo> listAll() const; CeSdkInfo find(const QString &name) const; static QString platformName(const QString &qtpath); + private: inline QString fixPaths(QString path) const; QList<CeSdkInfo> m_list; diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp index b265266376..b860d68b0f 100644 --- a/src/plugins/projectexplorer/clangparser.cpp +++ b/src/plugins/projectexplorer/clangparser.cpp @@ -40,7 +40,7 @@ static Task::TaskType taskType(const QString &capture) } // opt. drive letter + filename: (2 brackets) -static const char * const FILE_PATTERN = "(<command line>|([A-Za-z]:)?[^:]+\\.[^:]+)"; +static const char *const FILE_PATTERN = "(<command line>|([A-Za-z]:)?[^:]+\\.[^:]+)"; ClangParser::ClangParser() : m_commandRegExp(QLatin1String("^clang(\\+\\+)?: +(fatal +)?(warning|error|note): (.*)$")), diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp index 7161e26b70..3750e6a123 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp @@ -49,7 +49,7 @@ CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project) : QWidget(), Core::Id languageId = factory->languageId(); ICodeStylePreferences *codeStylePreferences = config->codeStyle(languageId); - CodeStyleEditor *preview = new CodeStyleEditor(factory, codeStylePreferences, m_ui.stackedWidget); + auto preview = new CodeStyleEditor(factory, codeStylePreferences, m_ui.stackedWidget); preview->clearMargins(); m_ui.stackedWidget->addWidget(preview); m_ui.languageComboBox->addItem(factory->displayName()); diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 6b44e5a7c8..e460371e08 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -65,8 +65,7 @@ class CompileOutputTextEdit : public Core::OutputWindow { Q_OBJECT public: - CompileOutputTextEdit(const Core::Context &context) - : Core::OutputWindow(context) + CompileOutputTextEdit(const Core::Context &context) : Core::OutputWindow(context) { setWheelZoomEnabled(true); @@ -182,7 +181,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : connect(m_zoomOutButton, &QToolButton::clicked, this, [this]() { m_outputWindow->zoomOut(1); }); - Aggregation::Aggregate *agg = new Aggregation::Aggregate; + auto agg = new Aggregation::Aggregate; agg->add(m_outputWindow); agg->add(new Core::BaseTextFind(m_outputWindow)); @@ -284,9 +283,7 @@ void CompileOutputWindow::clearContents() } void CompileOutputWindow::visibilityChanged(bool) -{ - -} +{ } int CompileOutputWindow::priorityInStatusBar() const { @@ -304,14 +301,10 @@ bool CompileOutputWindow::canPrevious() const } void CompileOutputWindow::goToNext() -{ - -} +{ } void CompileOutputWindow::goToPrev() -{ - -} +{ } bool CompileOutputWindow::canNavigate() const { diff --git a/src/plugins/projectexplorer/configtaskhandler.cpp b/src/plugins/projectexplorer/configtaskhandler.cpp index 73c1a30ed9..5ad2a11a81 100644 --- a/src/plugins/projectexplorer/configtaskhandler.cpp +++ b/src/plugins/projectexplorer/configtaskhandler.cpp @@ -56,7 +56,7 @@ void ConfigTaskHandler::handle(const Task &task) QAction *ConfigTaskHandler::createAction(QObject *parent) const { - QAction *action = new QAction(Core::ICore::msgShowOptionsDialog(), parent); + auto action = new QAction(Core::ICore::msgShowOptionsDialog(), parent); action->setToolTip(Core::ICore::msgShowOptionsDialogToolTip()); return action; } diff --git a/src/plugins/projectexplorer/copytaskhandler.cpp b/src/plugins/projectexplorer/copytaskhandler.cpp index b40c8296fc..1896eb2f7d 100644 --- a/src/plugins/projectexplorer/copytaskhandler.cpp +++ b/src/plugins/projectexplorer/copytaskhandler.cpp @@ -64,6 +64,5 @@ Core::Id CopyTaskHandler::actionManagerId() const QAction *CopyTaskHandler::createAction(QObject *parent) const { - QAction *copyAction = new QAction(parent); - return copyAction; + return new QAction(parent); } diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp index be1ecd448b..cc67c637c8 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.cpp +++ b/src/plugins/projectexplorer/currentprojectfilter.cpp @@ -36,7 +36,7 @@ using namespace Core; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -CurrentProjectFilter::CurrentProjectFilter() : BaseFileFilter(), m_project(0) +CurrentProjectFilter::CurrentProjectFilter() : BaseFileFilter() { setId("Files in current project"); setDisplayName(tr("Files in Current Project")); @@ -49,7 +49,7 @@ CurrentProjectFilter::CurrentProjectFilter() : BaseFileFilter(), m_project(0) void CurrentProjectFilter::markFilesAsOutOfDate() { - setFileIterator(0); + setFileIterator(nullptr); } void CurrentProjectFilter::prepareSearch(const QString &entry) diff --git a/src/plugins/projectexplorer/currentprojectfilter.h b/src/plugins/projectexplorer/currentprojectfilter.h index c62b2fa5de..d36f1bf6a1 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.h +++ b/src/plugins/projectexplorer/currentprojectfilter.h @@ -49,7 +49,7 @@ private: void currentProjectChanged(); void markFilesAsOutOfDate(); - Project *m_project; + Project *m_project = nullptr; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/currentprojectfind.cpp b/src/plugins/projectexplorer/currentprojectfind.cpp index e0c48be58c..bffcd83945 100644 --- a/src/plugins/projectexplorer/currentprojectfind.cpp +++ b/src/plugins/projectexplorer/currentprojectfind.cpp @@ -100,7 +100,7 @@ void CurrentProjectFind::handleProjectChanged() void CurrentProjectFind::recheckEnabled() { - Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); + auto search = qobject_cast<Core::SearchResult *>(sender()); if (!search) return; QString projectFile = getAdditionalParameters(search).toString(); diff --git a/src/plugins/projectexplorer/customparserconfigdialog.h b/src/plugins/projectexplorer/customparserconfigdialog.h index 3b235c8205..c34dbfbf4e 100644 --- a/src/plugins/projectexplorer/customparserconfigdialog.h +++ b/src/plugins/projectexplorer/customparserconfigdialog.h @@ -43,7 +43,7 @@ class CustomParserConfigDialog : public QDialog Q_OBJECT public: - explicit CustomParserConfigDialog(QDialog *parent = 0); + explicit CustomParserConfigDialog(QDialog *parent = nullptr); ~CustomParserConfigDialog() override; void setExampleSettings(); diff --git a/src/plugins/projectexplorer/customtoolchain.cpp b/src/plugins/projectexplorer/customtoolchain.cpp index 261599df52..a910450113 100644 --- a/src/plugins/projectexplorer/customtoolchain.cpp +++ b/src/plugins/projectexplorer/customtoolchain.cpp @@ -204,7 +204,7 @@ IOutputParser *CustomToolChain::outputParser() const case Msvc: return new MsvcParser; #endif case Custom: return new CustomParser(m_customParserSettings); - default: return 0; + default: return nullptr; } } @@ -352,7 +352,7 @@ bool CustomToolChain::operator ==(const ToolChain &other) const if (!ToolChain::operator ==(other)) return false; - const CustomToolChain *customTc = static_cast<const CustomToolChain *>(&other); + auto customTc = static_cast<const CustomToolChain *>(&other); return m_compilerCommand == customTc->m_compilerCommand && m_makeCommand == customTc->m_makeCommand && m_targetAbi == customTc->m_targetAbi @@ -428,12 +428,12 @@ bool CustomToolChainFactory::canRestore(const QVariantMap &data) ToolChain *CustomToolChainFactory::restore(const QVariantMap &data) { - CustomToolChain *tc = new CustomToolChain(ToolChain::ManualDetection); + auto tc = new CustomToolChain(ToolChain::ManualDetection); if (tc->fromMap(data)) return tc; delete tc; - return 0; + return nullptr; } // -------------------------------------------------------------------------- @@ -499,8 +499,8 @@ CustomToolChainConfigWidget::CustomToolChainConfigWidget(CustomToolChain *tc) : for (int i = 0; i < CustomToolChain::OutputParserCount; ++i) m_errorParserComboBox->addItem(CustomToolChain::parserName((CustomToolChain::OutputParser)i)); - QWidget *parserLayoutWidget = new QWidget; - QHBoxLayout *parserLayout = new QHBoxLayout(parserLayoutWidget); + auto parserLayoutWidget = new QWidget; + auto parserLayout = new QHBoxLayout(parserLayoutWidget); parserLayout->setContentsMargins(0, 0, 0, 0); m_predefinedMacros->setTabChangesFocus(true); m_predefinedMacros->setToolTip(tr("Each line defines a macro. Format is MACRO[=VALUE].")); @@ -576,7 +576,7 @@ void CustomToolChainConfigWidget::applyImpl() if (toolChain()->isAutoDetected()) return; - CustomToolChain *tc = static_cast<CustomToolChain *>(toolChain()); + auto tc = static_cast<CustomToolChain *>(toolChain()); Q_ASSERT(tc); QString displayName = tc->displayName(); tc->setCompilerCommand(m_compilerCommand->fileName()); @@ -595,7 +595,7 @@ void CustomToolChainConfigWidget::setFromToolchain() { // subwidgets are not yet connected! bool blocked = blockSignals(true); - CustomToolChain *tc = static_cast<CustomToolChain *>(toolChain()); + auto tc = static_cast<CustomToolChain *>(toolChain()); m_compilerCommand->setFileName(tc->compilerCommand()); m_makeCommand->setFileName(FileName::fromString(tc->makeCommand(Environment()))); m_abiWidget->setAbis(QList<Abi>(), tc->targetAbi()); @@ -610,7 +610,7 @@ void CustomToolChainConfigWidget::setFromToolchain() bool CustomToolChainConfigWidget::isDirtyImpl() const { - CustomToolChain *tc = static_cast<CustomToolChain *>(toolChain()); + auto tc = static_cast<CustomToolChain *>(toolChain()); Q_ASSERT(tc); return m_compilerCommand->fileName() != tc->compilerCommand() || m_makeCommand->path() != tc->makeCommand(Environment()) diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 0471a53cc4..a4878f319e 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -135,10 +135,10 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p) Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDialogParameters &p) const { QTC_ASSERT(!d->m_parameters.isNull(), return 0); - Core::BaseFileWizard *wizard = new Core::BaseFileWizard(this, p.extraValues(), parent); + auto wizard = new Core::BaseFileWizard(this, p.extraValues(), parent); d->m_context->reset(); - CustomWizardPage *customPage = new CustomWizardPage(d->m_context, parameters()); + auto customPage = new CustomWizardPage(d->m_context, parameters()); customPage->setPath(p.defaultPath()); if (parameters()->firstPageId >= 0) wizard->setPage(parameters()->firstPageId, customPage); @@ -202,7 +202,7 @@ template <class WizardPage> WizardPage *findWizardPage(const QWizard *w) { foreach (int pageId, w->pageIds()) - if (WizardPage *wp = qobject_cast<WizardPage *>(w->page(pageId))) + if (auto wp = qobject_cast<WizardPage *>(w->page(pageId))) return wp; return 0; } @@ -330,7 +330,7 @@ CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizard return p->klass.isEmpty() ? (p->kind == factory->kind()) : (p->klass == factory->klass()); }); - CustomWizard *rc = 0; + CustomWizard *rc = nullptr; if (factory) rc = factory->create(); @@ -474,7 +474,7 @@ CustomProjectWizard::CustomProjectWizard() Core::BaseFileWizard *CustomProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const { - BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(this, parent, parameters); + auto projectDialog = new BaseProjectWizardDialog(this, parent, parameters); initProjectWizardDialog(projectDialog, parameters.defaultPath(), projectDialog->extensionPages()); diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h index beeff9825a..619b8470c6 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.h +++ b/src/plugins/projectexplorer/customwizard/customwizard.h @@ -74,7 +74,7 @@ template <class Wizard> class CustomWizardMetaFactory : public ICustomWizardMeta public: CustomWizardMetaFactory(const QString &klass, Core::IWizardFactory::WizardKind kind) : ICustomWizardMetaFactory(klass, kind) { } CustomWizardMetaFactory(Core::IWizardFactory::WizardKind kind) : ICustomWizardMetaFactory(QString(), kind) { } - CustomWizard *create() const { return new Wizard; } + CustomWizard *create() const override { return new Wizard; } }; // Documentation inside. @@ -86,7 +86,7 @@ public: typedef QMap<QString, QString> FieldReplacementMap; CustomWizard(); - ~CustomWizard(); + ~CustomWizard() override; // Can be reimplemented to create custom wizards. initWizardDialog() needs to be // called. @@ -130,7 +130,7 @@ class PROJECTEXPLORER_EXPORT CustomProjectWizard : public CustomWizard public: CustomProjectWizard(); - static bool postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage = 0); + static bool postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage = nullptr); signals: void projectLocationChanged(const QString &path); diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp index 542e3689f9..3cdfe71bbd 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp @@ -69,17 +69,17 @@ namespace Internal { \sa ProjectExplorer::CustomWizard */ -CustomWizardFieldPage::LineEditData::LineEditData(QLineEdit* le, const QString &defText, const QString &pText) : +CustomWizardFieldPage::LineEditData::LineEditData(QLineEdit *le, const QString &defText, const QString &pText) : lineEdit(le), defaultText(defText), placeholderText(pText) { } -CustomWizardFieldPage::TextEditData::TextEditData(QTextEdit* le, const QString &defText) : +CustomWizardFieldPage::TextEditData::TextEditData(QTextEdit *le, const QString &defText) : textEdit(le), defaultText(defText) { } -CustomWizardFieldPage::PathChooserData::PathChooserData(PathChooser* pe, const QString &defText) : +CustomWizardFieldPage::PathChooserData::PathChooserData(PathChooser *pe, const QString &defText) : pathChooser(pe), defaultText(defText) { } @@ -93,7 +93,7 @@ CustomWizardFieldPage::CustomWizardFieldPage(const QSharedPointer<CustomWizardCo m_formLayout(new QFormLayout), m_errorLabel(new QLabel) { - QVBoxLayout *vLayout = new QVBoxLayout; + auto vLayout = new QVBoxLayout; m_formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); if (debug) qDebug() << Q_FUNC_INFO << parameters->fields.size(); @@ -109,10 +109,6 @@ CustomWizardFieldPage::CustomWizardFieldPage(const QSharedPointer<CustomWizardCo setTitle(parameters->fieldPageTitle); } -CustomWizardFieldPage::~CustomWizardFieldPage() -{ -} - void CustomWizardFieldPage::addRow(const QString &name, QWidget *w) { m_formLayout->addRow(name, w); @@ -144,7 +140,7 @@ void CustomWizardFieldPage::addField(const CustomWizardField &field)\ bool spansRow = false; // Check known classes: QComboBox const QString className = field.controlAttributes.value(QLatin1String("class")); - QWidget *fieldWidget = 0; + QWidget *fieldWidget = nullptr; if (className == QLatin1String("QComboBox")) { fieldWidget = registerComboBox(fieldName, field); } else if (className == QLatin1String("QTextEdit")) { @@ -196,7 +192,7 @@ static void comboChoices(const CustomWizardField::ControlAttributeMap &controlAt QWidget *CustomWizardFieldPage::registerComboBox(const QString &fieldName, const CustomWizardField &field) { - TextFieldComboBox *combo = new TextFieldComboBox; + auto combo = new TextFieldComboBox; do { // Set up items and current index QStringList values; QStringList displayTexts; @@ -220,7 +216,7 @@ QWidget *CustomWizardFieldPage::registerComboBox(const QString &fieldName, QWidget *CustomWizardFieldPage::registerTextEdit(const QString &fieldName, const CustomWizardField &field) { - QTextEdit *textEdit = new QTextEdit; + auto textEdit = new QTextEdit; // Suppress formatting by default (inverting QTextEdit's default value) when // pasting from Bug tracker, etc. const bool acceptRichText = field.controlAttributes.value(QLatin1String("acceptRichText")) == QLatin1String("true"); @@ -236,7 +232,7 @@ QWidget *CustomWizardFieldPage::registerTextEdit(const QString &fieldName, QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName, const CustomWizardField &field) { - PathChooser *pathChooser = new PathChooser; + auto pathChooser = new PathChooser; const QString expectedKind = field.controlAttributes.value(QLatin1String("expectedkind")).toLower(); if (expectedKind == QLatin1String("existingdirectory")) pathChooser->setExpectedKind(PathChooser::ExistingDirectory); @@ -266,7 +262,7 @@ QWidget *CustomWizardFieldPage::registerCheckBox(const QString &fieldName, { typedef CustomWizardField::ControlAttributeMap::const_iterator AttributeMapConstIt; - TextFieldCheckBox *checkBox = new TextFieldCheckBox(fieldDescription); + auto checkBox = new TextFieldCheckBox(fieldDescription); const bool defaultValue = field.controlAttributes.value(QLatin1String("defaultvalue")) == QLatin1String("true"); checkBox->setChecked(defaultValue); const AttributeMapConstIt trueTextIt = field.controlAttributes.constFind(QLatin1String("truevalue")); @@ -284,7 +280,7 @@ QWidget *CustomWizardFieldPage::registerCheckBox(const QString &fieldName, QWidget *CustomWizardFieldPage::registerLineEdit(const QString &fieldName, const CustomWizardField &field) { - QLineEdit *lineEdit = new QLineEdit; + auto lineEdit = new QLineEdit; const QString validationRegExp = field.controlAttributes.value(QLatin1String("validator")); if (!validationRegExp.isEmpty()) { diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.h b/src/plugins/projectexplorer/customwizard/customwizardpage.h index 87077e875b..e670b97430 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardpage.h +++ b/src/plugins/projectexplorer/customwizard/customwizardpage.h @@ -54,12 +54,11 @@ public: explicit CustomWizardFieldPage(const QSharedPointer<CustomWizardContext> &ctx, const QSharedPointer<CustomWizardParameters> ¶meters, - QWidget *parent = 0); - virtual ~CustomWizardFieldPage(); + QWidget *parent = nullptr); - virtual bool validatePage(); - virtual void initializePage(); - virtual void cleanupPage(); + bool validatePage() override; + void initializePage() override; + void cleanupPage() override; static QMap<QString, QString> replacementMap(const QWizard *w, const QSharedPointer<CustomWizardContext> &ctx, @@ -72,23 +71,23 @@ protected: private: class LineEditData { public: - explicit LineEditData(QLineEdit* le = 0, const QString &defText = QString(), const QString &pText = QString()); - QLineEdit* lineEdit; + explicit LineEditData(QLineEdit *le = nullptr, const QString &defText = QString(), const QString &pText = QString()); + QLineEdit *lineEdit; QString defaultText; QString placeholderText; QString userChange; }; class TextEditData { public: - explicit TextEditData(QTextEdit* le = 0, const QString &defText = QString()); - QTextEdit* textEdit; + explicit TextEditData(QTextEdit *le = nullptr, const QString &defText = QString()); + QTextEdit *textEdit; QString defaultText; QString userChange; }; class PathChooserData { public: - explicit PathChooserData(Utils::PathChooser* pe = 0, const QString &defText = QString()); - Utils::PathChooser* pathChooser; + explicit PathChooserData(Utils::PathChooser *pe = nullptr, const QString &defText = QString()); + Utils::PathChooser *pathChooser; QString defaultText; QString userChange; }; @@ -121,12 +120,12 @@ class CustomWizardPage : public CustomWizardFieldPage { public: explicit CustomWizardPage(const QSharedPointer<CustomWizardContext> &ctx, const QSharedPointer<CustomWizardParameters> ¶meters, - QWidget *parent = 0); + QWidget *parent = nullptr); QString path() const; void setPath(const QString &path); - virtual bool isComplete() const; + bool isComplete() const override; private: Utils::PathChooser *m_pathChooser; diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index 64cbab2e67..fed8a6a653 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -105,7 +105,7 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value, { if (role == Qt::CheckStateRole) { Project *p = m_projects.at(index.row()); - const Qt::CheckState c = static_cast<Qt::CheckState>(value.toInt()); + auto c = static_cast<const Qt::CheckState>(value.toInt()); if (c == Qt::Checked) { if (SessionManager::addDependency(m_project, p)) { @@ -206,22 +206,21 @@ void DependenciesView::updateSizeHint() // DependenciesWidget // -DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent) - : QWidget(parent) - , m_project(project) - , m_model(new DependenciesModel(project, this)) +DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent) : QWidget(parent), + m_project(project), + m_model(new DependenciesModel(project, this)) { - QVBoxLayout *vbox = new QVBoxLayout(this); + auto vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); vbox->addWidget(m_detailsContainer); - QWidget *detailsWidget = new QWidget(m_detailsContainer); + auto detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); - QGridLayout *layout = new QGridLayout(detailsWidget); + auto layout = new QGridLayout(detailsWidget); layout->setContentsMargins(0, -1, 0, -1); - DependenciesView *treeView = new DependenciesView(this); + auto treeView = new DependenciesView(this); treeView->setModel(m_model); treeView->setHeaderHidden(true); layout->addWidget(treeView, 0 ,0); diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index 5c5c886e5c..2a87b26a4e 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -50,7 +50,7 @@ class DependenciesModel : public QAbstractListModel Q_OBJECT public: - explicit DependenciesModel(Project *project, QObject *parent = 0); + explicit DependenciesModel(Project *project, QObject *parent = nullptr); int rowCount(const QModelIndex &index) const override; int columnCount(const QModelIndex &index) const override; diff --git a/src/plugins/projectexplorer/deployablefile.cpp b/src/plugins/projectexplorer/deployablefile.cpp index efdabfbf4a..1d7b6132c1 100644 --- a/src/plugins/projectexplorer/deployablefile.cpp +++ b/src/plugins/projectexplorer/deployablefile.cpp @@ -33,20 +33,13 @@ using namespace Utils; namespace ProjectExplorer { -DeployableFile::DeployableFile() - : m_type(TypeNormal) -{ -} - DeployableFile::DeployableFile(const QString &localFilePath, const QString &remoteDir, Type type) : m_localFilePath(FileName::fromUserInput(localFilePath)), m_remoteDir(remoteDir), m_type(type) -{ -} +{ } DeployableFile::DeployableFile(const FileName &localFilePath, const QString &remoteDir, Type type) : m_localFilePath(localFilePath), m_remoteDir(remoteDir), m_type(type) -{ -} +{ } QString DeployableFile::remoteFilePath() const { diff --git a/src/plugins/projectexplorer/deployablefile.h b/src/plugins/projectexplorer/deployablefile.h index 4517b2e62e..70d05c29e8 100644 --- a/src/plugins/projectexplorer/deployablefile.h +++ b/src/plugins/projectexplorer/deployablefile.h @@ -42,7 +42,7 @@ public: TypeExecutable }; - DeployableFile(); + DeployableFile() = default; DeployableFile(const QString &m_localFilePath, const QString &m_remoteDir, Type type = TypeNormal); DeployableFile(const Utils::FileName &localFilePath, const QString &remoteDir, @@ -59,7 +59,7 @@ public: private: Utils::FileName m_localFilePath; QString m_remoteDir; - Type m_type; + Type m_type = TypeNormal; }; diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp index 1b2f9c1fd1..6d119ef910 100644 --- a/src/plugins/projectexplorer/deployconfiguration.cpp +++ b/src/plugins/projectexplorer/deployconfiguration.cpp @@ -40,8 +40,7 @@ const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildSt const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList."; DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) : - ProjectConfiguration(target, id), - m_stepList(0) + ProjectConfiguration(target, id) { Q_ASSERT(target); m_stepList = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_DEPLOY)); @@ -53,8 +52,7 @@ DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) : } DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) : - ProjectConfiguration(target, source), - m_stepList(0) + ProjectConfiguration(target, source) { Q_ASSERT(target); // Do not clone stepLists here, do that in the derived constructor instead @@ -94,7 +92,7 @@ QVariantMap DeployConfiguration::toMap() const NamedWidget *DeployConfiguration::createConfigWidget() { - return 0; + return nullptr; } bool DeployConfiguration::isEnabled() const @@ -227,7 +225,7 @@ bool DefaultDeployConfigurationFactory::canCreate(Target *parent, Core::Id id) c DeployConfiguration *DefaultDeployConfigurationFactory::create(Target *parent, Core::Id id) { if (!canCreate(parent, id)) - return 0; + return nullptr; return new DefaultDeployConfiguration(parent, id); } @@ -239,11 +237,11 @@ bool DefaultDeployConfigurationFactory::canRestore(Target *parent, const QVarian DeployConfiguration *DefaultDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map) { if (!canRestore(parent, map)) - return 0; - DefaultDeployConfiguration *dc = new DefaultDeployConfiguration(parent, idFromMap(map)); + return nullptr; + auto dc = new DefaultDeployConfiguration(parent, idFromMap(map)); if (!dc->fromMap(map)) { delete dc; - return 0; + return nullptr; } return dc; } @@ -256,7 +254,7 @@ bool DefaultDeployConfigurationFactory::canClone(Target *parent, DeployConfigura DeployConfiguration *DefaultDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *product) { if (!canClone(parent, product)) - return 0; + return nullptr; return new DefaultDeployConfiguration(parent, product); } diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h index 31bff0158a..aec33fd308 100644 --- a/src/plugins/projectexplorer/deployconfiguration.h +++ b/src/plugins/projectexplorer/deployconfiguration.h @@ -72,7 +72,7 @@ protected: private: void ctor(); - BuildStepList *m_stepList; + BuildStepList *m_stepList = nullptr; }; class PROJECTEXPLORER_EXPORT DefaultDeployConfiguration : public DeployConfiguration @@ -90,7 +90,7 @@ class PROJECTEXPLORER_EXPORT DeployConfigurationFactory : public QObject Q_OBJECT public: - explicit DeployConfigurationFactory(QObject *parent = 0); + explicit DeployConfigurationFactory(QObject *parent = nullptr); // used to show the list of possible additons to a target, returns a list of types virtual QList<Core::Id> availableCreationIds(Target *parent) const = 0; diff --git a/src/plugins/projectexplorer/deployconfigurationmodel.cpp b/src/plugins/projectexplorer/deployconfigurationmodel.cpp index 1f14521f20..b0e5dc70eb 100644 --- a/src/plugins/projectexplorer/deployconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/deployconfigurationmodel.cpp @@ -50,9 +50,9 @@ public: } }; -DeployConfigurationModel::DeployConfigurationModel(Target *target, QObject *parent) - : QAbstractListModel(parent), - m_target(target) +DeployConfigurationModel::DeployConfigurationModel(Target *target, QObject *parent) : + QAbstractListModel(parent), + m_target(target) { m_deployConfigurations = m_target->deployConfigurations(); Utils::sort(m_deployConfigurations, DeployConfigurationComparer()); @@ -62,9 +62,10 @@ DeployConfigurationModel::DeployConfigurationModel(Target *target, QObject *pare connect(target, &Target::removedDeployConfiguration, this, &DeployConfigurationModel::removedDeployConfiguration); - foreach (DeployConfiguration *dc, m_deployConfigurations) + foreach (DeployConfiguration *dc, m_deployConfigurations) { connect(dc, &ProjectConfiguration::displayNameChanged, this, &DeployConfigurationModel::displayNameChanged); + } } int DeployConfigurationModel::rowCount(const QModelIndex &parent) const @@ -79,7 +80,7 @@ int DeployConfigurationModel::columnCount(const QModelIndex &parent) const void DeployConfigurationModel::displayNameChanged() { - DeployConfiguration *dc = qobject_cast<DeployConfiguration *>(sender()); + auto dc = qobject_cast<DeployConfiguration *>(sender()); if (!dc) return; @@ -135,14 +136,14 @@ QVariant DeployConfigurationModel::data(const QModelIndex &index, int role) cons DeployConfiguration *DeployConfigurationModel::deployConfigurationAt(int i) { if (i > m_deployConfigurations.size() || i < 0) - return 0; + return nullptr; return m_deployConfigurations.at(i); } DeployConfiguration *DeployConfigurationModel::deployConfigurationFor(const QModelIndex &idx) { if (idx.row() > m_deployConfigurations.size() || idx.row() < 0) - return 0; + return nullptr; return m_deployConfigurations.at(idx.row()); } diff --git a/src/plugins/projectexplorer/deployconfigurationmodel.h b/src/plugins/projectexplorer/deployconfigurationmodel.h index af0712c64e..95b6092898 100644 --- a/src/plugins/projectexplorer/deployconfigurationmodel.h +++ b/src/plugins/projectexplorer/deployconfigurationmodel.h @@ -37,7 +37,7 @@ class DeployConfigurationModel : public QAbstractListModel { Q_OBJECT public: - explicit DeployConfigurationModel(Target *target, QObject *parent = 0); + explicit DeployConfigurationModel(Target *target, QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/plugins/projectexplorer/deploymentdatamodel.cpp b/src/plugins/projectexplorer/deploymentdatamodel.cpp index 8a3a4ee255..f5d655792f 100644 --- a/src/plugins/projectexplorer/deploymentdatamodel.cpp +++ b/src/plugins/projectexplorer/deploymentdatamodel.cpp @@ -27,10 +27,8 @@ namespace ProjectExplorer { -DeploymentDataModel::DeploymentDataModel(QObject *parent) - : QAbstractTableModel(parent) -{ -} +DeploymentDataModel::DeploymentDataModel(QObject *parent) : QAbstractTableModel(parent) +{ } void DeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData) { diff --git a/src/plugins/projectexplorer/deploymentdatamodel.h b/src/plugins/projectexplorer/deploymentdatamodel.h index d148b572ad..a2437cb4bc 100644 --- a/src/plugins/projectexplorer/deploymentdatamodel.h +++ b/src/plugins/projectexplorer/deploymentdatamodel.h @@ -36,7 +36,7 @@ class PROJECTEXPLORER_EXPORT DeploymentDataModel : public QAbstractTableModel { Q_OBJECT public: - explicit DeploymentDataModel(QObject *parent = 0); + explicit DeploymentDataModel(QObject *parent = nullptr); void setDeploymentData(const DeploymentData &deploymentData); diff --git a/src/plugins/projectexplorer/deploymentdataview.cpp b/src/plugins/projectexplorer/deploymentdataview.cpp index e25743be4c..40f4ad3fb4 100644 --- a/src/plugins/projectexplorer/deploymentdataview.cpp +++ b/src/plugins/projectexplorer/deploymentdataview.cpp @@ -44,8 +44,8 @@ public: using namespace Internal; -DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) : - NamedWidget(parent), d(new DeploymentDataViewPrivate) +DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) : NamedWidget(parent), + d(new DeploymentDataViewPrivate) { d->ui.setupUi(this); d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle); diff --git a/src/plugins/projectexplorer/deploymentdataview.h b/src/plugins/projectexplorer/deploymentdataview.h index 5f984b3189..f8d3b11698 100644 --- a/src/plugins/projectexplorer/deploymentdataview.h +++ b/src/plugins/projectexplorer/deploymentdataview.h @@ -38,7 +38,7 @@ class PROJECTEXPLORER_EXPORT DeploymentDataView : public NamedWidget Q_OBJECT public: - explicit DeploymentDataView(Target *target, QWidget *parent = 0); + explicit DeploymentDataView(Target *target, QWidget *parent = nullptr); ~DeploymentDataView() override; private: diff --git a/src/plugins/projectexplorer/doubletabwidget.cpp b/src/plugins/projectexplorer/doubletabwidget.cpp index 6e6084d695..8f2c176ef3 100644 --- a/src/plugins/projectexplorer/doubletabwidget.cpp +++ b/src/plugins/projectexplorer/doubletabwidget.cpp @@ -27,6 +27,7 @@ #include "ui_doubletabwidget.h" #include <utils/fileutils.h> +#include <utils/qtcassert.h> #include <utils/stylehelper.h> #include <utils/theme/theme.h> @@ -37,8 +38,6 @@ #include <QMenu> #include <QToolTip> -#include <QDebug> - using namespace ProjectExplorer::Internal; using namespace Utils; @@ -96,9 +95,7 @@ static void drawSecondLevelSeparator(QPainter *painter, QPoint top, QPoint botto DoubleTabWidget::DoubleTabWidget(QWidget *parent) : QWidget(parent), m_selection(StyleHelper::dpiSpecificImageFile(QLatin1String(":/projectexplorer/images/selection.png"))), - ui(new Ui::DoubleTabWidget), - m_currentIndex(-1), - m_lastVisibleIndex(-1) + ui(new Ui::DoubleTabWidget) { ui->setupUi(this); } @@ -170,7 +167,7 @@ QSize DoubleTabWidget::minimumSizeHint() const void DoubleTabWidget::updateNameIsUniqueAdd(Tab *tab) { tab->nameIsUnique = true; - for (int i=0; i < m_tabs.size(); ++i) { + for (int i = 0; i < m_tabs.size(); ++i) { if (m_tabs.at(i).name == tab->name) { m_tabs[i].nameIsUnique = false; tab->nameIsUnique = false; @@ -183,15 +180,16 @@ void DoubleTabWidget::updateNameIsUniqueRemove(const Tab &tab) { if (tab.nameIsUnique) return; - int index; + int index = -1; int count = 0; - for (int i=0; i < m_tabs.size(); ++i) { + for (int i = 0; i < m_tabs.size(); ++i) { if (m_tabs.at(i).name == tab.name) { ++count; index = i; } } + QTC_ASSERT(index >= 0, return); if (count == 1) m_tabs[index].nameIsUnique = true; } @@ -544,7 +542,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event) bool DoubleTabWidget::event(QEvent *event) { if (event->type() == QEvent::ToolTip) { - QHelpEvent *helpevent = static_cast<QHelpEvent*>(event); + auto helpevent = static_cast<QHelpEvent*>(event); QPair<HitArea, int> hit = convertPosToTab(helpevent->pos()); if (hit.first == HITTAB && m_tabs.at(m_currentTabIndices.at(hit.second)).nameIsUnique) { const QString &fileName = m_tabs.at(m_currentTabIndices.at(hit.second)).fullName; diff --git a/src/plugins/projectexplorer/doubletabwidget.h b/src/plugins/projectexplorer/doubletabwidget.h index d701bcea00..6b96ff704b 100644 --- a/src/plugins/projectexplorer/doubletabwidget.h +++ b/src/plugins/projectexplorer/doubletabwidget.h @@ -38,7 +38,7 @@ class DoubleTabWidget : public QWidget { Q_OBJECT public: - explicit DoubleTabWidget(QWidget *parent = 0); + explicit DoubleTabWidget(QWidget *parent = nullptr); ~DoubleTabWidget() override; void setTitle(const QString &title); @@ -68,7 +68,8 @@ protected: QSize minimumSizeHint() const override; private: - struct Tab { + class Tab { + public: QString name; QString fullName; bool nameIsUnique; @@ -86,12 +87,11 @@ private: Ui::DoubleTabWidget *ui; - QString m_title; QList<Tab> m_tabs; - int m_currentIndex; + int m_currentIndex = -1; + int m_lastVisibleIndex = -1; QVector<int> m_currentTabIndices; - int m_lastVisibleIndex; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index 5eedf278e6..01060baacb 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -62,21 +62,19 @@ namespace ProjectExplorer { struct EditorConfigurationPrivate { - EditorConfigurationPrivate() - : m_useGlobal(true) - , m_typingSettings(TextEditorSettings::typingSettings()) - , m_storageSettings(TextEditorSettings::storageSettings()) - , m_behaviorSettings(TextEditorSettings::behaviorSettings()) - , m_extraEncodingSettings(TextEditorSettings::extraEncodingSettings()) - , m_textCodec(Core::EditorManager::defaultTextCodec()) - { - } - - bool m_useGlobal; - ICodeStylePreferences *m_defaultCodeStyle; + EditorConfigurationPrivate() : + m_typingSettings(TextEditorSettings::typingSettings()), + m_storageSettings(TextEditorSettings::storageSettings()), + m_behaviorSettings(TextEditorSettings::behaviorSettings()), + m_extraEncodingSettings(TextEditorSettings::extraEncodingSettings()), + m_textCodec(Core::EditorManager::defaultTextCodec()) + { } + + ICodeStylePreferences *m_defaultCodeStyle = nullptr; TypingSettings m_typingSettings; StorageSettings m_storageSettings; BehaviorSettings m_behaviorSettings; + bool m_useGlobal = true; ExtraEncodingSettings m_extraEncodingSettings; MarginSettings m_marginSettings; QTextCodec *m_textCodec; @@ -277,7 +275,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use) d->m_useGlobal = use; d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0); foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { - if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) { + if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget())) { Project *project = SessionManager::projectForFile(editor->document()->filePath()); if (project && project->editorConfiguration() == this) switchSettings(widget); diff --git a/src/plugins/projectexplorer/environmentaspect.cpp b/src/plugins/projectexplorer/environmentaspect.cpp index d724cd986e..ba2a2fb2e7 100644 --- a/src/plugins/projectexplorer/environmentaspect.cpp +++ b/src/plugins/projectexplorer/environmentaspect.cpp @@ -39,8 +39,8 @@ namespace ProjectExplorer { // EnvironmentAspect: // -------------------------------------------------------------------- -EnvironmentAspect::EnvironmentAspect(RunConfiguration *runConfig) - : IRunConfigurationAspect(runConfig), m_base(-1) +EnvironmentAspect::EnvironmentAspect(RunConfiguration *runConfig) : + IRunConfigurationAspect(runConfig), m_base(-1) { setDisplayName(tr("Run Environment")); setId("EnvironmentAspect"); diff --git a/src/plugins/projectexplorer/environmentaspectwidget.cpp b/src/plugins/projectexplorer/environmentaspectwidget.cpp index 4996eec917..e5e78032eb 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.cpp +++ b/src/plugins/projectexplorer/environmentaspectwidget.cpp @@ -50,13 +50,13 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWid QTC_CHECK(m_aspect); setContentsMargins(0, 0, 0, 0); - QVBoxLayout *topLayout = new QVBoxLayout(this); + auto topLayout = new QVBoxLayout(this); topLayout->setMargin(0); - QWidget *baseEnvironmentWidget = new QWidget; - QHBoxLayout *baseLayout = new QHBoxLayout(baseEnvironmentWidget); + auto baseEnvironmentWidget = new QWidget; + auto baseLayout = new QHBoxLayout(baseEnvironmentWidget); baseLayout->setMargin(0); - QLabel *label = new QLabel(tr("Base environment for this run configuration:"), this); + auto label = new QLabel(tr("Base environment for this run configuration:"), this); baseLayout->addWidget(label); m_baseEnvironmentComboBox = new QComboBox; QList<int> bases = m_aspect->possibleBaseEnvironments(); diff --git a/src/plugins/projectexplorer/environmentitemswidget.cpp b/src/plugins/projectexplorer/environmentitemswidget.cpp index 15b960934b..c35cbac971 100644 --- a/src/plugins/projectexplorer/environmentitemswidget.cpp +++ b/src/plugins/projectexplorer/environmentitemswidget.cpp @@ -67,7 +67,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) : QWidget(parent), d(new EnvironmentItemsWidgetPrivate) { d->m_editor = new TextEditor::SnippetEditorWidget(this); - QVBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->addWidget(d->m_editor); } @@ -104,11 +104,10 @@ EnvironmentItemsDialog::EnvironmentItemsDialog(QWidget *parent) : { resize(640, 480); d->m_editor = new EnvironmentItemsWidget(this); - QDialogButtonBox *box = new QDialogButtonBox( - QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + auto box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject); - QVBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->addWidget(d->m_editor); layout->addWidget(box); setWindowTitle(tr("Edit Environment")); diff --git a/src/plugins/projectexplorer/environmentitemswidget.h b/src/plugins/projectexplorer/environmentitemswidget.h index 6306d5f770..8a81281862 100644 --- a/src/plugins/projectexplorer/environmentitemswidget.h +++ b/src/plugins/projectexplorer/environmentitemswidget.h @@ -36,7 +36,7 @@ class EnvironmentItemsWidget : public QWidget { Q_OBJECT public: - explicit EnvironmentItemsWidget(QWidget *parent = 0); + explicit EnvironmentItemsWidget(QWidget *parent = nullptr); ~EnvironmentItemsWidget() override; void setEnvironmentItems(const QList<Utils::EnvironmentItem> &items); @@ -53,14 +53,15 @@ class EnvironmentItemsDialog : public QDialog { Q_OBJECT public: - explicit EnvironmentItemsDialog(QWidget *parent = 0); + explicit EnvironmentItemsDialog(QWidget *parent = nullptr); ~EnvironmentItemsDialog() override; void setEnvironmentItems(const QList<Utils::EnvironmentItem> &items); QList<Utils::EnvironmentItem> environmentItems() const; static QList<Utils::EnvironmentItem> - getEnvironmentItems(QWidget *parent, const QList<Utils::EnvironmentItem> &initial, bool *ok = 0); + getEnvironmentItems(QWidget *parent, const QList<Utils::EnvironmentItem> &initial, + bool *ok = nullptr); private: EnvironmentItemsDialogPrivate *d; diff --git a/src/plugins/projectexplorer/environmentwidget.cpp b/src/plugins/projectexplorer/environmentwidget.cpp index 707626c518..ce5ea989af 100644 --- a/src/plugins/projectexplorer/environmentwidget.cpp +++ b/src/plugins/projectexplorer/environmentwidget.cpp @@ -50,10 +50,9 @@ class EnvironmentValidator : public QValidator { Q_OBJECT public: - EnvironmentValidator(QWidget *parent, Utils::EnvironmentModel *model, - QTreeView *view, - const QModelIndex &index) - : QValidator(parent), m_model(model), m_view(view), m_index(index) + EnvironmentValidator(QWidget *parent, Utils::EnvironmentModel *model, QTreeView *view, + const QModelIndex &index) : + QValidator(parent), m_model(model), m_view(view), m_index(index) { m_hideTipTimer.setInterval(2000); m_hideTipTimer.setSingleShot(true); @@ -103,7 +102,7 @@ public: if (index.column() != 0) return w; - if (QLineEdit *edit = qobject_cast<QLineEdit *>(w)) + if (auto edit = qobject_cast<QLineEdit *>(w)) edit->setValidator(new EnvironmentValidator(edit, m_model, m_view, index)); return w; } @@ -144,22 +143,22 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails connect(d->m_model, &Utils::EnvironmentModel::focusIndex, this, &EnvironmentWidget::focusIndex); - QVBoxLayout *vbox = new QVBoxLayout(this); + auto vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); d->m_detailsContainer = new Utils::DetailsWidget(this); - QWidget *details = new QWidget(d->m_detailsContainer); + auto details = new QWidget(d->m_detailsContainer); d->m_detailsContainer->setWidget(details); details->setVisible(false); - QVBoxLayout *vbox2 = new QVBoxLayout(details); + auto vbox2 = new QVBoxLayout(details); vbox2->setMargin(0); if (additionalDetailsWidget) vbox2->addWidget(additionalDetailsWidget); - QHBoxLayout *horizontalLayout = new QHBoxLayout(); + auto horizontalLayout = new QHBoxLayout(); horizontalLayout->setMargin(0); auto tree = new Utils::TreeView(this); connect(tree, &QAbstractItemView::activated, @@ -178,7 +177,7 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails findWrapper->setFrameStyle(QFrame::StyledPanel); horizontalLayout->addWidget(findWrapper); - QVBoxLayout *buttonLayout = new QVBoxLayout(); + auto buttonLayout = new QVBoxLayout(); d->m_editButton = new QPushButton(this); d->m_editButton->setText(tr("&Edit")); @@ -235,7 +234,7 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails EnvironmentWidget::~EnvironmentWidget() { delete d->m_model; - d->m_model = 0; + d->m_model = nullptr; delete d; } diff --git a/src/plugins/projectexplorer/environmentwidget.h b/src/plugins/projectexplorer/environmentwidget.h index 73cf307ab1..380a68917e 100644 --- a/src/plugins/projectexplorer/environmentwidget.h +++ b/src/plugins/projectexplorer/environmentwidget.h @@ -45,7 +45,7 @@ class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QWidget Q_OBJECT public: - explicit EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget = 0); + explicit EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget = nullptr); ~EnvironmentWidget() override; void setBaseEnvironmentText(const QString &text); diff --git a/src/plugins/projectexplorer/expanddata.cpp b/src/plugins/projectexplorer/expanddata.cpp index f58f6066b1..9e940aeb27 100644 --- a/src/plugins/projectexplorer/expanddata.cpp +++ b/src/plugins/projectexplorer/expanddata.cpp @@ -28,9 +28,9 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -ExpandData::ExpandData(const QString &path_, const QString &displayName_) - : path(path_), displayName(displayName_) -{} +ExpandData::ExpandData(const QString &path_, const QString &displayName_) : + path(path_), displayName(displayName_) +{ } bool ExpandData::operator==(const ExpandData &other) const { diff --git a/src/plugins/projectexplorer/extracompiler.cpp b/src/plugins/projectexplorer/extracompiler.cpp index 605e24252e..77f9961e2a 100644 --- a/src/plugins/projectexplorer/extracompiler.cpp +++ b/src/plugins/projectexplorer/extracompiler.cpp @@ -317,8 +317,7 @@ void ExtraCompilerPrivate::updateIssues() if (!lastEditor) return; - TextEditor::TextEditorWidget *widget = - qobject_cast<TextEditor::TextEditorWidget *>(lastEditor->widget()); + auto widget = qobject_cast<TextEditor::TextEditorWidget *>(lastEditor->widget()); if (!widget) return; diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 919b1ffa6d..c6a660ed3f 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -69,15 +69,14 @@ class DotRemovalFilter : public QSortFilterProxyModel { Q_OBJECT public: - explicit DotRemovalFilter(QObject *parent = 0); + explicit DotRemovalFilter(QObject *parent = nullptr); protected: virtual bool filterAcceptsRow(int source_row, const QModelIndex &parent) const; Qt::DropActions supportedDragActions() const; }; DotRemovalFilter::DotRemovalFilter(QObject *parent) : QSortFilterProxyModel(parent) -{ -} +{ } bool DotRemovalFilter::filterAcceptsRow(int source_row, const QModelIndex &parent) const { @@ -97,15 +96,13 @@ Qt::DropActions DotRemovalFilter::supportedDragActions() const class FolderNavigationModel : public QFileSystemModel { public: - explicit FolderNavigationModel(QObject *parent = 0); + explicit FolderNavigationModel(QObject *parent = nullptr); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; Qt::DropActions supportedDragActions() const; }; -FolderNavigationModel::FolderNavigationModel(QObject *parent) : - QFileSystemModel(parent) -{ -} +FolderNavigationModel::FolderNavigationModel(QObject *parent) : QFileSystemModel(parent) +{ } QVariant FolderNavigationModel::data(const QModelIndex &index, int role) const { @@ -125,15 +122,13 @@ Qt::DropActions FolderNavigationModel::supportedDragActions() const Shows a file system folder */ -FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) - : QWidget(parent), - m_listView(new Utils::ListView(this)), - m_fileSystemModel(new FolderNavigationModel(this)), - m_filterHiddenFilesAction(new QAction(tr("Show Hidden Files"), this)), - m_filterModel(new DotRemovalFilter(this)), - m_title(new Utils::ElidingLabel(this)), - m_autoSync(false), - m_toggleSync(new QToolButton(this)) +FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent), + m_listView(new Utils::ListView(this)), + m_fileSystemModel(new FolderNavigationModel(this)), + m_filterHiddenFilesAction(new QAction(tr("Show Hidden Files"), this)), + m_filterModel(new DotRemovalFilter(this)), + m_title(new Utils::ElidingLabel(this)), + m_toggleSync(new QToolButton(this)) { m_fileSystemModel->setResolveSymlinks(false); m_fileSystemModel->setIconProvider(Core::FileIconProvider::iconProvider()); @@ -154,7 +149,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) m_listView->setDragDropMode(QAbstractItemView::DragOnly); setFocusProxy(m_listView); - QVBoxLayout *layout = new QVBoxLayout(); + auto layout = new QVBoxLayout(); layout->addWidget(m_title); layout->addWidget(m_listView); m_title->setMargin(5); @@ -424,14 +419,14 @@ FolderNavigationWidgetFactory::FolderNavigationWidgetFactory() Core::NavigationView FolderNavigationWidgetFactory::createWidget() { Core::NavigationView n; - FolderNavigationWidget *fnw = new FolderNavigationWidget; + auto fnw = new FolderNavigationWidget; n.widget = fnw; - QToolButton *filter = new QToolButton; + auto filter = new QToolButton; filter->setIcon(Core::Icons::FILTER.icon()); filter->setToolTip(tr("Filter Files")); filter->setPopupMode(QToolButton::InstantPopup); filter->setProperty("noArrow", true); - QMenu *filterMenu = new QMenu(filter); + auto filterMenu = new QMenu(filter); filterMenu->addAction(fnw->m_filterHiddenFilesAction); filter->setMenu(filterMenu); n.dockToolBarWidgets << filter << fnw->m_toggleSync; @@ -440,7 +435,7 @@ Core::NavigationView FolderNavigationWidgetFactory::createWidget() void FolderNavigationWidgetFactory::saveSettings(int position, QWidget *widget) { - FolderNavigationWidget *fnw = qobject_cast<FolderNavigationWidget *>(widget); + auto fnw = qobject_cast<FolderNavigationWidget *>(widget); QTC_ASSERT(fnw, return); QSettings *settings = Core::ICore::settings(); const QString baseKey = QLatin1String("FolderNavigationWidget.") + QString::number(position); @@ -450,7 +445,7 @@ void FolderNavigationWidgetFactory::saveSettings(int position, QWidget *widget) void FolderNavigationWidgetFactory::restoreSettings(int position, QWidget *widget) { - FolderNavigationWidget *fnw = qobject_cast<FolderNavigationWidget *>(widget); + auto fnw = qobject_cast<FolderNavigationWidget *>(widget); QTC_ASSERT(fnw, return); QSettings *settings = Core::ICore::settings(); const QString baseKey = QLatin1String("FolderNavigationWidget.") + QString::number(position); diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h index 6caa8209a4..cf10b1c5f5 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.h +++ b/src/plugins/projectexplorer/foldernavigationwidget.h @@ -48,7 +48,7 @@ class FolderNavigationWidget : public QWidget Q_OBJECT Q_PROPERTY(bool autoSynchronization READ autoSynchronization WRITE setAutoSynchronization) public: - explicit FolderNavigationWidget(QWidget *parent = 0); + explicit FolderNavigationWidget(QWidget *parent = nullptr); static QStringList projectFilesInDirectory(const QString &path); @@ -80,8 +80,9 @@ private: QAction *m_filterHiddenFilesAction; QSortFilterProxyModel *m_filterModel; QLabel *m_title; - bool m_autoSync; + bool m_autoSync = false; QToolButton *m_toggleSync; + // FolderNavigationWidgetFactory needs private members to build a menu friend class FolderNavigationWidgetFactory; }; @@ -89,6 +90,7 @@ private: class FolderNavigationWidgetFactory : public Core::INavigationWidgetFactory { Q_OBJECT + public: FolderNavigationWidgetFactory(); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index dff1c85ecb..e657c0dea8 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -734,7 +734,7 @@ bool GccToolChain::operator ==(const ToolChain &other) const if (!ToolChain::operator ==(other)) return false; - const GccToolChain *gccTc = static_cast<const GccToolChain *>(&other); + auto gccTc = static_cast<const GccToolChain *>(&other); return m_compilerCommand == gccTc->m_compilerCommand && m_targetAbi == gccTc->m_targetAbi && m_platformCodeGenFlags == gccTc->m_platformCodeGenFlags && m_platformLinkerFlags == gccTc->m_platformLinkerFlags; @@ -817,7 +817,7 @@ ToolChain *GccToolChainFactory::restore(const QVariantMap &data) return tc; delete tc; - return 0; + return nullptr; } GccToolChain *GccToolChainFactory::createToolChain(bool autoDetect) @@ -883,8 +883,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) : ToolChainConfigWidget(tc), m_compilerCommand(new PathChooser), - m_abiWidget(new AbiWidget), - m_isReadOnly(false) + m_abiWidget(new AbiWidget) { Q_ASSERT(tc); @@ -920,7 +919,7 @@ void GccToolChainConfigWidget::applyImpl() if (toolChain()->isAutoDetected()) return; - GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); + auto tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); QString displayName = tc->displayName(); tc->setCompilerCommand(m_compilerCommand->fileName()); @@ -937,7 +936,7 @@ void GccToolChainConfigWidget::setFromToolchain() { // subwidgets are not yet connected! bool blocked = blockSignals(true); - GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); + auto tc = static_cast<GccToolChain *>(toolChain()); m_compilerCommand->setFileName(tc->compilerCommand()); m_platformCodeGenFlagsLineEdit->setText(QtcProcess::joinArgs(tc->platformCodeGenFlags())); m_platformLinkerFlagsLineEdit->setText(QtcProcess::joinArgs(tc->platformLinkerFlags())); @@ -949,7 +948,7 @@ void GccToolChainConfigWidget::setFromToolchain() bool GccToolChainConfigWidget::isDirtyImpl() const { - GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); + auto tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); return m_compilerCommand->fileName() != tc->compilerCommand() || m_platformCodeGenFlagsLineEdit->text() != QtcProcess::joinArgs(tc->platformCodeGenFlags()) @@ -1315,8 +1314,7 @@ GccToolChain *LinuxIccToolChainFactory::createToolChain(bool autoDetect) } GccToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, WarningFlags &flags) : - m_flags(flags), - m_triggered(false) + m_flags(flags) { if (!flag.startsWith(QLatin1String("-W"))) { m_triggered = true; diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index 33c900537a..cd651ab444 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -94,10 +94,10 @@ public: public: DetectedAbisResult() = default; DetectedAbisResult(const QList<Abi> &supportedAbis, - const QString &originalTargetTriple = QString()) - : supportedAbis(supportedAbis) - , originalTargetTriple(originalTargetTriple) - {} + const QString &originalTargetTriple = QString()) : + supportedAbis(supportedAbis), + originalTargetTriple(originalTargetTriple) + { } QList<Abi> supportedAbis; QString originalTargetTriple; @@ -132,15 +132,16 @@ protected: class WarningFlagAdder { - QByteArray m_flagUtf8; - WarningFlags &m_flags; - bool m_doesEnable; - bool m_triggered; public: WarningFlagAdder(const QString &flag, WarningFlags &flags); void operator ()(const char name[], WarningFlags flagsSet); bool triggered() const; + private: + QByteArray m_flagUtf8; + WarningFlags &m_flags; + bool m_doesEnable; + bool m_triggered = false; }; private: diff --git a/src/plugins/projectexplorer/gcctoolchainfactories.h b/src/plugins/projectexplorer/gcctoolchainfactories.h index 700e8d09eb..cdebccc27f 100644 --- a/src/plugins/projectexplorer/gcctoolchainfactories.h +++ b/src/plugins/projectexplorer/gcctoolchainfactories.h @@ -94,7 +94,7 @@ private: QLineEdit *m_platformLinkerFlagsLineEdit; AbiWidget *m_abiWidget; - bool m_isReadOnly; + bool m_isReadOnly = false; QByteArray m_macros; }; diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp index 271d65df64..1045138a94 100644 --- a/src/plugins/projectexplorer/gnumakeparser.cpp +++ b/src/plugins/projectexplorer/gnumakeparser.cpp @@ -41,9 +41,7 @@ namespace { const char * const MAKEFILE_PATTERN("^((.*?[/\\\\])?[Mm]akefile(\\.[a-zA-Z]+)?):(\\d+):\\s"); } -GnuMakeParser::GnuMakeParser() : - m_suppressIssues(false), - m_fatalErrorCount(0) +GnuMakeParser::GnuMakeParser() { setObjectName(QLatin1String("GnuMakeParser")); m_makeDir.setPattern(QLatin1String(MAKEEXEC_PATTERN) + diff --git a/src/plugins/projectexplorer/gnumakeparser.h b/src/plugins/projectexplorer/gnumakeparser.h index 97bd7805fc..9c5108bc4b 100644 --- a/src/plugins/projectexplorer/gnumakeparser.h +++ b/src/plugins/projectexplorer/gnumakeparser.h @@ -61,12 +61,13 @@ private: QStringList m_directories; + bool m_suppressIssues = false; + + int m_fatalErrorCount = 0; + #if defined WITH_TESTS friend class ProjectExplorerPlugin; #endif - bool m_suppressIssues; - - int m_fatalErrorCount; }; #if defined WITH_TESTS diff --git a/src/plugins/projectexplorer/headerpath.h b/src/plugins/projectexplorer/headerpath.h index 37200239a0..db3d5590b1 100644 --- a/src/plugins/projectexplorer/headerpath.h +++ b/src/plugins/projectexplorer/headerpath.h @@ -39,9 +39,7 @@ public: FrameworkHeaderPath }; - HeaderPath() : m_kind(GlobalHeaderPath) - { } - + HeaderPath() = default; HeaderPath(const QString &path, Kind kind) : m_path(path), m_kind(kind) { } @@ -55,7 +53,7 @@ public: private: QString m_path; - Kind m_kind; + Kind m_kind = GlobalHeaderPath; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/importwidget.cpp b/src/plugins/projectexplorer/importwidget.cpp index 2e6deeabef..d9bd629179 100644 --- a/src/plugins/projectexplorer/importwidget.cpp +++ b/src/plugins/projectexplorer/importwidget.cpp @@ -39,24 +39,24 @@ ImportWidget::ImportWidget(QWidget *parent) : m_pathChooser(new Utils::PathChooser) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - QVBoxLayout *vboxLayout = new QVBoxLayout(); + auto vboxLayout = new QVBoxLayout(); setLayout(vboxLayout); vboxLayout->setContentsMargins(0, 0, 0, 0); - Utils::DetailsWidget *detailsWidget = new Utils::DetailsWidget(this); + auto detailsWidget = new Utils::DetailsWidget(this); detailsWidget->setUseCheckBox(false); detailsWidget->setSummaryText(tr("Import Build From...")); detailsWidget->setSummaryFontBold(true); // m_detailsWidget->setIcon(); // FIXME: Set icon! vboxLayout->addWidget(detailsWidget); - QWidget *widget = new QWidget; - QVBoxLayout *layout = new QVBoxLayout(widget); + auto widget = new QWidget; + auto layout = new QVBoxLayout(widget); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_pathChooser); m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); m_pathChooser->setHistoryCompleter(QLatin1String("Import.SourceDir.History")); - QPushButton *importButton = new QPushButton(tr("Import"), widget); + auto importButton = new QPushButton(tr("Import"), widget); layout->addWidget(importButton); connect(importButton, &QAbstractButton::clicked, this, &ImportWidget::handleImportRequest); diff --git a/src/plugins/projectexplorer/importwidget.h b/src/plugins/projectexplorer/importwidget.h index dc3601c71d..9a55f64e1b 100644 --- a/src/plugins/projectexplorer/importwidget.h +++ b/src/plugins/projectexplorer/importwidget.h @@ -40,7 +40,7 @@ class ImportWidget : public QWidget Q_OBJECT public: - explicit ImportWidget(QWidget *parent = 0); + explicit ImportWidget(QWidget *parent = nullptr); void setCurrentDirectory(const Utils::FileName &dir); diff --git a/src/plugins/projectexplorer/ioutputparser.cpp b/src/plugins/projectexplorer/ioutputparser.cpp index 59efa62ef1..bf772e576c 100644 --- a/src/plugins/projectexplorer/ioutputparser.cpp +++ b/src/plugins/projectexplorer/ioutputparser.cpp @@ -224,4 +224,4 @@ QString IOutputParser::rightTrimmed(const QString &in) return in.mid(0, pos); } -} +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/ioutputparser.h b/src/plugins/projectexplorer/ioutputparser.h index 2ab74acbd5..7590ce2f7e 100644 --- a/src/plugins/projectexplorer/ioutputparser.h +++ b/src/plugins/projectexplorer/ioutputparser.h @@ -70,7 +70,7 @@ public slots: private: virtual void doFlush(); - IOutputParser *m_parser = 0; + IOutputParser *m_parser = nullptr; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/itaskhandler.h b/src/plugins/projectexplorer/itaskhandler.h index 307a15a330..9f8692bbf4 100644 --- a/src/plugins/projectexplorer/itaskhandler.h +++ b/src/plugins/projectexplorer/itaskhandler.h @@ -44,6 +44,8 @@ class PROJECTEXPLORER_EXPORT ITaskHandler : public QObject Q_OBJECT public: + virtual ~ITaskHandler() { } + virtual bool isDefaultHandler() const { return false; } virtual bool canHandle(const Task &) const = 0; virtual void handle(const Task &) = 0; diff --git a/src/plugins/projectexplorer/journaldwatcher.cpp b/src/plugins/projectexplorer/journaldwatcher.cpp index a702d18c95..5f8bebc83d 100644 --- a/src/plugins/projectexplorer/journaldwatcher.cpp +++ b/src/plugins/projectexplorer/journaldwatcher.cpp @@ -34,18 +34,14 @@ namespace ProjectExplorer { -JournaldWatcher *JournaldWatcher::m_instance = 0; +JournaldWatcher *JournaldWatcher::m_instance = nullptr; namespace Internal { class JournaldWatcherPrivate { public: - JournaldWatcherPrivate() : - m_journalContext(0), - m_notifier(0) - { } - + JournaldWatcherPrivate() = default; ~JournaldWatcherPrivate() { teardown(); @@ -67,8 +63,8 @@ public: }; QList<SubscriberInformation> m_subscriptions; - sd_journal *m_journalContext; - QSocketNotifier *m_notifier; + sd_journal *m_journalContext = nullptr; + QSocketNotifier *m_notifier = nullptr; }; bool JournaldWatcherPrivate::setup() @@ -96,11 +92,11 @@ bool JournaldWatcherPrivate::setup() void JournaldWatcherPrivate::teardown() { delete m_notifier; - m_notifier = 0; + m_notifier = nullptr; if (m_journalContext) { sd_journal_close(m_journalContext); - m_journalContext = 0; + m_journalContext = nullptr; } } @@ -130,16 +126,16 @@ JournaldWatcher::LogEntry JournaldWatcherPrivate::retrieveEntry() using namespace Internal; -static JournaldWatcherPrivate *d = 0; +static JournaldWatcherPrivate *d = nullptr; JournaldWatcher::~JournaldWatcher() { d->teardown(); - m_instance = 0; + m_instance = nullptr; delete d; - d = 0; + d = nullptr; } JournaldWatcher *JournaldWatcher::instance() diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index ca825246b3..b1b1c450ac 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -662,8 +662,7 @@ void PathChooserField::initializeData(MacroExpander *expander) CheckBoxField::CheckBoxField() : m_checkedValue(QLatin1String("0")), - m_uncheckedValue(QLatin1String("1")), - m_isModified(false) + m_uncheckedValue(QLatin1String("1")) { } bool CheckBoxField::parseData(const QVariant &data, QString *errorMessage) @@ -732,9 +731,6 @@ void CheckBoxField::initializeData(MacroExpander *expander) // ComboBoxFieldData: // -------------------------------------------------------------------- -ComboBoxField::ComboBoxField() : m_index(-1), m_disabledIndex(-1), m_savedIndex(-1) -{ } - struct ComboBoxItem { ComboBoxItem(const QString &k = QString(), const QString &v = QString(), const QVariant &c = true) : key(k), value(v), condition(c) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.h b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.h index debc1e6393..62c3556996 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.h @@ -107,16 +107,16 @@ public: }; JsonFieldPage(Utils::MacroExpander *expander, QWidget *parent = 0); - ~JsonFieldPage(); + ~JsonFieldPage() override; typedef std::function<Field *()> FieldFactory; static void registerFieldFactory(const QString &id, const FieldFactory &ff); bool setup(const QVariant &data); - bool isComplete() const; - void initializePage(); - void cleanupPage(); + bool isComplete() const override; + void initializePage() override; + void cleanupPage() override; QFormLayout *layout() const { return m_formLayout; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h index 4a03d114fc..0e67fdff7f 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h @@ -53,7 +53,7 @@ public: QVariant m_isCompleteExpando; QString m_isCompleteExpandoMessage; - QWidget *m_widget = 0; + QWidget *m_widget = nullptr; }; // -------------------------------------------------------------------- @@ -66,8 +66,8 @@ public: LabelField(); private: - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); - bool parseData(const QVariant &data, QString *errorMessage); + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; + bool parseData(const QVariant &data, QString *errorMessage) override; bool m_wordWrap; QString m_text; @@ -78,11 +78,11 @@ class SpacerField : public JsonFieldPage::Field public: SpacerField(); - bool suppressName() const { return true; } + bool suppressName() const override { return true; } private: - bool parseData(const QVariant &data, QString *errorMessage); - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); + bool parseData(const QVariant &data, QString *errorMessage) override; + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; int m_factor; }; @@ -93,13 +93,13 @@ public: LineEditField(); private: - bool parseData(const QVariant &data, QString *errorMessage); - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); + bool parseData(const QVariant &data, QString *errorMessage) override; + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; - void setup(JsonFieldPage *page, const QString &name); + void setup(JsonFieldPage *page, const QString &name) override; - bool validate(Utils::MacroExpander *expander, QString *message); - void initializeData(Utils::MacroExpander *expander); + bool validate(Utils::MacroExpander *expander, QString *message) override; + void initializeData(Utils::MacroExpander *expander) override; bool m_isModified; bool m_isValidating; @@ -119,13 +119,13 @@ public: TextEditField(); private: - bool parseData(const QVariant &data, QString *errorMessage); - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); + bool parseData(const QVariant &data, QString *errorMessage) override; + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; - void setup(JsonFieldPage *page, const QString &name); + void setup(JsonFieldPage *page, const QString &name) override; - bool validate(Utils::MacroExpander *expander, QString *message); - void initializeData(Utils::MacroExpander *expander); + bool validate(Utils::MacroExpander *expander, QString *message) override; + void initializeData(Utils::MacroExpander *expander) override; QString m_defaultText; bool m_acceptRichText; @@ -140,15 +140,15 @@ public: PathChooserField(); private: - bool parseData(const QVariant &data, QString *errorMessage); + bool parseData(const QVariant &data, QString *errorMessage) override; - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); - void setEnabled(bool e); + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; + void setEnabled(bool e) override; - void setup(JsonFieldPage *page, const QString &name); + void setup(JsonFieldPage *page, const QString &name) override; - bool validate(Utils::MacroExpander *expander, QString *message); - void initializeData(Utils::MacroExpander *expander); + bool validate(Utils::MacroExpander *expander, QString *message) override; + void initializeData(Utils::MacroExpander *expander) override; QString m_path; QString m_basePath; @@ -163,47 +163,47 @@ class CheckBoxField : public JsonFieldPage::Field public: CheckBoxField(); - bool suppressName() const { return true; } + bool suppressName() const override { return true; } private: - bool parseData(const QVariant &data, QString *errorMessage); + bool parseData(const QVariant &data, QString *errorMessage) override; - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; - void setup(JsonFieldPage *page, const QString &name); + void setup(JsonFieldPage *page, const QString &name) override; - bool validate(Utils::MacroExpander *expander, QString *message); - void initializeData(Utils::MacroExpander *expander); + bool validate(Utils::MacroExpander *expander, QString *message) override; + void initializeData(Utils::MacroExpander *expander) override; QString m_checkedValue; QString m_uncheckedValue; QVariant m_checkedExpression; - bool m_isModified; + bool m_isModified = false; }; class ComboBoxField : public JsonFieldPage::Field { public: - ComboBoxField(); + ComboBoxField() = default; private: - bool parseData(const QVariant &data, QString *errorMessage); + bool parseData(const QVariant &data, QString *errorMessage) override; - QWidget *createWidget(const QString &displayName, JsonFieldPage *page); + QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override; - void setup(JsonFieldPage *page, const QString &name); + void setup(JsonFieldPage *page, const QString &name) override; - bool validate(Utils::MacroExpander *expander, QString *message); - void initializeData(Utils::MacroExpander *expander); + bool validate(Utils::MacroExpander *expander, QString *message) override; + void initializeData(Utils::MacroExpander *expander) override; QStringList m_itemList; QStringList m_itemDataList; QVariantList m_itemConditionList; - int m_index; - int m_disabledIndex; + int m_index = -1; + int m_disabledIndex = -1; - mutable int m_savedIndex; + mutable int m_savedIndex = -1; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp index cbaf11d8b9..865ee82865 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp @@ -32,13 +32,12 @@ namespace ProjectExplorer { -JsonFilePage::JsonFilePage(QWidget *parent) : - Utils::FileWizardPage(parent) +JsonFilePage::JsonFilePage(QWidget *parent) : Utils::FileWizardPage(parent) { } void JsonFilePage::initializePage() { - JsonWizard *wiz = qobject_cast<JsonWizard *>(wizard()); + auto wiz = qobject_cast<JsonWizard *>(wizard()); if (!wiz) return; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h index 744e81e369..1bdeb5b8f4 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h @@ -35,10 +35,10 @@ class JsonFilePage : public Utils::FileWizardPage Q_OBJECT public: - JsonFilePage(QWidget *parent = 0); + JsonFilePage(QWidget *parent = nullptr); - void initializePage(); - bool validatePage(); + void initializePage() override; + bool validatePage() override; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp index aed65d3cce..4275f6db5d 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp @@ -52,7 +52,7 @@ JsonKitsPage::JsonKitsPage(QWidget *parent) : TargetSetupPage(parent) void JsonKitsPage::initializePage() { - JsonWizard *wiz = qobject_cast<JsonWizard *>(wizard()); + auto wiz = qobject_cast<JsonWizard *>(wizard()); QTC_ASSERT(wiz, return); connect(wiz, &JsonWizard::filesPolished, this, &JsonKitsPage::setupProjectFiles); @@ -72,10 +72,10 @@ void JsonKitsPage::initializePage() void JsonKitsPage::cleanupPage() { - JsonWizard *wiz = qobject_cast<JsonWizard *>(wizard()); + auto wiz = qobject_cast<JsonWizard *>(wizard()); QTC_ASSERT(wiz, return); - disconnect(wiz, &JsonWizard::allDone, this, 0); + disconnect(wiz, &JsonWizard::allDone, this, nullptr); TargetSetupPage::cleanupPage(); } @@ -102,7 +102,7 @@ void JsonKitsPage::setPreferredFeatures(const QVariant &data) void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files) { - Project *project = 0; + Project *project = nullptr; QList<IProjectManager *> managerList = ExtensionSystem::PluginManager::getObjects<IProjectManager>(); foreach (const JsonWizard::GeneratorFile &f, files) { @@ -122,7 +122,7 @@ void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files) if (setupProject(project)) project->saveSettings(); delete project; - project = 0; + project = nullptr; } } } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h index 28ac2af4f1..35077a2405 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h @@ -38,10 +38,10 @@ class JsonKitsPage : public TargetSetupPage Q_OBJECT public: - JsonKitsPage(QWidget *parent = 0); + JsonKitsPage(QWidget *parent = nullptr); - void initializePage(); - void cleanupPage(); + void initializePage() override; + void cleanupPage() override; void setUnexpandedProjectPath(const QString &path); QString unexpandedProjectPath() const; @@ -70,7 +70,7 @@ private: QVector<ConditionalFeature> m_preferredFeatures; QSet<Core::Id> evaluate(const QVector<ConditionalFeature> &list, const QVariant &defaultSet, - JsonWizard *wiz); + JsonWizard *wiz); }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp index c44ce5d2db..b23b000d30 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp @@ -35,13 +35,12 @@ namespace ProjectExplorer { -JsonProjectPage::JsonProjectPage(QWidget *parent) : - Utils::ProjectIntroPage(parent) +JsonProjectPage::JsonProjectPage(QWidget *parent) : Utils::ProjectIntroPage(parent) { } void JsonProjectPage::initializePage() { - JsonWizard *wiz = qobject_cast<JsonWizard *>(wizard()); + auto wiz = qobject_cast<JsonWizard *>(wizard()); QTC_ASSERT(wiz, return); setPath(wiz->stringValue(QLatin1String("InitialPath"))); @@ -81,7 +80,6 @@ QString JsonProjectPage::uniqueProjectName(const QString &path) if (!pathDir.exists(name)) return name; } - return prefix; } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.h b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.h index 17ecc63e80..b362b98894 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.h @@ -35,10 +35,10 @@ class JsonProjectPage : public Utils::ProjectIntroPage Q_OBJECT public: - JsonProjectPage(QWidget *parent = 0); + JsonProjectPage(QWidget *parent = nullptr); - void initializePage(); - bool validatePage(); + void initializePage() override; + bool validatePage() override; static QString uniqueProjectName(const QString &path); }; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp index 6fee29f61a..909f690b22 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp @@ -80,7 +80,7 @@ static IWizardFactory::WizardKind wizardKind(JsonWizard *wiz) JsonSummaryPage::JsonSummaryPage(QWidget *parent) : Internal::ProjectWizardPage(parent), - m_wizard(0) + m_wizard(nullptr) { connect(this, &Internal::ProjectWizardPage::projectNodeChanged, this, &JsonSummaryPage::summarySettingsHaveChanged); @@ -96,6 +96,7 @@ void JsonSummaryPage::setHideProjectUiValue(const QVariant &hideProjectUiValue) void JsonSummaryPage::initializePage() { m_wizard = qobject_cast<JsonWizard *>(wizard()); + QTC_ASSERT(m_wizard, return); m_wizard->setValue(QLatin1String(KEY_SELECTED_PROJECT), QVariant()); m_wizard->setValue(QLatin1String(KEY_SELECTED_NODE), QVariant()); @@ -147,7 +148,7 @@ bool JsonSummaryPage::validatePage() void JsonSummaryPage::cleanupPage() { - disconnect(m_wizard, &JsonWizard::filesReady, this, 0); + disconnect(m_wizard, &JsonWizard::filesReady, this, nullptr); } void JsonSummaryPage::triggerCommit(const JsonWizard::GeneratorFiles &files) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h index 9ca0ad20c5..6ea9598bb3 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h @@ -40,12 +40,12 @@ class JsonSummaryPage : public Internal::ProjectWizardPage Q_OBJECT public: - JsonSummaryPage(QWidget *parent = 0); + JsonSummaryPage(QWidget *parent = nullptr); void setHideProjectUiValue(const QVariant &hideProjectUiValue); - void initializePage(); - bool validatePage(); - void cleanupPage(); + void initializePage() override; + bool validatePage() override; + void cleanupPage() override; public slots: void triggerCommit(const JsonWizard::GeneratorFiles &files); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index d95b4e1802..3c2a247e9a 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -44,8 +44,7 @@ namespace ProjectExplorer { -JsonWizard::JsonWizard(QWidget *parent) : - Utils::Wizard(parent) +JsonWizard::JsonWizard(QWidget *parent) : Utils::Wizard(parent) { setMinimumSize(800, 500); m_expander.registerExtraResolver([this](const QString &name, QString *ret) -> bool { @@ -298,7 +297,7 @@ void JsonWizard::reject() void JsonWizard::handleNewPages(int pageId) { - Utils::WizardPage *wp = qobject_cast<Utils::WizardPage *>(page(pageId)); + auto wp = qobject_cast<Utils::WizardPage *>(page(pageId)); if (!wp) return; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h index 5fdfe27561..d571f9cab7 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h @@ -46,7 +46,7 @@ class PROJECTEXPLORER_EXPORT JsonWizard : public Utils::Wizard public: class GeneratorFile { public: - GeneratorFile() : generator(0) { } + GeneratorFile() : generator(nullptr) { } GeneratorFile(const Core::GeneratedFile &f, JsonWizardGenerator *g) : file(f), generator(g) { } @@ -59,8 +59,8 @@ public: typedef QList<GeneratorFile> GeneratorFiles; Q_PROPERTY(GeneratorFiles generateFileList READ generateFileList) - explicit JsonWizard(QWidget *parent = 0); - ~JsonWizard(); + explicit JsonWizard(QWidget *parent = nullptr); + ~JsonWizard() override; void addGenerator(JsonWizardGenerator *gen); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 8e5b279937..7856a08b28 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -308,7 +308,7 @@ JsonWizardFactory *JsonWizardFactory::createWizardFactory(const QVariantMap &dat JsonWizardFactory *factory = new JsonWizardFactory; if (!factory->initialize(data, baseDir, errorMessage)) { delete factory; - factory = 0; + factory = nullptr; } return factory; } @@ -350,9 +350,6 @@ void JsonWizardFactory::registerGeneratorFactory(JsonWizardGeneratorFactory *fac s_generatorFactories.append(factory); } -JsonWizardFactory::~JsonWizardFactory() -{ } - Utils::Wizard *JsonWizardFactory::runWizardImpl(const QString &path, QWidget *parent, Core::Id platform, const QVariantMap &variables) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h index 7ae4a43f6d..3722f10318 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h @@ -81,8 +81,6 @@ public: static void registerPageFactory(JsonWizardPageFactory *factory); static void registerGeneratorFactory(JsonWizardGeneratorFactory *factory); - ~JsonWizardFactory(); - static QList<QVariant> objectOrList(const QVariant &data, QString *errorMessage); static QString localizedString(const QVariant &value); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h index 5f9597079b..52bee65d6e 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h @@ -40,9 +40,9 @@ public: Core::GeneratedFiles fileList(Utils::MacroExpander *expander, const QString &wizardDir, const QString &projectDir, - QString *errorMessage); + QString *errorMessage) override; - bool writeFile(const JsonWizard *wizard, Core::GeneratedFile *file, QString *errorMessage); + bool writeFile(const JsonWizard *wizard, Core::GeneratedFile *file, QString *errorMessage) override; private: class File { @@ -60,7 +60,7 @@ private: }; Core::GeneratedFile generateFile(const File &file, Utils::MacroExpander *expander, - QString *errorMessage); + QString *errorMessage); QList<File> m_fileList; }; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp index 7f45ddf47e..79b29c8f7c 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.cpp @@ -92,10 +92,10 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi if (!languageId.isValid()) return true; // don't modify files like *.ui, *.pro - Project *baseProject = qobject_cast<Project *>(wizard->property("SelectedProject").value<QObject *>()); + auto baseProject = qobject_cast<Project *>(wizard->property("SelectedProject").value<QObject *>()); ICodeStylePreferencesFactory *factory = TextEditorSettings::codeStyleFactory(languageId); - Indenter *indenter = 0; + Indenter *indenter = nullptr; if (factory) indenter = factory->createIndenter(); if (!indenter) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.h index 9621e5beae..04997198c8 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardgeneratorfactory.h @@ -99,8 +99,8 @@ public: JsonWizardGenerator *create(Core::Id typeId, const QVariant &data, const QString &path, Core::Id platform, - const QVariantMap &variables); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + const QVariantMap &variables) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; class ScannerGeneratorFactory : public JsonWizardGeneratorFactory @@ -112,8 +112,8 @@ public: JsonWizardGenerator *create(Core::Id typeId, const QVariant &data, const QString &path, Core::Id platform, - const QVariantMap &variables); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + const QVariantMap &variables) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp index c3abd6be12..89fa6cb23b 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp @@ -63,13 +63,13 @@ Utils::WizardPage *FieldPageFactory::create(JsonWizard *wizard, Core::Id typeId, { Q_UNUSED(wizard); - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); - JsonFieldPage *page = new JsonFieldPage(wizard->expander()); + auto page = new JsonFieldPage(wizard->expander()); if (!page->setup(data)) { delete page; - return 0; + return nullptr; } return page; @@ -110,10 +110,9 @@ Utils::WizardPage *FilePageFactory::create(JsonWizard *wizard, Core::Id typeId, { Q_UNUSED(wizard); Q_UNUSED(data); - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); - JsonFilePage *page = new JsonFilePage; - return page; + return new JsonFilePage; } bool FilePageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) @@ -144,9 +143,9 @@ KitsPageFactory::KitsPageFactory() Utils::WizardPage *KitsPageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) { Q_UNUSED(wizard); - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); - JsonKitsPage *page = new JsonKitsPage; + auto page = new JsonKitsPage; const QVariantMap dataMap = data.toMap(); page->setUnexpandedProjectPath(dataMap.value(QLatin1String(KEY_PROJECT_FILE)).toString()); page->setRequiredFeatures(dataMap.value(QLatin1String(KEY_REQUIRED_FEATURES))); @@ -205,9 +204,9 @@ Utils::WizardPage *ProjectPageFactory::create(JsonWizard *wizard, Core::Id typeI { Q_UNUSED(wizard); Q_UNUSED(data); - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); - JsonProjectPage *page = new JsonProjectPage; + auto page = new JsonProjectPage; QVariantMap tmp = data.isNull() ? QVariantMap() : data.toMap(); QString description @@ -265,9 +264,9 @@ Utils::WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Core::Id typeI { Q_UNUSED(wizard); Q_UNUSED(data); - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); - JsonSummaryPage *page = new JsonSummaryPage; + auto page = new JsonSummaryPage; QVariant hideProjectUi = data.toMap().value(QLatin1String(KEY_HIDE_PROJECT_UI)); page->setHideProjectUiValue(hideProjectUi); return page; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h index fe8f13221c..447842a889 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h @@ -35,8 +35,8 @@ class FieldPageFactory : public JsonWizardPageFactory public: FieldPageFactory(); - Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; class FilePageFactory : public JsonWizardPageFactory @@ -44,8 +44,8 @@ class FilePageFactory : public JsonWizardPageFactory public: FilePageFactory(); - Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; class KitsPageFactory : public JsonWizardPageFactory @@ -53,8 +53,8 @@ class KitsPageFactory : public JsonWizardPageFactory public: KitsPageFactory(); - Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; class ProjectPageFactory : public JsonWizardPageFactory @@ -62,8 +62,8 @@ class ProjectPageFactory : public JsonWizardPageFactory public: ProjectPageFactory(); - Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; class SummaryPageFactory : public JsonWizardPageFactory @@ -71,8 +71,8 @@ class SummaryPageFactory : public JsonWizardPageFactory public: SummaryPageFactory(); - Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); - bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) override; + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) override; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.h index 01930a847d..e852ad1fe0 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.h @@ -42,7 +42,7 @@ public: Core::GeneratedFiles fileList(Utils::MacroExpander *expander, const QString &wizardDir, const QString &projectDir, - QString *errorMessage); + QString *errorMessage) override; private: Core::GeneratedFiles scan(const QString &dir, const QDir &base); diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index f05d0da8c0..30d193ce60 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -72,14 +72,7 @@ class KitPrivate public: KitPrivate(Id id, Kit *kit) : - m_id(id), - m_nestedBlockingLevel(0), - m_autodetected(false), - m_sdkProvided(false), - m_isValid(true), - m_hasWarning(false), - m_hasValidityInfo(false), - m_mustNotify(false) + m_id(id) { if (!id.isValid()) m_id = Id::fromString(QUuid::createUuid().toString()); @@ -116,13 +109,13 @@ public: QString m_fileSystemFriendlyName; QString m_autoDetectionSource; Id m_id; - int m_nestedBlockingLevel; - bool m_autodetected; - bool m_sdkProvided; - bool m_isValid; - bool m_hasWarning; - bool m_hasValidityInfo; - bool m_mustNotify; + int m_nestedBlockingLevel = 0; + bool m_autodetected = false; + bool m_sdkProvided = false; + bool m_isValid = true; + bool m_hasWarning = false; + bool m_hasValidityInfo = false; + bool m_mustNotify = false; QIcon m_icon; FileName m_iconPath; @@ -210,7 +203,7 @@ void Kit::unblockNotification() Kit *Kit::clone(bool keepName) const { - Kit *k = new Kit; + auto k = new Kit; if (keepName) k->d->m_unexpandedDisplayName = d->m_unexpandedDisplayName; else @@ -512,7 +505,7 @@ void Kit::addToEnvironment(Environment &env) const IOutputParser *Kit::createOutputParser() const { - IOutputParser *first = new OsParser; + auto first = new OsParser; QList<KitInformation *> infoList = KitManager::kitInformation(); foreach (KitInformation *ki, infoList) first->appendOutputParser(ki->createOutputParser(this)); diff --git a/src/plugins/projectexplorer/kit.h b/src/plugins/projectexplorer/kit.h index 00cb589ec4..f50c94f44f 100644 --- a/src/plugins/projectexplorer/kit.h +++ b/src/plugins/projectexplorer/kit.h @@ -42,6 +42,7 @@ namespace ProjectExplorer { class IOutputParser; namespace Internal { +class KitManagerPrivate; class KitModel; class KitPrivate; } // namespace Internal @@ -139,6 +140,7 @@ private: friend class KitInformation; friend class KitManager; + friend class Internal::KitManagerPrivate; friend class Internal::KitModel; // needed for setAutoDetected() when cloning kits }; diff --git a/src/plugins/projectexplorer/kitchooser.cpp b/src/plugins/projectexplorer/kitchooser.cpp index 50f4a527f0..c08e1303f2 100644 --- a/src/plugins/projectexplorer/kitchooser.cpp +++ b/src/plugins/projectexplorer/kitchooser.cpp @@ -51,7 +51,7 @@ KitChooser::KitChooser(QWidget *parent) : m_chooser->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); m_manageButton = new QPushButton(KitConfigWidget::msgManage(), this); - QHBoxLayout *layout = new QHBoxLayout(this); + auto layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_chooser); layout->addWidget(m_manageButton); @@ -116,7 +116,7 @@ Kit *KitChooser::currentKit() const { const int index = m_chooser->currentIndex(); Core::ICore::settings()->setValue(QLatin1String(lastKitKey), index); - return index == -1 ? 0 : kitAt(index); + return index == -1 ? nullptr : kitAt(index); } void KitChooser::setCurrentKitId(Core::Id id) @@ -143,7 +143,7 @@ void KitChooser::setKitMatcher(const KitChooser::KitMatcher &matcher) Kit *KitChooser::kitAt(int index) const { - Core::Id id = qvariant_cast<Core::Id>(m_chooser->itemData(index)); + auto id = qvariant_cast<Core::Id>(m_chooser->itemData(index)); return KitManager::find(id); } diff --git a/src/plugins/projectexplorer/kitchooser.h b/src/plugins/projectexplorer/kitchooser.h index 95269a3daa..5bd3561844 100644 --- a/src/plugins/projectexplorer/kitchooser.h +++ b/src/plugins/projectexplorer/kitchooser.h @@ -48,7 +48,7 @@ class PROJECTEXPLORER_EXPORT KitChooser : public QWidget Q_OBJECT public: - explicit KitChooser(QWidget *parent = 0); + explicit KitChooser(QWidget *parent = nullptr); void setCurrentKitId(Core::Id id); Core::Id currentKitId() const; diff --git a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp index a4ef73a5fc..b57bf86b25 100644 --- a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp @@ -430,13 +430,13 @@ void KitEnvironmentConfigWidget::editEnvironmentChanges() m_dialog = new QDialog(m_summaryLabel); m_dialog->setWindowTitle(tr("Edit Environment Changes")); - QVBoxLayout *layout = new QVBoxLayout(m_dialog); + auto layout = new QVBoxLayout(m_dialog); m_editor = new QPlainTextEdit; m_editor->setToolTip(tr("Enter one variable per line with the variable name " "separated from the variable value by \"=\".<br>" "Environment variables can be referenced with ${OTHER}.")); - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply|QDialogButtonBox::Cancel); + auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply|QDialogButtonBox::Cancel); layout->addWidget(m_editor); layout->addWidget(buttons); @@ -462,8 +462,8 @@ void KitEnvironmentConfigWidget::applyChanges() void KitEnvironmentConfigWidget::closeChangesDialog() { m_dialog->deleteLater(); - m_dialog = 0; - m_editor = 0; + m_dialog = nullptr; + m_editor = nullptr; } void KitEnvironmentConfigWidget::acceptChangesDialog() diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index aa05440e0a..236058ea71 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -71,22 +71,19 @@ static FileName settingsFileName() class KitManagerPrivate { public: - KitManagerPrivate(); ~KitManagerPrivate(); - Kit *m_defaultKit; - bool m_initialized; + Kit *m_defaultKit = nullptr; + bool m_initialized = false; QList<KitInformation *> m_informationList; QList<Kit *> m_kitList; - PersistentSettingsWriter *m_writer; + PersistentSettingsWriter *m_writer = nullptr; }; -KitManagerPrivate::KitManagerPrivate() : - m_defaultKit(0), m_initialized(false), m_writer(0) -{ } - KitManagerPrivate::~KitManagerPrivate() { + foreach (Kit *k, m_kitList) + delete k; qDeleteAll(m_informationList); delete m_writer; } @@ -97,8 +94,8 @@ KitManagerPrivate::~KitManagerPrivate() // KitManager: // -------------------------------------------------------------------------- -static Internal::KitManagerPrivate *d; -static KitManager *m_instance; +static Internal::KitManagerPrivate *d = nullptr; +static KitManager *m_instance = nullptr; KitManager *KitManager::instance() { @@ -230,11 +227,9 @@ void KitManager::restoreKits() KitManager::~KitManager() { - foreach (Kit *k, d->m_kitList) - delete k; - d->m_kitList.clear(); delete d; - m_instance = 0; + d = nullptr; + m_instance = nullptr; } void KitManager::saveKits() @@ -480,14 +475,7 @@ void KitManager::deregisterKit(Kit *k) return; d->m_kitList.removeOne(k); if (defaultKit() == k) { - QList<Kit *> stList = kits(); - Kit *newDefault = 0; - foreach (Kit *cur, stList) { - if (cur->isValid()) { - newDefault = cur; - break; - } - } + Kit *newDefault = Utils::findOrDefault(kits(), [](Kit *k) { return k->isValid(); }); setDefaultKit(newDefault); } emit m_instance->kitRemoved(k); diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index 3a9ccd9b5d..a34f567cf3 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -168,7 +168,7 @@ signals: void kitsLoaded(); private: - explicit KitManager(QObject *parent = 0); + explicit KitManager(QObject *parent = nullptr); // Make sure the this is only called after all // KitInformation are registered! diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp index 0079d650e0..d5b4d60e87 100644 --- a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp @@ -60,12 +60,10 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) : m_nameEdit(new QLineEdit), m_fileSystemFriendlyNameLineEdit(new QLineEdit), m_kit(k), - m_modifiedKit(new Kit(Core::Id(WORKING_COPY_KIT_ID))), - m_fixingKit(false), - m_hasUniqueName(true) + m_modifiedKit(new Kit(Core::Id(WORKING_COPY_KIT_ID))) { - static const Qt::Alignment alignment - = static_cast<Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); + static auto alignment + = static_cast<const Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); m_layout->addWidget(m_nameEdit, 0, WidgetColumn); m_layout->addWidget(m_iconButton, 0, ButtonColumn); @@ -86,10 +84,10 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) : connect(m_fileSystemFriendlyNameLineEdit, &QLineEdit::textChanged, this, &KitManagerConfigWidget::setFileSystemFriendlyName); - QWidget *inner = new QWidget; + auto inner = new QWidget; inner->setLayout(m_layout); - QGridLayout *mainLayout = new QGridLayout(this); + auto mainLayout = new QGridLayout(this); mainLayout->setMargin(1); mainLayout->addWidget(inner, 0, 0); @@ -207,7 +205,7 @@ void KitManagerConfigWidget::addConfigWidget(KitConfigWidget *widget) QString name = widget->displayName(); QString toolTip = widget->toolTip(); - QAction *action = new QAction(tr("Mark as Mutable"), 0); + auto action = new QAction(tr("Mark as Mutable"), 0); action->setCheckable(true); action->setChecked(widget->isMutable()); action->setEnabled(!widget->isSticky()); @@ -225,8 +223,8 @@ void KitManagerConfigWidget::addConfigWidget(KitConfigWidget *widget) if (QWidget *button = widget->buttonWidget()) m_layout->addWidget(button, row, ButtonColumn); - static const Qt::Alignment alignment - = static_cast<Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); + static auto alignment + = static_cast<const Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)); QLabel *label = createLabel(name, toolTip); m_layout->addWidget(label, row, LabelColumn, alignment); m_widgets.append(widget); @@ -365,7 +363,7 @@ void KitManagerConfigWidget::showEvent(QShowEvent *event) QLabel *KitManagerConfigWidget::createLabel(const QString &name, const QString &toolTip) { - QLabel *label = new QLabel(name); + auto label = new QLabel(name); label->setToolTip(toolTip); return label; } diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.h b/src/plugins/projectexplorer/kitmanagerconfigwidget.h index 86ae1d1a0b..2054304a5b 100644 --- a/src/plugins/projectexplorer/kitmanagerconfigwidget.h +++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.h @@ -97,9 +97,9 @@ private: QList<QLabel *> m_labels; Kit *m_kit; Kit *m_modifiedKit; - bool m_isDefaultKit; - bool m_fixingKit; - bool m_hasUniqueName; + bool m_isDefaultKit = false; + bool m_fixingKit = false; + bool m_hasUniqueName = true; QList<QAction *> m_actions; mutable QString m_cachedDisplayName; }; diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 35196fcfaa..e932c53673 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -102,11 +102,8 @@ public: // KitModel // -------------------------------------------------------------------------- -KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent) : - TreeModel(parent), - m_parentLayout(parentLayout), - m_defaultNode(0), - m_keepUnique(true) +KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent) : TreeModel(parent), + m_parentLayout(parentLayout) { setHeader(QStringList(tr("Name"))); m_autoRoot = new TreeItem(QStringList(tr("Auto-detected"))); @@ -140,7 +137,7 @@ Kit *KitModel::kit(const QModelIndex &index) KitNode *KitModel::kitNode(const QModelIndex &index) { TreeItem *n = itemForIndex(index); - return n && n->level() == 2 ? static_cast<KitNode *>(n) : 0; + return (n && n->level() == 2) ? static_cast<KitNode *>(n) : nullptr; } QModelIndex KitModel::indexOf(Kit *k) const @@ -168,12 +165,12 @@ KitManagerConfigWidget *KitModel::widget(const QModelIndex &index) void KitModel::isAutoDetectedChanged() { - KitManagerConfigWidget *w = qobject_cast<KitManagerConfigWidget *>(sender()); + auto w = qobject_cast<KitManagerConfigWidget *>(sender()); int idx = -1; idx = Utils::indexOf(m_manualRoot->children(), [w](TreeItem *node) { return static_cast<KitNode *>(node)->widget == w; }); - TreeItem *oldParent = 0; + TreeItem *oldParent = nullptr; TreeItem *newParent = w->workingCopy()->isAutoDetected() ? m_autoRoot : m_manualRoot; if (idx != -1) { oldParent = m_manualRoot; @@ -284,7 +281,7 @@ KitNode *KitModel::findWorkingCopy(Kit *k) const KitNode *KitModel::createNode(Kit *k) { - KitNode *node = new KitNode(k); + auto node = new KitNode(k); m_parentLayout->addWidget(node->widget); connect(node->widget, &KitManagerConfigWidget::dirty, [this, node] { if (m_autoRoot->children().contains(node) diff --git a/src/plugins/projectexplorer/kitmodel.h b/src/plugins/projectexplorer/kitmodel.h index 545130e8ff..9ddda63169 100644 --- a/src/plugins/projectexplorer/kitmodel.h +++ b/src/plugins/projectexplorer/kitmodel.h @@ -53,7 +53,7 @@ class KitModel : public Utils::TreeModel Q_OBJECT public: - explicit KitModel(QBoxLayout *parentLayout, QObject *parent = 0); + explicit KitModel(QBoxLayout *parentLayout, QObject *parent = nullptr); Kit *kit(const QModelIndex &); KitNode *kitNode(const QModelIndex &); @@ -90,9 +90,9 @@ private: QList<KitNode *> m_toRemoveList; QBoxLayout *m_parentLayout; - KitNode *m_defaultNode; + KitNode *m_defaultNode = nullptr; - bool m_keepUnique; + bool m_keepUnique = true; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/kitoptionspage.cpp b/src/plugins/projectexplorer/kitoptionspage.cpp index 4da68df9dd..2d7d8a4c57 100644 --- a/src/plugins/projectexplorer/kitoptionspage.cpp +++ b/src/plugins/projectexplorer/kitoptionspage.cpp @@ -262,7 +262,7 @@ void KitOptionsPage::finish() { if (m_widget) { delete m_widget; - m_widget = 0; + m_widget = nullptr; } } diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp index 4ed2e2b077..4e64f56b3c 100644 --- a/src/plugins/projectexplorer/linuxiccparser.cpp +++ b/src/plugins/projectexplorer/linuxiccparser.cpp @@ -31,8 +31,8 @@ using namespace ProjectExplorer; -LinuxIccParser::LinuxIccParser() - : m_expectFirstLine(true), m_indent(0), m_temporary(Task()) +LinuxIccParser::LinuxIccParser() : + m_temporary(Task()) { setObjectName(QLatin1String("LinuxIccParser")); // main.cpp(53): error #308: function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible diff --git a/src/plugins/projectexplorer/linuxiccparser.h b/src/plugins/projectexplorer/linuxiccparser.h index 866e5cfb5d..bfb57d850c 100644 --- a/src/plugins/projectexplorer/linuxiccparser.h +++ b/src/plugins/projectexplorer/linuxiccparser.h @@ -49,8 +49,8 @@ private: QRegExp m_caretLine; QRegExp m_pchInfoLine; - bool m_expectFirstLine; - int m_indent; + bool m_expectFirstLine = true; + int m_indent = 0; Task m_temporary; int m_lines = 0; }; diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp index 2e99c51b18..35a6c2c9e9 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp +++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp @@ -131,8 +131,8 @@ void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatu static bool isLocal(RunConfiguration *runConfiguration) { - Target *target = runConfiguration ? runConfiguration->target() : 0; - Kit *kit = target ? target->kit() : 0; + Target *target = runConfiguration ? runConfiguration->target() : nullptr; + Kit *kit = target ? target->kit() : nullptr; return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; } diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.h b/src/plugins/projectexplorer/localapplicationruncontrol.h index c4703d7132..940a5586ca 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.h +++ b/src/plugins/projectexplorer/localapplicationruncontrol.h @@ -35,7 +35,7 @@ class LocalApplicationRunControlFactory : public IRunControlFactory Q_OBJECT public: bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override; - RunControl* create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override; + RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 98f207e737..f4bef00484 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -166,8 +166,7 @@ void TargetSelectorDelegate::paint(QPainter *painter, //////// // ListWidget //////// -ListWidget::ListWidget(QWidget *parent) - : QListWidget(parent), m_maxCount(0), m_optimalWidth(0) +ListWidget::ListWidget(QWidget *parent) : QListWidget(parent) { setFocusPolicy(Qt::NoFocus); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -251,7 +250,7 @@ QListWidgetItem *ProjectListWidget::itemForProject(Project *project) if (currentItem->data(Qt::UserRole).value<Project*>() == project) return currentItem; } - return 0; + return nullptr; } QString ProjectListWidget::fullName(Project *project) @@ -264,7 +263,7 @@ void ProjectListWidget::addProject(Project *project) m_ignoreIndexChange = true; int pos = count(); - for (int i=0; i < count(); ++i) { + for (int i = 0; i < count(); ++i) { Project *p = item(i)->data(Qt::UserRole).value<Project*>(); if (projectLesserThan(project, p)) { pos = i; @@ -488,7 +487,7 @@ void GenericListWidget::rowChanged(int index) void GenericListWidget::displayNameChanged() { m_ignoreIndexChange = true; - ProjectConfiguration *activeProjectConfiguration = 0; + ProjectConfiguration *activeProjectConfiguration = nullptr; if (currentItem()) activeProjectConfiguration = currentItem()->data(Qt::UserRole).value<ProjectConfiguration *>(); @@ -536,7 +535,7 @@ QListWidgetItem *GenericListWidget::itemForProjectConfiguration(ProjectConfigura if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc) return lwi; } - return 0; + return nullptr; } ///////// @@ -544,7 +543,7 @@ QListWidgetItem *GenericListWidget::itemForProjectConfiguration(ProjectConfigura ///////// KitAreaWidget::KitAreaWidget(QWidget *parent) : QWidget(parent), - m_layout(new QGridLayout(this)), m_kit(0) + m_layout(new QGridLayout(this)) { m_layout->setMargin(3); setAutoFillBackground(true); @@ -553,7 +552,7 @@ KitAreaWidget::KitAreaWidget(QWidget *parent) : QWidget(parent), KitAreaWidget::~KitAreaWidget() { - setKit(0); + setKit(nullptr); } void KitAreaWidget::setKit(Kit *k) @@ -644,13 +643,8 @@ QWidget *MiniProjectTargetSelector::createTitleLabel(const QString &text) } MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorAction, QWidget *parent) : - QWidget(parent), m_projectAction(targetSelectorAction), - m_project(0), - m_target(0), - m_buildConfiguration(0), - m_deployConfiguration(0), - m_runConfiguration(0), - m_hideOnRelease(false) + QWidget(parent), + m_projectAction(targetSelectorAction) { QPalette p; p.setColor(QPalette::Foreground, creatorTheme()->color(Theme::MiniProjectTargetSelectorTextColor)); @@ -958,7 +952,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize) setFixedSize(m_summaryLabel->width() + 1, heightWithoutKitArea + kitAreaHeight); //1 extra pixel for the border } - QPoint moveTo = statusBar->mapToGlobal(QPoint(0,0)); + QPoint moveTo = statusBar->mapToGlobal(QPoint(0, 0)); moveTo -= QPoint(0, height()); move(moveTo); } @@ -1253,7 +1247,7 @@ void MiniProjectTargetSelector::changeStartupProject(Project *project) this, &MiniProjectTargetSelector::activeTargetChanged); activeTargetChanged(m_project->activeTarget()); } else { - activeTargetChanged(0); + activeTargetChanged(nullptr); } if (project) { @@ -1262,7 +1256,7 @@ void MiniProjectTargetSelector::changeStartupProject(Project *project) list.append(t); m_listWidgets[TARGET]->setProjectConfigurations(list, project->activeTarget()); } else { - m_listWidgets[TARGET]->setProjectConfigurations(QList<ProjectConfiguration *>(), 0); + m_listWidgets[TARGET]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr); } updateActionAndSummary(); @@ -1287,7 +1281,7 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target) m_target = target; - m_kitAreaWidget->setKit(m_target ? m_target->kit() : 0); + m_kitAreaWidget->setKit(m_target ? m_target->kit() : nullptr); m_listWidgets[TARGET]->setActiveProjectConfiguration(m_target); @@ -1344,12 +1338,12 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target) connect(m_target, &Target::activeRunConfigurationChanged, this, &MiniProjectTargetSelector::activeRunConfigurationChanged); } else { - m_listWidgets[BUILD]->setProjectConfigurations(QList<ProjectConfiguration *>(), 0); - m_listWidgets[DEPLOY]->setProjectConfigurations(QList<ProjectConfiguration *>(), 0); - m_listWidgets[RUN]->setProjectConfigurations(QList<ProjectConfiguration *>(), 0); - m_buildConfiguration = 0; - m_deployConfiguration = 0; - m_runConfiguration = 0; + m_listWidgets[BUILD]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr); + m_listWidgets[DEPLOY]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr); + m_listWidgets[RUN]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr); + m_buildConfiguration = nullptr; + m_deployConfiguration = nullptr; + m_runConfiguration = nullptr; } updateActionAndSummary(); } diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h index e099a075ea..9dd2e8fe57 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.h +++ b/src/plugins/projectexplorer/miniprojecttargetselector.h @@ -65,8 +65,8 @@ public: int padding(); private: - int m_maxCount; - int m_optimalWidth; + int m_maxCount = 0; + int m_optimalWidth = 0; }; class ProjectListWidget : public ListWidget @@ -74,7 +74,7 @@ class ProjectListWidget : public ListWidget Q_OBJECT public: - explicit ProjectListWidget(QWidget *parent = 0); + explicit ProjectListWidget(QWidget *parent = nullptr); private: void addProject(ProjectExplorer::Project *project); @@ -91,7 +91,7 @@ class KitAreaWidget : public QWidget { Q_OBJECT public: - explicit KitAreaWidget(QWidget *parent = 0); + explicit KitAreaWidget(QWidget *parent = nullptr); ~KitAreaWidget() override; void setKit(ProjectExplorer::Kit *k); @@ -100,7 +100,7 @@ private: void updateKit(ProjectExplorer::Kit *k); QGridLayout *m_layout; - Kit *m_kit; + Kit *m_kit = nullptr; QList<KitConfigWidget *> m_widgets; QList<QLabel *> m_labels; }; @@ -110,7 +110,7 @@ class GenericListWidget : public ListWidget Q_OBJECT public: - explicit GenericListWidget(QWidget *parent = 0); + explicit GenericListWidget(QWidget *parent = nullptr); signals: void changeActiveProjectConfiguration(ProjectExplorer::ProjectConfiguration *dc); @@ -134,7 +134,7 @@ class MiniProjectTargetSelector : public QWidget Q_OBJECT public: - explicit MiniProjectTargetSelector(QAction *projectAction, QWidget *parent = 0); + explicit MiniProjectTargetSelector(QAction *projectAction, QWidget *parent = nullptr); void setVisible(bool visible) override; void keyPressEvent(QKeyEvent *ke) override; @@ -202,12 +202,12 @@ private: QVector<QWidget *> m_titleWidgets; QLabel *m_summaryLabel; - Project *m_project; - Target *m_target; - BuildConfiguration *m_buildConfiguration; - DeployConfiguration *m_deployConfiguration; - RunConfiguration *m_runConfiguration; - bool m_hideOnRelease; + Project *m_project = nullptr; + Target *m_target = nullptr; + BuildConfiguration *m_buildConfiguration = nullptr; + DeployConfiguration *m_deployConfiguration = nullptr; + RunConfiguration *m_runConfiguration = nullptr; + bool m_hideOnRelease = false; QDateTime m_earliestHidetime; }; diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 308624b23a..696502117f 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -344,14 +344,12 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(Utils::Environment& env MsvcToolChain::MsvcToolChain(const QString &name, const Abi &abi, const QString &varsBat, const QString &varsBatArg, Detection d) : MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID, name, abi, varsBat, varsBatArg, d) -{ -} +{ } MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &abi, const QString &varsBat, const QString &varsBatArg, - Detection d) - : AbstractMsvcToolChain(typeId, d, abi, varsBat) - , m_varsBatArg(varsBatArg) + Detection d) : AbstractMsvcToolChain(typeId, d, abi, varsBat), + m_varsBatArg(varsBatArg) { Q_ASSERT(!name.isEmpty()); @@ -368,12 +366,10 @@ bool MsvcToolChain::isValid() const MsvcToolChain::MsvcToolChain(Core::Id typeId) : AbstractMsvcToolChain(typeId, ManualDetection) -{ -} +{ } MsvcToolChain::MsvcToolChain() : MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID) -{ -} +{ } QString MsvcToolChain::typeDisplayName() const { @@ -456,10 +452,10 @@ ToolChain *MsvcToolChain::clone() const // call setFromMsvcToolChain(). // -------------------------------------------------------------------------- -MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc) - : ToolChainConfigWidget(tc) - , m_nameDisplayLabel(new QLabel(this)) - , m_varsBatDisplayLabel(new QLabel(this)) +MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc) : + ToolChainConfigWidget(tc), + m_nameDisplayLabel(new QLabel(this)), + m_varsBatDisplayLabel(new QLabel(this)) { m_nameDisplayLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); m_mainLayout->addRow(m_nameDisplayLabel); @@ -859,7 +855,7 @@ bool MsvcToolChainFactory::canRestore(const QVariantMap &data) template <class ToolChainType> ToolChainType *readFromMap(const QVariantMap &data) { - ToolChainType *result = new ToolChainType; + auto result = new ToolChainType; if (result->fromMap(data)) return result; delete result; diff --git a/src/plugins/projectexplorer/namedwidget.h b/src/plugins/projectexplorer/namedwidget.h index d11d439ef0..26c9550f7e 100644 --- a/src/plugins/projectexplorer/namedwidget.h +++ b/src/plugins/projectexplorer/namedwidget.h @@ -36,7 +36,7 @@ class PROJECTEXPLORER_EXPORT NamedWidget : public QWidget Q_OBJECT public: - explicit NamedWidget(QWidget *parent = 0); + explicit NamedWidget(QWidget *parent = nullptr); QString displayName() const; diff --git a/src/plugins/projectexplorer/nodesvisitor.h b/src/plugins/projectexplorer/nodesvisitor.h index 957e9f4131..641be9025a 100644 --- a/src/plugins/projectexplorer/nodesvisitor.h +++ b/src/plugins/projectexplorer/nodesvisitor.h @@ -43,9 +43,9 @@ class PROJECTEXPLORER_EXPORT NodesVisitor { public: virtual ~NodesVisitor(); - virtual void visitSessionNode(SessionNode *) {} - virtual void visitProjectNode(ProjectNode *) {} - virtual void visitFolderNode(FolderNode *) {} + virtual void visitSessionNode(SessionNode *) { } + virtual void visitProjectNode(ProjectNode *) { } + virtual void visitFolderNode(FolderNode *) { } protected: NodesVisitor() {} @@ -65,7 +65,7 @@ public: private: Utils::FileName m_path; - QList<Node*> m_nodes; + QList<Node *> m_nodes; }; class PROJECTEXPLORER_EXPORT FindAllFilesVisitor : public NodesVisitor { diff --git a/src/plugins/projectexplorer/osparser.cpp b/src/plugins/projectexplorer/osparser.cpp index 8deecf5f16..acd4d3d633 100644 --- a/src/plugins/projectexplorer/osparser.cpp +++ b/src/plugins/projectexplorer/osparser.cpp @@ -31,8 +31,7 @@ using namespace ProjectExplorer; -OsParser::OsParser() : - m_hasFatalError(false) +OsParser::OsParser() { setObjectName(QLatin1String("OsParser")); } diff --git a/src/plugins/projectexplorer/osparser.h b/src/plugins/projectexplorer/osparser.h index 40fc67d275..a053a65a73 100644 --- a/src/plugins/projectexplorer/osparser.h +++ b/src/plugins/projectexplorer/osparser.h @@ -46,7 +46,7 @@ public: bool hasFatalErrors() const override; private: - bool m_hasFatalError; + bool m_hasFatalError = false; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/panelswidget.cpp b/src/plugins/projectexplorer/panelswidget.cpp index 01a68ee47a..ee587f889f 100644 --- a/src/plugins/projectexplorer/panelswidget.cpp +++ b/src/plugins/projectexplorer/panelswidget.cpp @@ -123,7 +123,7 @@ PanelsWidget::PanelsWidget(QWidget *parent) : m_root->setPalette(pal); // The layout holding the individual panels: - QVBoxLayout *topLayout = new QVBoxLayout(m_root); + auto topLayout = new QVBoxLayout(m_root); topLayout->setMargin(0); topLayout->setSpacing(0); @@ -165,14 +165,14 @@ void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel) // icon: if (!panel->icon().isNull()) { - QLabel *iconLabel = new QLabel(m_root); + auto iconLabel = new QLabel(m_root); iconLabel->setPixmap(panel->icon().pixmap(ICON_SIZE, ICON_SIZE)); iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0); m_layout->addWidget(iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter); } // name: - QLabel *nameLabel = new QLabel(m_root); + auto nameLabel = new QLabel(m_root); nameLabel->setText(panel->displayName()); QPalette palette = nameLabel->palette(); for (int i = QPalette::Active; i < QPalette::NColorGroups; ++i ) { @@ -191,7 +191,7 @@ void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel) // line: const int lineRow(headerRow + 1); - QWidget *line = new OnePixelBlackLine(m_root); + auto line = new OnePixelBlackLine(m_root); m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop); // add the widget: diff --git a/src/plugins/projectexplorer/panelswidget.h b/src/plugins/projectexplorer/panelswidget.h index 067cfc5811..aae2d80ce3 100644 --- a/src/plugins/projectexplorer/panelswidget.h +++ b/src/plugins/projectexplorer/panelswidget.h @@ -40,7 +40,7 @@ class PROJECTEXPLORER_EXPORT PanelsWidget : public QScrollArea { Q_OBJECT public: - explicit PanelsWidget(QWidget *parent = 0); + explicit PanelsWidget(QWidget *parent = nullptr); ~PanelsWidget() override; // Adds a widget diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index 64833b4585..a05665f42f 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -44,14 +44,12 @@ const char PROCESS_WORKINGDIRECTORY_KEY[] = "ProjectExplorer.ProcessStep.Working const char PROCESS_ARGUMENTS_KEY[] = "ProjectExplorer.ProcessStep.Arguments"; } -ProcessStep::ProcessStep(BuildStepList *bsl) : - AbstractProcessStep(bsl, Core::Id(PROCESS_STEP_ID)) +ProcessStep::ProcessStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(PROCESS_STEP_ID)) { ctor(); } -ProcessStep::ProcessStep(BuildStepList *bsl, ProcessStep *bs) : - AbstractProcessStep(bsl, bs), +ProcessStep::ProcessStep(BuildStepList *bsl, ProcessStep *bs) : AbstractProcessStep(bsl, bs), m_command(bs->m_command), m_arguments(bs->m_arguments), m_workingDirectory(bs->m_workingDirectory) @@ -165,7 +163,7 @@ bool ProcessStepFactory::canCreate(BuildStepList *parent, Core::Id id) const BuildStep *ProcessStepFactory::create(BuildStepList *parent, Core::Id id) { if (!canCreate(parent, id)) - return 0; + return nullptr; return new ProcessStep(parent); } @@ -177,7 +175,7 @@ bool ProcessStepFactory::canClone(BuildStepList *parent, BuildStep *bs) const BuildStep *ProcessStepFactory::clone(BuildStepList *parent, BuildStep *bs) { if (!canClone(parent, bs)) - return 0; + return nullptr; return new ProcessStep(parent, static_cast<ProcessStep *>(bs)); } @@ -190,13 +188,13 @@ bool ProcessStepFactory::canRestore(BuildStepList *parent, const QVariantMap &ma BuildStep *ProcessStepFactory::restore(BuildStepList *parent, const QVariantMap &map) { if (!canRestore(parent, map)) - return 0; + return nullptr; - ProcessStep *bs(new ProcessStep(parent)); + auto bs = new ProcessStep(parent); if (bs->fromMap(map)) return bs; delete bs; - return 0; + return nullptr; } QList<Core::Id> ProcessStepFactory::availableCreationIds(BuildStepList *parent) const @@ -215,8 +213,8 @@ QString ProcessStepFactory::displayNameForId(Core::Id id) const // ProcessStepConfigWidget //******* -ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) - : m_step(step) +ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) : + m_step(step) { m_ui.setupUi(this); m_ui.command->setExpectedKind(Utils::PathChooser::Command); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index d20c324c39..914dfec934 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -89,16 +89,16 @@ public: ~ProjectPrivate(); Core::Id m_id; - Core::IDocument *m_document = 0; - IProjectManager *m_manager = 0; - ProjectNode *m_rootProjectNode = 0; + Core::IDocument *m_document = nullptr; + IProjectManager *m_manager = nullptr; + ProjectNode *m_rootProjectNode = nullptr; QList<Target *> m_targets; - Target *m_activeTarget = 0; + Target *m_activeTarget = nullptr; EditorConfiguration m_editorConfiguration; Core::Context m_projectContext; Core::Context m_projectLanguages; QVariantMap m_pluginSettings; - Internal::UserFileAccessor *m_accessor = 0; + Internal::UserFileAccessor *m_accessor = nullptr; KitMatcher m_requiredKitMatcher; KitMatcher m_preferredKitMatcher; @@ -108,9 +108,9 @@ public: ProjectPrivate::~ProjectPrivate() { - // Make sure our root node is 0 when deleting + // Make sure our root node is null when deleting ProjectNode *oldNode = m_rootProjectNode; - m_rootProjectNode = 0; + m_rootProjectNode = nullptr; delete oldNode; delete m_document; @@ -166,14 +166,14 @@ QString Project::makeUnique(const QString &preferredName, const QStringList &use void Project::changeEnvironment() { - Target *t = qobject_cast<Target *>(sender()); + auto t = qobject_cast<Target *>(sender()); if (t == activeTarget()) emit environmentChanged(); } void Project::changeBuildConfigurationEnabled() { - Target *t = qobject_cast<Target *>(sender()); + auto t = qobject_cast<Target *>(sender()); if (t == activeTarget()) emit buildConfigurationEnabledChanged(); } @@ -195,7 +195,7 @@ void Project::addTarget(Target *t) emit addedTarget(t); // check activeTarget: - if (activeTarget() == 0) + if (!activeTarget()) setActiveTarget(t); } @@ -208,7 +208,7 @@ bool Project::removeTarget(Target *target) if (target == activeTarget()) { if (d->m_targets.size() == 1) - SessionManager::setActiveTarget(this, 0, SetActive::Cascade); + SessionManager::setActiveTarget(this, nullptr, SetActive::Cascade); else if (d->m_targets.first() == target) SessionManager::setActiveTarget(this, d->m_targets.at(1), SetActive::Cascade); else @@ -264,19 +264,19 @@ bool Project::supportsKit(Kit *k, QString *errorMessage) const Target *Project::createTarget(Kit *k) { if (!k || target(k)) - return 0; + return nullptr; - Target *t = new Target(this, k); + auto t = new Target(this, k); if (!setupTarget(t)) { delete t; - return 0; + return nullptr; } return t; } Target *Project::cloneTarget(Target *sourceTarget, Kit *k) { - Target *newTarget = new Target(this, k); + auto newTarget = new Target(this, k); QStringList buildconfigurationError; QStringList deployconfigurationError; @@ -367,7 +367,7 @@ Target *Project::cloneTarget(Target *sourceTarget, Kit *k) .arg(k->displayName())); delete newTarget; - newTarget = 0; + newTarget = nullptr; } else if (!buildconfigurationError.isEmpty() || !deployconfigurationError.isEmpty() || ! runconfigurationError.isEmpty()) { @@ -399,7 +399,7 @@ Target *Project::cloneTarget(Target *sourceTarget, Kit *k) msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); if (msgBox.exec() != QDialog::Accepted) { delete newTarget; - newTarget = 0; + newTarget = nullptr; } } @@ -446,19 +446,19 @@ Target *Project::restoreTarget(const QVariantMap &data) if (target(id)) { qWarning("Warning: Duplicated target id found, not restoring second target with id '%s'. Continuing.", qPrintable(id.toString())); - return 0; + return nullptr; } Kit *k = KitManager::find(id); if (!k) { qWarning("Warning: No kit '%s' found. Continuing.", qPrintable(id.toString())); - return 0; + return nullptr; } - Target *t = new Target(this, k); + auto t = new Target(this, k); if (!t->fromMap(data)) { delete t; - return 0; + return nullptr; } return t; @@ -724,7 +724,7 @@ Utils::MacroExpander *Project::macroExpander() const ProjectImporter *Project::createProjectImporter() const { - return 0; + return nullptr; } KitMatcher Project::requiredKitMatcher() const @@ -749,7 +749,7 @@ void Project::setPreferredKitMatcher(const KitMatcher &matcher) void Project::onBuildDirectoryChanged() { - Target *target = qobject_cast<Target *>(sender()); + auto target = qobject_cast<Target *>(sender()); if (target && target == activeTarget()) emit buildDirectoryChanged(); } diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 7fd785279f..d407953f30 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -98,7 +98,7 @@ public: Target *activeTarget() const; Target *target(Core::Id id) const; Target *target(Kit *k) const; - virtual bool supportsKit(Kit *k, QString *errorMessage = 0) const; + virtual bool supportsKit(Kit *k, QString *errorMessage = nullptr) const; Target *createTarget(Kit *k); Target *cloneTarget(Target *sourceTarget, Kit *k); diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp index d804828628..700fd8ec71 100644 --- a/src/plugins/projectexplorer/projectconfiguration.cpp +++ b/src/plugins/projectexplorer/projectconfiguration.cpp @@ -31,8 +31,7 @@ const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id"; const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName"; const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName"; -ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id) : - QObject(parent), +ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id) : QObject(parent), m_id(id) { setObjectName(id.toString()); } @@ -45,9 +44,6 @@ ProjectConfiguration::ProjectConfiguration(QObject *parent, const ProjectConfigu m_displayName = tr("Clone of %1").arg(source->displayName()); } -ProjectConfiguration::~ProjectConfiguration() -{ } - Core::Id ProjectConfiguration::id() const { return m_id; diff --git a/src/plugins/projectexplorer/projectconfiguration.h b/src/plugins/projectexplorer/projectconfiguration.h index d784c00b75..ac417d23de 100644 --- a/src/plugins/projectexplorer/projectconfiguration.h +++ b/src/plugins/projectexplorer/projectconfiguration.h @@ -44,7 +44,7 @@ class PROJECTEXPLORER_EXPORT ProjectConfiguration : public QObject public: // ctors are protected - ~ProjectConfiguration() override; + ~ProjectConfiguration() = default; Core::Id id() const; QString displayName() const; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e68a06ed96..ef0857b805 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -169,19 +169,19 @@ namespace ProjectExplorer { static Target *activeTarget() { Project *project = ProjectTree::currentProject(); - return project ? project->activeTarget() : 0; + return project ? project->activeTarget() : nullptr; } static BuildConfiguration *activeBuildConfiguration() { Target *target = activeTarget(); - return target ? target->activeBuildConfiguration() : 0; + return target ? target->activeBuildConfiguration() : nullptr; } static Kit *currentKit() { Target *target = activeTarget(); - return target ? target->kit() : 0; + return target ? target->kit() : nullptr; } class ProjectExplorerPluginPrivate : public QObject @@ -189,8 +189,6 @@ class ProjectExplorerPluginPrivate : public QObject Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ProjectExplorerPlugin) public: - ProjectExplorerPluginPrivate(); - void deploy(QList<Project *>); int queue(QList<Project *>, QList<Id> stepIds); void updateContextMenuActions(); @@ -350,39 +348,26 @@ public: QString m_lastOpenDirectory; QPointer<RunConfiguration> m_delayedRunConfiguration; QList<QPair<RunConfiguration *, Core::Id>> m_delayedRunConfigurationForRun; - bool m_shouldHaveRunConfiguration; - Core::Id m_runMode; QString m_projectFilterString; MiniProjectTargetSelector * m_targetSelector; ProjectExplorerSettings m_projectExplorerSettings; + bool m_shouldHaveRunConfiguration = false; + bool m_shuttingDown; + Core::Id m_runMode = Constants::NO_RUN_MODE; ProjectWelcomePage *m_welcomePage = nullptr; - IMode *m_projectsMode; + IMode *m_projectsMode = nullptr; - TaskHub *m_taskHub; - KitManager *m_kitManager; - ToolChainManager *m_toolChainManager; - bool m_shuttingDown; + TaskHub *m_taskHub = nullptr; + KitManager *m_kitManager = nullptr; + ToolChainManager *m_toolChainManager = nullptr; QStringList m_arguments; QList<ProjectPanelFactory *> m_panelFactories; #ifdef WITH_JOURNALD - JournaldWatcher *m_journalWatcher; + JournaldWatcher *m_journalWatcher = nullptr; #endif QThreadPool m_threadPool; }; -ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() : - m_shouldHaveRunConfiguration(false), - m_runMode(Constants::NO_RUN_MODE), - m_projectsMode(0), - m_kitManager(0), - m_toolChainManager(0), - m_shuttingDown(false) -#ifdef WITH_JOURNALD - , m_journalWatcher(0) -#endif -{ -} - class ProjectsMode : public IMode { public: @@ -399,8 +384,8 @@ public: } }; -static ProjectExplorerPlugin *m_instance = 0; -static ProjectExplorerPluginPrivate *dd = 0; +static ProjectExplorerPlugin *m_instance = nullptr; +static ProjectExplorerPluginPrivate *dd = nullptr; ProjectExplorerPlugin::ProjectExplorerPlugin() { @@ -1492,7 +1477,7 @@ void ProjectExplorerPlugin::extensionsInitialized() OpenProjectResult result = ProjectExplorerPlugin::openProject(fileName); if (!result) showOpenProjectError(result); - return 0; + return nullptr; }); Utils::MimeDatabase mdb; @@ -1542,7 +1527,7 @@ ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown() ProjectTree::aboutToShutDown(); dd->m_proWindow->aboutToShutdown(); // disconnect from session SessionManager::closeAllProjects(); - dd->m_projectsMode = 0; + dd->m_projectsMode = nullptr; dd->m_shuttingDown = true; // Attempt to synchronously shutdown all run controls. // If that fails, fall back to asynchronous shutdown (Debugger run controls @@ -2019,14 +2004,14 @@ void ProjectExplorerPluginPrivate::buildQueueFinished(bool success) if (BuildManager::tasksAvailable()) BuildManager::showTaskWindow(); } - m_delayedRunConfiguration = 0; + m_delayedRunConfiguration = nullptr; m_shouldHaveRunConfiguration = false; m_runMode = Constants::NO_RUN_MODE; } void ProjectExplorerPluginPrivate::runConfigurationConfigurationFinished() { - RunConfiguration *rc = qobject_cast<RunConfiguration *>(sender()); + auto rc = qobject_cast<RunConfiguration *>(sender()); Core::Id runMode = Constants::NO_RUN_MODE; for (int i = 0; i < m_delayedRunConfigurationForRun.size(); ++i) { if (m_delayedRunConfigurationForRun.at(i).first == rc) { @@ -2290,7 +2275,7 @@ int ProjectExplorerPluginPrivate::queue(QList<Project *> projects, QList<Id> ste foreach (Project *pro, projects) { if (!pro || pro->needsConfiguration()) continue; - BuildStepList *bsl = 0; + BuildStepList *bsl = nullptr; if (id == Constants::BUILDSTEPS_DEPLOY && pro->activeTarget()->activeDeployConfiguration()) bsl = pro->activeTarget()->activeDeployConfiguration()->stepList(); @@ -2445,11 +2430,11 @@ void ProjectExplorerPluginPrivate::runProjectWithoutDeploy() void ProjectExplorerPluginPrivate::runProjectContextMenu() { Node *node = ProjectTree::currentNode(); - ProjectNode *projectNode = node ? node->asProjectNode() : 0; + ProjectNode *projectNode = node ? node->asProjectNode() : nullptr; if (projectNode == ProjectTree::currentProject()->rootProjectNode() || !projectNode) { m_instance->runProject(ProjectTree::currentProject(), Constants::NORMAL_RUN_MODE); } else { - QAction *act = qobject_cast<QAction *>(sender()); + auto act = qobject_cast<QAction *>(sender()); if (!act) return; RunConfiguration *rc = act->data().value<RunConfiguration *>(); @@ -2511,11 +2496,11 @@ QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio } else if (BuildManager::isBuilding()) { result.first = false; result.second = tr("A build is in progress."); - } else if (!hasBuildSettings(0)) { + } else if (!hasBuildSettings(nullptr)) { result.first = false; result.second = tr("Project has no build settings."); } else { - foreach (Project *project, SessionManager::projectOrder(0)) { + foreach (Project *project, SessionManager::projectOrder(nullptr)) { if (project && project->activeTarget() && project->activeTarget()->activeBuildConfiguration() @@ -2631,7 +2616,7 @@ void ProjectExplorerPluginPrivate::projectDisplayNameChanged(Project *pro) void ProjectExplorerPluginPrivate::startupProjectChanged() { - static QPointer<Project> previousStartupProject = 0; + static QPointer<Project> previousStartupProject = nullptr; Project *project = SessionManager::startupProject(); if (project == previousStartupProject) return; @@ -2654,8 +2639,8 @@ void ProjectExplorerPluginPrivate::startupProjectChanged() void ProjectExplorerPluginPrivate::activeTargetChanged() { - static QPointer<Target> previousTarget = 0; - Target *target = 0; + static QPointer<Target> previousTarget = nullptr; + Target *target = nullptr; Project *startupProject = SessionManager::startupProject(); if (startupProject) target = startupProject->activeTarget(); @@ -2678,8 +2663,8 @@ void ProjectExplorerPluginPrivate::activeTargetChanged() void ProjectExplorerPluginPrivate::activeRunConfigurationChanged() { - static QPointer<RunConfiguration> previousRunConfiguration = 0; - RunConfiguration *rc = 0; + static QPointer<RunConfiguration> previousRunConfiguration = nullptr; + RunConfiguration *rc = nullptr; Project *startupProject = SessionManager::startupProject(); if (startupProject && startupProject->activeTarget()) rc = startupProject->activeTarget()->activeRunConfiguration(); @@ -2736,10 +2721,10 @@ void ProjectExplorerPluginPrivate::updateDeployActions() && !project->activeTarget()->activeBuildConfiguration()->isEnabled(); }; - if (Utils::anyOf(SessionManager::projectOrder(0), hasDisabledBuildConfiguration)) + if (Utils::anyOf(SessionManager::projectOrder(nullptr), hasDisabledBuildConfiguration)) enableDeploySessionAction = false; } - if (!hasProjects || !hasDeploySettings(0) || BuildManager::isBuilding()) + if (!hasProjects || !hasDeploySettings(nullptr) || BuildManager::isBuilding()) enableDeploySessionAction = false; m_deploySessionAction->setEnabled(enableDeploySessionAction); @@ -3075,7 +3060,7 @@ void ProjectExplorerPluginPrivate::addNewSubproject() void ProjectExplorerPluginPrivate::handleAddExistingFiles() { Node *node = ProjectTree::currentNode(); - FolderNode *folderNode = node ? node->asFolderNode() : 0; + FolderNode *folderNode = node ? node->asFolderNode() : nullptr; QTC_ASSERT(folderNode, return); @@ -3090,7 +3075,7 @@ void ProjectExplorerPluginPrivate::handleAddExistingFiles() void ProjectExplorerPluginPrivate::addExistingDirectory() { Node *node = ProjectTree::currentNode(); - FolderNode *folderNode = node ? node->asFolderNode() : 0; + FolderNode *folderNode = node ? node->asFolderNode() : nullptr; QTC_ASSERT(folderNode, return); @@ -3272,7 +3257,7 @@ void ProjectExplorerPluginPrivate::handleRenameFile() { QWidget *focusWidget = QApplication::focusWidget(); while (focusWidget) { - ProjectTreeWidget *treeWidget = qobject_cast<ProjectTreeWidget*>(focusWidget); + auto treeWidget = qobject_cast<ProjectTreeWidget*>(focusWidget); if (treeWidget) { treeWidget->editCurrentItem(); return; diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 64e8882e88..bbf2454ff7 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -42,7 +42,7 @@ QT_END_NAMESPACE namespace Core { class IMode; class Id; -} +} // namespace Core namespace ProjectExplorer { class RunControl; @@ -75,7 +75,7 @@ public: const QString &errorMessage) : m_projects(projects), m_alreadyOpen(alreadyOpen), m_errorMessage(errorMessage) - {} + { } explicit operator bool() const { @@ -84,7 +84,7 @@ public: Project *project() const { - return m_projects.isEmpty() ? 0 : m_projects.first(); + return m_projects.isEmpty() ? nullptr : m_projects.first(); } QList<Project *> projects() const @@ -134,7 +134,7 @@ public: static QStringList projectFilePatterns(); static QList<QPair<QString, QString> > recentProjects(); - static bool canRunStartupProject(Core::Id runMode, QString *whyNot = 0); + static bool canRunStartupProject(Core::Id runMode, QString *whyNot = nullptr); static void runProject(Project *pro, Core::Id, const bool forceSkipDeploy = false); static void runStartupProject(Core::Id runMode, bool forceSkipDeploy = false); static void runRunConfiguration(RunConfiguration *rc, Core::Id runMode, diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index 6660ea5df7..206fd6a644 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -45,7 +45,7 @@ class ProjectExplorerSettingsWidget : public QWidget Q_OBJECT public: - explicit ProjectExplorerSettingsWidget(QWidget *parent = 0); + explicit ProjectExplorerSettingsWidget(QWidget *parent = nullptr); ProjectExplorerSettings settings() const; void setSettings(const ProjectExplorerSettings &s); diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index 4f163f3e42..79d5669d67 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -81,23 +81,16 @@ namespace Internal { class ProjectWizardContext { public: - ProjectWizardContext(); void clear(); - QPointer<ProjectWizardPage> page; // this is managed by the wizard! - const IWizardFactory *wizard; + QPointer<ProjectWizardPage> page = nullptr; // this is managed by the wizard! + const IWizardFactory *wizard = nullptr; }; -ProjectWizardContext::ProjectWizardContext() : - page(0), - wizard(0) -{ -} - void ProjectWizardContext::clear() { - page = 0; - wizard = 0; + page = nullptr; + wizard = nullptr; } // ---- ProjectFileWizardExtension @@ -208,7 +201,7 @@ bool ProjectFileWizardExtension::processProject( static ICodeStylePreferences *codeStylePreferences(Project *project, Id languageId) { if (!languageId.isValid()) - return 0; + return nullptr; if (project) return project->editorConfiguration()->codeStyle(languageId); @@ -232,7 +225,7 @@ void ProjectFileWizardExtension::applyCodeStyle(GeneratedFile *file) const ICodeStylePreferencesFactory *factory = TextEditorSettings::codeStyleFactory(languageId); - Indenter *indenter = 0; + Indenter *indenter = nullptr; if (factory) indenter = factory->createIndenter(); if (!indenter) diff --git a/src/plugins/projectexplorer/projectfilewizardextension.h b/src/plugins/projectexplorer/projectfilewizardextension.h index 9a3675c01c..fe9d3f8d92 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.h +++ b/src/plugins/projectexplorer/projectfilewizardextension.h @@ -55,7 +55,7 @@ private: bool processProject(const QList<Core::GeneratedFile> &files, bool *removeOpenProjectAttribute, QString *errorMessage); - ProjectWizardContext *m_context = 0; + ProjectWizardContext *m_context = nullptr; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectimporter.cpp b/src/plugins/projectexplorer/projectimporter.cpp index fa46b016fa..00f085de95 100644 --- a/src/plugins/projectexplorer/projectimporter.cpp +++ b/src/plugins/projectexplorer/projectimporter.cpp @@ -40,7 +40,7 @@ static const Core::Id KIT_TEMPORARY_NAME("PE.TempName"); static const Core::Id KIT_FINAL_NAME("PE.FinalName"); static const Core::Id TEMPORARY_OF_PROJECTS("PE.TempProject"); -ProjectImporter::ProjectImporter(const QString &path) : m_projectPath(path), m_isUpdating(false) +ProjectImporter::ProjectImporter(const QString &path) : m_projectPath(path) { } ProjectImporter::~ProjectImporter() diff --git a/src/plugins/projectexplorer/projectimporter.h b/src/plugins/projectexplorer/projectimporter.h index f11b03aa8e..635c7b10e2 100644 --- a/src/plugins/projectexplorer/projectimporter.h +++ b/src/plugins/projectexplorer/projectimporter.h @@ -71,7 +71,7 @@ protected: private: const QString m_projectPath; - bool m_isUpdating; + bool m_isUpdating = false; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 404e7c19aa..311bf89e05 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -79,8 +79,8 @@ bool sortNodes(Node *n1, Node *n2) // projects if (n1Type == ProjectNodeType) { if (n2Type == ProjectNodeType) { - ProjectNode *project1 = static_cast<ProjectNode*>(n1); - ProjectNode *project2 = static_cast<ProjectNode*>(n2); + auto project1 = static_cast<ProjectNode*>(n1); + auto project2 = static_cast<ProjectNode*>(n2); int result = caseFriendlyCompare(project1->displayName(), project2->displayName()); if (result != 0) @@ -100,8 +100,8 @@ bool sortNodes(Node *n1, Node *n2) if (n1Type == VirtualFolderNodeType) { if (n2Type == VirtualFolderNodeType) { - VirtualFolderNode *folder1 = static_cast<VirtualFolderNode *>(n1); - VirtualFolderNode *folder2 = static_cast<VirtualFolderNode *>(n2); + auto folder1 = static_cast<VirtualFolderNode *>(n1); + auto folder2 = static_cast<VirtualFolderNode *>(n2); if (folder1->priority() > folder2->priority()) return true; @@ -124,8 +124,8 @@ bool sortNodes(Node *n1, Node *n2) if (n1Type == FolderNodeType) { if (n2Type == FolderNodeType) { - FolderNode *folder1 = static_cast<FolderNode*>(n1); - FolderNode *folder2 = static_cast<FolderNode*>(n2); + auto folder1 = static_cast<FolderNode*>(n1); + auto folder2 = static_cast<FolderNode*>(n2); int result = caseFriendlyCompare(folder1->filePath().toString(), folder2->filePath().toString()); @@ -170,13 +170,8 @@ bool sortNodes(Node *n1, Node *n2) } // namespace anon -FlatModel::FlatModel(SessionNode *rootNode, QObject *parent) - : QAbstractItemModel(parent), - m_filterProjects(false), - m_filterGeneratedFiles(true), - m_rootNode(rootNode), - m_startupProject(0), - m_parentFolderForChange(0) +FlatModel::FlatModel(SessionNode *rootNode, QObject *parent) : QAbstractItemModel(parent), + m_rootNode(rootNode) { ProjectTree *tree = ProjectTree::instance(); @@ -428,7 +423,7 @@ QList<Node*> FlatModel::childNodes(FolderNode *parentNode, const QSet<Node*> &bl QList<Node*> nodeList; if (parentNode->nodeType() == SessionNodeType) { - SessionNode *sessionNode = static_cast<SessionNode*>(parentNode); + auto sessionNode = static_cast<SessionNode*>(parentNode); QList<ProjectNode*> projectList = sessionNode->projectNodes(); for (int i = 0; i < projectList.size(); ++i) { if (!blackList.contains(projectList.at(i))) @@ -507,7 +502,7 @@ QModelIndex FlatModel::indexForNode(const Node *node_) const // We assume that we are only called for nodes that are represented // we use non-const pointers internally - Node *node = const_cast<Node*>(node_); + auto node = const_cast<Node*>(node_); if (!node) return QModelIndex(); @@ -558,7 +553,7 @@ Node *FlatModel::nodeForIndex(const QModelIndex &index) const { if (index.isValid()) return (Node*)index.internalPointer(); - return 0; + return nullptr; } /* @@ -569,7 +564,7 @@ Node *FlatModel::nodeForIndex(const QModelIndex &index) const FolderNode *FlatModel::visibleFolderNode(FolderNode *node) const { if (!node) - return 0; + return nullptr; for (FolderNode *folderNode = node; folderNode; @@ -577,7 +572,7 @@ FolderNode *FlatModel::visibleFolderNode(FolderNode *node) const if (!filter(folderNode)) return folderNode; } - return 0; + return nullptr; } bool FlatModel::filter(Node *node) const diff --git a/src/plugins/projectexplorer/projectmodels.h b/src/plugins/projectexplorer/projectmodels.h index 0d8eca9a8f..15a41e50b9 100644 --- a/src/plugins/projectexplorer/projectmodels.h +++ b/src/plugins/projectexplorer/projectmodels.h @@ -117,15 +117,15 @@ private: FolderNode *visibleFolderNode(FolderNode *node) const; bool filter(Node *node) const; - bool m_filterProjects; - bool m_filterGeneratedFiles; + bool m_filterProjects = false; + bool m_filterGeneratedFiles = true; SessionNode *m_rootNode; mutable QHash<FolderNode*, QList<Node*> > m_childNodes; - ProjectNode *m_startupProject; + ProjectNode *m_startupProject = nullptr; - FolderNode *m_parentFolderForChange; - Node *m_nodeForSortKeyChange; + FolderNode *m_parentFolderForChange = nullptr; + Node *m_nodeForSortKeyChange = nullptr; static const QLoggingCategory &logger(); diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 8840f5d902..74dca37a42 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -42,7 +42,7 @@ #include <QIcon> #include <QStyle> -using namespace ProjectExplorer; +namespace ProjectExplorer { /*! \class ProjectExplorer::Node @@ -59,20 +59,14 @@ using namespace ProjectExplorer; \sa ProjectExplorer::NodesWatcher, ProjectExplorer::NodesVisitor */ -Node::Node(NodeType nodeType, const Utils::FileName &filePath, int line) - : m_nodeType(nodeType), - m_line(line), - m_projectNode(0), - m_folderNode(0), - m_filePath(filePath) -{ - -} +Node::Node(NodeType nodeType, const Utils::FileName &filePath, int line) : + m_nodeType(nodeType), + m_line(line), + m_filePath(filePath) +{ } Node::~Node() -{ - -} +{ } void Node::emitNodeSortKeyAboutToChange() { @@ -168,22 +162,22 @@ void Node::emitNodeUpdated() FileNode *Node::asFileNode() { - return 0; + return nullptr; } FolderNode *Node::asFolderNode() { - return 0; + return nullptr; } ProjectNode *Node::asProjectNode() { - return 0; + return nullptr; } SessionNode *Node::asSessionNode() { - return 0; + return nullptr; } void Node::setParentFolderNode(FolderNode *parentFolder) @@ -203,12 +197,10 @@ void Node::setParentFolderNode(FolderNode *parentFolder) FileNode::FileNode(const Utils::FileName &filePath, const FileType fileType, - bool generated, int line) - : Node(FileNodeType, filePath, line), - m_fileType(fileType), - m_generated(generated) -{ -} + bool generated, int line) : Node(FileNodeType, filePath, line), + m_fileType(fileType), + m_generated(generated) +{ } FileType FileNode::fileType() const { @@ -378,10 +370,7 @@ void FolderNode::addFileNodes(const QList<FileNode *> &files) // empty list or greater then last node m_fileNodes.append(file); } else { - QList<FileNode *>::iterator it - = qLowerBound(m_fileNodes.begin(), - m_fileNodes.end(), - file); + auto it = qLowerBound(m_fileNodes.begin(), m_fileNodes.end(), file); m_fileNodes.insert(it, file); } } @@ -409,8 +398,8 @@ void FolderNode::removeFileNodes(const QList<FileNode *> &files) ProjectTree::instance()->emitFilesAboutToBeRemoved(this, toRemove); - QList<FileNode*>::const_iterator toRemoveIter = toRemove.constBegin(); - QList<FileNode*>::iterator filesIter = m_fileNodes.begin(); + auto toRemoveIter = toRemove.constBegin(); + auto filesIter = m_fileNodes.begin(); for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) { while (*filesIter != *toRemoveIter) { ++filesIter; @@ -449,10 +438,7 @@ void FolderNode::addFolderNodes(const QList<FolderNode*> &subFolders) m_subFolderNodes.append(folder); } else { // Binary Search for insertion point - QList<FolderNode*>::iterator it - = qLowerBound(m_subFolderNodes.begin(), - m_subFolderNodes.end(), - folder); + auto it = qLowerBound(m_subFolderNodes.begin(), m_subFolderNodes.end(), folder); m_subFolderNodes.insert(it, folder); } @@ -482,8 +468,8 @@ void FolderNode::removeFolderNodes(const QList<FolderNode*> &subFolders) ProjectTree::instance()->emitFoldersAboutToBeRemoved(this, toRemove); - QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin(); - QList<FolderNode*>::iterator folderIter = m_subFolderNodes.begin(); + auto toRemoveIter = toRemove.constBegin(); + auto folderIter = m_subFolderNodes.begin(); for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) { QTC_ASSERT((*toRemoveIter)->nodeType() != ProjectNodeType, qDebug("project nodes have to be removed via removeProjectNodes")); @@ -520,14 +506,10 @@ bool FolderNode::showInSimpleTree() const \sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode */ -VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) - : FolderNode(folderPath, VirtualFolderNodeType), m_priority(priority) -{ -} - -VirtualFolderNode::~VirtualFolderNode() -{ -} +VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) : + FolderNode(folderPath, VirtualFolderNodeType), + m_priority(priority) +{ } int VirtualFolderNode::priority() const { @@ -547,8 +529,8 @@ int VirtualFolderNode::priority() const /*! Creates an uninitialized project node object. */ -ProjectNode::ProjectNode(const Utils::FileName &projectFilePath) - : FolderNode(projectFilePath, ProjectNodeType) +ProjectNode::ProjectNode(const Utils::FileName &projectFilePath) : + FolderNode(projectFilePath, ProjectNodeType) { // project node "manages" itself setProjectNode(this); @@ -691,9 +673,9 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects) ProjectTree::instance()->emitFoldersAboutToBeRemoved(this, toRemove); - QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin(); - QList<FolderNode*>::iterator folderIter = m_subFolderNodes.begin(); - QList<ProjectNode*>::iterator projectIter = m_subProjectNodes.begin(); + auto toRemoveIter = toRemove.constBegin(); + auto folderIter = m_subFolderNodes.begin(); + auto projectIter = m_subProjectNodes.begin(); for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) { while (*projectIter != *toRemoveIter) { ++projectIter; @@ -724,10 +706,9 @@ ProjectNode *ProjectNode::asProjectNode() \class ProjectExplorer::SessionNode */ -SessionNode::SessionNode() - : FolderNode(Utils::FileName::fromString(QLatin1String("session")), SessionNodeType) -{ -} +SessionNode::SessionNode() : + FolderNode(Utils::FileName::fromString(QLatin1String("session")), SessionNodeType) +{ } QList<ProjectAction> SessionNode::supportedActions(Node *node) const { @@ -804,9 +785,9 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes) ProjectTree::instance()->emitFoldersAboutToBeRemoved(this, toRemove); - QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin(); - QList<FolderNode*>::iterator folderIter = m_subFolderNodes.begin(); - QList<ProjectNode*>::iterator projectIter = m_projectNodes.begin(); + auto toRemoveIter = toRemove.constBegin(); + auto folderIter = m_subFolderNodes.begin(); + auto projectIter = m_projectNodes.begin(); for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) { while (*projectIter != *toRemoveIter) { ++projectIter; @@ -825,3 +806,5 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes) ProjectTree::instance()->emitFoldersRemoved(this); } } + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 31d93d42f9..de7bf24389 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -137,8 +137,8 @@ protected: private: NodeType m_nodeType; int m_line; - ProjectNode *m_projectNode; - FolderNode *m_folderNode; + ProjectNode *m_projectNode = nullptr; + FolderNode *m_folderNode = nullptr; Utils::FileName m_filePath; }; @@ -193,7 +193,7 @@ public: public: AddNewInformation(const QString &name, int p) :displayName(name), priority(p) - {} + { } QString displayName; int priority; }; @@ -227,9 +227,9 @@ class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode { public: explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority); - ~VirtualFolderNode() override; int priority() const; + private: int m_priority; }; diff --git a/src/plugins/projectexplorer/projectpanelfactory.cpp b/src/plugins/projectexplorer/projectpanelfactory.cpp index 2240252056..587cb55422 100644 --- a/src/plugins/projectexplorer/projectpanelfactory.cpp +++ b/src/plugins/projectexplorer/projectpanelfactory.cpp @@ -30,7 +30,6 @@ namespace ProjectExplorer { static QList<ProjectPanelFactory *> s_factories; ProjectPanelFactory::ProjectPanelFactory() : - m_priority(0), m_supportsFunction([] (Project *) { return true; }) { } diff --git a/src/plugins/projectexplorer/projectpanelfactory.h b/src/plugins/projectexplorer/projectpanelfactory.h index a251da03ea..416514a986 100644 --- a/src/plugins/projectexplorer/projectpanelfactory.h +++ b/src/plugins/projectexplorer/projectpanelfactory.h @@ -91,7 +91,7 @@ private: friend class ProjectExplorerPlugin; static void destroyFactories(); - int m_priority; + int m_priority = 0; QString m_displayName; std::function<bool (Project *)> m_supportsFunction; std::function<QWidget *(Project *)> m_createWidgetFunction; diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp index ae5abd1e6b..43710c1a36 100644 --- a/src/plugins/projectexplorer/projecttree.cpp +++ b/src/plugins/projectexplorer/projecttree.cpp @@ -58,16 +58,9 @@ namespace ProjectExplorer { using namespace Internal; -ProjectTree *ProjectTree::s_instance = 0; +ProjectTree *ProjectTree::s_instance = nullptr; -ProjectTree::ProjectTree(QObject *parent) - : QObject(parent), - m_currentNode(0), - m_currentProject(0), - m_resetCurrentNodeFolder(false), - m_resetCurrentNodeFile(false), - m_resetCurrentNodeProject(false), - m_focusForContextMenu(0) +ProjectTree::ProjectTree(QObject *parent) : QObject(parent) { s_instance = this; @@ -160,7 +153,7 @@ void ProjectTree::documentManagerCurrentFileChanged() Project *ProjectTree::projectForNode(Node *node) { if (!node) - return 0; + return nullptr; FolderNode *rootProjectNode = node->asFolderNode(); if (!rootProjectNode) @@ -179,7 +172,7 @@ void ProjectTree::updateFromDocumentManager(bool invalidCurrentNode) Core::IDocument *document = Core::EditorManager::currentDocument(); const FileName fileName = document ? document->filePath() : FileName(); - Node *currentNode = 0; + Node *currentNode = nullptr; if (!invalidCurrentNode && m_currentNode && m_currentNode->filePath() == fileName) currentNode = m_currentNode; else @@ -444,7 +437,7 @@ void ProjectTree::collapseAll() void ProjectTree::updateExternalFileWarning() { - Core::IDocument *document = qobject_cast<Core::IDocument *>(sender()); + auto document = qobject_cast<Core::IDocument *>(sender()); if (!document || document->filePath().isEmpty()) return; Core::InfoBar *infoBar = document->infoBar(); @@ -486,7 +479,7 @@ bool ProjectTree::hasFocus(ProjectTreeWidget *widget) void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &globalPos, Node *node) { - QMenu *contextMenu = 0; + QMenu *contextMenu = nullptr; if (!node) node = SessionManager::sessionNode(); @@ -512,7 +505,7 @@ void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &global qWarning("ProjectExplorerPlugin::showContextMenu - Missing handler for node type"); } } else { // session item - emit s_instance->aboutToShowContextMenu(0, node); + emit s_instance->aboutToShowContextMenu(nullptr, node); contextMenu = Core::ActionManager::actionContainer(Constants::M_SESSIONCONTEXT)->menu(); } @@ -541,7 +534,7 @@ void ProjectTree::highlightProject(Project *project, const QString &message) void ProjectTree::hideContextMenu() { - m_focusForContextMenu = 0; + m_focusForContextMenu = nullptr; } bool ProjectTree::isInNodeHierarchy(Node *n) diff --git a/src/plugins/projectexplorer/projecttree.h b/src/plugins/projectexplorer/projecttree.h index 678f298b70..2a48995893 100644 --- a/src/plugins/projectexplorer/projecttree.h +++ b/src/plugins/projectexplorer/projecttree.h @@ -43,7 +43,7 @@ class PROJECTEXPLORER_EXPORT ProjectTree : public QObject { Q_OBJECT public: - explicit ProjectTree(QObject *parent = 0); + explicit ProjectTree(QObject *parent = nullptr); static ProjectTree *instance(); @@ -145,14 +145,14 @@ private: private: static ProjectTree *s_instance; QList<Internal::ProjectTreeWidget *> m_projectTreeWidgets; - Node *m_currentNode; - Project *m_currentProject; + Node *m_currentNode = nullptr; + Project *m_currentProject = nullptr; QList<FileNode *> m_filesAdded; QList<FolderNode *> m_foldersAdded; - bool m_resetCurrentNodeFolder; - bool m_resetCurrentNodeFile; - bool m_resetCurrentNodeProject; - Internal::ProjectTreeWidget *m_focusForContextMenu; + bool m_resetCurrentNodeFolder = false; + bool m_resetCurrentNodeFile = false; + bool m_resetCurrentNodeProject = false; + Internal::ProjectTreeWidget *m_focusForContextMenu = nullptr; Core::Context m_lastProjectContext; }; diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 1b79decf33..680727f1e1 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -165,13 +165,7 @@ private: Shows the projects in form of a tree. */ -ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) - : QWidget(parent), - m_view(0), - m_model(0), - m_filterProjectsAction(0), - m_autoSync(false), - m_autoExpand(true) +ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent) { m_model = new FlatModel(SessionManager::sessionNode(), this); Project *pro = SessionManager::startupProject(); @@ -185,7 +179,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) m_view->installEventFilter(this); initView(); - QVBoxLayout *layout = new QVBoxLayout(); + auto layout = new QVBoxLayout(); layout->addWidget(ItemViewFind::createSearchableWrapper( m_view, ItemViewFind::DarkColored, ItemViewFind::FetchMoreWhileSearching)); @@ -580,15 +574,15 @@ ProjectTreeWidgetFactory::ProjectTreeWidgetFactory() NavigationView ProjectTreeWidgetFactory::createWidget() { NavigationView n; - ProjectTreeWidget *ptw = new ProjectTreeWidget; + auto ptw = new ProjectTreeWidget; n.widget = ptw; - QToolButton *filter = new QToolButton; + auto filter = new QToolButton; filter->setIcon(Core::Icons::FILTER.icon()); filter->setToolTip(tr("Filter Tree")); filter->setPopupMode(QToolButton::InstantPopup); filter->setProperty("noArrow", true); - QMenu *filterMenu = new QMenu(filter); + auto filterMenu = new QMenu(filter); filterMenu->addAction(ptw->m_filterProjectsAction); filterMenu->addAction(ptw->m_filterGeneratedFilesAction); filter->setMenu(filterMenu); @@ -599,7 +593,7 @@ NavigationView ProjectTreeWidgetFactory::createWidget() void ProjectTreeWidgetFactory::saveSettings(int position, QWidget *widget) { - ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); + auto ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); QSettings *settings = ICore::settings(); const QString baseKey = QLatin1String("ProjectTreeWidget.") + QString::number(position); @@ -610,7 +604,7 @@ void ProjectTreeWidgetFactory::saveSettings(int position, QWidget *widget) void ProjectTreeWidgetFactory::restoreSettings(int position, QWidget *widget) { - ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); + auto ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); QSettings *settings = ICore::settings(); const QString baseKey = QLatin1String("ProjectTreeWidget.") + QString::number(position); diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h index bd0bd97310..dbda089187 100644 --- a/src/plugins/projectexplorer/projecttreewidget.h +++ b/src/plugins/projectexplorer/projecttreewidget.h @@ -52,7 +52,7 @@ class ProjectTreeWidget : public QWidget { Q_OBJECT public: - explicit ProjectTreeWidget(QWidget *parent = 0); + explicit ProjectTreeWidget(QWidget *parent = nullptr); ~ProjectTreeWidget() override; bool autoSynchronization() const; @@ -94,16 +94,16 @@ private: void renamed(const Utils::FileName &oldPath, const Utils::FileName &newPath); QSet<ExpandData> m_toExpand; - QTreeView *m_view; - FlatModel *m_model; - QAction *m_filterProjectsAction; + QTreeView *m_view = nullptr; + FlatModel *m_model = nullptr; + QAction *m_filterProjectsAction = nullptr; QAction *m_filterGeneratedFilesAction; QToolButton *m_toggleSync; QModelIndex m_subIndex; QString m_modelId; - bool m_autoSync; - bool m_autoExpand; + bool m_autoSync = false; + bool m_autoExpand = true; Utils::FileName m_delayedRename; static QList<ProjectTreeWidget *> m_projectTreeWidgets; diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 504ec3fbbc..f94d4debee 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -117,7 +117,7 @@ void SessionModel::resetSessions() void SessionModel::cloneSession(const QString &session) { - SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), 0); + SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), nullptr); newSessionInputDialog.setWindowTitle(tr("New session name")); newSessionInputDialog.setValue(session + QLatin1String(" (2)")); @@ -145,7 +145,7 @@ void SessionModel::deleteSession(const QString &session) void SessionModel::renameSession(const QString &session) { - SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), 0); + SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), nullptr); newSessionInputDialog.setWindowTitle(tr("New session name")); newSessionInputDialog.setValue(session); @@ -180,7 +180,6 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const switch (role) { case Qt::DisplayRole: return data.second; - break; case FilePathRole: return data.first; case PrettyFilePathRole: @@ -188,8 +187,6 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const default: return QVariant(); } - - return QVariant(); } QHash<int, QByteArray> ProjectModel::roleNames() const @@ -209,11 +206,6 @@ void ProjectModel::resetProjects() /////////////////// -ProjectWelcomePage::ProjectWelcomePage() : - m_sessionModel(0), m_projectModel(0) -{ -} - void ProjectWelcomePage::facilitateQml(QQmlEngine *engine) { m_sessionModel = new SessionModel(this); diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h index 9ab1207112..2d56e4c103 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.h +++ b/src/plugins/projectexplorer/projectwelcomepage.h @@ -43,7 +43,7 @@ class SessionModel : public QAbstractListModel public: enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole, ProjectsPathRole, ProjectsDisplayRole }; - explicit SessionModel(QObject *parent = 0); + explicit SessionModel(QObject *parent = nullptr); int rowCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; @@ -66,7 +66,7 @@ class ProjectModel : public QAbstractListModel public: enum { FilePathRole = Qt::UserRole+1, PrettyFilePathRole }; - ProjectModel(QObject *parent = 0); + ProjectModel(QObject *parent = nullptr); int rowCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; QHash<int, QByteArray> roleNames() const override; @@ -79,11 +79,11 @@ class ProjectWelcomePage : public Core::IWelcomePage { Q_OBJECT public: - ProjectWelcomePage(); + ProjectWelcomePage() = default; void facilitateQml(QQmlEngine *engine) override; QUrl pageLocation() const override; - QWidget *page() { return 0; } + QWidget *page() { return nullptr; } QString title() const override { return tr("Projects"); } int priority() const override { return 20; } Core::Id id() const override; @@ -100,8 +100,8 @@ signals: void manageSessions(); private: - SessionModel *m_sessionModel; - ProjectModel *m_projectModel; + SessionModel *m_sessionModel = nullptr; + ProjectModel *m_projectModel = nullptr; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 62a83b5d5d..2f211500bb 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -54,7 +54,7 @@ ProjectWindow::ProjectWindow(QWidget *parent) m_currentWidget(0) { // Setup overall layout: - QVBoxLayout *viewLayout = new QVBoxLayout(this); + auto viewLayout = new QVBoxLayout(this); viewLayout->setMargin(0); viewLayout->setSpacing(0); @@ -92,7 +92,7 @@ void ProjectWindow::aboutToShutdown() void ProjectWindow::removedTarget(Target *) { - Project *p = qobject_cast<Project *>(sender()); + auto p = qobject_cast<Project *>(sender()); QTC_ASSERT(p, return); if (p->targets().isEmpty()) projectUpdated(p); @@ -312,10 +312,8 @@ int WidgetCache::indexForProject(Project *project) const Project *WidgetCache::projectFor(int projectIndex) const { - if (projectIndex < 0) - return 0; - if (projectIndex >= m_projects.size()) - return 0; + if (projectIndex < 0 || projectIndex >= m_projects.size()) + return nullptr; return m_projects.at(projectIndex).project; } @@ -351,7 +349,7 @@ int WidgetCache::recheckFactories(Project *project, int oldSupportsIndex) info.supports[i] = fac.at(i)->supports(project); if (!info.supports.at(i)) { delete info.widgets.at(i); - info.widgets[i] = 0; + info.widgets[i] = nullptr; } } diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h index 6389965a06..f2d9652a11 100644 --- a/src/plugins/projectexplorer/projectwindow.h +++ b/src/plugins/projectexplorer/projectwindow.h @@ -78,7 +78,7 @@ class ProjectWindow : public QWidget Q_OBJECT public: - explicit ProjectWindow(QWidget *parent = 0); + explicit ProjectWindow(QWidget *parent = nullptr); void aboutToShutdown(); diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index 8b9f6fa00d..f806ca2c93 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -77,26 +77,19 @@ public: private: QString m_displayName; QString m_toolTip; - FolderNode *m_node; - bool m_canAdd; - int m_priority; + FolderNode *m_node = nullptr; + bool m_canAdd = true; + int m_priority = -1; }; -AddNewTree::AddNewTree(const QString &displayName) - : m_displayName(displayName), - m_node(0), - m_canAdd(true), - m_priority(-1) -{ -} +AddNewTree::AddNewTree(const QString &displayName) : + m_displayName(displayName) +{ } // FIXME: potentially merge the following two functions. // Note the different handling of 'node' and m_canAdd. -AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, const QString &displayName) - : m_displayName(displayName), - m_node(0), - m_canAdd(false), - m_priority(-1) +AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, const QString &displayName) : + m_displayName(displayName) { if (node) m_toolTip = ProjectExplorerPlugin::directoryFor(node); @@ -104,11 +97,9 @@ AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, const QSt appendChild(child); } -AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, const FolderNode::AddNewInformation &info) - : m_displayName(info.displayName), - m_node(node), - m_canAdd(true), - m_priority(info.priority) +AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, + const FolderNode::AddNewInformation &info) : + m_displayName(info.displayName) { if (node) m_toolTip = ProjectExplorerPlugin::directoryFor(node); @@ -119,13 +110,16 @@ AddNewTree::AddNewTree(FolderNode *node, QList<AddNewTree *> children, const Fol QVariant AddNewTree::data(int, int role) const { - if (role == Qt::DisplayRole) + switch (role) { + case Qt::DisplayRole: return m_displayName; - if (role == Qt::ToolTipRole) + case Qt::ToolTipRole: return m_toolTip; - if (role == Qt::UserRole) + case Qt::UserRole: return QVariant::fromValue(static_cast<void*>(node())); - return QVariant(); + default: + return QVariant(); + } } Qt::ItemFlags AddNewTree::flags(int) const @@ -147,24 +141,21 @@ public: AddNewTree *bestChoice() const; bool deploys(); QString deployingProjects() const; + private: QString m_commonDirectory; QStringList m_files; - bool m_deploys; + bool m_deploys = false; QString m_deployText; - AddNewTree *m_bestChoice; - int m_bestMatchLength; - int m_bestMatchPriority; + AddNewTree *m_bestChoice = nullptr; + int m_bestMatchLength = -1; + int m_bestMatchPriority = -1; }; -BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QStringList &files) - : m_commonDirectory(commonDirectory), - m_files(files), - m_deploys(false), - m_deployText(QCoreApplication::translate("ProjectWizard", "The files are implicitly added to the projects:") + QLatin1Char('\n')), - m_bestChoice(0), - m_bestMatchLength(-1), - m_bestMatchPriority(-1) +BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QStringList &files) : + m_commonDirectory(commonDirectory), + m_files(files), + m_deployText(QCoreApplication::translate("ProjectWizard", "The files are implicitly added to the projects:") + QLatin1Char('\n')) { } // Find the project the new files should be added @@ -247,14 +238,14 @@ static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString & if (list.contains(AddSubProject) && !list.contains(InheritedFromParent)) { if (projectPath.isEmpty() || root->canAddSubProject(projectPath)) { FolderNode::AddNewInformation info = root->addNewInformation(QStringList() << projectPath, contextNode); - AddNewTree *item = new AddNewTree(root, children, info); + auto item = new AddNewTree(root, children, info); selector->inspect(item, root == contextNode); return item; } } if (children.isEmpty()) - return 0; + return nullptr; return new AddNewTree(root, children, root->displayName()); } @@ -283,12 +274,12 @@ static inline AddNewTree *buildAddFilesTree(FolderNode *root, const QStringList const QList<ProjectAction> &list = root->supportedActions(root); if (list.contains(AddNewFile) && !list.contains(InheritedFromParent)) { FolderNode::AddNewInformation info = root->addNewInformation(files, contextNode); - AddNewTree *item = new AddNewTree(root, children, info); + auto item = new AddNewTree(root, children, info); selector->inspect(item, root == contextNode); return item; } if (children.isEmpty()) - return 0; + return nullptr; return new AddNewTree(root, children, root->displayName()); } @@ -320,11 +311,8 @@ static inline AddNewTree *getChoices(const QStringList &generatedFiles, // ProjectWizardPage: // -------------------------------------------------------------------- -ProjectWizardPage::ProjectWizardPage(QWidget *parent) : - WizardPage(parent), - m_ui(new Ui::WizardPage), - m_model(0), - m_repositoryExists(false) +ProjectWizardPage::ProjectWizardPage(QWidget *parent) : WizardPage(parent), + m_ui(new Ui::WizardPage) { m_ui->setupUi(this); m_ui->vcsManageButton->setText(ICore::msgShowOptionsDialog()); @@ -380,7 +368,7 @@ bool ProjectWizardPage::expandTree(const QModelIndex &root) m_ui->projectComboBox->view()->collapse(root); // if we are a high priority node, our *parent* needs to be expanded - AddNewTree *tree = static_cast<AddNewTree *>(root.internalPointer()); + auto tree = static_cast<AddNewTree *>(root.internalPointer()); if (tree && tree->priority() >= 100) expand = true; @@ -401,7 +389,7 @@ void ProjectWizardPage::setBestNode(AddNewTree *tree) FolderNode *ProjectWizardPage::currentNode() const { QVariant v = m_ui->projectComboBox->currentData(Qt::UserRole); - return v.isNull() ? 0 : static_cast<FolderNode *>(v.value<void *>()); + return v.isNull() ? nullptr : static_cast<FolderNode *>(v.value<void *>()); } void ProjectWizardPage::setAddingSubProject(bool addingSubProject) @@ -423,7 +411,7 @@ void ProjectWizardPage::initializeVersionControls() if (versionControls.isEmpty()) hideVersionControlUiElements(); - IVersionControl *currentSelection = 0; + IVersionControl *currentSelection = nullptr; int currentIdx = versionControlIndex() - 1; if (currentIdx >= 0 && currentIdx <= m_activeVersionControls.size() - 1) currentSelection = m_activeVersionControls.at(currentIdx); @@ -500,7 +488,7 @@ void ProjectWizardPage::initializeProjectTree(Node *context, const QStringList & setAdditionalInfo(selector.deployingProjects()); - TreeModel *model = new TreeModel(tree); + auto model = new TreeModel(tree); setModel(model); setBestNode(selector.bestChoice()); setAddingSubProject(action == AddSubProject); @@ -537,7 +525,7 @@ IVersionControl *ProjectWizardPage::currentVersionControl() { int index = m_ui->addToVersionControlComboBox->currentIndex() - 1; // Subtract "<None>" if (index < 0 || index > m_activeVersionControls.count()) - return 0; // <None> + return nullptr; // <None> return m_activeVersionControls.at(index); } diff --git a/src/plugins/projectexplorer/projectwizardpage.h b/src/plugins/projectexplorer/projectwizardpage.h index a074595b3b..931e4e6729 100644 --- a/src/plugins/projectexplorer/projectwizardpage.h +++ b/src/plugins/projectexplorer/projectwizardpage.h @@ -53,7 +53,7 @@ class ProjectWizardPage : public Utils::WizardPage Q_OBJECT public: - explicit ProjectWizardPage(QWidget *parent = 0); + explicit ProjectWizardPage(QWidget *parent = nullptr); ~ProjectWizardPage() override; FolderNode *currentNode() const; @@ -96,11 +96,11 @@ private: Ui::WizardPage *m_ui; QStringList m_projectToolTips; - Utils::TreeModel *m_model; + Utils::TreeModel *m_model = nullptr; QList<Core::IVersionControl*> m_activeVersionControls; QString m_commonDirectory; - bool m_repositoryExists; + bool m_repositoryExists = false; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/propertiespanel.h b/src/plugins/projectexplorer/propertiespanel.h index 3bff1012c8..0f7e284c4a 100644 --- a/src/plugins/projectexplorer/propertiespanel.h +++ b/src/plugins/projectexplorer/propertiespanel.h @@ -50,7 +50,7 @@ public: private: QString m_displayName; - QWidget *m_widget; + QWidget *m_widget = nullptr; QIcon m_icon; }; diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index c83c064de5..d5e6aed18a 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -110,13 +110,9 @@ ISettingsAspect *ISettingsAspect::clone() const // /////////////////////////////////////////////////////////////////////// -IRunConfigurationAspect::IRunConfigurationAspect(RunConfiguration *runConfig) -{ - m_runConfiguration = runConfig; - m_projectSettings = 0; - m_globalSettings = 0; - m_useGlobalSettings = false; -} +IRunConfigurationAspect::IRunConfigurationAspect(RunConfiguration *runConfig) : + m_runConfiguration(runConfig) +{ } IRunConfigurationAspect::~IRunConfigurationAspect() { @@ -130,7 +126,7 @@ IRunConfigurationAspect::~IRunConfigurationAspect() RunConfigWidget *IRunConfigurationAspect::createConfigurationWidget() { - return 0; + return nullptr; } void IRunConfigurationAspect::setProjectSettings(ISettingsAspect *settings) @@ -293,7 +289,7 @@ RunConfiguration::ConfigurationState RunConfiguration::ensureConfigured(QString BuildConfiguration *RunConfiguration::activeBuildConfiguration() const { if (!target()) - return 0; + return nullptr; return target()->activeBuildConfiguration(); } @@ -358,11 +354,11 @@ QList<IRunConfigurationAspect *> RunConfiguration::extraAspects() const } IRunConfigurationAspect *RunConfiguration::extraAspect(Core::Id id) const { - QTC_ASSERT(m_aspectsInitialized, return 0); + QTC_ASSERT(m_aspectsInitialized, return nullptr); foreach (IRunConfigurationAspect *aspect, m_aspects) if (aspect->id() == id) return aspect; - return 0; + return nullptr; } /*! @@ -438,10 +434,10 @@ IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) : RunConfiguration *IRunConfigurationFactory::create(Target *parent, Core::Id id) { if (!canCreate(parent, id)) - return 0; + return nullptr; RunConfiguration *rc = doCreate(parent, id); if (!rc) - return 0; + return nullptr; rc->addExtraAspects(); return rc; } @@ -449,11 +445,11 @@ RunConfiguration *IRunConfigurationFactory::create(Target *parent, Core::Id id) RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVariantMap &map) { if (!canRestore(parent, map)) - return 0; + return nullptr; RunConfiguration *rc = doRestore(parent, map); if (!rc->fromMap(map)) { delete rc; - rc = 0; + rc = nullptr; } return rc; } @@ -495,7 +491,7 @@ QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent) Returns a widget used to configure this runner. Ownership is transferred to the caller. - Returns 0 if @p \a runConfiguration is not suitable for RunControls from this + Returns null if @p \a runConfiguration is not suitable for RunControls from this factory, or no user-accessible configuration is required. */ @@ -518,7 +514,7 @@ IRunControlFactory::IRunControlFactory(QObject *parent) IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc) { Q_UNUSED(rc); - return 0; + return nullptr; } /*! @@ -567,7 +563,7 @@ public: Utils::Icon icon; const QPointer<RunConfiguration> runConfiguration; QPointer<Project> project; - Utils::OutputFormatter *outputFormatter = 0; + Utils::OutputFormatter *outputFormatter = nullptr; // A handle to the actual application process. ProcessHandle applicationProcessHandle; @@ -581,10 +577,9 @@ public: } // Internal -RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) - : d(new Internal::RunControlPrivate(runConfiguration, mode)) -{ -} +RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) : + d(new Internal::RunControlPrivate(runConfiguration, mode)) +{ } RunControl::~RunControl() { diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index ddd9e222f4..6649423672 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -147,10 +147,10 @@ protected: private: Core::Id m_id; QString m_displayName; - bool m_useGlobalSettings; - RunConfiguration *m_runConfiguration; - ISettingsAspect *m_projectSettings; // Owned if present. - ISettingsAspect *m_globalSettings; // Not owned. + bool m_useGlobalSettings = false; + RunConfiguration *m_runConfiguration = nullptr; + ISettingsAspect *m_projectSettings = nullptr; // Owned if present. + ISettingsAspect *m_globalSettings = nullptr; // Not owned. }; class PROJECTEXPLORER_EXPORT ClonableConcept @@ -240,7 +240,7 @@ public: // Pop up configuration dialog in case for example the executable is missing. enum ConfigurationState { Configured, UnConfigured, Waiting }; // TODO rename function - virtual ConfigurationState ensureConfigured(QString *errorMessage = 0); + virtual ConfigurationState ensureConfigured(QString *errorMessage = nullptr); Target *target() const; @@ -254,11 +254,11 @@ public: template <typename T> T *extraAspect() const { - QTC_ASSERT(m_aspectsInitialized, return 0); + QTC_ASSERT(m_aspectsInitialized, return nullptr); foreach (IRunConfigurationAspect *aspect, m_aspects) if (T *result = qobject_cast<T *>(aspect)) return result; - return 0; + return nullptr; } virtual Runnable runnable() const; @@ -291,7 +291,7 @@ class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject Q_OBJECT public: - explicit IRunConfigurationFactory(QObject *parent = 0); + explicit IRunConfigurationFactory(QObject *parent = nullptr); enum CreationMode {UserCreate, AutoCreate}; virtual QList<Core::Id> availableCreationIds(Target *parent, CreationMode mode = UserCreate) const = 0; @@ -320,7 +320,7 @@ class PROJECTEXPLORER_EXPORT IRunControlFactory : public QObject { Q_OBJECT public: - explicit IRunControlFactory(QObject *parent = 0); + explicit IRunControlFactory(QObject *parent = nullptr); virtual bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const = 0; virtual RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) = 0; @@ -353,7 +353,7 @@ public: ~RunControl() override; virtual void start() = 0; - virtual bool promptToStop(bool *optionalPrompt = 0) const; + virtual bool promptToStop(bool *optionalPrompt = nullptr) const; virtual StopResult stop() = 0; virtual bool isRunning() const = 0; virtual bool supportsReRunning() const { return true; } @@ -397,7 +397,7 @@ protected: bool showPromptToStopDialog(const QString &title, const QString &text, const QString &stopButtonText = QString(), const QString &cancelButtonText = QString(), - bool *prompt = 0) const; + bool *prompt = nullptr) const; private: void bringApplicationToForegroundInternal(); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 2b5d24c904..1f063d02af 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -49,9 +49,10 @@ namespace ProjectExplorer { \class ProjectExplorer::TerminalAspect */ -TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key, bool useTerminal, bool userSet) - : IRunConfigurationAspect(runConfig), m_useTerminal(useTerminal), - m_userSet(userSet), m_checkBox(0), m_key(key) +TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key, + bool useTerminal, bool userSet) : + IRunConfigurationAspect(runConfig), + m_useTerminal(useTerminal), m_userSet(userSet), m_checkBox(nullptr), m_key(key) { setDisplayName(tr("Terminal")); setId("TerminalAspect"); diff --git a/src/plugins/projectexplorer/runconfigurationmodel.cpp b/src/plugins/projectexplorer/runconfigurationmodel.cpp index d9d477b8f3..45d7bf0668 100644 --- a/src/plugins/projectexplorer/runconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/runconfigurationmodel.cpp @@ -50,10 +50,11 @@ public: } }; -RunConfigurationModel::RunConfigurationModel(Target *target, QObject *parent) - : QAbstractListModel(parent), - m_target(target) +RunConfigurationModel::RunConfigurationModel(Target *target, QObject *parent) : + QAbstractListModel(parent), + m_target(target) { + QTC_ASSERT(target, return); m_runConfigurations = m_target->runConfigurations(); Utils::sort(m_runConfigurations, RunConfigurationComparer()); @@ -135,14 +136,14 @@ QVariant RunConfigurationModel::data(const QModelIndex &index, int role) const RunConfiguration *RunConfigurationModel::runConfigurationAt(int i) { if (i > m_runConfigurations.size() || i < 0) - return 0; + return nullptr; return m_runConfigurations.at(i); } RunConfiguration *RunConfigurationModel::runConfigurationFor(const QModelIndex &idx) { if (idx.row() > m_runConfigurations.size() || idx.row() < 0) - return 0; + return nullptr; return m_runConfigurations.at(idx.row()); } diff --git a/src/plugins/projectexplorer/runconfigurationmodel.h b/src/plugins/projectexplorer/runconfigurationmodel.h index a5d9235798..8af2566b95 100644 --- a/src/plugins/projectexplorer/runconfigurationmodel.h +++ b/src/plugins/projectexplorer/runconfigurationmodel.h @@ -37,7 +37,7 @@ class RunConfigurationModel : public QAbstractListModel Q_OBJECT public: - explicit RunConfigurationModel(Target *target, QObject *parent = 0); + explicit RunConfigurationModel(Target *target, QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index 6323d8a46b..3dcc3093de 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -83,17 +83,10 @@ using ExtensionSystem::PluginManager; /// RunSettingsWidget /// -RunSettingsWidget::RunSettingsWidget(Target *target) - : m_target(target), - m_runConfigurationsModel(new RunConfigurationModel(target, this)), - m_deployConfigurationModel(new DeployConfigurationModel(target, this)), - m_runConfigurationWidget(0), - m_runConfiguration(0), - m_runLayout(0), - m_deployConfigurationWidget(0), - m_deployLayout(0), - m_deploySteps(0), - m_ignoreChange(false) +RunSettingsWidget::RunSettingsWidget(Target *target) : + m_target(target), + m_runConfigurationsModel(new RunConfigurationModel(target, this)), + m_deployConfigurationModel(new DeployConfigurationModel(target, this)) { Q_ASSERT(m_target); @@ -102,7 +95,7 @@ RunSettingsWidget::RunSettingsWidget(Target *target) m_removeDeployToolButton = new QPushButton(tr("Remove"), this); m_renameDeployButton = new QPushButton(tr("Rename..."), this); - QWidget *deployWidget = new QWidget(this); + auto deployWidget = new QWidget(this); m_runConfigurationCombo = new QComboBox(this); m_runConfigurationCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); @@ -112,17 +105,15 @@ RunSettingsWidget::RunSettingsWidget(Target *target) m_removeRunToolButton = new QPushButton(tr("Remove"), this); m_renameRunButton = new QPushButton(tr("Rename..."), this); - QSpacerItem *spacer1 = - new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum); - QSpacerItem *spacer2 = - new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); + auto spacer1 = new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum); + auto spacer2 = new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); - QWidget *runWidget = new QWidget(this); + auto runWidget = new QWidget(this); - QLabel *deployTitle = new QLabel(tr("Deployment"), this); - QLabel *deployLabel = new QLabel(tr("Method:"), this); - QLabel *runTitle = new QLabel(tr("Run"), this); - QLabel *runLabel = new QLabel(tr("Run configuration:"), this); + auto deployTitle = new QLabel(tr("Deployment"), this); + auto deployLabel = new QLabel(tr("Method:"), this); + auto runTitle = new QLabel(tr("Run"), this); + auto runLabel = new QLabel(tr("Run configuration:"), this); runLabel->setBuddy(m_runConfigurationCombo); @@ -243,7 +234,7 @@ void RunSettingsWidget::aboutToShowAddMenu() foreach (IRunConfigurationFactory *factory, factories) { QList<Core::Id> ids = factory->availableCreationIds(m_target); foreach (Core::Id id, ids) { - QAction *action = new QAction(factory->displayNameForId(id), m_addRunMenu); + auto action = new QAction(factory->displayNameForId(id), m_addRunMenu); connect(action, &QAction::triggered, [factory, id, this]() { RunConfiguration *newRC = factory->create(m_target, id); if (!newRC) @@ -337,7 +328,7 @@ void RunSettingsWidget::currentRunConfigurationChanged(int index) if (m_ignoreChange) return; - RunConfiguration *selectedRunConfiguration = 0; + RunConfiguration *selectedRunConfiguration = nullptr; if (index >= 0) selectedRunConfiguration = m_runConfigurationsModel->runConfigurationAt(index); @@ -357,7 +348,7 @@ void RunSettingsWidget::currentDeployConfigurationChanged(int index) if (m_ignoreChange) return; if (index == -1) - SessionManager::setActiveDeployConfiguration(m_target, 0, SetActive::Cascade); + SessionManager::setActiveDeployConfiguration(m_target, nullptr, SetActive::Cascade); else SessionManager::setActiveDeployConfiguration(m_target, m_deployConfigurationModel->deployConfigurationAt(index), SetActive::Cascade); @@ -452,9 +443,9 @@ void RunSettingsWidget::updateRemoveToolButton() void RunSettingsWidget::updateDeployConfiguration(DeployConfiguration *dc) { delete m_deployConfigurationWidget; - m_deployConfigurationWidget = 0; + m_deployConfigurationWidget = nullptr; delete m_deploySteps; - m_deploySteps = 0; + m_deploySteps = nullptr; m_ignoreChange = true; m_deployConfigurationCombo->setCurrentIndex(-1); @@ -485,7 +476,7 @@ void RunSettingsWidget::setConfigurationWidget(RunConfiguration *rc) return; delete m_runConfigurationWidget; - m_runConfigurationWidget = 0; + m_runConfigurationWidget = nullptr; removeSubWidgets(); if (!rc) return; @@ -540,7 +531,7 @@ void RunSettingsWidget::addSubWidget(RunConfigWidget *widget) { widget->setContentsMargins(0, 10, 0, 0); - QLabel *label = new QLabel(this); + auto label = new QLabel(this); label->setText(widget->displayName()); connect(widget, &RunConfigWidget::displayNameChanged, label, &QLabel::setText); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index e03408cd22..839a1e5688 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -48,8 +48,6 @@ class Target; namespace Internal { -const char RUNSETTINGS_PANEL_ID[] = "ProjectExplorer.RunSettingsPanel"; - class BuildStepListWidget; class RunSettingsWidget : public QWidget @@ -85,15 +83,15 @@ private: Target *m_target; RunConfigurationModel *m_runConfigurationsModel; DeployConfigurationModel *m_deployConfigurationModel; - QWidget *m_runConfigurationWidget; - RunConfiguration *m_runConfiguration; - QVBoxLayout *m_runLayout; - NamedWidget *m_deployConfigurationWidget; - QVBoxLayout *m_deployLayout; - BuildStepListWidget *m_deploySteps; + QWidget *m_runConfigurationWidget = nullptr; + RunConfiguration *m_runConfiguration = nullptr; + QVBoxLayout *m_runLayout = nullptr; + NamedWidget *m_deployConfigurationWidget = nullptr; + QVBoxLayout *m_deployLayout = nullptr; + BuildStepListWidget *m_deploySteps = nullptr; QMenu *m_addRunMenu; QMenu *m_addDeployMenu; - bool m_ignoreChange; + bool m_ignoreChange = false; typedef QPair<RunConfigWidget *, QLabel *> RunConfigItem; QList<RunConfigItem> m_subWidgets; diff --git a/src/plugins/projectexplorer/selectablefilesmodel.cpp b/src/plugins/projectexplorer/selectablefilesmodel.cpp index e3f3abe7b5..5b022468b2 100644 --- a/src/plugins/projectexplorer/selectablefilesmodel.cpp +++ b/src/plugins/projectexplorer/selectablefilesmodel.cpp @@ -144,7 +144,7 @@ void SelectableFilesModel::buildTree(const Utils::FileName &baseDir, Tree *tree, } ++m_futureCount; if (fileInfo.isDir()) { - Tree *t = new Tree; + auto t = new Tree; t->parent = tree; t->name = fileInfo.fileName(); t->fullPath = fn; @@ -154,7 +154,7 @@ void SelectableFilesModel::buildTree(const Utils::FileName &baseDir, Tree *tree, allUnchecked &= t->checked == Qt::Unchecked; tree->childDirectories.append(t); } else { - Tree *t = new Tree; + auto t = new Tree; t->parent = tree; t->name = fileInfo.fileName(); t->checked = (m_allFiles || m_files.contains(fn)) ? Qt::Checked : Qt::Unchecked; @@ -193,7 +193,7 @@ int SelectableFilesModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return 1; - Tree *parentT = static_cast<Tree *>(parent.internalPointer()); + auto parentT = static_cast<Tree *>(parent.internalPointer()); return parentT->childDirectories.size() + parentT->visibleFiles.size(); } @@ -201,7 +201,7 @@ QModelIndex SelectableFilesModel::index(int row, int column, const QModelIndex & { if (!parent.isValid()) return createIndex(row, column, m_root); - Tree *parentT = static_cast<Tree *>(parent.internalPointer()); + auto parentT = static_cast<Tree *>(parent.internalPointer()); if (row < parentT->childDirectories.size()) return createIndex(row, column, parentT->childDirectories.at(row)); else @@ -214,7 +214,7 @@ QModelIndex SelectableFilesModel::parent(const QModelIndex &child) const return QModelIndex(); if (!child.internalPointer()) return QModelIndex(); - Tree *parent = static_cast<Tree *>(child.internalPointer())->parent; + auto parent = static_cast<Tree *>(child.internalPointer())->parent; if (!parent) return QModelIndex(); if (!parent->parent) //then the parent is the root @@ -230,7 +230,7 @@ QVariant SelectableFilesModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); - Tree *t = static_cast<Tree *>(index.internalPointer()); + auto t = static_cast<Tree *>(index.internalPointer()); if (role == Qt::DisplayRole) return t->name; if (role == Qt::CheckStateRole) @@ -247,7 +247,7 @@ bool SelectableFilesModel::setData(const QModelIndex &index, const QVariant &val { if (role == Qt::CheckStateRole) { // We can do that! - Tree *t = static_cast<Tree *>(index.internalPointer()); + auto t = static_cast<Tree *>(index.internalPointer()); t->checked = Qt::CheckState(value.toInt()); propagateDown(index); propagateUp(index); @@ -261,7 +261,7 @@ void SelectableFilesModel::propagateUp(const QModelIndex &index) QModelIndex parent = index.parent(); if (!parent.isValid()) return; - Tree *parentT = static_cast<Tree *>(parent.internalPointer()); + auto parentT = static_cast<Tree *>(parent.internalPointer()); if (!parentT) return; bool allChecked = true; @@ -290,7 +290,7 @@ void SelectableFilesModel::propagateUp(const QModelIndex &index) void SelectableFilesModel::propagateDown(const QModelIndex &index) { - Tree *t = static_cast<Tree *>(index.internalPointer()); + auto t = static_cast<Tree *>(index.internalPointer()); for (int i = 0; i<t->childDirectories.size(); ++i) { t->childDirectories[i]->checked = t->checked; propagateDown(index.child(i, 0)); @@ -405,7 +405,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index) { bool allChecked = true; bool allUnchecked = true; - Tree *t = static_cast<Tree *>(index.internalPointer()); + auto t = static_cast<Tree *>(index.internalPointer()); for (int i=0; i < t->childDirectories.size(); ++i) { Qt::CheckState childCheckState = applyFilter(index.child(i, 0)); @@ -475,7 +475,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index) ++newIndex; } // end of block = newIndex - beginInsertRows(index, visibleIndex, visibleIndex + newIndex-startOfBlock-1); + beginInsertRows(index, visibleIndex, visibleIndex + newIndex - startOfBlock - 1); for (int i= newIndex - 1; i >= startOfBlock; --i) t->visibleFiles.insert(visibleIndex, newRows.at(i)); endInsertRows(); @@ -485,8 +485,8 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index) break; } if (newIndex != newEnd) { - beginInsertRows(index, visibleIndex, visibleIndex + newEnd-newIndex-1); - for (int i=newEnd-1; i >=newIndex; --i) + beginInsertRows(index, visibleIndex, visibleIndex + newEnd - newIndex - 1); + for (int i = newEnd - 1; i >= newIndex; --i) t->visibleFiles.insert(visibleIndex, newRows.at(i)); endInsertRows(); } @@ -527,7 +527,6 @@ enum class SelectableFilesWidgetRows { SelectableFilesWidget::SelectableFilesWidget(QWidget *parent) : QWidget(parent), - m_model(0), m_baseDirChooser(new Utils::PathChooser), m_baseDirLabel(new QLabel), m_startParsingButton(new QPushButton), @@ -733,7 +732,7 @@ SelectableFilesDialogEditFiles::SelectableFilesDialogEditFiles(const Utils::File m_filesWidget->setBaseDirEditable(false); - QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this); + auto buttonBox = new QDialogButtonBox(Qt::Horizontal, this); buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, diff --git a/src/plugins/projectexplorer/selectablefilesmodel.h b/src/plugins/projectexplorer/selectablefilesmodel.h index f4de2fd253..ec82c055e4 100644 --- a/src/plugins/projectexplorer/selectablefilesmodel.h +++ b/src/plugins/projectexplorer/selectablefilesmodel.h @@ -182,7 +182,7 @@ private: void smartExpand(const QModelIndex &index); - SelectableFilesModel *m_model; + SelectableFilesModel *m_model = nullptr; Utils::PathChooser *m_baseDirChooser; QLabel *m_baseDirLabel; diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 6c6d942032..7f835d5607 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -122,8 +122,7 @@ public: static SessionManager *m_instance = nullptr; static SessionManagerPrivate *d = nullptr; -SessionManager::SessionManager(QObject *parent) - : QObject(parent) +SessionManager::SessionManager(QObject *parent) : QObject(parent) { m_instance = this; d = new SessionManagerPrivate; @@ -471,7 +470,7 @@ bool SessionManager::save() data.insert(QLatin1String("CascadeSetActive"), d->m_casadeSetActive); QMap<QString, QVariant> depMap; - QMap<QString, QStringList>::const_iterator i = d->m_depMap.constBegin(); + auto i = d->m_depMap.constBegin(); while (i != d->m_depMap.constEnd()) { QString key = i.key(); QStringList values; @@ -483,9 +482,9 @@ bool SessionManager::save() data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap)); data.insert(QLatin1String("EditorSettings"), EditorManager::saveState().toBase64()); - QMap<QString, QVariant>::const_iterator it, end = d->m_values.constEnd(); + auto end = d->m_values.constEnd(); QStringList keys; - for (it = d->m_values.constBegin(); it != end; ++it) { + for (auto it = d->m_values.constBegin(); it != end; ++it) { data.insert(QLatin1String("value-") + it.key(), it.value()); keys << it.key(); } @@ -573,7 +572,7 @@ QStringList SessionManagerPrivate::dependenciesOrder() const } while (!unordered.isEmpty()) { - for (int i=(unordered.count()-1); i>=0; --i) { + for (int i = (unordered.count() - 1); i >= 0; --i) { if (unordered.at(i).second.isEmpty()) { ordered << unordered.at(i).first; unordered.removeAt(i); @@ -709,7 +708,7 @@ void SessionManager::removeProjects(QList<Project *> remove) projectFiles.insert(pro->projectFilePath().toString()); } - QSet<QString>::const_iterator i = projectFiles.begin(); + auto i = projectFiles.begin(); while (i != projectFiles.end()) { QStringList dependencies; foreach (const QString &dependency, d->m_depMap.value(*i)) { @@ -761,7 +760,7 @@ void SessionManager::setValue(const QString &name, const QVariant &value) QVariant SessionManager::value(const QString &name) { - QMap<QString, QVariant>::const_iterator it = d->m_values.constFind(name); + auto it = d->m_values.constFind(name); return (it == d->m_values.constEnd()) ? QVariant() : *it; } @@ -864,7 +863,7 @@ void SessionManagerPrivate::restoreValues(const PersistentSettingsReader &reader void SessionManagerPrivate::restoreDependencies(const PersistentSettingsReader &reader) { QMap<QString, QVariant> depMap = reader.restoreValue(QLatin1String("ProjectDependencies")).toMap(); - QMap<QString, QVariant>::const_iterator i = depMap.constBegin(); + auto i = depMap.constBegin(); while (i != depMap.constEnd()) { const QString &key = i.key(); if (!m_failedProjects.contains(key)) { diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index a5b1f55ef1..ce37b59125 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -52,7 +52,7 @@ class PROJECTEXPLORER_EXPORT SessionManager : public QObject Q_OBJECT public: - explicit SessionManager(QObject *parent = 0); + explicit SessionManager(QObject *parent = nullptr); ~SessionManager() override; static SessionManager *instance(); diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp index 8e05f7673b..2f6f6b15dc 100644 --- a/src/plugins/projectexplorer/sessiondialog.cpp +++ b/src/plugins/projectexplorer/sessiondialog.cpp @@ -81,13 +81,13 @@ void SessionValidator::fixup(QString &input) const SessionNameInputDialog::SessionNameInputDialog(const QStringList &sessions, QWidget *parent) : QDialog(parent), m_usedSwitchTo(false) { - QVBoxLayout *hlayout = new QVBoxLayout(this); - QLabel *label = new QLabel(tr("Enter the name of the session:"), this); + auto hlayout = new QVBoxLayout(this); + auto label = new QLabel(tr("Enter the name of the session:"), this); hlayout->addWidget(label); m_newSessionLineEdit = new QLineEdit(this); m_newSessionLineEdit->setValidator(new SessionValidator(this, sessions)); hlayout->addWidget(m_newSessionLineEdit); - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); m_switchToButton = buttons->addButton(tr("Switch To"), QDialogButtonBox::AcceptRole); connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); @@ -118,8 +118,7 @@ bool SessionNameInputDialog::isSwitchToRequested() const } -SessionDialog::SessionDialog(QWidget *parent) - : QDialog(parent) +SessionDialog::SessionDialog(QWidget *parent) : QDialog(parent) { m_ui.setupUi(this); diff --git a/src/plugins/projectexplorer/sessiondialog.h b/src/plugins/projectexplorer/sessiondialog.h index 4cf231f29e..bb1ae10dd4 100644 --- a/src/plugins/projectexplorer/sessiondialog.h +++ b/src/plugins/projectexplorer/sessiondialog.h @@ -43,7 +43,7 @@ class SessionDialog : public QDialog Q_OBJECT public: - explicit SessionDialog(QWidget *parent = 0); + explicit SessionDialog(QWidget *parent = nullptr); void setAutoLoadSession(bool); bool autoLoadSession() const; @@ -68,7 +68,7 @@ class SessionNameInputDialog : public QDialog Q_OBJECT public: - explicit SessionNameInputDialog(const QStringList &sessions, QWidget *parent = 0); + explicit SessionNameInputDialog(const QStringList &sessions, QWidget *parent = nullptr); void setValue(const QString &value); QString value() const; diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index c7094ae154..28514964d1 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -2083,7 +2083,7 @@ QVariantMap UserFileVersion11Upgrader::upgrade(const QVariantMap &map) const QString oldTargetId = extraTargetData.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString(); // Check each BCs/DCs and create profiles as needed - Kit *rawKit = new Kit; // Do not needlessly use Core::Ids + auto rawKit = new Kit; // Do not needlessly use Core::Ids QMapIterator<int, QVariantMap> buildIt(bcs); while (buildIt.hasNext()) { buildIt.next(); diff --git a/src/plugins/projectexplorer/showoutputtaskhandler.h b/src/plugins/projectexplorer/showoutputtaskhandler.h index 2d17342d57..2c9aa230d0 100644 --- a/src/plugins/projectexplorer/showoutputtaskhandler.h +++ b/src/plugins/projectexplorer/showoutputtaskhandler.h @@ -44,7 +44,7 @@ public: QAction *createAction(QObject *parent) const override; private: - CompileOutputWindow * m_window; + CompileOutputWindow *m_window; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index e42a76ec1d..be131f39e0 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -154,35 +154,35 @@ Target::~Target() void Target::changeEnvironment() { - BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender()); + auto bc = qobject_cast<BuildConfiguration *>(sender()); if (bc == activeBuildConfiguration()) emit environmentChanged(); } void Target::changeBuildConfigurationEnabled() { - BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender()); + auto bc = qobject_cast<BuildConfiguration *>(sender()); if (bc == activeBuildConfiguration()) emit buildConfigurationEnabledChanged(); } void Target::changeDeployConfigurationEnabled() { - DeployConfiguration *dc = qobject_cast<DeployConfiguration *>(sender()); + auto dc = qobject_cast<DeployConfiguration *>(sender()); if (dc == activeDeployConfiguration()) emit deployConfigurationEnabledChanged(); } void Target::changeRunConfigurationEnabled() { - RunConfiguration *rc = qobject_cast<RunConfiguration *>(sender()); + auto rc = qobject_cast<RunConfiguration *>(sender()); if (rc == activeRunConfiguration()) emit runConfigurationEnabledChanged(); } void Target::onBuildDirectoryChanged() { - BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender()); + auto bc = qobject_cast<BuildConfiguration *>(sender()); if (bc && activeBuildConfiguration() == bc) emit buildDirectoryChanged(); } @@ -263,7 +263,7 @@ bool Target::removeBuildConfiguration(BuildConfiguration *configuration) if (activeBuildConfiguration() == configuration) { if (d->m_buildConfigurations.isEmpty()) - SessionManager::setActiveBuildConfiguration(this, 0, SetActive::Cascade); + SessionManager::setActiveBuildConfiguration(this, nullptr, SetActive::Cascade); else SessionManager::setActiveBuildConfiguration(this, d->m_buildConfigurations.at(0), SetActive::Cascade); } @@ -337,7 +337,7 @@ bool Target::removeDeployConfiguration(DeployConfiguration *dc) if (activeDeployConfiguration() == dc) { if (d->m_deployConfigurations.isEmpty()) - SessionManager::setActiveDeployConfiguration(this, 0, SetActive::Cascade); + SessionManager::setActiveDeployConfiguration(this, nullptr, SetActive::Cascade); else SessionManager::setActiveDeployConfiguration(this, d->m_deployConfigurations.at(0), SetActive::Cascade); @@ -431,7 +431,7 @@ void Target::removeRunConfiguration(RunConfiguration* runConfiguration) if (activeRunConfiguration() == runConfiguration) { if (d->m_runConfigurations.isEmpty()) - setActiveRunConfiguration(0); + setActiveRunConfiguration(nullptr); else setActiveRunConfiguration(d->m_runConfigurations.at(0)); } diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp index 9b1f72409e..9c7062536e 100644 --- a/src/plugins/projectexplorer/targetselector.cpp +++ b/src/plugins/projectexplorer/targetselector.cpp @@ -394,7 +394,7 @@ void TargetSelector::updateButtons() bool TargetSelector::event(QEvent *e) { if (e->type() == QEvent::ToolTip) { - const QHelpEvent *helpEvent = static_cast<const QHelpEvent *>(e); + auto helpEvent = static_cast<const QHelpEvent *>(e); int targetIndex; int subTargetIndex; getControlAt(helpEvent->x(), helpEvent->y(), 0, &targetIndex, &subTargetIndex); diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h index bad62d0339..13e21770b5 100644 --- a/src/plugins/projectexplorer/targetselector.h +++ b/src/plugins/projectexplorer/targetselector.h @@ -39,7 +39,8 @@ class QPixmapButton; class TargetSelector : public QWidget { -Q_OBJECT + Q_OBJECT + public: class Target { public: @@ -47,7 +48,7 @@ public: int currentSubIndex; }; - explicit TargetSelector(QWidget *parent = 0); + explicit TargetSelector(QWidget *parent = nullptr); QSize sizeHint() const override; diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index cb7b25552f..046a4f2a46 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -76,8 +76,8 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) : { Q_ASSERT(m_project); - m_panelWidgets[0] = 0; - m_panelWidgets[1] = 0; + m_panelWidgets[0] = nullptr; + m_panelWidgets[1] = nullptr; m_addMenu = new QMenu(this); m_targetMenu = new QMenu(this); @@ -114,8 +114,8 @@ TargetSettingsPanelWidget::~TargetSettingsPanelWidget() bool TargetSettingsPanelWidget::event(QEvent *event) { if (event->type() == QEvent::StatusTip) { - QAction *act = 0; - QMenu *menu = 0; + QAction *act = nullptr; + QMenu *menu = nullptr; if (m_addMenu->activeAction()) { menu = m_addMenu; act = m_addMenu->activeAction(); @@ -129,7 +129,7 @@ bool TargetSettingsPanelWidget::event(QEvent *event) return QWidget::event(event); } - QStatusTipEvent *ev = static_cast<QStatusTipEvent *>(event); + auto ev = static_cast<QStatusTipEvent *>(event); ev->accept(); if (act != m_lastAction) @@ -154,7 +154,7 @@ bool TargetSettingsPanelWidget::event(QEvent *event) void TargetSettingsPanelWidget::setupUi() { - QVBoxLayout *viewLayout = new QVBoxLayout(this); + auto viewLayout = new QVBoxLayout(this); viewLayout->setMargin(0); viewLayout->setSpacing(0); @@ -167,9 +167,9 @@ void TargetSettingsPanelWidget::setupUi() // no target label: m_noTargetLabel = new QWidget; - QVBoxLayout *noTargetLayout = new QVBoxLayout(m_noTargetLabel); + auto noTargetLayout = new QVBoxLayout(m_noTargetLabel); noTargetLayout->setMargin(0); - QLabel *label = new QLabel(m_noTargetLabel); + auto label = new QLabel(m_noTargetLabel); label->setText(tr("No kit defined in this project.")); { QFont f = label->font(); @@ -219,9 +219,9 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd if (targetIndex == -1 || subIndex == -1) { // no more kits! delete m_panelWidgets[0]; - m_panelWidgets[0] = 0; + m_panelWidgets[0] = nullptr; delete m_panelWidgets[1]; - m_panelWidgets[1] = 0; + m_panelWidgets[1] = nullptr; m_centralWidget->setCurrentWidget(m_noTargetLabel); return; @@ -245,9 +245,9 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd auto wrapWidgetInPropertiesPanel = [](QWidget *widget, const QString &displayName, const QIcon &icon) -> PropertiesPanel *{ - PropertiesPanel *panel = new PropertiesPanel; - QWidget *w = new QWidget(); - QVBoxLayout *l = new QVBoxLayout(w); + auto panel = new PropertiesPanel; + auto w = new QWidget(); + auto l = new QVBoxLayout(w); l->addWidget(widget); l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); l->setContentsMargins(QMargins()); @@ -264,8 +264,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd RunSettingsWidget::tr("Run Settings"), QIcon(QLatin1String(":/projectexplorer/images/RunSettings.png"))); - PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget); - PanelsWidget *runPanel = new PanelsWidget(m_centralWidget); + auto buildPanel = new PanelsWidget(m_centralWidget); + auto runPanel = new PanelsWidget(m_centralWidget); buildPanel->addPropertiesPanel(build); runPanel->addPropertiesPanel(run); @@ -413,7 +413,7 @@ void TargetSettingsPanelWidget::activeTargetChanged(Target *target) void TargetSettingsPanelWidget::createAction(Kit *k, QMenu *menu) { - QAction *action = new QAction(k->displayName(), menu); + auto action = new QAction(k->displayName(), menu); action->setData(QVariant::fromValue(k->id())); QString statusTip = QLatin1String("<html><body>"); QString errorMessage; @@ -442,7 +442,7 @@ void TargetSettingsPanelWidget::updateTargetButtons() foreach (IPotentialKit *potentialKit, potentialKits) { if (!potentialKit->isEnabled()) continue; - QAction *action = new QAction(potentialKit->displayName(), m_addMenu); + auto action = new QAction(potentialKit->displayName(), m_addMenu); action->setData(QVariant::fromValue(potentialKit)); m_addMenu->addAction(action); } @@ -480,7 +480,7 @@ void TargetSettingsPanelWidget::updateTargetButtons() void TargetSettingsPanelWidget::renameTarget() { - Target *t = qobject_cast<Target *>(sender()); + auto t = qobject_cast<Target *>(sender()); if (!t) return; const int pos = m_targets.indexOf(t); @@ -504,8 +504,8 @@ void TargetSettingsPanelWidget::importTarget(const Utils::FileName &path) if (!m_importer) return; - Target *target = 0; - BuildConfiguration *bc = 0; + Target *target = nullptr; + BuildConfiguration *bc = nullptr; QList<BuildInfo *> toImport = m_importer->import(path, false); foreach (BuildInfo *info, toImport) { target = m_project->target(info->kitId); diff --git a/src/plugins/projectexplorer/targetsettingspanel.h b/src/plugins/projectexplorer/targetsettingspanel.h index 7705224c09..8b65e0cf70 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.h +++ b/src/plugins/projectexplorer/targetsettingspanel.h @@ -80,20 +80,20 @@ private: void importTarget(const Utils::FileName &path); void createAction(Kit *k, QMenu *menu); - Target *m_currentTarget = 0; + Target *m_currentTarget = nullptr; Project *m_project; ProjectImporter *m_importer; - TargetSettingsWidget *m_selector = 0; - QStackedWidget *m_centralWidget = 0; + TargetSettingsWidget *m_selector = nullptr; + QStackedWidget *m_centralWidget = nullptr; QWidget *m_noTargetLabel; PanelsWidget *m_panelWidgets[2]; QList<Target *> m_targets; QMenu *m_targetMenu; - QMenu *m_changeMenu = 0; - QMenu *m_duplicateMenu = 0; + QMenu *m_changeMenu = nullptr; + QMenu *m_duplicateMenu = nullptr; QMenu *m_addMenu; - QAction *m_lastAction = 0; - QAction *m_importAction = 0; + QAction *m_lastAction = nullptr; + QAction *m_importAction = nullptr; int m_menuTargetIndex = -1; static int s_targetSubIndex; }; diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp index 397e750a23..5517a4ebea 100644 --- a/src/plugins/projectexplorer/targetsettingswidget.cpp +++ b/src/plugins/projectexplorer/targetsettingswidget.cpp @@ -32,8 +32,7 @@ using namespace ProjectExplorer::Internal; -TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) : - QWidget(parent), +TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) : QWidget(parent), ui(new Ui::TargetSettingsWidget), m_targetSelector(new TargetSelector(this)) { @@ -48,12 +47,12 @@ TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) : "}")); } - QHBoxLayout *headerLayout = new QHBoxLayout; + auto headerLayout = new QHBoxLayout; headerLayout->setContentsMargins(5, 3, 0, 0); ui->header->setLayout(headerLayout); - QWidget *buttonWidget = new QWidget(ui->header); - QVBoxLayout *buttonLayout = new QVBoxLayout; + auto buttonWidget = new QWidget(ui->header); + auto buttonLayout = new QVBoxLayout; buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->setSpacing(4); buttonWidget->setLayout(buttonLayout); diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h index ee6573c384..55597af352 100644 --- a/src/plugins/projectexplorer/targetsettingswidget.h +++ b/src/plugins/projectexplorer/targetsettingswidget.h @@ -44,7 +44,7 @@ class TargetSettingsWidget : public QWidget Q_OBJECT public: - explicit TargetSettingsWidget(QWidget *parent = 0); + explicit TargetSettingsWidget(QWidget *parent = nullptr); ~TargetSettingsWidget() override; void setCentralWidget(QWidget *widget); @@ -78,7 +78,7 @@ private: TargetSelector *m_targetSelector; QPushButton *m_addButton; QPushButton *m_manageButton; - QWidget *m_centralWidget = 0; + QWidget *m_centralWidget = nullptr; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/targetsetuppage.cpp b/src/plugins/projectexplorer/targetsetuppage.cpp index 7b6d250972..447df63542 100644 --- a/src/plugins/projectexplorer/targetsetuppage.cpp +++ b/src/plugins/projectexplorer/targetsetuppage.cpp @@ -67,7 +67,7 @@ public: void setupUi(TargetSetupPage *q) { - QWidget *setupTargetPage = new QWidget(q); + auto setupTargetPage = new QWidget(q); descriptionLabel = new QLabel(setupTargetPage); descriptionLabel->setWordWrap(true); descriptionLabel->setVisible(false); @@ -104,17 +104,16 @@ public: scrollArea = new QScrollArea(scrollAreaWidget); scrollArea->setWidgetResizable(true); - QWidget *scrollAreaWidgetContents; - scrollAreaWidgetContents = new QWidget(); + auto scrollAreaWidgetContents = new QWidget(); scrollAreaWidgetContents->setGeometry(QRect(0, 0, 230, 81)); scrollArea->setWidget(scrollAreaWidgetContents); - QVBoxLayout *verticalLayout = new QVBoxLayout(scrollAreaWidget); + auto verticalLayout = new QVBoxLayout(scrollAreaWidget); verticalLayout->setSpacing(0); verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->addWidget(scrollArea); - QVBoxLayout *verticalLayout_2 = new QVBoxLayout(setupTargetPage); + auto verticalLayout_2 = new QVBoxLayout(setupTargetPage); verticalLayout_2->addWidget(headerLabel); verticalLayout_2->addWidget(noValidKitLabel); verticalLayout_2->addWidget(descriptionLabel); @@ -123,7 +122,7 @@ public: verticalLayout_2->addWidget(centralWidget); verticalLayout_2->addWidget(scrollAreaWidget); - QVBoxLayout *verticalLayout_3 = new QVBoxLayout(q); + auto verticalLayout_3 = new QVBoxLayout(q); verticalLayout_3->setContentsMargins(0, 0, 0, -1); verticalLayout_3->addWidget(setupTargetPage); @@ -141,13 +140,9 @@ using namespace Internal; TargetSetupPage::TargetSetupPage(QWidget *parent) : Utils::WizardPage(parent), - m_importer(0), - m_baseLayout(0), - m_firstWidget(0), m_ui(new TargetSetupPageUi), m_importWidget(new ImportWidget(this)), - m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)), - m_forceOptionHint(false) + m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)) { m_importWidget->setVisible(false); @@ -161,7 +156,7 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : policy.setHeightForWidth(sizePolicy().hasHeightForWidth()); setSizePolicy(policy); - QWidget *centralWidget = new QWidget(this); + auto centralWidget = new QWidget(this); m_ui->scrollArea->setWidget(centralWidget); centralWidget->setLayout(new QVBoxLayout); m_ui->centralWidget->setLayout(new QVBoxLayout); @@ -206,9 +201,8 @@ void TargetSetupPage::setRequiredKitMatcher(const KitMatcher &matcher) QList<Core::Id> TargetSetupPage::selectedKits() const { QList<Core::Id> result; - QMap<Core::Id, TargetSetupWidget *>::const_iterator it, end; - it = m_widgets.constBegin(); - end = m_widgets.constEnd(); + auto it = m_widgets.constBegin(); + auto end = m_widgets.constEnd(); for ( ; it != end; ++it) { if (isKitSelected(it.key())) @@ -510,7 +504,7 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k) return 0; QList<BuildInfo *> infoList = factory->availableSetups(k, m_projectPath); - TargetSetupWidget *widget = infoList.isEmpty() ? 0 : new TargetSetupWidget(k, m_projectPath, infoList); + TargetSetupWidget *widget = infoList.isEmpty() ? nullptr : new TargetSetupWidget(k, m_projectPath, infoList); if (!widget) return 0; diff --git a/src/plugins/projectexplorer/targetsetuppage.h b/src/plugins/projectexplorer/targetsetuppage.h index c2d5b1d73b..d004143634 100644 --- a/src/plugins/projectexplorer/targetsetuppage.h +++ b/src/plugins/projectexplorer/targetsetuppage.h @@ -57,7 +57,7 @@ class PROJECTEXPLORER_EXPORT TargetSetupPage : public Utils::WizardPage Q_OBJECT public: - explicit TargetSetupPage(QWidget *parent = 0); + explicit TargetSetupPage(QWidget *parent = nullptr); ~TargetSetupPage() override; /// Initializes the TargetSetupPage @@ -109,12 +109,12 @@ private: KitMatcher m_requiredMatcher; KitMatcher m_preferredMatcher; - ProjectImporter *m_importer; - QLayout *m_baseLayout; + ProjectImporter *m_importer = nullptr; + QLayout *m_baseLayout = nullptr; QString m_projectPath; QString m_defaultShadowBuildLocation; QMap<Core::Id, Internal::TargetSetupWidget *> m_widgets; - Internal::TargetSetupWidget *m_firstWidget; + Internal::TargetSetupWidget *m_firstWidget = nullptr; Internal::TargetSetupPageUi *m_ui; @@ -122,7 +122,7 @@ private: QSpacerItem *m_spacer; QList<QWidget *> m_potentialWidgets; - bool m_forceOptionHint; + bool m_forceOptionHint = false; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp index 101d8dde92..c5aaab3c88 100644 --- a/src/plugins/projectexplorer/targetsetupwidget.cpp +++ b/src/plugins/projectexplorer/targetsetupwidget.cpp @@ -56,15 +56,12 @@ namespace Internal { TargetSetupWidget::TargetSetupWidget(Kit *k, const QString &projectPath, const QList<BuildInfo *> &infoList) : - m_kit(k), - m_haveImported(false), - m_ignoreChange(false), - m_selected(0) + m_kit(k) { Q_ASSERT(m_kit); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - QVBoxLayout *vboxLayout = new QVBoxLayout(); + auto vboxLayout = new QVBoxLayout(); setLayout(vboxLayout); vboxLayout->setContentsMargins(0, 0, 0, 0); m_detailsWidget = new Utils::DetailsWidget(this); @@ -74,20 +71,20 @@ TargetSetupWidget::TargetSetupWidget(Kit *k, m_detailsWidget->setToolTip(m_kit->toHtml()); vboxLayout->addWidget(m_detailsWidget); - Utils::FadingWidget *panel = new Utils::FadingWidget(m_detailsWidget); - QHBoxLayout *panelLayout = new QHBoxLayout(panel); + auto panel = new Utils::FadingWidget(m_detailsWidget); + auto panelLayout = new QHBoxLayout(panel); m_manageButton = new QPushButton(KitConfigWidget::msgManage()); panelLayout->addWidget(m_manageButton); m_detailsWidget->setToolWidget(panel); handleKitUpdate(m_kit); - QWidget *widget = new QWidget; - QVBoxLayout *layout = new QVBoxLayout; + auto widget = new QWidget; + auto layout = new QVBoxLayout; widget->setLayout(layout); layout->setContentsMargins(0, 0, 0, 0); - QWidget *w = new QWidget; + auto w = new QWidget; m_newBuildsLayout = new QGridLayout; m_newBuildsLayout->setMargin(0); if (Utils::HostOsInfo::isMacHost()) @@ -125,7 +122,7 @@ Kit *TargetSetupWidget::kit() void TargetSetupWidget::clearKit() { - m_kit = 0; + m_kit = nullptr; } bool TargetSetupWidget::isKitSelected() const @@ -165,20 +162,20 @@ void TargetSetupWidget::addBuildInfo(BuildInfo *info, bool isImport) m_infoList << info; - QCheckBox *checkbox = new QCheckBox; + auto checkbox = new QCheckBox; checkbox->setText(info->displayName); checkbox->setChecked(m_enabled.at(pos)); checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_newBuildsLayout->addWidget(checkbox, pos * 2, 0); - Utils::PathChooser *pathChooser = new Utils::PathChooser(); + auto pathChooser = new Utils::PathChooser(); pathChooser->setExpectedKind(Utils::PathChooser::Directory); pathChooser->setFileName(info->buildDirectory); pathChooser->setHistoryCompleter(QLatin1String("TargetSetup.BuildDir.History")); pathChooser->setReadOnly(isImport); m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1); - QLabel *reportIssuesLabel = new QLabel; + auto reportIssuesLabel = new QLabel; reportIssuesLabel->setIndent(32); m_newBuildsLayout->addWidget(reportIssuesLabel, pos * 2 + 1, 0, 1, 2); reportIssuesLabel->setVisible(false); @@ -289,7 +286,7 @@ void TargetSetupWidget::clear() void TargetSetupWidget::checkBoxToggled(bool b) { - QCheckBox *box = qobject_cast<QCheckBox *>(sender()); + auto box = qobject_cast<QCheckBox *>(sender()); if (!box) return; int index = m_checkboxes.indexOf(box); @@ -309,7 +306,7 @@ void TargetSetupWidget::pathChanged() { if (m_ignoreChange) return; - Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender()); + auto pathChooser = qobject_cast<Utils::PathChooser *>(sender()); if (!pathChooser) return; int index = m_pathChoosers.indexOf(pathChooser); diff --git a/src/plugins/projectexplorer/targetsetupwidget.h b/src/plugins/projectexplorer/targetsetupwidget.h index f4fa60f603..c3d83d55a7 100644 --- a/src/plugins/projectexplorer/targetsetupwidget.h +++ b/src/plugins/projectexplorer/targetsetupwidget.h @@ -91,7 +91,7 @@ private: Kit *m_kit; QString m_projectPath; - bool m_haveImported; + bool m_haveImported = false; Utils::DetailsWidget *m_detailsWidget; QPushButton *m_manageButton; QGridLayout *m_newBuildsLayout; @@ -101,8 +101,8 @@ private: QList<bool> m_enabled; QList<QLabel *> m_reportIssuesLabels; QList<bool> m_issues; - bool m_ignoreChange; - int m_selected; // Number of selected buildconfiguartions + bool m_ignoreChange = false; + int m_selected = 0; // Number of selected buildconfiguartions }; } // namespace Internal diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp index 5b5aa4dd0b..2ce383bc6b 100644 --- a/src/plugins/projectexplorer/taskhub.cpp +++ b/src/plugins/projectexplorer/taskhub.cpp @@ -33,7 +33,7 @@ using namespace ProjectExplorer; -TaskHub *m_instance = 0; +static TaskHub *m_instance = nullptr; QVector<Core::Id> TaskHub::m_registeredCategories; static Core::Id categoryForType(Task::TaskType type) @@ -51,9 +51,10 @@ static Core::Id categoryForType(Task::TaskType type) class TaskMark : public TextEditor::TextMark { public: - TaskMark(unsigned int id, const QString &fileName, int lineNumber, Task::TaskType type, bool visible) - : TextMark(fileName, lineNumber, categoryForType(type)) - , m_id(id) + TaskMark(unsigned int id, const QString &fileName, int lineNumber, + Task::TaskType type, bool visible) : + TextMark(fileName, lineNumber, categoryForType(type)), + m_id(id) { setVisible(visible); } @@ -108,7 +109,7 @@ TaskHub::TaskHub() TaskHub::~TaskHub() { - m_instance = 0; + m_instance = nullptr; } void TaskHub::addCategory(Core::Id categoryId, const QString &displayName, bool visible) @@ -142,8 +143,7 @@ void TaskHub::addTask(Task task) task.movedLine = task.line; if (task.line != -1 && !task.file.isEmpty()) { - TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, - task.type, !task.icon.isNull()); + auto mark = new TaskMark(task.taskId, task.file.toString(), task.line, task.type, !task.icon.isNull()); mark->setIcon(task.icon); mark->setPriority(TextEditor::TextMark::LowPriority); task.addMark(mark); @@ -192,4 +192,3 @@ void TaskHub::requestPopup() { emit m_instance->popupRequested(Core::IOutputPane::NoModeSwitch); } - diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 2bdc319023..c0f6dd0f65 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -110,7 +110,7 @@ void TaskModel::addTask(const Task &task) CategoryData &data = m_categories[task.category]; CategoryData &global = m_categories[Core::Id()]; - QList<Task>::iterator it = qLowerBound(m_tasks.begin(), m_tasks.end(),task.taskId, sortById); + auto it = qLowerBound(m_tasks.begin(), m_tasks.end(),task.taskId, sortById); int i = it - m_tasks.begin(); beginInsertRows(QModelIndex(), i, i); m_tasks.insert(it, task); @@ -135,7 +135,7 @@ void TaskModel::removeTask(const Task &task) int TaskModel::rowForId(unsigned int id) { - QList<Task>::const_iterator it = qLowerBound(m_tasks.constBegin(), m_tasks.constEnd(), id, sortById); + auto it = qLowerBound(m_tasks.constBegin(), m_tasks.constEnd(), id, sortById); if (it == m_tasks.constEnd()) return -1; return it - m_tasks.constBegin(); @@ -378,8 +378,8 @@ QVariant TaskFilterModel::data(const QModelIndex &index, int role) const static QPair<int, int> findFilteredRange(int first, int last, const QList<int> &list) { - QList<int>::const_iterator filteredFirst = qLowerBound(list, first); - QList<int>::const_iterator filteredLast = qUpperBound(filteredFirst, list.constEnd(), last); + auto filteredFirst = qLowerBound(list, first); + auto filteredLast = qUpperBound(filteredFirst, list.constEnd(), last); return qMakePair(filteredFirst - list.constBegin(), filteredLast - list.constBegin() - 1); } @@ -453,7 +453,7 @@ void TaskFilterModel::handleReset() QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const { - QList<int>::const_iterator it = qBinaryFind(m_mapping.constBegin(), m_mapping.constEnd(), idx.row()); + auto it = qBinaryFind(m_mapping.constBegin(), m_mapping.constEnd(), idx.row()); if (it == m_mapping.constEnd()) return QModelIndex(); return index(it - m_mapping.constBegin(), 0); diff --git a/src/plugins/projectexplorer/taskmodel.h b/src/plugins/projectexplorer/taskmodel.h index 113c388413..e94d218cab 100644 --- a/src/plugins/projectexplorer/taskmodel.h +++ b/src/plugins/projectexplorer/taskmodel.h @@ -79,8 +79,6 @@ private: class CategoryData { public: - CategoryData() : count(0), warnings(0), errors(0) { } - void addTask(const Task &task) { ++count; @@ -106,9 +104,9 @@ private: } QString displayName; - int count; - int warnings; - int errors; + int count = 0; + int warnings = 0; + int errors = 0; }; QHash<Core::Id,CategoryData> m_categories; // category id to data @@ -127,7 +125,7 @@ class TaskFilterModel : public QAbstractItemModel Q_OBJECT public: - TaskFilterModel(TaskModel *sourceModel, QObject *parent = 0); + TaskFilterModel(TaskModel *sourceModel, QObject *parent = nullptr); TaskModel *taskModel() { return m_sourceModel; } diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 952ab63f8a..d439c3643b 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -204,7 +204,7 @@ public: Internal::TaskView *m_listview; Internal::TaskWindowContext *m_taskWindowContext; QMenu *m_contextMenu; - ITaskHandler *m_defaultHandler; + ITaskHandler *m_defaultHandler = nullptr; QToolButton *m_filterWarningsButton; QToolButton *m_categoriesButton; QMenu *m_categoriesMenu; @@ -214,7 +214,7 @@ public: static QToolButton *createFilterButton(QIcon icon, const QString &toolTip, QObject *receiver, std::function<void(bool)> lambda) { - QToolButton *button = new QToolButton; + auto button = new QToolButton; button->setIcon(icon); button->setToolTip(toolTip); button->setCheckable(true); @@ -227,8 +227,6 @@ static QToolButton *createFilterButton(QIcon icon, const QString &toolTip, TaskWindow::TaskWindow() : d(new TaskWindowPrivate) { - d->m_defaultHandler = 0; - d->m_model = new Internal::TaskModel(this); d->m_filter = new Internal::TaskFilterModel(d->m_model); d->m_listview = new Internal::TaskView; @@ -500,7 +498,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index) void TaskWindow::actionTriggered() { - QAction *action = qobject_cast<QAction *>(sender()); + auto action = qobject_cast<QAction *>(sender()); if (!action || !action->isEnabled()) return; ITaskHandler *h = handler(action); @@ -537,7 +535,7 @@ void TaskWindow::updateCategoriesMenu() for (NameToIdsConstIt it = nameToIds.constBegin(); it != cend; ++it) { const QString &displayName = it.key(); const Core::Id categoryId = it.value(); - QAction *action = new QAction(d->m_categoriesMenu); + auto action = new QAction(d->m_categoriesMenu); action->setCheckable(true); action->setText(displayName); action->setChecked(!filteredCategories.contains(categoryId)); @@ -673,7 +671,7 @@ QSize TaskDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelInd QStyleOptionViewItem opt = option; initStyleOption(&opt, index); - const QAbstractItemView * view = qobject_cast<const QAbstractItemView *>(opt.widget); + auto view = qobject_cast<const QAbstractItemView *>(opt.widget); const bool selected = (view->selectionModel()->currentIndex() == index); QSize s; s.setWidth(option.rect.width()); @@ -687,7 +685,7 @@ QSize TaskDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelInd int fontHeight = fm.height(); int fontLeading = fm.leading(); - TaskModel *model = static_cast<TaskFilterModel *>(view->model())->taskModel(); + auto model = static_cast<TaskFilterModel *>(view->model())->taskModel(); Positions positions(option, model); if (selected) { @@ -746,7 +744,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, QColor backgroundColor; QColor textColor; - const QAbstractItemView * view = qobject_cast<const QAbstractItemView *>(opt.widget); + auto view = qobject_cast<const QAbstractItemView *>(opt.widget); bool selected = view->selectionModel()->currentIndex() == index; if (selected) { @@ -767,7 +765,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->setPen(textColor); - TaskModel *model = static_cast<TaskFilterModel *>(view->model())->taskModel(); + auto model = static_cast<TaskFilterModel *>(view->model())->taskModel(); Positions positions(opt, model); // Paint TaskIconArea: diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index a63a6ecc01..05ec1bbc84 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -62,9 +62,9 @@ public: } QByteArray m_id; + mutable QString m_displayName; Core::Id m_typeId; Detection m_detection; - mutable QString m_displayName; }; } // namespace Internal @@ -247,7 +247,7 @@ bool ToolChainFactory::canCreate() ToolChain *ToolChainFactory::create() { - return 0; + return nullptr; } bool ToolChainFactory::canRestore(const QVariantMap &) @@ -257,7 +257,7 @@ bool ToolChainFactory::canRestore(const QVariantMap &) ToolChain *ToolChainFactory::restore(const QVariantMap &) { - return 0; + return nullptr; } static QPair<QString, QString> rawIdData(const QVariantMap &data) diff --git a/src/plugins/projectexplorer/toolchainconfigwidget.cpp b/src/plugins/projectexplorer/toolchainconfigwidget.cpp index efe73053a2..2bfe9b3403 100644 --- a/src/plugins/projectexplorer/toolchainconfigwidget.cpp +++ b/src/plugins/projectexplorer/toolchainconfigwidget.cpp @@ -40,11 +40,11 @@ namespace ProjectExplorer { ToolChainConfigWidget::ToolChainConfigWidget(ToolChain *tc) : - m_toolChain(tc), m_errorLabel(0) + m_toolChain(tc) { Q_ASSERT(tc); - Utils::DetailsWidget *centralWidget = new Utils::DetailsWidget; + auto centralWidget = new Utils::DetailsWidget; centralWidget->setState(Utils::DetailsWidget::NoSummary); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -54,7 +54,7 @@ ToolChainConfigWidget::ToolChainConfigWidget(ToolChain *tc) : setWidget(centralWidget); - QWidget *detailsBox = new QWidget(); + auto detailsBox = new QWidget(); m_mainLayout = new QFormLayout(detailsBox); m_mainLayout->setContentsMargins(0, 0, 0, 0); diff --git a/src/plugins/projectexplorer/toolchainconfigwidget.h b/src/plugins/projectexplorer/toolchainconfigwidget.h index 3fdc440f83..e6b5764ca4 100644 --- a/src/plugins/projectexplorer/toolchainconfigwidget.h +++ b/src/plugins/projectexplorer/toolchainconfigwidget.h @@ -76,7 +76,7 @@ protected: private: ToolChain *m_toolChain; - QLabel *m_errorLabel; + QLabel *m_errorLabel = nullptr; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/toolchainmanager.h b/src/plugins/projectexplorer/toolchainmanager.h index d70f4ba974..11dfe0ec12 100644 --- a/src/plugins/projectexplorer/toolchainmanager.h +++ b/src/plugins/projectexplorer/toolchainmanager.h @@ -76,7 +76,7 @@ signals: void toolChainsLoaded(); private: - explicit ToolChainManager(QObject *parent = 0); + explicit ToolChainManager(QObject *parent = nullptr); // Make sure the this is only called after all // Tool chain Factories are registered! diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index 4e86d3dfa6..fb235e8dc6 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -144,7 +144,7 @@ public: m_addButton->setMenu(addMenu); m_cloneButton = new QPushButton(ToolChainOptionsPage::tr("Clone"), this); - connect(m_cloneButton, &QAbstractButton::clicked, [this] { createToolChain(0); }); + connect(m_cloneButton, &QAbstractButton::clicked, [this] { createToolChain(nullptr); }); m_delButton = new QPushButton(ToolChainOptionsPage::tr("Remove"), this); @@ -218,7 +218,7 @@ void ToolChainOptionsWidget::markForRemoval(ToolChainTreeItem *item) m_model.takeItem(item); if (m_toAddList.contains(item)) { delete item->toolChain; - item->toolChain = 0; + item->toolChain = nullptr; m_toAddList.removeOne(item); delete item; } else { @@ -270,10 +270,10 @@ void ToolChainOptionsWidget::toolChainSelectionChanged() if (oldWidget) oldWidget->setVisible(false); - QWidget *currentTcWidget = item ? item->widget : 0; + QWidget *currentTcWidget = item ? item->widget : nullptr; m_container->setWidget(currentTcWidget); - m_container->setVisible(currentTcWidget != 0); + m_container->setVisible(currentTcWidget); updateState(); } @@ -330,7 +330,7 @@ void ToolChainOptionsWidget::apply() void ToolChainOptionsWidget::createToolChain(ToolChainFactory *factory) { - ToolChain *tc = 0; + ToolChain *tc = nullptr; if (factory) { // Clone. @@ -347,7 +347,7 @@ void ToolChainOptionsWidget::createToolChain(ToolChainFactory *factory) if (!tc) return; - ToolChainTreeItem *item = new ToolChainTreeItem(tc, true); + auto item = new ToolChainTreeItem(tc, true); m_toAddList.append(item); m_manualRoot->appendChild(item); @@ -373,7 +373,7 @@ ToolChainTreeItem *ToolChainOptionsWidget::currentTreeItem() { QModelIndex index = m_toolChainView->currentIndex(); TreeItem *item = m_model.itemForIndex(index); - return item && item->level() == 2 ? static_cast<ToolChainTreeItem *>(item) : 0; + return (item && item->level() == 2) ? static_cast<ToolChainTreeItem *>(item) : nullptr; } // -------------------------------------------------------------------------- @@ -406,7 +406,7 @@ void ToolChainOptionsPage::apply() void ToolChainOptionsPage::finish() { delete m_widget; - m_widget = 0; + m_widget = nullptr; } } // namespace Internal diff --git a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp index d109e7e3b6..06e164cd30 100644 --- a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp +++ b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp @@ -48,10 +48,10 @@ namespace Internal { /// TargetSetupPageWrapper //////// -TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) : - QWidget(), m_project(project) +TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) : QWidget(), + m_project(project) { - QVBoxLayout *layout = new QVBoxLayout(); + auto layout = new QVBoxLayout(); layout->setMargin(0); setLayout(layout); @@ -68,12 +68,12 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) : layout->addWidget(m_targetSetupPage); // Apply row - QHBoxLayout *hbox = new QHBoxLayout(); + auto hbox = new QHBoxLayout(); layout->addLayout(hbox); layout->setMargin(0); hbox->addStretch(); - QDialogButtonBox *box = new QDialogButtonBox(this); + auto box = new QDialogButtonBox(this); m_configureButton = new QPushButton(this); m_configureButton->setText(tr("Configure Project")); diff --git a/src/plugins/projectexplorer/waitforstopdialog.cpp b/src/plugins/projectexplorer/waitforstopdialog.cpp index 1b9e4e7176..1bd57372b4 100644 --- a/src/plugins/projectexplorer/waitforstopdialog.cpp +++ b/src/plugins/projectexplorer/waitforstopdialog.cpp @@ -35,18 +35,18 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -WaitForStopDialog::WaitForStopDialog(QList<ProjectExplorer::RunControl *> runControls) - : m_runControls(runControls) +WaitForStopDialog::WaitForStopDialog(QList<ProjectExplorer::RunControl *> runControls) : + m_runControls(runControls) { setWindowTitle(tr("Waiting for Applications to Stop")); - QVBoxLayout *layout = new QVBoxLayout(); + auto layout = new QVBoxLayout(); setLayout(layout); m_progressLabel = new QLabel; layout->addWidget(m_progressLabel); - QPushButton *cancelButton = new QPushButton(tr("Cancel")); + auto cancelButton = new QPushButton(tr("Cancel")); connect(cancelButton, &QPushButton::clicked, this, &QDialog::close); layout->addWidget(cancelButton); @@ -74,7 +74,7 @@ void WaitForStopDialog::updateProgressText() void WaitForStopDialog::runControlFinished() { - RunControl *rc = qobject_cast<RunControl *>(sender()); + auto rc = qobject_cast<RunControl *>(sender()); m_runControls.removeOne(rc); if (m_runControls.isEmpty()) { diff --git a/src/plugins/projectexplorer/wincetoolchain.cpp b/src/plugins/projectexplorer/wincetoolchain.cpp index dd8968d60c..3c3ce90512 100644 --- a/src/plugins/projectexplorer/wincetoolchain.cpp +++ b/src/plugins/projectexplorer/wincetoolchain.cpp @@ -122,8 +122,7 @@ Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &en if (!generateEnvironmentSettings(env, m_vcvarsBat, QString(), envPairs)) return result; - QMap<QString,QString>::const_iterator envPairIter; - for (envPairIter = envPairs.constBegin(); envPairIter!=envPairs.constEnd(); ++envPairIter) { + for (auto envPairIter = envPairs.constBegin(); envPairIter!=envPairs.constEnd(); ++envPairIter) { // Replace the env values with those from the WinCE SDK QString varValue = envPairIter.value(); if (envPairIter.key() == QLatin1String("PATH")) @@ -139,7 +138,7 @@ Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &en // Now loop round and do the delayed expansion - Utils::Environment::const_iterator envIter = result.constBegin(); + auto envIter = result.constBegin(); while (envIter != result.constEnd()) { const QString key = result.key(envIter); const QString unexpandedValue = result.value(envIter); @@ -260,11 +259,11 @@ WinCEToolChain::WinCEToolChain() : WinCEToolChain *WinCEToolChain::readFromMap(const QVariantMap &data) { - WinCEToolChain *tc = new WinCEToolChain; + auto tc = new WinCEToolChain; if (tc->fromMap(data)) return tc; delete tc; - return 0; + return nullptr; } QString WinCEToolChain::typeDisplayName() const @@ -438,7 +437,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect(const QList<ToolChain *> &a } -QString WinCEToolChain::autoDetectCdbDebugger(QStringList *checkedDirectories /* = 0 */) +QString WinCEToolChain::autoDetectCdbDebugger(QStringList *checkedDirectories) { Q_UNUSED(checkedDirectories); return QString(); @@ -454,7 +453,7 @@ bool WinCEToolChain::operator ==(const ToolChain &other) const if (!AbstractMsvcToolChain::operator ==(other)) return false; - const WinCEToolChain *ceTc = static_cast<const WinCEToolChain *>(&other); + auto ceTc = static_cast<const WinCEToolChain *>(&other); return m_ceVer == ceTc->m_ceVer; } @@ -470,7 +469,7 @@ ToolChain *WinCEToolChainFactory::restore(const QVariantMap &data) WinCEToolChainConfigWidget::WinCEToolChainConfigWidget(ToolChain *tc) : ToolChainConfigWidget(tc) { - WinCEToolChain *toolChain = static_cast<WinCEToolChain *>(tc); + auto toolChain = static_cast<WinCEToolChain *>(tc); QTC_ASSERT(tc, return); m_mainLayout->addRow(tr("SDK:"), new QLabel(toolChain->displayName())); diff --git a/src/plugins/projectexplorer/wincetoolchain.h b/src/plugins/projectexplorer/wincetoolchain.h index 1422ccfe91..376b25fe04 100644 --- a/src/plugins/projectexplorer/wincetoolchain.h +++ b/src/plugins/projectexplorer/wincetoolchain.h @@ -65,7 +65,7 @@ public: ToolChain *clone() const override; - static QString autoDetectCdbDebugger(QStringList *checkedDirectories = 0); + static QString autoDetectCdbDebugger(QStringList *checkedDirectories = nullptr); bool operator ==(const ToolChain &other) const override; diff --git a/src/plugins/projectexplorer/windebuginterface.cpp b/src/plugins/projectexplorer/windebuginterface.cpp index 928181d517..c03a07f00b 100644 --- a/src/plugins/projectexplorer/windebuginterface.cpp +++ b/src/plugins/projectexplorer/windebuginterface.cpp @@ -49,7 +49,7 @@ namespace ProjectExplorer { namespace Internal { -WinDebugInterface *WinDebugInterface::m_instance = 0; +WinDebugInterface *WinDebugInterface::m_instance = nullptr; WinDebugInterface *WinDebugInterface::instance() { @@ -76,7 +76,7 @@ WinDebugInterface::~WinDebugInterface() { if (stop()) wait(500); - m_instance = 0; + m_instance = nullptr; } void WinDebugInterface::run() @@ -184,15 +184,15 @@ bool WinDebugInterface::runLoop() namespace ProjectExplorer { namespace Internal { -WinDebugInterface *WinDebugInterface::m_instance = 0; +WinDebugInterface *WinDebugInterface::m_instance = nullptr; -WinDebugInterface *WinDebugInterface::instance() { return 0; } +WinDebugInterface *WinDebugInterface::instance() { return nullptr; } -WinDebugInterface::WinDebugInterface(QObject *) {} +WinDebugInterface::WinDebugInterface(QObject *) { } -WinDebugInterface::~WinDebugInterface() {} +WinDebugInterface::~WinDebugInterface() { } -void WinDebugInterface::run() {} +void WinDebugInterface::run() { } bool WinDebugInterface::runLoop() { return false; } diff --git a/src/plugins/projectexplorer/windebuginterface.h b/src/plugins/projectexplorer/windebuginterface.h index c7de7f6b37..e59e5a4150 100644 --- a/src/plugins/projectexplorer/windebuginterface.h +++ b/src/plugins/projectexplorer/windebuginterface.h @@ -35,7 +35,7 @@ class WinDebugInterface : public QThread Q_OBJECT public: - explicit WinDebugInterface(QObject *parent = 0); + explicit WinDebugInterface(QObject *parent = nullptr); ~WinDebugInterface() override; static WinDebugInterface *instance(); diff --git a/src/plugins/projectexplorer/xcodebuildparser.cpp b/src/plugins/projectexplorer/xcodebuildparser.cpp index 41f24e0a38..cb19e50114 100644 --- a/src/plugins/projectexplorer/xcodebuildparser.cpp +++ b/src/plugins/projectexplorer/xcodebuildparser.cpp @@ -39,9 +39,7 @@ static const char successRe[] = "\\*\\* BUILD SUCCEEDED \\*\\*$"; static const char buildRe[] = "=== BUILD (AGGREGATE )?TARGET (.*) OF PROJECT (.*) WITH .* ===$"; static const char signatureChangeRe[] = "(.+): replacing existing signature$"; -XcodebuildParser::XcodebuildParser() : - m_fatalErrorCount(0), - m_xcodeBuildParserState(OutsideXcodebuild) +XcodebuildParser::XcodebuildParser() { setObjectName(QLatin1String("XcodeParser")); m_failureRe.setPattern(QLatin1String(failureRe)); diff --git a/src/plugins/projectexplorer/xcodebuildparser.h b/src/plugins/projectexplorer/xcodebuildparser.h index 2557c70342..ae49fd7eeb 100644 --- a/src/plugins/projectexplorer/xcodebuildparser.h +++ b/src/plugins/projectexplorer/xcodebuildparser.h @@ -51,12 +51,12 @@ public: bool hasFatalErrors() const override; private: - int m_fatalErrorCount; + int m_fatalErrorCount = 0; QRegExp m_failureRe; QRegExp m_successRe; QRegExp m_buildRe; QRegExp m_replacingSignatureRe; - XcodebuildStatus m_xcodeBuildParserState; + XcodebuildStatus m_xcodeBuildParserState = OutsideXcodebuild; QString m_lastTarget; QString m_lastProject; @@ -71,7 +71,7 @@ class XcodebuildParserTester : public QObject { Q_OBJECT public: - explicit XcodebuildParserTester(XcodebuildParser *parser, QObject *parent = 0); + explicit XcodebuildParserTester(XcodebuildParser *parser, QObject *parent = nullptr); XcodebuildParser *parser; XcodebuildParser::XcodebuildStatus expectedFinalState; diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index efa9057997..44336458bc 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -226,8 +226,6 @@ class PythonProjectManager : public IProjectManager { Q_OBJECT public: - PythonProjectManager() {} - QString mimeType() const override { return QLatin1String(PythonMimeType); } Project *openProject(const QString &fileName, QString *errorString) override; diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp index b0805f65a0..d2afdd1eb6 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp @@ -56,12 +56,11 @@ static QString qtcProfilePrefix() { return qtcProfileGroup() + sep; } namespace QbsProjectManager { namespace Internal { -qbs::Settings *QbsManager::m_settings = 0; -Internal::QbsLogSink *QbsManager::m_logSink = 0; -QbsManager *QbsManager::m_instance = 0; +qbs::Settings *QbsManager::m_settings = nullptr; +Internal::QbsLogSink *QbsManager::m_logSink = nullptr; +QbsManager *QbsManager::m_instance = nullptr; -QbsManager::QbsManager() : - m_defaultPropertyProvider(new DefaultPropertyProvider) +QbsManager::QbsManager() : m_defaultPropertyProvider(new DefaultPropertyProvider) { m_instance = this; @@ -98,7 +97,7 @@ QbsManager::~QbsManager() { delete m_defaultPropertyProvider; delete m_settings; - m_instance = 0; + m_instance = nullptr; } QString QbsManager::mimeType() const @@ -112,7 +111,7 @@ ProjectExplorer::Project *QbsManager::openProject(const QString &fileName, QStri if (errorString) *errorString = tr("Failed opening project \"%1\": Project is not a file.") .arg(fileName); - return 0; + return nullptr; } return new QbsProject(this, fileName); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.h b/src/plugins/qbsprojectmanager/qbsprojectmanager.h index 0d36825072..ecade37059 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.h @@ -59,8 +59,8 @@ public: QbsManager(); ~QbsManager(); - QString mimeType() const; - ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString); + QString mimeType() const override; + ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override; // QBS profiles management: QString profileForKit(const ProjectExplorer::Kit *k); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h index 28b8014bb6..8bffd7cf1c 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h @@ -52,8 +52,8 @@ public: void unregisterProject(QmakeProject *project); void notifyChanged(const Utils::FileName &name); - virtual QString mimeType() const; - ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString); + QString mimeType() const override; + ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override; // Context information used in the slot implementations ProjectExplorer::Node *contextNode() const; diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.h b/src/plugins/qmlprojectmanager/qmlprojectmanager.h index 3e0782c25b..bf42681439 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager.h +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.h @@ -41,8 +41,8 @@ class Manager: public ProjectExplorer::IProjectManager public: Manager(); - virtual QString mimeType() const; - virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString); + QString mimeType() const override; + ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override; void notifyChanged(const QString &fileName); diff --git a/src/plugins/tasklist/stopmonitoringhandler.h b/src/plugins/tasklist/stopmonitoringhandler.h index b257c330c0..ebf8a4e8e7 100644 --- a/src/plugins/tasklist/stopmonitoringhandler.h +++ b/src/plugins/tasklist/stopmonitoringhandler.h @@ -33,11 +33,9 @@ namespace Internal { class StopMonitoringHandler : public ProjectExplorer::ITaskHandler { public: - StopMonitoringHandler() {} - - bool canHandle(const ProjectExplorer::Task &) const; - void handle(const ProjectExplorer::Task &); - QAction *createAction(QObject *parent) const; + bool canHandle(const ProjectExplorer::Task &) const override; + void handle(const ProjectExplorer::Task &) override; + QAction *createAction(QObject *parent) const override; }; } // namespace Internal |