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