diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index c290ebfc1b2..76e492e350f 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -369,6 +369,29 @@ void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText) 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); @@ -380,7 +403,9 @@ void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout) switch (m_displayStyle) { case PathChooserDisplay: m_pathChooserDisplay = new PathChooser(parent); - m_pathChooserDisplay->setExpectedKind(PathChooser::File); + 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); @@ -388,6 +413,7 @@ void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout) 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); @@ -467,6 +493,27 @@ void ExecutableAspect::setExecutablePathStyle(OsType osType) }); } +void ExecutableAspect::setHistoryCompleter(const QString &historyCompleterKey) +{ + m_executable.setHistoryCompleter(historyCompleterKey); + if (m_alternativeExecutable) + m_alternativeExecutable->setHistoryCompleter(historyCompleterKey); +} + +void ExecutableAspect::setExpectedKind(const PathChooser::Kind expectedKind) +{ + m_executable.setExpectedKind(expectedKind); + if (m_alternativeExecutable) + m_alternativeExecutable->setExpectedKind(expectedKind); +} + +void ExecutableAspect::setEnvironment(const Environment &env) +{ + m_executable.setEnvironment(env); + if (m_alternativeExecutable) + m_alternativeExecutable->setEnvironment(env); +} + void ExecutableAspect::makeOverridable(const QString &overridingKey, const QString &useOverridableKey) { QTC_ASSERT(!m_alternativeExecutable, return); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index 83f5e5a70f3..d8c84da2651 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -29,6 +29,7 @@ #include "applicationlauncher.h" #include +#include #include QT_BEGIN_NAMESPACE @@ -39,11 +40,6 @@ class QFormLayout; class QToolButton; QT_END_NAMESPACE -namespace Utils { -class FancyLineEdit; -class PathChooser; -} - namespace ProjectExplorer { class PROJECTEXPLORER_EXPORT TerminalAspect : public IRunConfigurationAspect @@ -189,6 +185,9 @@ public: 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); @@ -212,6 +211,9 @@ private: 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; @@ -233,6 +235,9 @@ public: void setLabelText(const QString &labelText); void setPlaceHolderText(const QString &placeHolderText); void setExecutablePathStyle(Utils::OsType osType); + void setHistoryCompleter(const QString &historyCompleterKey); + void setExpectedKind(const Utils::PathChooser::Kind expectedKind); + void setEnvironment(const Utils::Environment &env); protected: void fromMap(const QVariantMap &map) override;