forked from qt-creator/qt-creator
ProjectExplorer: Make string based aspect widgets more flexible
By making some of the underlying PathChooser etc. functions accessible. Change-Id: Iaea1543af8b6711bd7594a029e0612d6c6fc4b4b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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);
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "applicationlauncher.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/osspecificaspects.h>
|
||||
|
||||
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<QString (const QString &)> &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<QLabel> m_label;
|
||||
QPointer<QLabel> m_labelDisplay;
|
||||
QPointer<Utils::FancyLineEdit> 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;
|
||||
|
Reference in New Issue
Block a user