Commit 95ac4edf authored by Tobias Hunger's avatar Tobias Hunger

Projectexplorer: Modernize codebase

Change-Id: I4793b58aa77bcd46af99f8b843c0f7439cdc9269
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: default avatarVikas Pachdha <vikas.pachdha@theqtcompany.com>
parent 79da8a45
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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>"
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 &current);
......
......@@ -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
......@@ -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())
......
......@@ -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
......@@ -50,7 +50,7 @@ AllProjectsFilter::AllProjectsFilter()
void AllProjectsFilter::markFilesAsOutOfDate()
{
setFileIterator(0);
setFileIterator(nullptr);
}
void AllProjectsFilter::prepareSearch(const QString &entry)
......
......@@ -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);
......
......@@ -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);
......
......@@ -47,7 +47,7 @@ public:
Gui
};
explicit ApplicationLauncher(QObject *parent = 0);
explicit ApplicationLauncher(QObject *parent = nullptr);
~ApplicationLauncher() override;
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
......
......@@ -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());
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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.
......
......@@ -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;
......
......@@ -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;
......
......@@ -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"));
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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<