CMake: Semi-automatic cleanups

* Shorten header guards
* Use override and auto where possible
* Remove useless destructors, etc.
* Remove private slots sections, unify private: sections
* Use member initialization where it makes sense

Change-Id: I00eaf6d706adc16859176d1b68c631d3336bb39f
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-01-07 15:22:53 +01:00
parent 079448d342
commit b2b6d3c526
41 changed files with 222 additions and 306 deletions

View File

@@ -42,7 +42,6 @@ class CMAKE_EXPORT CMakeAutoCompleter : public TextEditor::AutoCompleter
{
public:
CMakeAutoCompleter();
virtual ~CMakeAutoCompleter() {}
bool isInComment(const QTextCursor &cursor) const override;
bool isInString(const QTextCursor &cursor) const override;

View File

@@ -123,9 +123,6 @@ QString CMakeBuildConfiguration::initialArguments() const
return m_initialArguments;
}
CMakeBuildConfiguration::~CMakeBuildConfiguration()
{ }
ProjectExplorer::NamedWidget *CMakeBuildConfiguration::createConfigWidget()
{
return new CMakeBuildSettingsWidget(this);
@@ -140,10 +137,6 @@ CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory(QObject *parent)
{
}
CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
{
}
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
{
return canHandle(parent) ? 0 : -1;
@@ -207,7 +200,7 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
copy.displayName, info->buildType);
}
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
auto bc = new CMakeBuildConfiguration(parent);
bc->setDisplayName(copy.displayName);
bc->setDefaultDisplayName(copy.displayName);
@@ -257,7 +250,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::restore(ProjectExplorer
{
if (!canRestore(parent, map))
return 0;
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
auto bc = new CMakeBuildConfiguration(parent);
if (bc->fromMap(map))
return bc;
delete bc;

View File

@@ -51,13 +51,12 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
public:
CMakeBuildConfiguration(ProjectExplorer::Target *parent);
~CMakeBuildConfiguration();
ProjectExplorer::NamedWidget *createConfigWidget();
ProjectExplorer::NamedWidget *createConfigWidget() override;
QVariantMap toMap() const;
QVariantMap toMap() const override;
BuildType buildType() const;
BuildType buildType() const override;
void emitBuildTypeChanged();
@@ -66,7 +65,7 @@ public:
protected:
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
bool fromMap(const QVariantMap &map);
bool fromMap(const QVariantMap &map) override;
private:
QString m_initialArguments;
@@ -80,20 +79,19 @@ class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurati
public:
CMakeBuildConfigurationFactory(QObject *parent = 0);
~CMakeBuildConfigurationFactory();
int priority(const ProjectExplorer::Target *parent) const;
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const;
int priority(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
const QString &projectPath) const;
const QString &projectPath) const override;
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
const ProjectExplorer::BuildInfo *info) const;
const ProjectExplorer::BuildInfo *info) const override;
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
private:
bool canHandle(const ProjectExplorer::Target *t) const;

View File

@@ -46,32 +46,32 @@
namespace CMakeProjectManager {
namespace Internal {
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) : m_buildConfiguration(0)
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) :
m_pathLineEdit(new QLineEdit),
m_changeButton(new QPushButton)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
auto vbox = new QVBoxLayout(this);
vbox->setMargin(0);
Utils::DetailsWidget *container = new Utils::DetailsWidget;
auto container = new Utils::DetailsWidget;
container->setState(Utils::DetailsWidget::NoSummary);
vbox->addWidget(container);
QWidget *details = new QWidget(container);
auto details = new QWidget(container);
container->setWidget(details);
QFormLayout *fl = new QFormLayout(details);
auto fl = new QFormLayout(details);
fl->setMargin(0);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QPushButton *runCmakeButton = new QPushButton(tr("Run CMake..."));
auto runCmakeButton = new QPushButton(tr("Run CMake..."));
connect(runCmakeButton, &QAbstractButton::clicked, this, &CMakeBuildSettingsWidget::runCMake);
fl->addRow(tr("Reconfigure project:"), runCmakeButton);
m_pathLineEdit = new QLineEdit(this);
m_pathLineEdit->setReadOnly(true);
QHBoxLayout *hbox = new QHBoxLayout();
auto hbox = new QHBoxLayout();
hbox->addWidget(m_pathLineEdit);
m_changeButton = new QPushButton(this);
m_changeButton->setText(tr("&Change"));
connect(m_changeButton, &QAbstractButton::clicked, this,
&CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog);

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_CMAKEBUILDSETTINGSWIDGET_H
#define CMAKEPROJECTMANAGER_INTERNAL_CMAKEBUILDSETTINGSWIDGET_H
#ifndef CMAKEBUILDSETTINGSWIDGET_H
#define CMAKEBUILDSETTINGSWIDGET_H
#include <projectexplorer/namedwidget.h>
@@ -47,16 +47,16 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::NamedWidget
public:
CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc);
private slots:
private:
void openChangeBuildDirectoryDialog();
void runCMake();
private:
QLineEdit *m_pathLineEdit;
QPushButton *m_changeButton;
CMakeBuildConfiguration *m_buildConfiguration;
CMakeBuildConfiguration *m_buildConfiguration = 0;
};
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_INTERNAL_CMAKEBUILDSETTINGSWIDGET_H
#endif // CMAKEBUILDSETTINGSWIDGET_H

View File

@@ -74,14 +74,12 @@ const char ADD_RUNCONFIGURATION_ARGUMENT_KEY[] = "CMakeProjectManager.MakeStep.A
const char ADD_RUNCONFIGURATION_TEXT[] = "Current executable";
}
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) :
AbstractProcessStep(bsl, Core::Id(MS_ID)), m_addRunConfigurationArgument(false)
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(MS_ID))
{
ctor();
}
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) :
AbstractProcessStep(bsl, id), m_addRunConfigurationArgument(false)
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
{
ctor();
}
@@ -357,25 +355,26 @@ QString CMakeBuildStep::cleanTarget()
// CMakeBuildStepConfigWidget
//
CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep)
: m_buildStep(buildStep)
CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep) :
m_buildStep(buildStep),
m_toolArguments(new QLineEdit),
m_buildTargetsList(new QListWidget)
{
QFormLayout *fl = new QFormLayout(this);
auto fl = new QFormLayout(this);
fl->setMargin(0);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(fl);
m_toolArguments = new QLineEdit(this);
fl->addRow(tr("Tool arguments:"), m_toolArguments);
m_toolArguments->setText(m_buildStep->toolArguments());
m_buildTargetsList = new QListWidget;
m_buildTargetsList->setFrameStyle(QFrame::NoFrame);
m_buildTargetsList->setMinimumHeight(200);
QFrame *frame = new QFrame(this);
auto frame = new QFrame(this);
frame->setFrameStyle(QFrame::StyledPanel);
QVBoxLayout *frameLayout = new QVBoxLayout(frame);
auto frameLayout = new QVBoxLayout(frame);
frameLayout->setMargin(0);
frameLayout->addWidget(Core::ItemViewFind::createSearchableWrapper(m_buildTargetsList,
Core::ItemViewFind::LightColored));
@@ -393,7 +392,7 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
QStringList targetList = pro->buildTargetTitles();
targetList.sort();
foreach (const QString &buildTarget, targetList) {
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
auto item = new QListWidgetItem(buildTarget, m_buildTargetsList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(m_buildStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
}
@@ -437,7 +436,7 @@ void CMakeBuildStepConfigWidget::buildTargetsChanged()
CMakeProject *pro = static_cast<CMakeProject *>(m_buildStep->target()->project());
foreach (const QString& buildTarget, pro->buildTargetTitles()) {
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
auto item = new QListWidgetItem(buildTarget, m_buildTargetsList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(m_buildStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
}
@@ -501,7 +500,7 @@ BuildStep *CMakeBuildStepFactory::create(BuildStepList *parent, Core::Id id)
{
if (!canCreate(parent, id))
return 0;
CMakeBuildStep *step = new CMakeBuildStep(parent);
auto step = new CMakeBuildStep(parent);
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
step->setBuildTarget(CMakeBuildStep::cleanTarget(), true);
return step;
@@ -528,7 +527,7 @@ BuildStep *CMakeBuildStepFactory::restore(BuildStepList *parent, const QVariantM
{
if (!canRestore(parent, map))
return 0;
CMakeBuildStep *bs(new CMakeBuildStep(parent));
auto bs = new CMakeBuildStep(parent);
if (bs->fromMap(map))
return bs;
delete bs;

View File

@@ -86,9 +86,6 @@ public:
static QString cleanTarget();
private:
void buildTargetsChanged();
signals:
void cmakeCommandChanged();
void targetsToBuildChanged();
@@ -103,10 +100,12 @@ protected:
bool fromMap(const QVariantMap &map) override;
// For parsing [ 76%]
virtual void stdOutput(const QString &line) override;
void stdOutput(const QString &line) override;
private:
void ctor();
void buildTargetsChanged();
CMakeRunConfiguration *targetsActiveRunConfiguration() const;
QRegExp m_percentProgress;
@@ -114,8 +113,8 @@ private:
QString m_ninjaProgressString;
QStringList m_buildTargets;
QString m_toolArguments;
bool m_addRunConfigurationArgument;
bool m_useNinja;
bool m_addRunConfigurationArgument = false;
bool m_useNinja = false;
};
class CMakeBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
@@ -123,8 +122,8 @@ class CMakeBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
Q_OBJECT
public:
CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep);
virtual QString displayName() const;
virtual QString summaryText() const;
QString displayName() const override;
QString summaryText() const override;
private:
void itemChanged(QListWidgetItem*);
@@ -133,10 +132,9 @@ private:
void buildTargetsChanged();
void selectedBuildTargetsChanged();
private:
CMakeBuildStep *m_buildStep;
QListWidget *m_buildTargetsList;
QLineEdit *m_toolArguments;
QListWidget *m_buildTargetsList;
QString m_summaryText;
};
@@ -147,15 +145,15 @@ class CMakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
public:
explicit CMakeBuildStepFactory(QObject *parent = 0);
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const override;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) const override;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const override;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override;
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *bc) const;
QString displayNameForId(Core::Id id) const;
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *bc) const override;
QString displayNameForId(Core::Id id) const override;
};
} // namespace Internal

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_CMAKECBPPARSER_H
#define CMAKEPROJECTMANAGER_INTERNAL_CMAKECBPPARSER_H
#ifndef CMAKECBPPARSER_H
#define CMAKECBPPARSER_H
#include "cmakeproject.h"
@@ -73,7 +73,7 @@ private:
void sortFiles();
QMap<Utils::FileName, QString> m_unitTargetMap;
ProjectExplorer::Kit *m_kit;
ProjectExplorer::Kit *m_kit = 0;
QList<ProjectExplorer::FileNode *> m_fileList;
QList<ProjectExplorer::FileNode *> m_cmakeFileList;
QSet<Utils::FileName> m_processedUnits;
@@ -91,4 +91,4 @@ private:
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_INTERNAL_CMAKECBPPARSER_H
#endif // CMAKECBPPARSER_H

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_CMAKEFILE_H
#define CMAKEPROJECTMANAGER_INTERNAL_CMAKEFILE_H
#ifndef CMAKEFILE_H
#define CMAKEFILE_H
#include <coreplugin/idocument.h>
@@ -62,4 +62,4 @@ private:
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_INTERNAL_CMAKEFILE_H
#endif // CMAKEFILE_H

View File

@@ -54,9 +54,6 @@ using namespace ProjectExplorer;
CMakeFileCompletionAssistProvider::CMakeFileCompletionAssistProvider()
{}
CMakeFileCompletionAssistProvider::~CMakeFileCompletionAssistProvider()
{}
bool CMakeFileCompletionAssistProvider::supportsEditor(Core::Id editorId) const
{
return editorId == CMakeProjectManager::Constants::CMAKE_EDITOR_ID;

View File

@@ -54,10 +54,9 @@ class CMakeFileCompletionAssistProvider : public TextEditor::CompletionAssistPro
public:
CMakeFileCompletionAssistProvider();
~CMakeFileCompletionAssistProvider();
bool supportsEditor(Core::Id editorId) const;
TextEditor::IAssistProcessor *createProcessor() const;
bool supportsEditor(Core::Id editorId) const override;
TextEditor::IAssistProcessor *createProcessor() const override;
};
} // Internal

View File

@@ -39,10 +39,6 @@
namespace CMakeProjectManager {
namespace Internal {
CMakeIndenter::CMakeIndenter()
{
}
bool CMakeIndenter::isElectricCharacter(const QChar &ch) const
{
return ch == QLatin1Char('(') || ch == QLatin1Char(')');

View File

@@ -41,9 +41,6 @@ namespace Internal {
class CMAKE_EXPORT CMakeIndenter : public TextEditor::Indenter
{
public:
CMakeIndenter();
virtual ~CMakeIndenter() {}
bool isElectricCharacter(const QChar &ch) const override;
void indentBlock(QTextDocument *doc, const QTextBlock &block, const QChar &typedChar, const TextEditor::TabSettings &tabSettings) override;
};

View File

@@ -48,9 +48,9 @@ namespace Internal {
CMakeKitConfigWidget::CMakeKitConfigWidget(ProjectExplorer::Kit *kit,
const ProjectExplorer::KitInformation *ki) :
ProjectExplorer::KitConfigWidget(kit, ki),
m_removingItem(false)
m_comboBox(new QComboBox),
m_manageButton(new QPushButton(KitConfigWidget::msgManage()))
{
m_comboBox = new QComboBox;
m_comboBox->setEnabled(false);
m_comboBox->setToolTip(toolTip());
@@ -63,7 +63,6 @@ CMakeKitConfigWidget::CMakeKitConfigWidget(ProjectExplorer::Kit *kit,
connect(m_comboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &CMakeKitConfigWidget::currentCMakeToolChanged);
m_manageButton = new QPushButton(KitConfigWidget::msgManage());
m_manageButton->setContentsMargins(0, 0, 0, 0);
connect(m_manageButton, &QPushButton::clicked,
this, &CMakeKitConfigWidget::manageCMakeTools);

View File

@@ -27,8 +27,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_CMAKEKITCONFIGWIDGET_H
#define CMAKEPROJECTMANAGER_INTERNAL_CMAKEKITCONFIGWIDGET_H
#ifndef CMAKEKITCONFIGWIDGET_H
#define CMAKEKITCONFIGWIDGET_H
#include <projectexplorer/kitconfigwidget.h>
@@ -70,8 +70,7 @@ private:
void currentCMakeToolChanged(int index);
void manageCMakeTools();
private:
bool m_removingItem;
bool m_removingItem = false;
QComboBox *m_comboBox;
QPushButton *m_manageButton;
};
@@ -79,4 +78,4 @@ private:
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_INTERNAL_CMAKEKITCONFIGWIDGET_H
#endif // CMAKEKITCONFIGWIDGET_H

View File

@@ -27,8 +27,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
#define CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
#ifndef CMAKEKITINFORMATION_H
#define CMAKEKITINFORMATION_H
#include "cmake_global.h"
@@ -55,10 +55,10 @@ public:
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const override;
void setup(ProjectExplorer::Kit *k) override;
void fix(ProjectExplorer::Kit *k) override;
virtual ItemList toUserOutput(const ProjectExplorer::Kit *k) const override;
virtual ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const override;
ItemList toUserOutput(const ProjectExplorer::Kit *k) const override;
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const override;
};
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_CMAKEKITINFORMATION_H
#endif // CMAKEKITINFORMATION_H

View File

@@ -53,20 +53,15 @@ CMakeLocatorFilter::CMakeLocatorFilter()
setShortcutString(QLatin1String("cm"));
setPriority(High);
connect(SessionManager::instance(), SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(slotProjectListUpdated()));
connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(slotProjectListUpdated()));
connect(SessionManager::instance(), &SessionManager::projectAdded,
this, &CMakeLocatorFilter::slotProjectListUpdated);
connect(SessionManager::instance(), &SessionManager::projectRemoved,
this, &CMakeLocatorFilter::slotProjectListUpdated);
// Initialize the filter
slotProjectListUpdated();
}
CMakeLocatorFilter::~CMakeLocatorFilter()
{
}
void CMakeLocatorFilter::prepareSearch(const QString &entry)
{
m_result.clear();

View File

@@ -44,18 +44,17 @@ class CMakeLocatorFilter : public Core::ILocatorFilter
public:
CMakeLocatorFilter();
~CMakeLocatorFilter();
void prepareSearch(const QString &entry);
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry);
void accept(Core::LocatorFilterEntry selection) const;
void refresh(QFutureInterface<void> &future);
void prepareSearch(const QString &entry) override;
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
const QString &entry) override;
void accept(Core::LocatorFilterEntry selection) const override;
void refresh(QFutureInterface<void> &future) override;
private slots:
void slotProjectListUpdated();
private:
QList<Core::LocatorFilterEntry> m_result;
void slotProjectListUpdated();
QList<Core::LocatorFilterEntry> m_result;
};
} // namespace Internal

View File

@@ -215,7 +215,7 @@ void CMakeOpenProjectWizard::setKit(Kit *kit)
NoKitPage::NoKitPage(CMakeOpenProjectWizard *cmakeWizard)
: QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
{
QVBoxLayout *layout = new QVBoxLayout;
auto layout = new QVBoxLayout;
setLayout(layout);
m_descriptionLabel = new QLabel(this);
@@ -227,7 +227,7 @@ NoKitPage::NoKitPage(CMakeOpenProjectWizard *cmakeWizard)
connect(m_optionsButton, &QAbstractButton::clicked, this, &NoKitPage::showOptions);
QHBoxLayout *hbox = new QHBoxLayout;
auto hbox = new QHBoxLayout;
hbox->addWidget(m_optionsButton);
hbox->addStretch();
@@ -272,7 +272,7 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
: QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
{
setLayout(new QVBoxLayout);
QLabel *label = new QLabel(this);
auto label = new QLabel(this);
label->setWordWrap(true);
label->setText(tr("Qt Creator has detected an <b>in-source-build in %1</b> "
"which prevents shadow builds. Qt Creator will not allow you to change the build directory. "
@@ -285,10 +285,10 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool change)
: QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
{
QFormLayout *fl = new QFormLayout;
auto fl = new QFormLayout;
this->setLayout(fl);
QLabel *label = new QLabel(this);
auto label = new QLabel(this);
label->setWordWrap(true);
if (change)
label->setText(tr("Please enter the directory in which you want to build your project.") + QLatin1Char(' '));
@@ -317,10 +317,9 @@ void ShadowBuildPage::buildDirectoryChanged()
// NoCMakePage
/////
NoCMakePage::NoCMakePage(CMakeOpenProjectWizard *cmakeWizard)
: QWizardPage(cmakeWizard)
NoCMakePage::NoCMakePage(CMakeOpenProjectWizard *cmakeWizard) : QWizardPage(cmakeWizard)
{
QVBoxLayout *layout = new QVBoxLayout;
auto layout = new QVBoxLayout;
setLayout(layout);
m_descriptionLabel = new QLabel(this);
@@ -332,7 +331,7 @@ NoCMakePage::NoCMakePage(CMakeOpenProjectWizard *cmakeWizard)
connect(m_optionsButton, &QAbstractButton::clicked, this, &NoCMakePage::showOptions);
QHBoxLayout *hbox = new QHBoxLayout;
auto hbox = new QHBoxLayout;
hbox->addWidget(m_optionsButton);
hbox->addStretch();
@@ -370,55 +369,48 @@ void NoCMakePage::showOptions()
CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode,
const QString &buildDirectory, const QString &initialArguments,
const QString &kitName, const QString &buildConfigurationName)
: QWizardPage(cmakeWizard),
m_cmakeWizard(cmakeWizard),
m_haveCbpFile(false),
m_mode(mode),
m_buildDirectory(buildDirectory),
m_kitName(kitName),
m_buildConfigurationName(buildConfigurationName)
const QString &kitName, const QString &buildConfigurationName) :
QWizardPage(cmakeWizard),
m_cmakeWizard(cmakeWizard),
m_descriptionLabel(new QLabel(this)),
m_argumentsLineEdit(new Utils::FancyLineEdit(this)),
m_generatorComboBox(new QComboBox(this)),
m_generatorExtraText(new QLabel(this)),
m_runCMake(new QPushButton(this)),
m_output(new QPlainTextEdit(this)),
m_exitCodeLabel(new QLabel(this)),
m_continueCheckBox(new QCheckBox(this)),
m_mode(mode),
m_buildDirectory(buildDirectory),
m_kitName(kitName),
m_buildConfigurationName(buildConfigurationName)
{
initWidgets();
m_argumentsLineEdit->setText(initialArguments);
}
void CMakeRunPage::initWidgets()
{
QFormLayout *fl = new QFormLayout;
auto fl = new QFormLayout;
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(fl);
// Description Label
m_descriptionLabel = new QLabel(this);
m_descriptionLabel->setWordWrap(true);
fl->addRow(m_descriptionLabel);
// Run CMake Line (with arguments)
m_argumentsLineEdit = new Utils::FancyLineEdit(this);
m_argumentsLineEdit->setHistoryCompleter(QLatin1String("CMakeArgumentsLineEdit"));
m_argumentsLineEdit->selectAll();
connect(m_argumentsLineEdit, &QLineEdit::returnPressed, this, &CMakeRunPage::runCMake);
fl->addRow(tr("Arguments:"), m_argumentsLineEdit);
m_generatorComboBox = new QComboBox(this);
fl->addRow(tr("Generator:"), m_generatorComboBox);
m_generatorExtraText = new QLabel(this);
fl->addRow(m_generatorExtraText);
m_runCMake = new QPushButton(this);
m_runCMake->setText(tr("Run CMake"));
connect(m_runCMake, &QAbstractButton::clicked, this, &CMakeRunPage::runCMake);
QHBoxLayout *hbox2 = new QHBoxLayout;
auto hbox2 = new QHBoxLayout;
hbox2->addStretch(10);
hbox2->addWidget(m_runCMake);
fl->addRow(hbox2);
// Bottom output window
m_output = new QPlainTextEdit(this);
m_output->setReadOnly(true);
// set smaller minimum size to avoid vanishing descriptions if all of the
// above is shown and the dialog not vertically resizing to fit stuff in (Mac)
@@ -431,19 +423,18 @@ void CMakeRunPage::initWidgets()
m_output->setSizePolicy(pl);
fl->addRow(m_output);
m_exitCodeLabel = new QLabel(this);
m_exitCodeLabel->setVisible(false);
fl->addRow(m_exitCodeLabel);
m_continueCheckBox = new QCheckBox(this);
m_continueCheckBox->setVisible(false);
m_continueCheckBox->setText(tr("Open project with errors."));
fl->addRow(m_continueCheckBox);
connect(m_continueCheckBox, &QCheckBox::toggled, this, &CMakeRunPage::completeChanged);
fl->addRow(m_continueCheckBox);
setTitle(tr("Run CMake"));
setMinimumSize(600, 400);
m_argumentsLineEdit->setText(initialArguments);
}
QByteArray CMakeRunPage::cachedGeneratorFromFile(const QString &cache)
@@ -532,6 +523,7 @@ bool CMakeRunPage::validatePage()
void CMakeRunPage::runCMake()
{
QTC_ASSERT(!m_cmakeProcess, return);
m_haveCbpFile = false;
Utils::Environment env = m_cmakeWizard->environment();

View File

@@ -111,11 +111,10 @@ public:
bool isComplete() const override;
void initializePage() override;
private slots:
private:
void kitsChanged();
void showOptions();
private:
QLabel *m_descriptionLabel;
QPushButton *m_optionsButton;
CMakeOpenProjectWizard *m_cmakeWizard;
@@ -126,6 +125,7 @@ class InSourceBuildPage : public QWizardPage
Q_OBJECT
public:
InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard);
private:
CMakeOpenProjectWizard *m_cmakeWizard;
};
@@ -148,7 +148,7 @@ class NoCMakePage : public QWizardPage
Q_OBJECT
public:
NoCMakePage(CMakeOpenProjectWizard *cmakeWizard);
bool isComplete() const;
bool isComplete() const override;
private:
void cmakeToolsChanged();
@@ -169,10 +169,10 @@ public:
const QString &kitName,
const QString &buildConfigurationName);
virtual void initializePage();
virtual bool validatePage();
virtual void cleanupPage();
virtual bool isComplete() const;
void initializePage() override;
bool validatePage() override;
void cleanupPage() override;
bool isComplete() const override;
private:
void runCMake();
@@ -180,27 +180,26 @@ private:
void cmakeReadyReadStandardOutput();
void cmakeReadyReadStandardError();
void initWidgets();
QByteArray cachedGeneratorFromFile(const QString &cache);
CMakeOpenProjectWizard *m_cmakeWizard;
QPlainTextEdit *m_output;
QPushButton *m_runCMake;
Utils::QtcProcess *m_cmakeProcess;
QLabel *m_descriptionLabel;
Utils::FancyLineEdit *m_argumentsLineEdit;
QComboBox *m_generatorComboBox;
QLabel *m_generatorExtraText;
QLabel *m_descriptionLabel;
QPushButton *m_runCMake;
QPlainTextEdit *m_output;
QLabel *m_exitCodeLabel;
QCheckBox *m_continueCheckBox;
bool m_haveCbpFile;
Utils::QtcProcess *m_cmakeProcess = 0;
bool m_haveCbpFile = false;
Mode m_mode;
QString m_buildDirectory;
QString m_kitName;
QString m_buildConfigurationName;
};
}
}
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEOPENPROJECTWIZARD_H

View File

@@ -42,8 +42,7 @@ using namespace ProjectExplorer;
const char COMMON_ERROR_PATTERN[] = "^CMake Error at (.*):([0-9]*) \\((.*)\\):";
const char NEXT_SUBERROR_PATTERN[] = "^CMake Error in (.*):";
CMakeParser::CMakeParser() :
m_skippedFirstEmptyLine(false)
CMakeParser::CMakeParser()
{
m_commonError.setPattern(QLatin1String(COMMON_ERROR_PATTERN));
m_commonError.setMinimal(true);

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEOUTPUTPARSER_H
#define CMAKEOUTPUTPARSER_H
#ifndef CMAKEPARSER_H
#define CMAKEPARSER_H
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/task.h>
@@ -43,20 +43,20 @@ class CMakeParser : public ProjectExplorer::IOutputParser
public:
explicit CMakeParser();
void stdError(const QString &line);
void stdError(const QString &line) override;
protected:
void doFlush();
void doFlush() override;
private:
ProjectExplorer::Task m_lastTask;
QRegExp m_commonError;
QRegExp m_nextSubError;
bool m_skippedFirstEmptyLine;
bool m_skippedFirstEmptyLine = false;
int m_lines = 0;
};
} // namespace CMakeProjectManager
} // namespace Internal
#endif // CMAKEOUTPUTPARSER_H
#endif // CMAKEPARSER_H

View File

@@ -46,19 +46,18 @@ class CMakePreloadCacheKitConfigWidget : public ProjectExplorer::KitConfigWidget
public:
CMakePreloadCacheKitConfigWidget(ProjectExplorer::Kit *k, const ProjectExplorer::KitInformation *ki);
~CMakePreloadCacheKitConfigWidget();
~CMakePreloadCacheKitConfigWidget() override;
QWidget *mainWidget() const;
QString displayName() const;
QString toolTip() const;
QWidget *mainWidget() const override;
QString displayName() const override;
QString toolTip() const override;
void makeReadOnly();
void refresh();
private slots:
void preloadFileWasChanged(const QString &text);
void makeReadOnly() override;
void refresh() override;
private:
void preloadFileWasChanged(const QString &text);
QLineEdit *m_lineEdit = nullptr;
bool m_ignoreChange = false;
};

View File

@@ -27,8 +27,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_CMAKEPRELOADCACHEKITINFORMATION_H
#define CMAKEPROJECTMANAGER_CMAKEPRELOADCACHEKITINFORMATION_H
#ifndef CMAKEPRELOADCACHEKITINFORMATION_H
#define CMAKEPRELOADCACHEKITINFORMATION_H
#include "cmake_global.h"
@@ -58,4 +58,4 @@ public:
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_CMAKEPRELOADCACHEKITINFORMATION_H
#endif // CMAKEPRELOADCACHEKITINFORMATION_H

View File

@@ -501,7 +501,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
}
if (!found) {
// No FolderNode yet, so create it
ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(path);
auto tmp = new ProjectExplorer::FolderNode(path);
tmp->setDisplayName(part);
parent->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << tmp);
parent = tmp;

View File

@@ -69,8 +69,9 @@ enum TargetType {
UtilityType = 64
};
struct CMAKE_EXPORT CMakeBuildTarget
class CMAKE_EXPORT CMakeBuildTarget
{
public:
QString title;
QString executable; // TODO: rename to output?
TargetType targetType;
@@ -131,14 +132,13 @@ protected:
// called by CMakeBuildSettingsWidget
void changeBuildDirectory(Internal::CMakeBuildConfiguration *bc, const QString &newBuildDirectory);
private slots:
private:
void fileChanged(const QString &fileName);
void activeTargetWasChanged(ProjectExplorer::Target *target);
void changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*);
void updateRunConfigurations();
private:
void buildTree(Internal::CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
ProjectExplorer::FolderNode *findOrCreateFolder(Internal::CMakeProjectNode *rootNode, QString directory);

View File

@@ -52,7 +52,9 @@
using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager()
CMakeManager::CMakeManager() :
m_runCMakeAction(new QAction(QIcon(), tr("Run CMake"), this)),
m_runCMakeActionContextMenu(new QAction(QIcon(), tr("Run CMake"), this))
{
Core::ActionContainer *mbuild =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
@@ -64,7 +66,6 @@ CMakeManager::CMakeManager()
const Core::Context projectContext(CMakeProjectManager::Constants::PROJECTCONTEXT);
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
m_runCMakeAction = new QAction(QIcon(), tr("Run CMake"), this);
Core::Command *command = Core::ActionManager::registerAction(m_runCMakeAction,
Constants::RUNCMAKE, globalcontext);
command->setAttribute(Core::Command::CA_Hide);
@@ -73,7 +74,6 @@ CMakeManager::CMakeManager()
runCMake(ProjectExplorer::SessionManager::startupProject());
});
m_runCMakeActionContextMenu = new QAction(QIcon(), tr("Run CMake"), this);
command = Core::ActionManager::registerAction(m_runCMakeActionContextMenu,
Constants::RUNCMAKECONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide);

View File

@@ -55,8 +55,8 @@ class CMakeManager : public ProjectExplorer::IProjectManager
public:
CMakeManager();
virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);
virtual QString mimeType() const;
ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override;
QString mimeType() const override;
void createXmlFile(Utils::QtcProcess *process,
const QString &executable,
@@ -73,8 +73,6 @@ private:
void updateRunCmakeAction();
void runCMake(ProjectExplorer::Project *project);
private:
CMakeSettingsPage *m_settingsPage;
QAction *m_runCMakeAction;
QAction *m_runCMakeActionContextMenu;
};

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEPROJECTNODE_H
#define CMAKEPROJECTNODE_H
#ifndef CMAKEPROJECTNODES_H
#define CMAKEPROJECTNODES_H
#include <projectexplorer/projectnodes.h>
@@ -49,4 +49,4 @@ public:
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTNODE_H
#endif // CMAKEPROJECTNODES_H

View File

@@ -52,14 +52,6 @@
using namespace CMakeProjectManager::Internal;
CMakeProjectPlugin::CMakeProjectPlugin()
{
}
CMakeProjectPlugin::~CMakeProjectPlugin()
{
}
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
Q_UNUSED(errorMessage)

View File

@@ -41,19 +41,15 @@ class CMakeToolManager;
namespace Internal {
class CMakeProjectPlugin
: public ExtensionSystem::IPlugin
class CMakeProjectPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CMakeProjectManager.json")
public:
CMakeProjectPlugin();
~CMakeProjectPlugin();
bool initialize(const QStringList &arguments, QString *errorMessage) override;
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
void extensionsInitialized() override;
private slots:
#ifdef WITH_TESTS

View File

@@ -68,8 +68,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const
const QString &workingDirectory, const QString &title) :
LocalApplicationRunConfiguration(parent, id),
m_buildTarget(target),
m_title(title),
m_enabled(true)
m_title(title)
{
addExtraAspect(new LocalEnvironmentAspect(this));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.Arguments")));
@@ -224,10 +223,6 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
IRunConfigurationFactory(parent)
{ setObjectName(QLatin1String("CMakeRunConfigurationFactory")); }
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
{
}
// used to show the list of possible additons to a project, returns a list of ids
QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
{

View File

@@ -78,7 +78,7 @@ public:
protected:
CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source);
virtual bool fromMap(const QVariantMap &map) override;
bool fromMap(const QVariantMap &map) override;
QString defaultDisplayName() const;
private:
@@ -87,7 +87,7 @@ private:
QString m_buildTarget;
QString m_title;
bool m_enabled;
bool m_enabled = true;
};
class CMakeRunConfigurationWidget : public QWidget
@@ -104,15 +104,15 @@ class CMakeRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFa
public:
explicit CMakeRunConfigurationFactory(QObject *parent = 0);
~CMakeRunConfigurationFactory();
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product);
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const override;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *product) override;
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const;
QString displayNameForId(Core::Id id) const;
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override;
QString displayNameForId(Core::Id id) const override;
static Core::Id idFromBuildTarget(const QString &target);
static QString buildTargetFromId(Core::Id id);
@@ -120,12 +120,12 @@ public:
private:
bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override;
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
const QVariantMap &map) override;
};
}
}
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKERUNCONFIGURATION_H

View File

@@ -537,7 +537,7 @@ void CMakeToolConfigWidget::currentCMakeToolChanged(const QModelIndex &newCurren
// CMakeSettingsPage
////
CMakeSettingsPage::CMakeSettingsPage() : m_widget(0)
CMakeSettingsPage::CMakeSettingsPage()
{
setId(Constants::CMAKE_SETTINGSPAGE_ID);
setDisplayName(tr("CMake"));
@@ -547,10 +547,6 @@ CMakeSettingsPage::CMakeSettingsPage() : m_widget(0)
setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
CMakeSettingsPage::~CMakeSettingsPage()
{
}
QWidget *CMakeSettingsPage::widget()
{
if (!m_widget)

View File

@@ -27,8 +27,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_CMAKESETTINGSPAGE_H
#define CMAKEPROJECTMANAGER_INTERNAL_CMAKESETTINGSPAGE_H
#ifndef CMAKESETTINGSPAGE_H
#define CMAKESETTINGSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/pathchooser.h>
@@ -48,17 +48,16 @@ class CMakeSettingsPage : public Core::IOptionsPage
public:
CMakeSettingsPage();
~CMakeSettingsPage();
QWidget *widget();
void apply();
void finish();
QWidget *widget() override;
void apply() override;
void finish() override;
private:
CMakeToolConfigWidget *m_widget;
CMakeToolConfigWidget *m_widget = 0;
};
} // namespace Internal
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_INTERNAL_CMAKESETTINGSPAGE_H
#endif // CMAKESETTINGSPAGE_H

View File

@@ -48,23 +48,17 @@ const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected";
///////////////////////////
// CMakeTool
///////////////////////////
CMakeTool::CMakeTool(Detection d, const Core::Id &id)
: m_state(Invalid), m_process(0),
m_isAutoDetected(d == AutoDetection),
m_hasCodeBlocksMsvcGenerator(false),
m_hasCodeBlocksNinjaGenerator(false),
m_id(id)
CMakeTool::CMakeTool(Detection d, const Core::Id &id) :
m_isAutoDetected(d == AutoDetection),
m_id(id)
{
//make sure every CMakeTool has a valid ID
if (!m_id.isValid())
createId();
}
CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk)
: m_state(Invalid), m_process(0),
m_isAutoDetected(fromSdk),
m_hasCodeBlocksMsvcGenerator(false),
m_hasCodeBlocksNinjaGenerator(false)
CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
m_isAutoDetected(fromSdk)
{
m_id = Core::Id::fromSetting(map.value(QLatin1String(CMAKE_INFORMATION_ID)));
m_displayName = map.value(QLatin1String(CMAKE_INFORMATION_DISPLAYNAME)).toString();

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEVALIDATOR_H
#define CMAKEVALIDATOR_H
#ifndef CMAKETOOL_H
#define CMAKETOOL_H
#include "cmake_global.h"
@@ -60,7 +60,7 @@ public:
explicit CMakeTool(Detection d, const Core::Id &id = Core::Id());
explicit CMakeTool(const QVariantMap &map, bool fromSdk);
~CMakeTool();
~CMakeTool() override;
enum State { Invalid, RunningBasic, RunningFunctionList, RunningFunctionDetails,
RunningPropertyList, RunningVariableList, RunningDone };
@@ -82,10 +82,9 @@ public:
void setPathMapper(const PathMapper &includePathMapper);
QString mapAllPaths(ProjectExplorer::Kit *kit, const QString &in) const;
private slots:
private:
void finished(int exitCode);
private:
void createId();
void finishStep();
void startNextStep();
@@ -96,13 +95,13 @@ private:
void parseDone();
QString formatFunctionDetails(const QString &command, const QString &args);
State m_state;
QProcess *m_process;
State m_state = Invalid;
QProcess *m_process = 0;
Utils::FileName m_executable;
bool m_isAutoDetected;
bool m_hasCodeBlocksMsvcGenerator;
bool m_hasCodeBlocksNinjaGenerator;
bool m_hasCodeBlocksMsvcGenerator = false;
bool m_hasCodeBlocksNinjaGenerator = false;
QMap<QString, QStringList> m_functionArgs;
QStringList m_variables;
@@ -115,4 +114,4 @@ private:
} // namespace CMakeProjectManager
#endif // CMAKEVALIDATOR_H
#endif // CMAKETOOL_H

View File

@@ -56,12 +56,9 @@ const char CMAKETOOL_FILENAME[] = "/qtcreator/cmaketools.xml";
class CMakeToolManagerPrivate
{
public:
CMakeToolManagerPrivate() :
m_preferNinja(false),
m_writer(0)
{}
CMakeToolManagerPrivate() : m_preferNinja(false), m_writer(0)
{ }
bool m_preferNinja;
Id m_defaultCMake;
@@ -110,7 +107,7 @@ static QList<CMakeTool *> readCMakeTools(const FileName &fileName, Core::Id *def
continue;
const QVariantMap dbMap = data.value(key).toMap();
CMakeTool *item = new CMakeTool(dbMap,fromSDK);
auto item = new CMakeTool(dbMap,fromSDK);
if (item->isAutoDetected()) {
if (!item->cmakeExecutable().toFileInfo().isExecutable()) {
qWarning() << QString::fromLatin1("CMakeTool \"%1\" (%2) read from \"%3\" dropped since the command is not executable.")
@@ -190,7 +187,7 @@ static QList<CMakeTool *> autoDetectCMakeTools()
QList<CMakeTool *> found;
foreach (const FileName &command, suspects) {
CMakeTool *item = new CMakeTool(CMakeTool::AutoDetection);
auto item = new CMakeTool(CMakeTool::AutoDetection);
item->setCMakeExecutable(command);
item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput()));
@@ -206,8 +203,7 @@ static QList<CMakeTool *> autoDetectCMakeTools()
CMakeToolManager *CMakeToolManager::m_instance = 0;
CMakeToolManager::CMakeToolManager(QObject *parent) :
QObject(parent)
CMakeToolManager::CMakeToolManager(QObject *parent) : QObject(parent)
{
QTC_ASSERT(!m_instance, return);
m_instance = this;

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
#define CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
#ifndef CMAKETOOLMANAGER_H
#define CMAKETOOLMANAGER_H
#include "cmake_global.h"
#include "cmaketool.h"
@@ -49,7 +49,7 @@ public:
typedef std::function<QList<CMakeTool *> ()> AutodetectionHelper;
CMakeToolManager(QObject *parent);
~CMakeToolManager();
~CMakeToolManager() override;
static CMakeToolManager *instance();
@@ -86,4 +86,4 @@ private:
} // namespace CMakeProjectManager
#endif // CMAKEPROJECTMANAGER_CMAKETOOLMANAGER_H
#endif // CMAKETOOLMANAGER_H

View File

@@ -57,13 +57,8 @@ static bool isMsvcFlavor(const ProjectExplorer::Abi &abi) {
}
}
GeneratorInfo::GeneratorInfo()
: m_kit(0), m_isNinja(false)
{}
GeneratorInfo::GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja)
: m_kit(kit), m_isNinja(ninja)
{}
GeneratorInfo::GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja) : m_kit(kit), m_isNinja(ninja)
{ }
ProjectExplorer::Kit *GeneratorInfo::kit() const
{

View File

@@ -27,8 +27,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CMAKEPROJECTMANAGER_INTERNAL_GENERATORINFO_H
#define CMAKEPROJECTMANAGER_INTERNAL_GENERATORINFO_H
#ifndef CMAKE_GENERATORINFO_H
#define CMAKE_GENERATORINFO_H
#include "cmakeprojectmanager.h"
@@ -46,21 +46,20 @@ class GeneratorInfo
public:
static QList<GeneratorInfo> generatorInfosFor(ProjectExplorer::Kit *k, bool hasNinja,
bool preferNinja, bool hasCodeBlocks);
GeneratorInfo();
explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false);
GeneratorInfo() = default;
ProjectExplorer::Kit *kit() const;
bool isNinja() const;
QString displayName() const;
QByteArray generatorArgument() const;
QByteArray generator() const;
QString preLoadCacheFileArgument() const;
private:
ProjectExplorer::Kit *m_kit;
bool m_isNinja;
explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false);
ProjectExplorer::Kit *m_kit = 0;
bool m_isNinja = false;
};
} // namespace Internal
@@ -68,4 +67,4 @@ private:
Q_DECLARE_METATYPE(CMakeProjectManager::Internal::GeneratorInfo)
#endif // CMAKEPROJECTMANAGER_INTERNAL_GENERATORINFO_H
#endif // CMAKE_GENERATORINFO_H