Commit f4296d75 authored by Tobias Hunger's avatar Tobias Hunger

ProjectExplorer: Modernize

* Use override where appropriate
* Use pragma once
* Make more constructors explicit

Change-Id: I2865fe10f288e3de570826058e43b70a0cb4ee37
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 6a3e687d
......@@ -544,10 +544,10 @@ static std::function<bool(const Kit *)> cdbMatcher(char wordWidth = 0)
static Kit *findUniversalCdbKit()
{
if (Utils::is64BitWindowsSystem()) {
if (Kit *cdb64Kit = KitManager::find(cdbMatcher(64)))
if (Kit *cdb64Kit = KitManager::find(KitMatcher(cdbMatcher(64))))
return cdb64Kit;
}
return KitManager::find(cdbMatcher());
return KitManager::find(KitMatcher(cdbMatcher()));
}
///////////////////////////////////////////////////////////////////////
......
......@@ -367,20 +367,20 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (!abis.isEmpty()) {
// Try exact abis.
m_kit = KitManager::find(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
m_kit = KitManager::find(KitMatcher(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
return abis.contains(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k);
return false;
}));
})));
if (!m_kit) {
// Or something compatible.
m_kit = KitManager::find(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
m_kit = KitManager::find(KitMatcher(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
foreach (const Abi &a, abis)
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
return true;
return false;
}));
})));
}
}
}
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PROJECTEXPLORER_ABI_H
#define PROJECTEXPLORER_ABI_H
#pragma once
#include "projectexplorer_export.h"
......@@ -156,6 +155,5 @@ inline int qHash(const ProjectExplorer::Abi &abi)
+ (abi.wordWidth() << 13);
return QT_PREPEND_NAMESPACE(qHash)(h);
}
} // namespace ProjectExplorer
#endif // PROJECTEXPLORER_ABI_H
} // namespace ProjectExplorer
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PROJECTEXPLORER_ABIWIDGET_H
#define PROJECTEXPLORER_ABIWIDGET_H
#pragma once
#include "projectexplorer_export.h"
......@@ -45,7 +44,7 @@ class PROJECTEXPLORER_EXPORT AbiWidget : public QWidget
public:
AbiWidget(QWidget *parent = 0);
~AbiWidget();
~AbiWidget() override;
void setAbis(const QList<Abi> &, const Abi &current);
QList<Abi> supportedAbis() const;
......@@ -66,5 +65,3 @@ private:
};
} // namespace ProjectExplorer
#endif // PROJECTEXPLORER_ABIWIDGET_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ABSTRACTMSVCTOOLCHAIN_H
#define ABSTRACTMSVCTOOLCHAIN_H
#pragma once
#include "toolchain.h"
#include "abi.h"
......@@ -100,5 +99,3 @@ protected:
} // namespace Internal
} // namespace ProjectExplorer
#endif // ABSTRACTMSVCTOOLCHAIN_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ABSTRACTPROCESSSTEP_H
#define ABSTRACTPROCESSSTEP_H
#pragma once
#include "buildstep.h"
#include "processparameters.h"
......@@ -100,5 +99,3 @@ private:
};
} // namespace ProjectExplorer
#endif // ABSTRACTPROCESSSTEP_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ALLPROJECTSFILTER_H
#define ALLPROJECTSFILTER_H
#pragma once
#include <coreplugin/locator/basefilefilter.h>
......@@ -39,8 +38,8 @@ class AllProjectsFilter : public Core::BaseFileFilter
public:
AllProjectsFilter();
void refresh(QFutureInterface<void> &future);
void prepareSearch(const QString &entry);
void refresh(QFutureInterface<void> &future) override;
void prepareSearch(const QString &entry) override;
private:
void markFilesAsOutOfDate();
......@@ -48,5 +47,3 @@ private:
} // namespace Internal
} // namespace ProjectExplorer
#endif // ALLPROJECTSFILTER_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ALLPROJECTSFIND_H
#define ALLPROJECTSFIND_H
#pragma once
#include <texteditor/basefilefind.h>
......@@ -43,24 +42,24 @@ class AllProjectsFind : public TextEditor::BaseFileFind
public:
AllProjectsFind();
QString id() const;
QString displayName() const;
QString id() const override;
QString displayName() const override;
bool isEnabled() const;
bool isEnabled() const override;
QWidget *createConfigWidget();
void writeSettings(QSettings *settings);
void readSettings(QSettings *settings);
QWidget *createConfigWidget() override;
void writeSettings(QSettings *settings) override;
void readSettings(QSettings *settings) override;
protected:
Utils::FileIterator *files(const QStringList &nameFilters,
const QVariant &additionalParameters) const;
const QVariant &additionalParameters) const override;
Utils::FileIterator *filesForProjects(const QStringList &nameFilters,
const QList<Project *> &projects) const;
const QList<Project *> &projects) const;
QVariant additionalParameters() const;
QString label() const;
QString toolTip() const;
QVariant additionalParameters() const override;
QString label() const override;
QString toolTip() const override;
private:
void handleFileListChanged();
......@@ -70,5 +69,3 @@ private:
} // namespace Internal
} // namespace ProjectExplorer
#endif // ALLPROJECTSFIND_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ANSIFILTERPARSER_H
#define ANSIFILTERPARSER_H
#pragma once
#include "ioutputparser.h"
......@@ -36,13 +35,11 @@ class AnsiFilterParser : public IOutputParser
public:
AnsiFilterParser();
void stdOutput(const QString &line);
void stdError(const QString &line);
void stdOutput(const QString &line) override;
void stdError(const QString &line) override;
private:
QString filterLine(const QString &line);
};
} // namespace ProjectExplorer
#endif // ANSIFILTERPARSER_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef APPLICATIONLAUNCHER_H
#define APPLICATIONLAUNCHER_H
#pragma once
#include "projectexplorer_export.h"
......@@ -49,7 +48,7 @@ public:
};
explicit ApplicationLauncher(QObject *parent = 0);
~ApplicationLauncher();
~ApplicationLauncher() override;
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
void start(const ProjectExplorer::StandardRunnable &runnable);
......@@ -85,5 +84,3 @@ private:
};
} // namespace ProjectExplorer
#endif // APPLICATIONLAUNCHER_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef APPOUTPUTPANE_H
#define APPOUTPUTPANE_H
#pragma once
#include <coreplugin/ioutputpane.h>
......@@ -62,23 +61,23 @@ public:
};
AppOutputPane();
virtual ~AppOutputPane();
QWidget *outputWidget(QWidget *);
QList<QWidget *> toolBarWidgets() const;
QString displayName() const;
int priorityInStatusBar() const;
void clearContents();
void visibilityChanged(bool);
bool canFocus() const;
bool hasFocus() const;
void setFocus();
bool canNext() const;
bool canPrevious() const;
void goToNext();
void goToPrev();
bool canNavigate() const;
~AppOutputPane() override;
QWidget *outputWidget(QWidget *) override;
QList<QWidget *> toolBarWidgets() const override;
QString displayName() const override;
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool) override;
bool canFocus() const override;
bool hasFocus() const override;
void setFocus() override;
bool canNext() const override;
bool canPrevious() const override;
void goToNext() override;
void goToPrev() override;
bool canNavigate() const override;
void createNewOutputWindow(RunControl *rc);
void showTabFor(RunControl *rc);
......@@ -162,5 +161,3 @@ private:
} // namespace Internal
} // namespace ProjectExplorer
#endif // APPOUTPUTPANE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BASEPROJECTWIZARDDIALOG_H
#define BASEPROJECTWIZARDDIALOG_H
#pragma once
#include "projectexplorer_export.h"
......@@ -51,7 +50,7 @@ public:
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent,
const Core::WizardDialogParameters &parameters);
virtual ~BaseProjectWizardDialog();
~BaseProjectWizardDialog() override;
QString projectName() const;
QString path() const;
......@@ -81,11 +80,9 @@ protected:
private:
void init();
void slotAccepted();
bool validateCurrentPage();
bool validateCurrentPage() override;
BaseProjectWizardDialogPrivate *d;
};
} // namespace ProjectExplorer
#endif // BASEPROJECTWIZARDDIALOG_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDCONFIGURATION_H
#define BUILDCONFIGURATION_H
#pragma once
#include "projectexplorer_export.h"
#include "projectconfiguration.h"
......@@ -155,5 +154,3 @@ signals:
} // namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::BuildConfiguration *)
#endif // BUILDCONFIGURATION_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDCONFIGURATIONMODEL_H
#define BUILDCONFIGURATIONMODEL_H
#pragma once
#include <QAbstractItemModel>
......@@ -39,21 +38,21 @@ class BuildConfigurationModel : public QAbstractListModel
public:
explicit BuildConfigurationModel(Target *target, QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
BuildConfiguration *buildConfigurationAt(int i);
BuildConfiguration *buildConfigurationFor(const QModelIndex &idx);
QModelIndex indexFor(BuildConfiguration *rc);
private:
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration*);
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration*);
void displayNameChanged();
Target *m_target;
QList<BuildConfiguration *> m_buildConfigurations;
};
}
#endif // RUNCONFIGURATIONMODEL_H
} // namespace ProjectExplorer
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDENVIRONMENTWIDGET_H
#define BUILDENVIRONMENTWIDGET_H
#pragma once
#include <projectexplorer/namedwidget.h>
......@@ -42,7 +41,7 @@ class PROJECTEXPLORER_EXPORT BuildEnvironmentWidget : public NamedWidget
Q_OBJECT
public:
BuildEnvironmentWidget(BuildConfiguration *bc);
explicit BuildEnvironmentWidget(BuildConfiguration *bc);
private:
void environmentModelUserChangesChanged();
......@@ -55,5 +54,3 @@ private:
};
} // namespace ProjectExplorer
#endif // BUILDENVIRONMENTWIDGET_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDINFO_H
#define BUILDINFO_H
#pragma once
#include "projectexplorer_export.h"
......@@ -74,5 +73,3 @@ private:
};
} // namespace ProjectExplorer
#endif // BUILDINFO_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDMANAGER_H
#define BUILDMANAGER_H
#pragma once
#include "projectexplorer_export.h"
#include "buildstep.h"
......@@ -43,7 +42,7 @@ class PROJECTEXPLORER_EXPORT BuildManager : public QObject
public:
explicit BuildManager(QObject *parent, QAction *cancelBuildAction);
~BuildManager();
~BuildManager() override;
static BuildManager *instance();
static void extensionsInitialized();
......@@ -104,5 +103,3 @@ private:
};
} // namespace ProjectExplorer
#endif // BUILDMANAGER_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDPROGRESS_H
#define BUILDPROGRESS_H
#pragma once
#include "taskwindow.h"
......@@ -39,8 +38,9 @@ namespace Internal {
class BuildProgress : public QWidget
{
Q_OBJECT
public:
BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation = Qt::Vertical);
explicit BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation = Qt::Vertical);
private:
void updateState();
......@@ -55,5 +55,3 @@ private:
} // namespace Internal
} // namespace ProjectExplorer
#endif // BUILDPROGRESS_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDSETTINGSPROPERTIESPAGE_H
#define BUILDSETTINGSPROPERTIESPAGE_H
#pragma once
#include <QWidget>
......@@ -49,7 +48,7 @@ class BuildSettingsWidget : public QWidget
Q_OBJECT
public:
BuildSettingsWidget(Target *target);
~BuildSettingsWidget();
~BuildSettingsWidget() override;
void clearWidgets();
void addSubWidget(NamedWidget *widget);
......@@ -86,5 +85,3 @@ private:
} // namespace Internal
} // namespace ProjectExplorer
#endif // BUILDSETTINGSPROPERTIESPAGE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDSTEP_H
#define BUILDSTEP_H
#pragma once
#include "projectconfiguration.h"
#include "projectexplorer_export.h"
......@@ -94,8 +93,7 @@ private:
bool m_enabled;
};
class PROJECTEXPLORER_EXPORT IBuildStepFactory :
public QObject
class PROJECTEXPLORER_EXPORT IBuildStepFactory : public QObject
{
Q_OBJECT
......@@ -116,14 +114,10 @@ public:
virtual BuildStep *clone(BuildStepList *parent, BuildStep *product) = 0;
};
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
: public QWidget
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget : public QWidget
{
Q_OBJECT
public:
BuildStepConfigWidget()
: QWidget()
{}
virtual QString summaryText() const = 0;
virtual QString additionalSummaryText() const { return QString(); }
virtual QString displayName() const = 0;
......@@ -134,20 +128,16 @@ signals:
void updateAdditionalSummary();
};
class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget
: public BuildStepConfigWidget
class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget : public BuildStepConfigWidget
{
Q_OBJECT
public:
SimpleBuildStepConfigWidget(BuildStep *step)
: m_step(step)
SimpleBuildStepConfigWidget(BuildStep *step) : m_step(step)
{
connect(m_step, &ProjectConfiguration::displayNameChanged,
this, &BuildStepConfigWidget::updateSummary);
}
~SimpleBuildStepConfigWidget() {}
QString summaryText() const { return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); }
QString displayName() const { return m_step->displayName(); }
bool showWidget() const { return false; }
......@@ -161,5 +151,3 @@ private:
Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputFormat)
Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputNewlineSetting)
#endif // BUILDSTEP_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef PROJECTEXPLORER_BUILDSTEPLIST_H
#define PROJECTEXPLORER_BUILDSTEPLIST_H
#pragma once
#include "projectexplorer_export.h"
......@@ -81,5 +80,3 @@ private:
} // namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::BuildStepList *)
#endif // PROJECTEXPLORER_BUILDSTEPLIST_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDSTEPSPAGE_H
#define BUILDSTEPSPAGE_H
#pragma once
#include "buildstep.h"
#include "namedwidget.h"
......@@ -52,7 +51,7 @@ class ToolWidget : public Utils::FadingPanel
{
Q_OBJECT
public:
ToolWidget(QWidget *parent = 0);
explicit ToolWidget(QWidget *parent = 0);
void fadeTo(qreal value);
void setOpacity(qreal value);
......@@ -63,6 +62,7 @@ public:
void setRemoveEnabled(bool b);
void setUpVisible(bool b);
void setDownVisible(bool b);
signals:
void disabledClicked();
void upClicked();
......@@ -154,5 +154,3 @@ private:
} // Internal
} // ProjectExplorer
#endif // BUILDSTEPSPAGE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef BUILDTARGETINFO_H
#define BUILDTARGETINFO_H
#pragma once
#include "projectexplorer_export.h"
......@@ -39,14 +38,13 @@ namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT BuildTargetInfo
{
public:
BuildTargetInfo() {}
BuildTargetInfo() = default;
BuildTargetInfo(const QString &targetName, const Utils::FileName &targetFilePath,
const Utils::FileName &projectFilePath)
: targetName(targetName)
, targetFilePath(targetFilePath)
, projectFilePath(projectFilePath)
{
}
const Utils::FileName &projectFilePath) :
targetName(targetName),
targetFilePath(targetFilePath),
projectFilePath(projectFilePath)
{ }
QString targetName;
Utils::FileName targetFilePath;
......@@ -71,7 +69,6 @@ inline uint qHash(const BuildTargetInfo &ti)
return qHash(ti.targetName);
}
class PROJECTEXPLORER_EXPORT BuildTargetInfoList
{
public:
......@@ -115,5 +112,3 @@ inline bool operator!=(const BuildTargetInfoList &til1, const BuildTargetInfoLis
}