From 253f7e35afc4e5419c01822f1c61da5ed125ba6d Mon Sep 17 00:00:00 2001
From: hjk
Date: Fri, 14 Sep 2018 15:02:16 +0200
Subject: [PATCH 01/25] RemoteLinux: Use aspects in
RemoteLinuxCustomCommandDeploymentStep
Change-Id: Idb25506c172f7300d3485fd8dcfda231e5351532
Reviewed-by: Ulf Hermann
---
...remotelinuxcustomcommanddeploymentstep.cpp | 81 +++----------------
.../remotelinuxcustomcommanddeploymentstep.h | 6 --
2 files changed, 9 insertions(+), 78 deletions(-)
diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
index c1c25c76fad..471ed7579d4 100644
--- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
+++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
@@ -25,58 +25,17 @@
#include "remotelinuxcustomcommanddeploymentstep.h"
-#include
-#include
-#include
-#include
-#include
+#include
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
-namespace {
-
-const char CommandLineKey[] = "RemoteLinuxCustomCommandDeploymentStep.CommandLine";
-
-class ConfigWidget : public SimpleBuildStepConfigWidget
-{
- Q_OBJECT
-public:
- ConfigWidget(AbstractRemoteLinuxCustomCommandDeploymentStep *step)
- : SimpleBuildStepConfigWidget(step)
- {
- QVBoxLayout * const mainLayout = new QVBoxLayout(this);
- mainLayout->setMargin(0);
- QHBoxLayout * const commandLineLayout = new QHBoxLayout;
- mainLayout->addLayout(commandLineLayout);
- QLabel * const commandLineLabel = new QLabel(tr("Command line:"));
- commandLineLayout->addWidget(commandLineLabel);
- m_commandLineEdit.setText(step->commandLine());
- commandLineLayout->addWidget(&m_commandLineEdit);
-
- connect(&m_commandLineEdit, &QLineEdit::textEdited,
- this, &ConfigWidget::handleCommandLineEdited);
- }
-
- bool showWidget() const { return true; }
-
-private:
- void handleCommandLineEdited() {
- AbstractRemoteLinuxCustomCommandDeploymentStep *step =
- qobject_cast(this->step());
- step->setCommandLine(m_commandLineEdit.text().trimmed());
- }
-
- QLineEdit m_commandLineEdit;
-};
-
-} // anonymous namespace
class AbstractRemoteLinuxCustomCommandDeploymentStepPrivate
{
public:
- QString commandLine;
+ BaseStringAspect *commandLineAspect;
};
class GenericRemoteLinuxCustomCommandDeploymentStepPrivate
@@ -95,6 +54,11 @@ AbstractRemoteLinuxCustomCommandDeploymentStep::AbstractRemoteLinuxCustomCommand
: AbstractRemoteLinuxDeployStep(bsl, id)
{
d = new AbstractRemoteLinuxCustomCommandDeploymentStepPrivate;
+
+ d->commandLineAspect = addAspect();
+ d->commandLineAspect->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
+ d->commandLineAspect->setLabelText(tr("Command line:"));
+ d->commandLineAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
}
AbstractRemoteLinuxCustomCommandDeploymentStep::~AbstractRemoteLinuxCustomCommandDeploymentStep()
@@ -102,40 +66,15 @@ AbstractRemoteLinuxCustomCommandDeploymentStep::~AbstractRemoteLinuxCustomComman
delete d;
}
-bool AbstractRemoteLinuxCustomCommandDeploymentStep::fromMap(const QVariantMap &map)
-{
- if (!AbstractRemoteLinuxDeployStep::fromMap(map))
- return false;
- d->commandLine = map.value(QLatin1String(CommandLineKey)).toString();
- return true;
-}
-
-QVariantMap AbstractRemoteLinuxCustomCommandDeploymentStep::toMap() const
-{
- QVariantMap map = AbstractRemoteLinuxDeployStep::toMap();
- map.insert(QLatin1String(CommandLineKey), d->commandLine);
- return map;
-}
-
-void AbstractRemoteLinuxCustomCommandDeploymentStep::setCommandLine(const QString &commandLine)
-{
- d->commandLine = commandLine;
-}
-
-QString AbstractRemoteLinuxCustomCommandDeploymentStep::commandLine() const
-{
- return d->commandLine;
-}
-
bool AbstractRemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error)
{
- deployService()->setCommandLine(d->commandLine);
+ deployService()->setCommandLine(d->commandLineAspect->value().trimmed());
return deployService()->isDeploymentPossible(error);
}
BuildStepConfigWidget *AbstractRemoteLinuxCustomCommandDeploymentStep::createConfigWidget()
{
- return new ConfigWidget(this);
+ return BuildStep::createConfigWidget();
}
@@ -167,5 +106,3 @@ QString GenericRemoteLinuxCustomCommandDeploymentStep::displayName()
}
} // namespace RemoteLinux
-
-#include "remotelinuxcustomcommanddeploymentstep.moc"
diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
index 47ff761962d..d8a740355d5 100644
--- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
+++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
@@ -42,12 +42,6 @@ class REMOTELINUX_EXPORT AbstractRemoteLinuxCustomCommandDeploymentStep
public:
~AbstractRemoteLinuxCustomCommandDeploymentStep() override;
- bool fromMap(const QVariantMap &map) override;
- QVariantMap toMap() const override;
-
- void setCommandLine(const QString &commandLine);
- QString commandLine() const;
-
protected:
AbstractRemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
From d05e906bac963fe48ce3dbceaf65c953ce12e6c0 Mon Sep 17 00:00:00 2001
From: hjk
Date: Fri, 14 Sep 2018 14:35:14 +0200
Subject: [PATCH 02/25] ProjectExplorer: Replace virtual
BuildStepConfigWidget::showWidget
... by a bool member.
One reason less for the need of custom derived classes, i.e. one
step forward to a setup where the then-generic config widget can be
created in BuildStepListWidget::init() and filled with aspect-
created subwidget, reducing the need of per-BuildStep boilerplate
similar to what was done in RunConfiguration recently.
Task-number: QTCREATORBUG-19985
Change-Id: I85d26bdb6b35d0d6715782214328a40eef87286e
Reviewed-by: Ulf Hermann
---
src/plugins/android/androidpackageinstallationstep.cpp | 6 +-----
src/plugins/android/androidpackageinstallationstep.h | 1 -
src/plugins/projectexplorer/buildstep.cpp | 2 +-
src/plugins/projectexplorer/buildstep.h | 9 +++++++--
src/plugins/remotelinux/tarpackagecreationstep.cpp | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/plugins/android/androidpackageinstallationstep.cpp b/src/plugins/android/androidpackageinstallationstep.cpp
index 3148fbc42da..cc6b8fc9466 100644
--- a/src/plugins/android/androidpackageinstallationstep.cpp
+++ b/src/plugins/android/androidpackageinstallationstep.cpp
@@ -128,6 +128,7 @@ namespace Internal {
AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step)
: m_step(step)
{
+ setShowWidget(false);
}
QString AndroidPackageInstallationStepWidget::summaryText() const
@@ -140,11 +141,6 @@ QString AndroidPackageInstallationStepWidget::displayName() const
return tr("Make install");
}
-bool AndroidPackageInstallationStepWidget::showWidget() const
-{
- return false;
-}
-
//
// AndroidPackageInstallationStepFactory
//
diff --git a/src/plugins/android/androidpackageinstallationstep.h b/src/plugins/android/androidpackageinstallationstep.h
index 40174ef1c6b..9e314a6f8f8 100644
--- a/src/plugins/android/androidpackageinstallationstep.h
+++ b/src/plugins/android/androidpackageinstallationstep.h
@@ -61,7 +61,6 @@ public:
QString summaryText() const override;
QString displayName() const override;
- bool showWidget() const override;
private:
AndroidPackageInstallationStep *m_step;
};
diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp
index 361b5e2b8e1..242ffea2a29 100644
--- a/src/plugins/projectexplorer/buildstep.cpp
+++ b/src/plugins/projectexplorer/buildstep.cpp
@@ -132,13 +132,13 @@ class ConfigWidget : public BuildStepConfigWidget
public:
ConfigWidget(BuildStep *step) : m_step(step)
{
+ setShowWidget(true);
connect(m_step, &ProjectConfiguration::displayNameChanged,
this, &BuildStepConfigWidget::updateSummary);
}
QString summaryText() const override { return "" + displayName() + ""; }
QString displayName() const override { return m_step->displayName(); }
- bool showWidget() const override { return true; }
BuildStep *step() const { return m_step; }
private:
diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h
index d6e685735b7..ddbb91d5d46 100644
--- a/src/plugins/projectexplorer/buildstep.h
+++ b/src/plugins/projectexplorer/buildstep.h
@@ -174,11 +174,16 @@ public:
virtual QString summaryText() const = 0;
virtual QString additionalSummaryText() const { return QString(); }
virtual QString displayName() const = 0;
- virtual bool showWidget() const { return true; }
+
+ bool showWidget() const { return m_showWidget; }
+ void setShowWidget(bool showWidget) { m_showWidget = showWidget; }
signals:
void updateSummary();
void updateAdditionalSummary();
+
+private:
+ bool m_showWidget = true;
};
class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget : public BuildStepConfigWidget
@@ -189,11 +194,11 @@ public:
{
connect(m_step, &ProjectConfiguration::displayNameChanged,
this, &BuildStepConfigWidget::updateSummary);
+ setShowWidget(false);
}
QString summaryText() const override { return QLatin1String("") + displayName() + QLatin1String(""); }
QString displayName() const override { return m_step->displayName(); }
- bool showWidget() const override { return false; }
BuildStep *step() const { return m_step; }
private:
diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp
index 2c95b13b4bb..bcf631d8f23 100644
--- a/src/plugins/remotelinux/tarpackagecreationstep.cpp
+++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp
@@ -56,6 +56,8 @@ class CreateTarStepWidget : public SimpleBuildStepConfigWidget
public:
CreateTarStepWidget(TarPackageCreationStep *step) : SimpleBuildStepConfigWidget(step)
{
+ setShowWidget(true);
+
m_ignoreMissingFilesCheckBox.setText(tr("Ignore missing files"));
m_incrementalDeploymentCheckBox.setText(tr("Package modified files only"));
@@ -88,8 +90,6 @@ public:
+ step->packageFilePath();
}
- bool showWidget() const { return true; }
-
private:
void handleIgnoreMissingFilesChanged(bool ignoreMissingFiles) {
TarPackageCreationStep *step = qobject_cast(this->step());
From 8dfa977f2fc83ed24358c654ed90936bb066b58a Mon Sep 17 00:00:00 2001
From: hjk
Date: Mon, 17 Sep 2018 15:56:14 +0200
Subject: [PATCH 03/25] ProjectExplorer: Move Base{Bool,String}Aspect to new
files
Create projectconfigurationaspect.{h,cpp} for re-usable aspects.
Also pimpl the two exported classes.
Task-number: QTCREATORBUG-19985
Change-Id: Id1d44b551c5dc2cf6eb4fbc3a2a505d4a83ae53f
Reviewed-by: Ulf Hermann
---
.../projectconfigurationaspects.cpp | 340 ++++++++++++++++++
.../projectconfigurationaspects.h | 109 ++++++
.../projectexplorer/projectexplorer.pro | 6 +-
.../projectexplorer/projectexplorer.qbs | 1 +
.../runconfigurationaspects.cpp | 256 -------------
.../projectexplorer/runconfigurationaspects.h | 92 +----
6 files changed, 455 insertions(+), 349 deletions(-)
create mode 100644 src/plugins/projectexplorer/projectconfigurationaspects.cpp
create mode 100644 src/plugins/projectexplorer/projectconfigurationaspects.h
diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.cpp b/src/plugins/projectexplorer/projectconfigurationaspects.cpp
new file mode 100644
index 00000000000..92dd68f60a1
--- /dev/null
+++ b/src/plugins/projectexplorer/projectconfigurationaspects.cpp
@@ -0,0 +1,340 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "projectconfigurationaspects.h"
+
+#include "environmentaspect.h"
+#include "project.h"
+#include "projectexplorer.h"
+#include "projectexplorersettings.h"
+#include "runconfiguration.h"
+#include "target.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace Utils;
+
+namespace ProjectExplorer {
+namespace Internal {
+
+class BaseBoolAspectPrivate
+{
+public:
+ bool m_value = false;
+ bool m_defaultValue = false;
+ QString m_label;
+ QPointer m_checkBox; // Owned by configuration widget
+};
+
+class BaseStringAspectPrivate
+{
+public:
+ BaseStringAspect::DisplayStyle m_displayStyle = BaseStringAspect::LabelDisplay;
+ QString m_labelText;
+ std::function m_displayFilter;
+ std::unique_ptr m_checker;
+
+ QString m_value;
+ QString m_placeHolderText;
+ QString m_historyCompleterKey;
+ PathChooser::Kind m_expectedKind = PathChooser::File;
+ Environment m_environment;
+ QPointer m_label;
+ QPointer m_labelDisplay;
+ QPointer m_lineEditDisplay;
+ QPointer m_pathChooserDisplay;
+ QPixmap m_labelPixmap;
+};
+
+} // Internal
+
+/*!
+ \class ProjectExplorer::BaseStringAspect
+*/
+
+BaseStringAspect::BaseStringAspect()
+ : d(new Internal::BaseStringAspectPrivate)
+{}
+
+BaseStringAspect::~BaseStringAspect() = default;
+
+QString BaseStringAspect::value() const
+{
+ return d->m_value;
+}
+
+void BaseStringAspect::setValue(const QString &value)
+{
+ const bool isSame = value == d->m_value;
+ d->m_value = value;
+ update();
+ if (!isSame)
+ emit changed();
+}
+
+void BaseStringAspect::fromMap(const QVariantMap &map)
+{
+ if (!settingsKey().isEmpty())
+ d->m_value = map.value(settingsKey()).toString();
+ if (d->m_checker)
+ d->m_checker->fromMap(map);
+}
+
+void BaseStringAspect::toMap(QVariantMap &map) const
+{
+ if (!settingsKey().isEmpty())
+ map.insert(settingsKey(), d->m_value);
+ if (d->m_checker)
+ d->m_checker->toMap(map);
+}
+
+FileName BaseStringAspect::fileName() const
+{
+ return FileName::fromString(d->m_value);
+}
+
+void BaseStringAspect::setLabelText(const QString &labelText)
+{
+ d->m_labelText = labelText;
+ if (d->m_label)
+ d->m_label->setText(labelText);
+}
+
+void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
+{
+ d->m_labelPixmap = labelPixmap;
+ if (d->m_label)
+ d->m_label->setPixmap(labelPixmap);
+}
+
+QString BaseStringAspect::labelText() const
+{
+ return d->m_labelText;
+}
+
+void BaseStringAspect::setDisplayFilter(const std::function &displayFilter)
+{
+ d->m_displayFilter = displayFilter;
+}
+
+bool BaseStringAspect::isChecked() const
+{
+ return !d->m_checker || d->m_checker->value();
+}
+
+void BaseStringAspect::setDisplayStyle(DisplayStyle displayStyle)
+{
+ d->m_displayStyle = displayStyle;
+}
+
+void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText)
+{
+ d->m_placeHolderText = placeHolderText;
+ if (d->m_lineEditDisplay)
+ d->m_lineEditDisplay->setPlaceholderText(placeHolderText);
+}
+
+void BaseStringAspect::setHistoryCompleter(const QString &historyCompleterKey)
+{
+ d->m_historyCompleterKey = historyCompleterKey;
+ if (d->m_lineEditDisplay)
+ d->m_lineEditDisplay->setHistoryCompleter(historyCompleterKey);
+ if (d->m_pathChooserDisplay)
+ d->m_pathChooserDisplay->setHistoryCompleter(historyCompleterKey);
+}
+
+void BaseStringAspect::setExpectedKind(const PathChooser::Kind expectedKind)
+{
+ d->m_expectedKind = expectedKind;
+ if (d->m_pathChooserDisplay)
+ d->m_pathChooserDisplay->setExpectedKind(expectedKind);
+}
+
+void BaseStringAspect::setEnvironment(const Environment &env)
+{
+ d->m_environment = env;
+ if (d->m_pathChooserDisplay)
+ d->m_pathChooserDisplay->setEnvironment(env);
+}
+
+void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
+{
+ QTC_CHECK(!d->m_label);
+ QWidget *parent = layout->parentWidget();
+ d->m_label = new QLabel(parent);
+ d->m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ d->m_label->setText(d->m_labelText);
+ if (!d->m_labelPixmap.isNull())
+ d->m_label->setPixmap(d->m_labelPixmap);
+
+ auto hbox = new QHBoxLayout;
+ switch (d->m_displayStyle) {
+ case PathChooserDisplay:
+ d->m_pathChooserDisplay = new PathChooser(parent);
+ d->m_pathChooserDisplay->setExpectedKind(d->m_expectedKind);
+ d->m_pathChooserDisplay->setHistoryCompleter(d->m_historyCompleterKey);
+ d->m_pathChooserDisplay->setEnvironment(d->m_environment);
+ connect(d->m_pathChooserDisplay, &PathChooser::pathChanged,
+ this, &BaseStringAspect::setValue);
+ hbox->addWidget(d->m_pathChooserDisplay);
+ break;
+ case LineEditDisplay:
+ d->m_lineEditDisplay = new FancyLineEdit(parent);
+ d->m_lineEditDisplay->setPlaceholderText(d->m_placeHolderText);
+ d->m_lineEditDisplay->setHistoryCompleter(d->m_historyCompleterKey);
+ connect(d->m_lineEditDisplay, &FancyLineEdit::textEdited,
+ this, &BaseStringAspect::setValue);
+ hbox->addWidget(d->m_lineEditDisplay);
+ break;
+ case LabelDisplay:
+ d->m_labelDisplay = new QLabel(parent);
+ d->m_labelDisplay->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ hbox->addWidget(d->m_labelDisplay);
+ break;
+ }
+
+ if (d->m_checker) {
+ auto form = new QFormLayout;
+ form->setContentsMargins(0, 0, 0, 0);
+ form->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+ d->m_checker->addToConfigurationLayout(form);
+ hbox->addLayout(form);
+ }
+ layout->addRow(d->m_label, hbox);
+
+ update();
+}
+
+void BaseStringAspect::update()
+{
+ const QString displayedString = d->m_displayFilter ? d->m_displayFilter(d->m_value)
+ : d->m_value;
+
+ const bool enabled = !d->m_checker || d->m_checker->value();
+
+ if (d->m_pathChooserDisplay) {
+ d->m_pathChooserDisplay->setFileName(FileName::fromString(displayedString));
+ d->m_pathChooserDisplay->setEnabled(enabled);
+ }
+
+ if (d->m_lineEditDisplay) {
+ d->m_lineEditDisplay->setText(displayedString);
+ d->m_lineEditDisplay->setEnabled(enabled);
+ }
+
+ if (d->m_labelDisplay)
+ d->m_labelDisplay->setText(displayedString);
+
+ if (d->m_label) {
+ d->m_label->setText(d->m_labelText);
+ if (!d->m_labelPixmap.isNull())
+ d->m_label->setPixmap(d->m_labelPixmap);
+ }
+}
+
+void BaseStringAspect::makeCheckable(const QString &checkerLabel, const QString &checkerKey)
+{
+ QTC_ASSERT(!d->m_checker, return);
+ d->m_checker.reset(new BaseBoolAspect);
+ d->m_checker->setLabel(checkerLabel);
+ d->m_checker->setSettingsKey(checkerKey);
+
+ connect(d->m_checker.get(), &BaseBoolAspect::changed, this, &BaseStringAspect::update);
+ connect(d->m_checker.get(), &BaseBoolAspect::changed, this, &BaseStringAspect::changed);
+
+ update();
+}
+
+/*!
+ \class ProjectExplorer::BaseBoolAspect
+*/
+
+BaseBoolAspect::BaseBoolAspect(const QString &settingsKey)
+ : d(new Internal::BaseBoolAspectPrivate)
+{
+ setSettingsKey(settingsKey);
+}
+
+BaseBoolAspect::~BaseBoolAspect() = default;
+
+void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
+{
+ QTC_CHECK(!d->m_checkBox);
+ d->m_checkBox = new QCheckBox(d->m_label, layout->parentWidget());
+ d->m_checkBox->setChecked(d->m_value);
+ layout->addRow(QString(), d->m_checkBox);
+ connect(d->m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
+ d->m_value = d->m_checkBox->isChecked();
+ emit changed();
+ });
+}
+
+void BaseBoolAspect::fromMap(const QVariantMap &map)
+{
+ d->m_value = map.value(settingsKey(), d->m_defaultValue).toBool();
+}
+
+void BaseBoolAspect::toMap(QVariantMap &data) const
+{
+ data.insert(settingsKey(), d->m_value);
+}
+
+bool BaseBoolAspect::defaultValue() const
+{
+ return d->m_defaultValue;
+}
+
+void BaseBoolAspect::setDefaultValue(bool defaultValue)
+{
+ d->m_defaultValue = defaultValue;
+}
+
+bool BaseBoolAspect::value() const
+{
+ return d->m_value;
+}
+
+void BaseBoolAspect::setValue(bool value)
+{
+ d->m_value = value;
+ if (d->m_checkBox)
+ d->m_checkBox->setChecked(d->m_value);
+}
+
+void BaseBoolAspect::setLabel(const QString &label)
+{
+ d->m_label = label;
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.h b/src/plugins/projectexplorer/projectconfigurationaspects.h
new file mode 100644
index 00000000000..a058c20ec0f
--- /dev/null
+++ b/src/plugins/projectexplorer/projectconfigurationaspects.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "projectconfiguration.h"
+#include "environmentaspect.h"
+
+#include
+#include
+
+#include
+
+namespace ProjectExplorer {
+
+namespace Internal {
+class BaseBoolAspectPrivate;
+class BaseStringAspectPrivate;
+} // Internal
+
+class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
+{
+ Q_OBJECT
+
+public:
+ explicit BaseBoolAspect(const QString &settingsKey = QString());
+ ~BaseBoolAspect() override;
+
+ void addToConfigurationLayout(QFormLayout *layout) override;
+
+ bool value() const;
+ void setValue(bool val);
+
+ bool defaultValue() const;
+ void setDefaultValue(bool defaultValue);
+
+ void setLabel(const QString &label);
+
+ void fromMap(const QVariantMap &map) override;
+ void toMap(QVariantMap &map) const override;
+
+private:
+ std::unique_ptr d;
+};
+
+class PROJECTEXPLORER_EXPORT BaseStringAspect : public ProjectConfigurationAspect
+{
+ Q_OBJECT
+
+public:
+ BaseStringAspect();
+ ~BaseStringAspect() override;
+
+ void addToConfigurationLayout(QFormLayout *layout) override;
+
+ QString value() const;
+ void setValue(const QString &val);
+
+ QString labelText() const;
+ void setLabelText(const QString &labelText);
+ void setLabelPixmap(const QPixmap &labelPixmap);
+
+ void setDisplayFilter(const std::function &displayFilter);
+ void setPlaceHolderText(const QString &placeHolderText);
+ void setHistoryCompleter(const QString &historyCompleterKey);
+ void setExpectedKind(const Utils::PathChooser::Kind expectedKind);
+ void setEnvironment(const Utils::Environment &env);
+
+ bool isChecked() const;
+ void makeCheckable(const QString &optionalLabel, const QString &optionalBaseKey);
+
+ enum DisplayStyle { LabelDisplay, LineEditDisplay, PathChooserDisplay };
+ void setDisplayStyle(DisplayStyle style);
+
+ void fromMap(const QVariantMap &map) override;
+ void toMap(QVariantMap &map) const override;
+
+ Utils::FileName fileName() const;
+ void setFileName(const Utils::FileName &val);
+
+private:
+ void update();
+
+ std::unique_ptr d;
+};
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 598e8ceddb1..8e21d9a0dd2 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -155,7 +155,8 @@ HEADERS += projectexplorer.h \
extracompiler.h \
customexecutablerunconfiguration.h \
projectmacro.h \
- makestep.h
+ makestep.h \
+ projectconfigurationaspects.h
SOURCES += projectexplorer.cpp \
abi.cpp \
@@ -292,7 +293,8 @@ SOURCES += projectexplorer.cpp \
extracompiler.cpp \
customexecutablerunconfiguration.cpp \
projectmacro.cpp \
- makestep.cpp
+ makestep.cpp \
+ projectconfigurationaspects.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 67f07840acc..58646326fab 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -101,6 +101,7 @@ Project {
"processstep.cpp", "processstep.h", "processstep.ui",
"project.cpp", "project.h",
"projectconfiguration.cpp", "projectconfiguration.h",
+ "projectconfigurationaspects.cpp", "projectconfigurationaspects.h",
"projectconfigurationmodel.cpp", "projectconfigurationmodel.h",
"projectexplorer.cpp", "projectexplorer.h",
"projectexplorer.qrc",
diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp
index a87ee68d0b8..06aa1e583ed 100644
--- a/src/plugins/projectexplorer/runconfigurationaspects.cpp
+++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp
@@ -292,203 +292,6 @@ void ArgumentsAspect::addToConfigurationLayout(QFormLayout *layout)
layout->addRow(tr("Command line arguments:"), m_chooser);
}
-/*!
- \class ProjectExplorer::BaseStringAspect
-*/
-
-BaseStringAspect::BaseStringAspect() = default;
-
-BaseStringAspect::~BaseStringAspect()
-{
- delete m_checker;
- m_checker = nullptr;
-}
-
-QString BaseStringAspect::value() const
-{
- return m_value;
-}
-
-void BaseStringAspect::setValue(const QString &value)
-{
- const bool isSame = value == m_value;
- m_value = value;
- update();
- if (!isSame)
- emit changed();
-}
-
-void BaseStringAspect::fromMap(const QVariantMap &map)
-{
- if (!settingsKey().isEmpty())
- m_value = map.value(settingsKey()).toString();
- if (m_checker)
- m_checker->fromMap(map);
-}
-
-void BaseStringAspect::toMap(QVariantMap &map) const
-{
- if (!settingsKey().isEmpty())
- map.insert(settingsKey(), m_value);
- if (m_checker)
- m_checker->toMap(map);
-}
-
-FileName BaseStringAspect::fileName() const
-{
- return FileName::fromString(m_value);
-}
-
-void BaseStringAspect::setLabelText(const QString &labelText)
-{
- m_labelText = labelText;
- if (m_label)
- m_label->setText(labelText);
-}
-
-void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
-{
- m_labelPixmap = labelPixmap;
- if (m_label)
- m_label->setPixmap(labelPixmap);
-}
-
-QString BaseStringAspect::labelText() const
-{
- return m_labelText;
-}
-
-void BaseStringAspect::setDisplayFilter(const std::function &displayFilter)
-{
- m_displayFilter = displayFilter;
-}
-
-bool BaseStringAspect::isChecked() const
-{
- return !m_checker || m_checker->value();
-}
-
-void BaseStringAspect::setDisplayStyle(DisplayStyle displayStyle)
-{
- m_displayStyle = displayStyle;
-}
-
-void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText)
-{
- m_placeHolderText = placeHolderText;
- if (m_lineEditDisplay)
- m_lineEditDisplay->setPlaceholderText(placeHolderText);
-}
-
-void BaseStringAspect::setHistoryCompleter(const QString &historyCompleterKey)
-{
- m_historyCompleterKey = historyCompleterKey;
- if (m_lineEditDisplay)
- m_lineEditDisplay->setHistoryCompleter(historyCompleterKey);
- if (m_pathChooserDisplay)
- m_pathChooserDisplay->setHistoryCompleter(historyCompleterKey);
-}
-
-void BaseStringAspect::setExpectedKind(const PathChooser::Kind expectedKind)
-{
- m_expectedKind = expectedKind;
- if (m_pathChooserDisplay)
- m_pathChooserDisplay->setExpectedKind(expectedKind);
-}
-
-void BaseStringAspect::setEnvironment(const Environment &env)
-{
- m_environment = env;
- if (m_pathChooserDisplay)
- m_pathChooserDisplay->setEnvironment(env);
-}
-
-void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
-{
- QTC_CHECK(!m_label);
- QWidget *parent = layout->parentWidget();
- m_label = new QLabel(parent);
- m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_label->setText(m_labelText);
- if (!m_labelPixmap.isNull())
- m_label->setPixmap(m_labelPixmap);
-
- auto hbox = new QHBoxLayout;
- switch (m_displayStyle) {
- case PathChooserDisplay:
- m_pathChooserDisplay = new PathChooser(parent);
- m_pathChooserDisplay->setExpectedKind(m_expectedKind);
- m_pathChooserDisplay->setHistoryCompleter(m_historyCompleterKey);
- m_pathChooserDisplay->setEnvironment(m_environment);
- connect(m_pathChooserDisplay, &PathChooser::pathChanged,
- this, &BaseStringAspect::setValue);
- hbox->addWidget(m_pathChooserDisplay);
- break;
- case LineEditDisplay:
- m_lineEditDisplay = new FancyLineEdit(parent);
- m_lineEditDisplay->setPlaceholderText(m_placeHolderText);
- m_lineEditDisplay->setHistoryCompleter(m_historyCompleterKey);
- connect(m_lineEditDisplay, &FancyLineEdit::textEdited,
- this, &BaseStringAspect::setValue);
- hbox->addWidget(m_lineEditDisplay);
- break;
- case LabelDisplay:
- m_labelDisplay = new QLabel(parent);
- m_labelDisplay->setTextInteractionFlags(Qt::TextSelectableByMouse);
- hbox->addWidget(m_labelDisplay);
- break;
- }
-
- if (m_checker) {
- auto form = new QFormLayout;
- form->setContentsMargins(0, 0, 0, 0);
- form->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
- m_checker->addToConfigurationLayout(form);
- hbox->addLayout(form);
- }
- layout->addRow(m_label, hbox);
-
- update();
-}
-
-void BaseStringAspect::update()
-{
- const QString displayedString = m_displayFilter ? m_displayFilter(m_value) : m_value;
- const bool enabled = !m_checker || m_checker->value();
-
- if (m_pathChooserDisplay) {
- m_pathChooserDisplay->setFileName(FileName::fromString(displayedString));
- m_pathChooserDisplay->setEnabled(enabled);
- }
-
- if (m_lineEditDisplay) {
- m_lineEditDisplay->setText(displayedString);
- m_lineEditDisplay->setEnabled(enabled);
- }
-
- if (m_labelDisplay)
- m_labelDisplay->setText(displayedString);
-
- if (m_label) {
- m_label->setText(m_labelText);
- if (!m_labelPixmap.isNull())
- m_label->setPixmap(m_labelPixmap);
- }
-}
-
-void BaseStringAspect::makeCheckable(const QString &checkerLabel, const QString &checkerKey)
-{
- QTC_ASSERT(!m_checker, return);
- m_checker = new BaseBoolAspect;
- m_checker->setLabel(checkerLabel);
- m_checker->setSettingsKey(checkerKey);
-
- connect(m_checker, &BaseBoolAspect::changed, this, &BaseStringAspect::update);
- connect(m_checker, &BaseBoolAspect::changed, this, &BaseStringAspect::changed);
-
- update();
-}
-
/*!
\class ProjectExplorer::ExecutableAspect
*/
@@ -607,65 +410,6 @@ void ExecutableAspect::toMap(QVariantMap &map) const
m_alternativeExecutable->toMap(map);
}
-/*!
- \class ProjectExplorer::BaseBoolAspect
-*/
-
-BaseBoolAspect::BaseBoolAspect(const QString &settingsKey)
-{
- setSettingsKey(settingsKey);
-}
-
-BaseBoolAspect::~BaseBoolAspect() = default;
-
-void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
-{
- QTC_CHECK(!m_checkBox);
- m_checkBox = new QCheckBox(m_label, layout->parentWidget());
- m_checkBox->setChecked(m_value);
- layout->addRow(QString(), m_checkBox);
- connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
- m_value = m_checkBox->isChecked();
- emit changed();
- });
-}
-
-void BaseBoolAspect::fromMap(const QVariantMap &map)
-{
- m_value = map.value(settingsKey(), m_defaultValue).toBool();
-}
-
-void BaseBoolAspect::toMap(QVariantMap &data) const
-{
- data.insert(settingsKey(), m_value);
-}
-
-bool BaseBoolAspect::defaultValue() const
-{
- return m_defaultValue;
-}
-
-void BaseBoolAspect::setDefaultValue(bool defaultValue)
-{
- m_defaultValue = defaultValue;
-}
-
-bool BaseBoolAspect::value() const
-{
- return m_value;
-}
-
-void BaseBoolAspect::setValue(bool value)
-{
- m_value = value;
- if (m_checkBox)
- m_checkBox->setChecked(m_value);
-}
-
-void BaseBoolAspect::setLabel(const QString &label)
-{
- m_label = label;
-}
/*!
\class ProjectExplorer::UseLibraryPathsAspect
diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h
index c17efc3197a..be40af6d292 100644
--- a/src/plugins/projectexplorer/runconfigurationaspects.h
+++ b/src/plugins/projectexplorer/runconfigurationaspects.h
@@ -25,19 +25,12 @@
#pragma once
-#include "runconfiguration.h"
+#include "projectconfigurationaspects.h"
#include "applicationlauncher.h"
#include "environmentaspect.h"
-#include
-#include
-#include
-
QT_BEGIN_NAMESPACE
class QCheckBox;
-class QLabel;
-class QLineEdit;
-class QFormLayout;
class QToolButton;
QT_END_NAMESPACE
@@ -120,34 +113,6 @@ private:
QPointer m_chooser;
};
-class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
-{
- Q_OBJECT
-
-public:
- explicit BaseBoolAspect(const QString &settingsKey = QString());
- ~BaseBoolAspect() override;
-
- void addToConfigurationLayout(QFormLayout *layout) override;
-
- bool value() const;
- void setValue(bool val);
-
- bool defaultValue() const;
- void setDefaultValue(bool defaultValue);
-
- void setLabel(const QString &label);
-
- void fromMap(const QVariantMap &map) override;
- void toMap(QVariantMap &map) const override;
-
-private:
- bool m_value = false;
- bool m_defaultValue = false;
- QString m_label;
- QPointer m_checkBox; // Owned by configuration widget
-};
-
class PROJECTEXPLORER_EXPORT UseLibraryPathsAspect : public BaseBoolAspect
{
Q_OBJECT
@@ -164,61 +129,6 @@ public:
UseDyldSuffixAspect();
};
-class PROJECTEXPLORER_EXPORT BaseStringAspect : public ProjectConfigurationAspect
-{
- Q_OBJECT
-
-public:
- BaseStringAspect();
- ~BaseStringAspect() override;
-
- void addToConfigurationLayout(QFormLayout *layout) override;
-
- QString value() const;
- void setValue(const QString &val);
-
- QString labelText() const;
- void setLabelText(const QString &labelText);
- void setLabelPixmap(const QPixmap &labelPixmap);
-
- void setDisplayFilter(const std::function &displayFilter);
- void setPlaceHolderText(const QString &placeHolderText);
- void setHistoryCompleter(const QString &historyCompleterKey);
- void setExpectedKind(const Utils::PathChooser::Kind expectedKind);
- void setEnvironment(const Utils::Environment &env);
-
- bool isChecked() const;
- void makeCheckable(const QString &optionalLabel, const QString &optionalBaseKey);
-
- enum DisplayStyle { LabelDisplay, LineEditDisplay, PathChooserDisplay };
- void setDisplayStyle(DisplayStyle style);
-
- void fromMap(const QVariantMap &map) override;
- void toMap(QVariantMap &map) const override;
-
- Utils::FileName fileName() const;
- void setFileName(const Utils::FileName &val);
-
-private:
- void update();
-
- DisplayStyle m_displayStyle = LabelDisplay;
- QString m_labelText;
- std::function m_displayFilter;
- BaseBoolAspect *m_checker = nullptr;
-
- QString m_value;
- QString m_placeHolderText;
- QString m_historyCompleterKey;
- Utils::PathChooser::Kind m_expectedKind = Utils::PathChooser::File;
- Utils::Environment m_environment;
- QPointer m_label;
- QPointer m_labelDisplay;
- QPointer m_lineEditDisplay;
- QPointer m_pathChooserDisplay;
- QPixmap m_labelPixmap;
-};
-
class PROJECTEXPLORER_EXPORT ExecutableAspect : public ProjectConfigurationAspect
{
Q_OBJECT
From 82688cabd16d8ac054d92e80ed606d5945bf3e3e Mon Sep 17 00:00:00 2001
From: hjk
Date: Tue, 18 Sep 2018 12:52:23 +0200
Subject: [PATCH 04/25] RemoteLinux: Merge
{Abstract,Generic}RLCustomCommandDeploymentStep
... into a RemoteLinuxCustomCommandDeploymentStep class.
There's only one one incarnation of the abstract base, and neither the
base nor the implementation is really big enough anymore to justify the
hierarchy.
Change-Id: I85759051589482ad48efc0e3cad4679416ceb387
Reviewed-by: Ulf Hermann
---
...remotelinuxcustomcommanddeploymentstep.cpp | 49 ++++++-------------
.../remotelinuxcustomcommanddeploymentstep.h | 39 +++------------
src/plugins/remotelinux/remotelinuxplugin.cpp | 2 +-
3 files changed, 23 insertions(+), 67 deletions(-)
diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
index 471ed7579d4..67a623a43c0 100644
--- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
+++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp
@@ -24,6 +24,7 @@
****************************************************************************/
#include "remotelinuxcustomcommanddeploymentstep.h"
+#include "remotelinuxcustomcommanddeployservice.h"
#include
@@ -32,75 +33,53 @@ using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
-class AbstractRemoteLinuxCustomCommandDeploymentStepPrivate
+class RemoteLinuxCustomCommandDeploymentStepPrivate
{
public:
BaseStringAspect *commandLineAspect;
-};
-
-class GenericRemoteLinuxCustomCommandDeploymentStepPrivate
-{
-public:
RemoteLinuxCustomCommandDeployService service;
};
} // namespace Internal
-using namespace Internal;
-
-
-AbstractRemoteLinuxCustomCommandDeploymentStep::AbstractRemoteLinuxCustomCommandDeploymentStep
- (BuildStepList *bsl, Core::Id id)
- : AbstractRemoteLinuxDeployStep(bsl, id)
+RemoteLinuxCustomCommandDeploymentStep::RemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl)
+ : AbstractRemoteLinuxDeployStep(bsl, stepId())
{
- d = new AbstractRemoteLinuxCustomCommandDeploymentStepPrivate;
-
+ d = new Internal::RemoteLinuxCustomCommandDeploymentStepPrivate;
d->commandLineAspect = addAspect();
d->commandLineAspect->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
d->commandLineAspect->setLabelText(tr("Command line:"));
d->commandLineAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
+ setDefaultDisplayName(displayName());
}
-AbstractRemoteLinuxCustomCommandDeploymentStep::~AbstractRemoteLinuxCustomCommandDeploymentStep()
+RemoteLinuxCustomCommandDeploymentStep::~RemoteLinuxCustomCommandDeploymentStep()
{
delete d;
}
-bool AbstractRemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error)
+bool RemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error)
{
- deployService()->setCommandLine(d->commandLineAspect->value().trimmed());
- return deployService()->isDeploymentPossible(error);
+ d->service.setCommandLine(d->commandLineAspect->value().trimmed());
+ return d->service.isDeploymentPossible(error);
}
-BuildStepConfigWidget *AbstractRemoteLinuxCustomCommandDeploymentStep::createConfigWidget()
+BuildStepConfigWidget *RemoteLinuxCustomCommandDeploymentStep::createConfigWidget()
{
return BuildStep::createConfigWidget();
}
-
-GenericRemoteLinuxCustomCommandDeploymentStep::GenericRemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl)
- : AbstractRemoteLinuxCustomCommandDeploymentStep(bsl, stepId())
-{
- d = new GenericRemoteLinuxCustomCommandDeploymentStepPrivate;
- setDefaultDisplayName(displayName());
-}
-
-GenericRemoteLinuxCustomCommandDeploymentStep::~GenericRemoteLinuxCustomCommandDeploymentStep()
-{
- delete d;
-}
-
-RemoteLinuxCustomCommandDeployService *GenericRemoteLinuxCustomCommandDeploymentStep::deployService() const
+AbstractRemoteLinuxDeployService *RemoteLinuxCustomCommandDeploymentStep::deployService() const
{
return &d->service;
}
-Core::Id GenericRemoteLinuxCustomCommandDeploymentStep::stepId()
+Core::Id RemoteLinuxCustomCommandDeploymentStep::stepId()
{
return "RemoteLinux.GenericRemoteLinuxCustomCommandDeploymentStep";
}
-QString GenericRemoteLinuxCustomCommandDeploymentStep::displayName()
+QString RemoteLinuxCustomCommandDeploymentStep::displayName()
{
return tr("Run custom remote command");
}
diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
index d8a740355d5..4ba666f8e9c 100644
--- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
+++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.h
@@ -26,50 +26,27 @@
#pragma once
#include "abstractremotelinuxdeploystep.h"
-#include "remotelinuxcustomcommanddeployservice.h"
namespace RemoteLinux {
-namespace Internal {
-class AbstractRemoteLinuxCustomCommandDeploymentStepPrivate;
-class GenericRemoteLinuxCustomCommandDeploymentStepPrivate;
-} // namespace Internal
+namespace Internal { class RemoteLinuxCustomCommandDeploymentStepPrivate; }
-
-class REMOTELINUX_EXPORT AbstractRemoteLinuxCustomCommandDeploymentStep
+class REMOTELINUX_EXPORT RemoteLinuxCustomCommandDeploymentStep
: public AbstractRemoteLinuxDeployStep
{
Q_OBJECT
public:
- ~AbstractRemoteLinuxCustomCommandDeploymentStep() override;
-
-protected:
- AbstractRemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
-
- bool initInternal(QString *error = 0) override;
-
-private:
- RemoteLinuxCustomCommandDeployService *deployService() const override = 0;
- ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
-
- Internal::AbstractRemoteLinuxCustomCommandDeploymentStepPrivate *d;
-};
-
-
-class REMOTELINUX_EXPORT GenericRemoteLinuxCustomCommandDeploymentStep
- : public AbstractRemoteLinuxCustomCommandDeploymentStep
-{
- Q_OBJECT
-public:
- explicit GenericRemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl);
- ~GenericRemoteLinuxCustomCommandDeploymentStep() override;
+ explicit RemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl);
+ ~RemoteLinuxCustomCommandDeploymentStep() override;
static Core::Id stepId();
static QString displayName();
private:
- RemoteLinuxCustomCommandDeployService *deployService() const override;
+ bool initInternal(QString *error) override;
+ AbstractRemoteLinuxDeployService *deployService() const override;
+ ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
- Internal::GenericRemoteLinuxCustomCommandDeploymentStepPrivate *d;
+ Internal::RemoteLinuxCustomCommandDeploymentStepPrivate *d;
};
} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index 2f67ae25e98..6a5dffa7474 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -73,7 +73,7 @@ public:
GenericDeployStepFactory tarPackageCreationStepFactory;
GenericDeployStepFactory uploadAndInstallTarPackageStepFactory;
GenericDeployStepFactory genericDirectUploadStepFactory;
- GenericDeployStepFactory
+ GenericDeployStepFactory
customCommandDeploymentStepFactory;
GenericDeployStepFactory
checkForFreeDiskSpaceStepFactory;
From b9db5ea86e30b57f48b757de30f71f5c0a9bd525 Mon Sep 17 00:00:00 2001
From: Eike Ziller
Date: Wed, 19 Sep 2018 14:39:46 +0200
Subject: [PATCH 05/25] Move documentationPath() from Core::ICore to
Core::HelpManager
It is documentation related API, so it belongs there.
Change-Id: I5d1676f251e6deb92050ddedac19bf3c332aab54
Reviewed-by: Jarek Kobus
Reviewed-by: Tim Jenssen
---
src/plugins/coreplugin/helpmanager.cpp | 7 +++++++
src/plugins/coreplugin/helpmanager.h | 2 ++
src/plugins/coreplugin/icore.cpp | 5 -----
src/plugins/coreplugin/icore.h | 1 -
src/plugins/help/helpplugin.cpp | 2 +-
src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp | 2 +-
6 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp
index a27b1499b3e..e5db350e99a 100644
--- a/src/plugins/coreplugin/helpmanager.cpp
+++ b/src/plugins/coreplugin/helpmanager.cpp
@@ -30,6 +30,8 @@
#include
#include
+#include
+#include
#include
namespace Core {
@@ -67,6 +69,11 @@ Implementation::~Implementation()
m_instance = nullptr;
}
+QString documentationPath()
+{
+ return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH);
+}
+
void registerDocumentation(const QStringList &files)
{
if (checkInstance())
diff --git a/src/plugins/coreplugin/helpmanager.h b/src/plugins/coreplugin/helpmanager.h
index 60bb412752f..a97f65b362f 100644
--- a/src/plugins/coreplugin/helpmanager.h
+++ b/src/plugins/coreplugin/helpmanager.h
@@ -58,6 +58,8 @@ enum HelpViewerLocation {
ExternalHelpAlways = 3
};
+CORE_EXPORT QString documentationPath();
+
CORE_EXPORT void registerDocumentation(const QStringList &fileNames);
CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces);
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index f88f0f8df44..f16f4369bb2 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -445,11 +445,6 @@ QString ICore::installerResourcePath()
+ Constants::IDE_ID;
}
-QString ICore::documentationPath()
-{
- return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH);
-}
-
/*!
Returns the path to the command line tools that are shipped with \QC (corresponding
to the IDE_LIBEXEC_PATH qmake variable).
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index 37ce9b05dd8..80e387658f4 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -95,7 +95,6 @@ public:
static QString resourcePath();
static QString userResourcePath();
static QString installerResourcePath();
- static QString documentationPath();
static QString libexecPath();
static QString clangExecutable(const QString &clangBinDirectory);
static QString clangIncludeDirectory(const QString &clangVersion,
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 2ce03e0789f..ea1b229236e 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -329,7 +329,7 @@ void HelpPlugin::extensionsInitialized()
{
QStringList filesToRegister;
// we might need to register creators inbuild help
- filesToRegister.append(ICore::documentationPath() + "/qtcreator.qch");
+ filesToRegister.append(Core::HelpManager::documentationPath() + "/qtcreator.qch");
Core::HelpManager::registerDocumentation(filesToRegister);
}
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index b235d7e3598..4aac91bad63 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -111,7 +111,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
- Core::HelpManager::registerDocumentation({Core::ICore::documentationPath() + "/qbs.qch"});
+ Core::HelpManager::registerDocumentation({Core::HelpManager::documentationPath() + "/qbs.qch"});
ProjectManager::registerProjectType(QmlJSTools::Constants::QBS_MIMETYPE);
KitManager::registerKitInformation();
From 807b0f78fc89409559ecc22229650a883def436d Mon Sep 17 00:00:00 2001
From: Jonathan Liu
Date: Thu, 20 Sep 2018 13:46:05 +1000
Subject: [PATCH 06/25] ProjectExplorer: Do not add too many newlines for
remote processes
Do not add newlines when remote process output gets flushed.
Task-number: QTCREATORBUG-19367
Change-Id: I9e878695279404d436264abd580884fb6a9e91ad
Reviewed-by: hjk
---
src/plugins/projectexplorer/runconfiguration.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index 438d631c781..f2f5871a5a3 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -1659,12 +1659,12 @@ void SimpleTargetRunner::start()
connect(&m_launcher, &ApplicationLauncher::remoteStderr,
this, [this](const QString &output) {
- appendMessage(output, Utils::StdErrFormatSameLine);
+ appendMessage(output, Utils::StdErrFormatSameLine, false);
});
connect(&m_launcher, &ApplicationLauncher::remoteStdout,
this, [this](const QString &output) {
- appendMessage(output, Utils::StdOutFormatSameLine);
+ appendMessage(output, Utils::StdOutFormatSameLine, false);
});
connect(&m_launcher, &ApplicationLauncher::finished,
From 7bd3f0682842b9324b926091166ee94be75d7bfc Mon Sep 17 00:00:00 2001
From: hjk
Date: Thu, 20 Sep 2018 09:45:24 +0200
Subject: [PATCH 07/25] Make BuildStep::createConfigWidget default
implementation non-pure
Amends 760723f7. The intention was actually that the default
implementation is not only good enough, but also that there doesn't
need to be a re-implementation to call it.
Change-Id: I47bd4dba6f8df2826d17696f727252954a5bbabf
Reviewed-by: Ulf Hermann
---
src/plugins/projectexplorer/buildstep.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h
index ddbb91d5d46..72f83c1bb37 100644
--- a/src/plugins/projectexplorer/buildstep.h
+++ b/src/plugins/projectexplorer/buildstep.h
@@ -55,7 +55,7 @@ protected:
public:
virtual bool init(QList &earlierSteps) = 0;
virtual void run(QFutureInterface &fi) = 0;
- virtual BuildStepConfigWidget *createConfigWidget() = 0;
+ virtual BuildStepConfigWidget *createConfigWidget();
virtual bool immutable() const;
virtual bool runInGuiThread() const;
From ed2fbeeecfb94648b5c1ba25bc7b8eca3be1ec9e Mon Sep 17 00:00:00 2001
From: hjk
Date: Thu, 20 Sep 2018 10:03:57 +0200
Subject: [PATCH 08/25] RemoteLinux: Remove
RemoteLinuxKillAppStep::createConfigWidget
Identical to base AbstractRemoteLinuxDeployStep::createConfigWidget.
Change-Id: I10a94514e50839950eb4e07a4ce1b4c004b51881
Reviewed-by: Ulf Hermann
---
src/plugins/remotelinux/remotelinuxkillappstep.cpp | 5 -----
src/plugins/remotelinux/remotelinuxkillappstep.h | 2 --
2 files changed, 7 deletions(-)
diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.cpp b/src/plugins/remotelinux/remotelinuxkillappstep.cpp
index bdf3972a7ba..25730602550 100644
--- a/src/plugins/remotelinux/remotelinuxkillappstep.cpp
+++ b/src/plugins/remotelinux/remotelinuxkillappstep.cpp
@@ -43,11 +43,6 @@ RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id)
setDefaultDisplayName(displayName());
}
-BuildStepConfigWidget *RemoteLinuxKillAppStep::createConfigWidget()
-{
- return new SimpleBuildStepConfigWidget(this);
-}
-
bool RemoteLinuxKillAppStep::initInternal(QString *error)
{
Q_UNUSED(error);
diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.h b/src/plugins/remotelinux/remotelinuxkillappstep.h
index dc94808ff12..e1f9b3f47e9 100644
--- a/src/plugins/remotelinux/remotelinuxkillappstep.h
+++ b/src/plugins/remotelinux/remotelinuxkillappstep.h
@@ -41,8 +41,6 @@ public:
static QString displayName();
private:
- ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
-
bool initInternal(QString *error) override;
AbstractRemoteLinuxDeployService *deployService() const override;
From b9a8e77a829eafe2171d9ab0bc34efe422cddf17 Mon Sep 17 00:00:00 2001
From: hjk
Date: Mon, 4 Jun 2018 10:28:16 +0200
Subject: [PATCH 09/25] ProjectExplorer: Decommission
RunWorkerFactory::priority
The only ever user (AppManager) doesn't need it for disambiguation
anymore.
Change-Id: Iea2f4d545bf9afb0610bf73c4ec7b2f29357edc0
Reviewed-by: Ulf Hermann
---
src/plugins/projectexplorer/runconfiguration.cpp | 16 +++++-----------
src/plugins/projectexplorer/runconfiguration.h | 6 +-----
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index cbf24c37e21..21ddbf03360 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -642,11 +642,6 @@ bool RunWorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMo
return true;
}
-void RunWorkerFactory::setPriority(int priority)
-{
- m_priority = priority;
-}
-
void RunWorkerFactory::setProducer(const WorkerCreator &producer)
{
m_producer = producer;
@@ -971,15 +966,14 @@ RunWorkerFactory::WorkerCreator RunControl::producer(RunConfiguration *runConfig
const auto canRun = std::bind(&RunWorkerFactory::canRun, std::placeholders::_1, runConfig, runMode);
const QList candidates = Utils::filtered(g_runWorkerFactories, canRun);
+ // This is legit, there might be combinations that cannot run.
if (candidates.empty())
return {};
- const auto higherPriority = std::bind(std::greater<>(),
- std::bind(&RunWorkerFactory::priority, std::placeholders::_1),
- std::bind(&RunWorkerFactory::priority, std::placeholders::_2));
- const auto bestFactory = std::max_element(candidates.begin(), candidates.end(), higherPriority);
-
- return (*bestFactory)->producer();
+ // There should be at most one top-level producer feeling responsible per combination.
+ // Breaking a tie should be done by tightening the restrictions on one of them.
+ QTC_CHECK(candidates.size() == 1);
+ return candidates.front()->producer();
}
void RunControlPrivate::initiateStart()
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index aaac5f7595c..33c72a9654c 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -382,12 +382,10 @@ public:
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
- void setPriority(int priority);
void setProducer(const WorkerCreator &producer);
void addConstraint(const Constraint &constraint);
void addSupportedRunMode(Core::Id runMode);
- int priority() const { return m_priority; }
WorkerCreator producer() const { return m_producer; }
private:
@@ -399,7 +397,6 @@ private:
QList m_supportedRunModes;
QList m_constraints;
WorkerCreator m_producer;
- int m_priority = 0;
};
/**
@@ -478,13 +475,12 @@ public:
factory->addConstraint(constraint);
}
template
- static void registerWorker(Core::Id runMode, const Constraint &constraint, int priority = 0)
+ static void registerWorker(Core::Id runMode, const Constraint &constraint)
{
auto factory = new RunWorkerFactory;
factory->setProducer([](RunControl *rc) { return new Worker(rc); });
factory->addSupportedRunMode(runMode);
factory->addConstraint(constraint);
- factory->setPriority(priority);
}
static WorkerCreator producer(RunConfiguration *runConfiguration, Core::Id runMode);
From bcb2df7b30208ad87545001e9d685ee6594cf6dc Mon Sep 17 00:00:00 2001
From: hjk
Date: Thu, 20 Sep 2018 09:38:38 +0200
Subject: [PATCH 10/25] Debugger: Add Perspective::name() accessor
Will be needed again by GammaRay.
Change-Id: I9afe61dd1db4a1ba4ec95a6abd089e12c6cbcd9a
Reviewed-by: Christian Stenger
---
src/plugins/debugger/debuggermainwindow.cpp | 5 +++++
src/plugins/debugger/debuggermainwindow.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index d8a45e55b30..5834c359334 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -593,6 +593,11 @@ QString Perspective::id() const
return d->m_id;
}
+QString Perspective::name() const
+{
+ return d->m_name;
+}
+
void Perspective::setAboutToActivateCallback(const Perspective::Callback &cb)
{
d->m_aboutToActivateCallback = cb;
diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h
index bb057b7b482..6cdb2c90eac 100644
--- a/src/plugins/debugger/debuggermainwindow.h
+++ b/src/plugins/debugger/debuggermainwindow.h
@@ -87,6 +87,7 @@ public:
void setShouldPersistChecker(const ShouldPersistChecker &checker);
QString id() const; // Currently used by GammaRay plugin.
+ QString name() const;
QWidget *centralWidget() const;
using Callback = std::function;
From 08ec1f93267eb66f52ee5ad61ed3aecc7cf68a16 Mon Sep 17 00:00:00 2001
From: Nikolai Kosjar
Date: Thu, 20 Sep 2018 12:04:21 +0200
Subject: [PATCH 11/25] CppTools: Fix crash on smart selection change with
lambda
...in case there is no lambda declarator provided, e.g.: []{}
Fixes: QTCREATORBUG-20994
Change-Id: I6a77cffe4e585422f1ed0639cabc687d3d123f5d
Reviewed-by: Christian Stenger
Reviewed-by: Alexandru Croitor
---
src/plugins/cpptools/cppselectionchanger.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/cpptools/cppselectionchanger.cpp b/src/plugins/cpptools/cppselectionchanger.cpp
index 5ac29f97cac..59ac0a1634c 100644
--- a/src/plugins/cpptools/cppselectionchanger.cpp
+++ b/src/plugins/cpptools/cppselectionchanger.cpp
@@ -924,6 +924,9 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
// TODO: Fix more lambda cases.
LambdaIntroducerAST *lambdaIntroducerAST = lambdaExpressionAST->lambda_introducer;
LambdaDeclaratorAST *lambdaDeclaratorAST = lambdaExpressionAST->lambda_declarator;
+ if (!lambdaDeclaratorAST)
+ return;
+
TrailingReturnTypeAST *trailingReturnTypeAST = lambdaDeclaratorAST->trailing_return_type;
unsigned firstSquareBracketTokenIndex = lambdaIntroducerAST->lbracket_token;
unsigned lastParenTokenIndex = lambdaDeclaratorAST->rparen_token;
From 6cf573534f49e2bd5ec2aeef97dca4a66002c671 Mon Sep 17 00:00:00 2001
From: Eike Ziller
Date: Thu, 20 Sep 2018 14:24:02 +0200
Subject: [PATCH 12/25] Bump version to 4.7.2
Change-Id: I10b0692b069aa587ab39156ddd6c4601646ff493
Reviewed-by: Eike Ziller
---
qbs/modules/qtc/qtc.qbs | 4 ++--
qtcreator.pri | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs
index 9d739f926b6..c289851119a 100644
--- a/qbs/modules/qtc/qtc.qbs
+++ b/qbs/modules/qtc/qtc.qbs
@@ -4,10 +4,10 @@ import qbs.FileInfo
import "qtc.js" as HelperFunctions
Module {
- property string qtcreator_display_version: '4.7.1'
+ property string qtcreator_display_version: '4.7.2'
property string ide_version_major: '4'
property string ide_version_minor: '7'
- property string ide_version_release: '1'
+ property string ide_version_release: '2'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.'
+ ide_version_release
diff --git a/qtcreator.pri b/qtcreator.pri
index 6a65bf602c6..f108158c6e2 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -1,10 +1,10 @@
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1
-QTCREATOR_VERSION = 4.7.1
+QTCREATOR_VERSION = 4.7.2
QTCREATOR_COMPAT_VERSION = 4.7.0
VERSION = $$QTCREATOR_VERSION
-QTCREATOR_DISPLAY_VERSION = 4.7.1
+QTCREATOR_DISPLAY_VERSION = 4.7.2
QTCREATOR_COPYRIGHT_YEAR = 2018
BINARY_ARTIFACTS_BRANCH = 4.7
From 12e253df9d5afee8d1cf56b4932917d0eb5d1f15 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh
Date: Fri, 21 Sep 2018 02:08:41 +0300
Subject: [PATCH 13/25] AutoTest: Remove usages of deprecated
QModelIndex::child
Change-Id: I8b310a54d6c1a044c94edac8fd67dfa8b2fcfb91
Reviewed-by: Christian Stenger
---
src/plugins/autotest/testresultmodel.cpp | 2 +-
src/plugins/autotest/testresultspane.cpp | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp
index 7eb23e41c95..d4dd274c478 100644
--- a/src/plugins/autotest/testresultmodel.cpp
+++ b/src/plugins/autotest/testresultmodel.cpp
@@ -430,7 +430,7 @@ bool TestResultFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
bool TestResultFilterModel::acceptTestCaseResult(const QModelIndex &srcIndex) const
{
for (int row = 0, count = m_sourceModel->rowCount(srcIndex); row < count; ++row) {
- const QModelIndex &child = srcIndex.child(row, 0);
+ const QModelIndex &child = m_sourceModel->index(row, 0, srcIndex);
Result::Type type = m_sourceModel->testResult(child)->result();
if (type == Result::MessageTestCaseSuccess)
type = Result::Pass;
diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp
index 89fce104de9..277109b600a 100644
--- a/src/plugins/autotest/testresultspane.cpp
+++ b/src/plugins/autotest/testresultspane.cpp
@@ -324,7 +324,7 @@ void TestResultsPane::goToNext()
if (currentIndex.isValid()) {
// try to set next to first child or next sibling
if (m_filterModel->rowCount(currentIndex)) {
- nextCurrentIndex = currentIndex.child(0, 0);
+ nextCurrentIndex = m_filterModel->index(0, 0, currentIndex);
} else {
nextCurrentIndex = currentIndex.sibling(currentIndex.row() + 1, 0);
// if it had no sibling check siblings of parent (and grandparents if necessary)
@@ -369,7 +369,7 @@ void TestResultsPane::goToPrev()
nextCurrentIndex = currentIndex.sibling(currentIndex.row() - 1, 0);
// if the sibling has children, use the last one
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
- nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
+ nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
} else {
nextCurrentIndex = currentIndex.parent();
}
@@ -386,7 +386,7 @@ void TestResultsPane::goToPrev()
nextCurrentIndex = m_filterModel->index(m_filterModel->rowCount(QModelIndex()) - 1, 0);
// step through until end
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
- nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
+ nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
}
m_treeView->setCurrentIndex(nextCurrentIndex);
From 9364e4b8ecbed6a555ba29d68678490d088c4c8d Mon Sep 17 00:00:00 2001
From: Orgad Shaneh
Date: Fri, 21 Sep 2018 01:30:02 +0300
Subject: [PATCH 14/25] Core: Modernize (minor)
Replace 2 loops with range loops, and use nullptr.
Change-Id: I9f8920bb978ed218c5ec9ca01105652ebb51d842
Reviewed-by: Alessandro Portale
---
src/plugins/coreplugin/actionmanager/command.cpp | 3 +--
src/plugins/coreplugin/mainwindow.cpp | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index 4d9715f8b82..c74dbedb103 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -313,8 +313,7 @@ void Action::addOverrideAction(QAction *action, const Context &context, bool scr
if (context.isEmpty()) {
m_contextActionMap.insert(Constants::C_GLOBAL, action);
} else {
- for (int i = 0; i < context.size(); ++i) {
- Id id = context.at(i);
+ for (const Id &id : context) {
if (m_contextActionMap.contains(id))
qWarning("%s", qPrintable(msgActionWarning(action, id, m_contextActionMap.value(id, nullptr))));
m_contextActionMap.insert(id, action);
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 6b86a9ca223..94bc49a7e92 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -355,7 +355,7 @@ void MainWindow::openDroppedFiles(const QList &files)
IContext *MainWindow::currentContextObject() const
{
- return m_activeContext.isEmpty() ? 0 : m_activeContext.first();
+ return m_activeContext.isEmpty() ? nullptr : m_activeContext.first();
}
QStatusBar *MainWindow::statusBar() const
@@ -1086,8 +1086,7 @@ void MainWindow::updateContext()
contexts.add(m_lowPrioAdditionalContexts);
Context uniquecontexts;
- for (int i = 0; i < contexts.size(); ++i) {
- const Id id = contexts.at(i);
+ for (const Id &id : qAsConst(contexts)) {
if (!uniquecontexts.contains(id))
uniquecontexts.add(id);
}
From d88a0d8e681ec18a98540fa0a77d589511083f1f Mon Sep 17 00:00:00 2001
From: Orgad Shaneh
Date: Fri, 21 Sep 2018 01:15:38 +0300
Subject: [PATCH 15/25] Utils: Modernize
range-based for, nullptr, member initializers, override.
Change-Id: I21ac5b23883c08dbd75819bb3298bc956cdb972c
Reviewed-by: Alessandro Portale
---
src/libs/modelinglib/qmt/stereotype/toolbar.h | 2 +-
src/libs/utils/fancylineedit.cpp | 8 ++--
src/libs/utils/mimetypes/mimedatabase_p.h | 2 +-
src/libs/utils/mimetypes/mimeglobpattern_p.h | 8 +---
src/libs/utils/mimetypes/mimeprovider_p.h | 22 +++++-----
src/libs/utils/mimetypes/mimetypeparser_p.h | 12 +++---
src/libs/utils/outputformatter.cpp | 8 +---
src/libs/utils/pathchooser.cpp | 3 +-
src/libs/utils/projectintropage.cpp | 9 ++--
src/libs/utils/tooltip/tips.h | 42 +++++++++----------
10 files changed, 52 insertions(+), 64 deletions(-)
diff --git a/src/libs/modelinglib/qmt/stereotype/toolbar.h b/src/libs/modelinglib/qmt/stereotype/toolbar.h
index ab3974ec2ec..2f9be9188c5 100644
--- a/src/libs/modelinglib/qmt/stereotype/toolbar.h
+++ b/src/libs/modelinglib/qmt/stereotype/toolbar.h
@@ -54,7 +54,7 @@ public:
}
Tool(const QString &name, const QString &elementType,
- const QString &stereotype = QString::null)
+ const QString &stereotype = QString())
: m_name(name),
m_elementType(elementType),
m_stereotype(stereotype)
diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp
index 9efe74687e1..55b4b12f7f1 100644
--- a/src/libs/utils/fancylineedit.cpp
+++ b/src/libs/utils/fancylineedit.cpp
@@ -236,7 +236,7 @@ void FancyLineEdit::updateButtonPositions()
{
QRect contentRect = rect();
for (int i = 0; i < 2; ++i) {
- Side iconpos = (Side)i;
+ Side iconpos = Side(i);
if (layoutDirection() == Qt::RightToLeft)
iconpos = (iconpos == Left ? Right : Left);
@@ -473,9 +473,9 @@ void FancyLineEdit::validate()
// Check buttons.
if (d->m_oldText.isEmpty() || t.isEmpty()) {
- for (int i = 0; i < 2; ++i) {
- if (d->m_iconbutton[i]->hasAutoHide())
- d->m_iconbutton[i]->animateShow(!t.isEmpty());
+ for (auto &button : qAsConst(d->m_iconbutton)) {
+ if (button->hasAutoHide())
+ button->animateShow(!t.isEmpty());
}
d->m_oldText = t;
}
diff --git a/src/libs/utils/mimetypes/mimedatabase_p.h b/src/libs/utils/mimetypes/mimedatabase_p.h
index 1a464fb0076..6f87b213f34 100644
--- a/src/libs/utils/mimetypes/mimedatabase_p.h
+++ b/src/libs/utils/mimetypes/mimedatabase_p.h
@@ -99,7 +99,7 @@ public:
MimeType mimeTypeForName(const QString &nameOrAlias);
MimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device, int *priorityPtr);
MimeType findByData(const QByteArray &data, int *priorityPtr);
- QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = 0);
+ QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = nullptr);
mutable MimeProviderBase *m_provider;
const QString m_defaultMimeType;
diff --git a/src/libs/utils/mimetypes/mimeglobpattern_p.h b/src/libs/utils/mimetypes/mimeglobpattern_p.h
index 863c432653b..accbab06469 100644
--- a/src/libs/utils/mimetypes/mimeglobpattern_p.h
+++ b/src/libs/utils/mimetypes/mimeglobpattern_p.h
@@ -58,15 +58,11 @@ namespace Internal {
struct MimeGlobMatchResult
{
- MimeGlobMatchResult()
- : m_weight(0), m_matchingPatternLength(0)
- {}
-
void addMatch(const QString &mimeType, int weight, const QString &pattern);
QStringList m_matchingMimeTypes;
- int m_weight;
- int m_matchingPatternLength;
+ int m_weight = 0;
+ int m_matchingPatternLength = 0;
QString m_foundSuffix;
};
diff --git a/src/libs/utils/mimetypes/mimeprovider_p.h b/src/libs/utils/mimetypes/mimeprovider_p.h
index deda7b9645c..b616d198798 100644
--- a/src/libs/utils/mimetypes/mimeprovider_p.h
+++ b/src/libs/utils/mimetypes/mimeprovider_p.h
@@ -141,14 +141,14 @@ class MimeXMLProvider : public MimeProviderBase
public:
MimeXMLProvider(MimeDatabasePrivate *db);
- virtual bool isValid();
- virtual MimeType mimeTypeForName(const QString &name);
- virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix);
- virtual QStringList parents(const QString &mime);
- virtual QString resolveAlias(const QString &name);
- virtual QStringList listAliases(const QString &name);
- virtual MimeType findByMagic(const QByteArray &data, int *accuracyPtr);
- virtual QList allMimeTypes();
+ bool isValid() override;
+ MimeType mimeTypeForName(const QString &name) override;
+ QStringList findByFileName(const QString &fileName, QString *foundSuffix) override;
+ QStringList parents(const QString &mime) override;
+ QString resolveAlias(const QString &name) override;
+ QStringList listAliases(const QString &name) override;
+ MimeType findByMagic(const QByteArray &data, int *accuracyPtr) override;
+ QList allMimeTypes() override;
bool load(const QString &fileName, QString *errorMessage);
@@ -161,9 +161,9 @@ public:
// Qt Creator additions
void addData(const QString &id, const QByteArray &data);
- QMap > magicRulesForMimeType(const MimeType &mimeType);
- void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns);
- void setMagicRulesForMimeType(const MimeType &mimeType, const QMap > &rules);
+ QMap > magicRulesForMimeType(const MimeType &mimeType) override;
+ void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns) override;
+ void setMagicRulesForMimeType(const MimeType &mimeType, const QMap > &rules) override;
private:
void ensureLoaded();
diff --git a/src/libs/utils/mimetypes/mimetypeparser_p.h b/src/libs/utils/mimetypes/mimetypeparser_p.h
index b37cec464df..8d70004bff0 100644
--- a/src/libs/utils/mimetypes/mimetypeparser_p.h
+++ b/src/libs/utils/mimetypes/mimetypeparser_p.h
@@ -101,22 +101,22 @@ public:
explicit MimeTypeParser(MimeXMLProvider &provider) : m_provider(provider) {}
protected:
- inline bool mimeTypeExists(const QString &mimeTypeName)
+ inline bool mimeTypeExists(const QString &mimeTypeName) override
{ return m_provider.mimeTypeForName(mimeTypeName).isValid(); }
- inline bool process(const MimeType &t, QString *)
+ inline bool process(const MimeType &t, QString *) override
{ m_provider.addMimeType(t); return true; }
- inline bool process(const MimeGlobPattern &glob, QString *)
+ inline bool process(const MimeGlobPattern &glob, QString *) override
{ m_provider.addGlobPattern(glob); return true; }
- inline void processParent(const QString &child, const QString &parent)
+ inline void processParent(const QString &child, const QString &parent) override
{ m_provider.addParent(child, parent); }
- inline void processAlias(const QString &alias, const QString &name)
+ inline void processAlias(const QString &alias, const QString &name) override
{ m_provider.addAlias(alias, name); }
- inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher)
+ inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher) override
{ m_provider.addMagicMatcher(matcher); }
private:
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp
index de1e20d33f8..ab47485e6e3 100644
--- a/src/libs/utils/outputformatter.cpp
+++ b/src/libs/utils/outputformatter.cpp
@@ -37,16 +37,12 @@ namespace Internal {
class OutputFormatterPrivate
{
public:
- OutputFormatterPrivate()
- : plainTextEdit(nullptr), overwriteOutput(false)
- {}
-
- QPlainTextEdit *plainTextEdit;
+ QPlainTextEdit *plainTextEdit = nullptr;
QTextCharFormat formats[NumberOfFormats];
QFont font;
QTextCursor cursor;
AnsiEscapeCodeHandler escapeCodeHandler;
- bool overwriteOutput;
+ bool overwriteOutput = false;
};
} // namespace Internal
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index 0d0dab0e60c..7efe61db630 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -167,7 +167,7 @@ public:
QHBoxLayout *m_hLayout = nullptr;
FancyLineEdit *m_lineEdit = nullptr;
- PathChooser::Kind m_acceptingKind;
+ PathChooser::Kind m_acceptingKind = PathChooser::ExistingDirectory;
QString m_dialogTitleOverride;
QString m_dialogFilter;
QString m_initialBrowsePathOverride;
@@ -181,7 +181,6 @@ public:
PathChooserPrivate::PathChooserPrivate() :
m_hLayout(new QHBoxLayout),
m_lineEdit(new FancyLineEdit),
- m_acceptingKind(PathChooser::ExistingDirectory),
m_macroExpander(globalMacroExpander())
{
}
diff --git a/src/libs/utils/projectintropage.cpp b/src/libs/utils/projectintropage.cpp
index 4aeabdaceb2..a449fe1285f 100644
--- a/src/libs/utils/projectintropage.cpp
+++ b/src/libs/utils/projectintropage.cpp
@@ -60,22 +60,19 @@ class ProjectIntroPagePrivate
public:
ProjectIntroPagePrivate();
Ui::ProjectIntroPage m_ui;
- bool m_complete;
+ bool m_complete = false;
QRegularExpressionValidator m_projectNameValidator;
// Status label style sheets
const QString m_errorStyleSheet;
const QString m_warningStyleSheet;
const QString m_hintStyleSheet;
- bool m_forceSubProject;
+ bool m_forceSubProject = false;
QStringList m_projectDirectories;
};
ProjectIntroPagePrivate:: ProjectIntroPagePrivate() :
- m_complete(false),
m_errorStyleSheet(QLatin1String("background : red;")),
- m_warningStyleSheet(QLatin1String("background : yellow;")),
- m_hintStyleSheet(),
- m_forceSubProject(false)
+ m_warningStyleSheet(QLatin1String("background : yellow;"))
{
}
diff --git a/src/libs/utils/tooltip/tips.h b/src/libs/utils/tooltip/tips.h
index fe1a8633d01..844848e7965 100644
--- a/src/libs/utils/tooltip/tips.h
+++ b/src/libs/utils/tooltip/tips.h
@@ -63,14 +63,14 @@ class TextTip : public QTipLabel
public:
TextTip(QWidget *parent);
- virtual void setContent(const QVariant &content);
- virtual bool isInteractive() const;
- virtual void configure(const QPoint &pos, QWidget *w);
- virtual bool canHandleContentReplacement(int typeId) const;
- virtual int showTime() const;
- virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
- virtual void paintEvent(QPaintEvent *event);
- virtual void resizeEvent(QResizeEvent *event);
+ void setContent(const QVariant &content) override;
+ bool isInteractive() const override;
+ void configure(const QPoint &pos, QWidget *w) override;
+ bool canHandleContentReplacement(int typeId) const override;
+ int showTime() const override;
+ bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
private:
QString m_text;
@@ -81,12 +81,12 @@ class ColorTip : public QTipLabel
public:
ColorTip(QWidget *parent);
- virtual void setContent(const QVariant &content);
- virtual void configure(const QPoint &pos, QWidget *w);
- virtual bool canHandleContentReplacement(int typeId) const;
- virtual int showTime() const { return 4000; }
- virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
- virtual void paintEvent(QPaintEvent *event);
+ void setContent(const QVariant &content) override;
+ void configure(const QPoint &pos, QWidget *w) override;
+ bool canHandleContentReplacement(int typeId) const override;
+ int showTime() const override { return 4000; }
+ bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
+ void paintEvent(QPaintEvent *event) override;
private:
QColor m_color;
@@ -98,15 +98,15 @@ class WidgetTip : public QTipLabel
Q_OBJECT
public:
- explicit WidgetTip(QWidget *parent = 0);
+ explicit WidgetTip(QWidget *parent = nullptr);
void pinToolTipWidget(QWidget *parent);
- virtual void setContent(const QVariant &content);
- virtual void configure(const QPoint &pos, QWidget *w);
- virtual bool canHandleContentReplacement(int typeId) const;
- virtual int showTime() const { return 30000; }
- virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
- virtual bool isInteractive() const { return true; }
+ void setContent(const QVariant &content) override;
+ void configure(const QPoint &pos, QWidget *w) override;
+ bool canHandleContentReplacement(int typeId) const override;
+ int showTime() const override { return 30000; }
+ bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
+ bool isInteractive() const override { return true; }
private:
QWidget *m_widget;
From 3c8f8f1ffcc0669b0a31aca0f6fa138606bfa061 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint
Date: Thu, 20 Sep 2018 08:39:59 +0200
Subject: [PATCH 16/25] qtcdebugger: Extend help text
Factor out a helper function to read out the current debugger.
Display the currently registered debugger and the Qt version used in the
help. Enable copying the message box text.
This offers a convenient way of checking since the debugger settings often
get overwritten by OS or MSVC updates.
Change-Id: If61e30ae22802b71960cb6f3da96100f5fd9e47c
Reviewed-by: Eike Ziller
Reviewed-by: hjk
Reviewed-by: David Schulz
---
src/tools/qtcdebugger/main.cpp | 48 +++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/src/tools/qtcdebugger/main.cpp b/src/tools/qtcdebugger/main.cpp
index 7453c08afca..38507c85394 100644
--- a/src/tools/qtcdebugger/main.cpp
+++ b/src/tools/qtcdebugger/main.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -138,6 +139,26 @@ static bool parseArguments(const QStringList &args, QString *errorMessage)
return true;
}
+static bool readDebugger(const wchar_t *key, QString *debugger,
+ QString *errorMessage)
+{
+ bool success = false;
+ HKEY handle;
+ const RegistryAccess::AccessMode accessMode = optIsWow
+#ifdef Q_OS_WIN64
+ ? RegistryAccess::Registry32Mode
+#else
+ ? RegistryAccess::Registry64Mode
+#endif
+ : RegistryAccess::DefaultAccessMode;
+
+ if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) {
+ success = registryReadStringKey(handle, key, debugger, errorMessage);
+ RegCloseKey(handle);
+ }
+ return success;
+}
+
static void usage(const QString &binary, const QString &message = QString())
{
QString msg;
@@ -170,10 +191,16 @@ static void usage(const QString &binary, const QString &message = QString())
<< "On 64-bit systems, do the same for the key HKEY_LOCAL_MACHINE\\" << wCharToQString(debuggerWow32RegistryKeyC) << ", "
<< "setting the new value to
\"" << QDir::toNativeSeparators(binary) << "\" -wow %ld %ld
"
<< "How to run a command with administrative privileges:
"
- << "runas /env /noprofile /user:Administrator \"command arguments\"
"
- << "