AutotoolsProjectManager: Modernize

modernize-use-nullptr
modernize-use-override
modernize-use-auto

Change-Id: I7abab567a6dab1bde93c520aa8746380ae24fda8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2018-11-04 09:50:14 +01:00
parent 24bcce4aa6
commit adf5305af6
8 changed files with 18 additions and 18 deletions
@@ -74,26 +74,26 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo *info)
// autogen.sh or autoreconf
QFile autogenFile(target()->project()->projectDirectory().toString() + "/autogen.sh");
if (autogenFile.exists()) {
AutogenStep *autogenStep = new AutogenStep(buildSteps);
auto autogenStep = new AutogenStep(buildSteps);
buildSteps->appendStep(autogenStep);
} else {
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
auto autoreconfStep = new AutoreconfStep(buildSteps);
buildSteps->appendStep(autoreconfStep);
}
// ./configure.
ConfigureStep *configureStep = new ConfigureStep(buildSteps);
auto configureStep = new ConfigureStep(buildSteps);
buildSteps->appendStep(configureStep);
connect(this, &BuildConfiguration::buildDirectoryChanged,
configureStep, &ConfigureStep::notifyBuildDirectoryChanged);
// make
MakeStep *makeStep = new MakeStep(buildSteps);
auto makeStep = new MakeStep(buildSteps);
buildSteps->appendStep(makeStep);
// ### Build Steps Clean ###
BuildStepList *cleanSteps = stepList(BUILDSTEPS_CLEAN);
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
auto cleanMakeStep = new MakeStep(cleanSteps);
cleanSteps->appendStep(cleanMakeStep);
}
@@ -133,7 +133,7 @@ QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit
BuildInfo *AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
const Utils::FileName &buildDir) const
{
BuildInfo *info = new BuildInfo(this);
auto info = new BuildInfo(this);
info->typeName = tr("Build");
info->buildDirectory = buildDir;
info->kitId = k->id();
@@ -49,7 +49,7 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsBuildConfigu
m_pathChooser(new Utils::PathChooser),
m_buildConfiguration(bc)
{
QFormLayout *fl = new QFormLayout(this);
auto fl = new QFormLayout(this);
fl->setContentsMargins(0, 0, 0, 0);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
@@ -75,7 +75,7 @@ void AutotoolsOpenProjectWizard::setBuildDirectory(const QString &directory)
BuildPathPage::BuildPathPage(AutotoolsOpenProjectWizard *w) : QWizardPage(w),
m_pc(new Utils::PathChooser)
{
QFormLayout *fl = new QFormLayout;
auto fl = new QFormLayout;
this->setLayout(fl);
QLabel *label = new QLabel(this);
@@ -86,7 +86,7 @@ BuildPathPage::BuildPathPage(AutotoolsOpenProjectWizard *w) : QWizardPage(w),
"with different settings."));
fl->addWidget(label);
m_pc->setHistoryCompleter(QLatin1String("AutoTools.BuildDir.History"));
AutotoolsOpenProjectWizard *wiz = static_cast<AutotoolsOpenProjectWizard *>(wizard());
auto wiz = static_cast<AutotoolsOpenProjectWizard *>(wizard());
m_pc->setBaseDirectory(wiz->sourceDirectory());
m_pc->setPath(wiz->buildDirectory());
connect(m_pc, &Utils::PathChooser::rawPathChanged, this, &BuildPathPage::buildDirectoryChanged);
@@ -41,7 +41,7 @@ class AutotoolsOpenProjectWizard : public Utils::Wizard
public:
enum PageId { BuildPathPageId };
AutotoolsOpenProjectWizard(const QString &sourceDirectory, QWidget *parent = 0);
AutotoolsOpenProjectWizard(const QString &sourceDirectory, QWidget *parent = nullptr);
QString buildDirectory() const;
QString sourceDirectory() const;
@@ -127,7 +127,7 @@ void AutotoolsProject::loadProjectTree()
this, &AutotoolsProject::makefileParsingFinished);
m_makefileParserThread->wait();
delete m_makefileParserThread;
m_makefileParserThread = 0;
m_makefileParserThread = nullptr;
}
// Parse the makefile asynchronously in a thread
@@ -56,7 +56,7 @@ bool MakefileParser::parse()
m_sources.clear();
m_makefiles.clear();
QFile *file = new QFile(m_makefile);
auto file = new QFile(m_makefile);
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning("%s: %s", qPrintable(m_makefile), qPrintable(file->errorString()));
delete file;
@@ -343,7 +343,7 @@ QStringList MakefileParser::directorySources(const QString &directory,
QStringList MakefileParser::targetValues(bool *hasVariables)
{
QStringList values;
if (hasVariables != 0)
if (hasVariables)
*hasVariables = false;
const int index = m_line.indexOf(QLatin1Char('='));
@@ -366,7 +366,7 @@ QStringList MakefileParser::targetValues(bool *hasVariables)
while (it != lineValues.end()) {
if ((*it).startsWith(QLatin1String("$("))) {
it = lineValues.erase(it);
if (hasVariables != 0)
if (hasVariables)
*hasVariables = true;
} else {
++it;
@@ -400,9 +400,9 @@ QStringList MakefileParser::targetValues(bool *hasVariables)
void MakefileParser::appendHeader(QStringList &list, const QDir &dir, const QString &fileName)
{
const char *const headerExtensions[] = {".h", ".hh", ".hg", ".hxx", ".hpp", 0};
const char *const headerExtensions[] = {".h", ".hh", ".hg", ".hxx", ".hpp", nullptr};
int i = 0;
while (headerExtensions[i] != 0) {
while (headerExtensions[i]) {
const QString headerFile = fileName + QLatin1String(headerExtensions[i]);
QFileInfo fileInfo(dir, headerFile);
if (fileInfo.exists())
@@ -200,7 +200,7 @@ private:
* contained a variable like $(test). Note that all variables are not
* part of the return value, as they cannot get interpreted currently.
*/
QStringList targetValues(bool *hasVariables = 0);
QStringList targetValues(bool *hasVariables = nullptr);
/**
* Adds recursively all sources of the current folder to m_sources and removes
@@ -56,7 +56,7 @@ public:
MakefileParserThread(const QString &makefile);
/** @see QThread::run() */
void run();
void run() override;
/**
* @return List of sources that are set for the _SOURCES target.