Commit 3119d93b authored by hjk's avatar hjk

VariableChooser: Rework

Allow multiple expanders to be registered for lineedits, e.g. a
local and the global ones, and actually show them.

Use a tree view in the chooser for somewhat more structured display.

Change-Id: I769f92144e5249f45e54381de52aa6973eb20118
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent e279c7e0
......@@ -49,6 +49,7 @@ public:
QHash<QByteArray, MacroExpander::StringFunction> m_map;
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
QMap<QByteArray, QString> m_descriptions;
QString m_displayName;
};
} // Internal
......@@ -320,4 +321,37 @@ QString MacroExpander::variableDescription(const QByteArray &variable)
return d->m_descriptions.value(variable);
}
QString MacroExpander::displayName() const
{
return d->m_displayName;
}
void MacroExpander::setDisplayName(const QString &displayName)
{
d->m_displayName = displayName;
}
class GlobalMacroExpander : public MacroExpander
{
Q_DECLARE_TR_FUNCTIONS(Utils::MacroExpander)
public:
GlobalMacroExpander()
{
setDisplayName(tr("Global variables"));
registerPrefix("Env", tr("Access environment variables."),
[](const QString &value) { return QString::fromLocal8Bit(qgetenv(value.toLocal8Bit())); });
}
};
/*!
* Returns the expander for globally registered variables.
*/
MacroExpander *globalMacroExpander()
{
static GlobalMacroExpander theGlobalExpander;
return &theGlobalExpander;
}
} // namespace Utils
......@@ -70,6 +70,9 @@ public:
QList<QByteArray> variables();
QString variableDescription(const QByteArray &variable);
QString displayName() const;
void setDisplayName(const QString &displayName);
private:
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
......@@ -77,6 +80,8 @@ private:
Internal::MacroExpanderPrivate *d;
};
QTCREATOR_UTILS_EXPORT MacroExpander *globalMacroExpander();
} // namespace Utils
#endif // UTILS_MACROEXPANDER_H
......@@ -79,9 +79,9 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
formLayout->addRow(tr("Init commands:"), m_gdbInitCommandsTextEdit);
formLayout->addRow(tr("Reset commands:"), m_gdbResetCommandsTextEdit);
VariableChooser::addVariableSupport(m_gdbResetCommandsTextEdit);
VariableChooser::addVariableSupport(m_gdbInitCommandsTextEdit);
(void)new VariableChooser(this);
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(m_gdbResetCommandsTextEdit);
chooser->addSupportedWidget(m_gdbInitCommandsTextEdit);
connect(m_gdbHostLineEdit, SIGNAL(editingFinished()), SLOT(hostnameChanged()));
connect(m_gdbPortSpinBox, SIGNAL(valueChanged(int)), SLOT(portChanged()));
......
......@@ -88,9 +88,9 @@ BareMetalDeviceConfigurationWizardSetupPage::BareMetalDeviceConfigurationWizardS
connect(m_gdbResetCommandsTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
connect(m_gdbInitCommandsPlainTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
VariableChooser::addVariableSupport(m_gdbResetCommandsTextEdit);
VariableChooser::addVariableSupport(m_gdbInitCommandsPlainTextEdit);
(void)new VariableChooser(this);
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(m_gdbResetCommandsTextEdit);
chooser->addSupportedWidget(m_gdbInitCommandsPlainTextEdit);
}
void BareMetalDeviceConfigurationWizardSetupPage::initializePage()
......
......@@ -64,7 +64,6 @@
#include <coreplugin/infobar.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/variablemanager.h>
#include <QDebug>
#include <QDir>
......
......@@ -53,7 +53,6 @@ SOURCES += corejsextensions.cpp \
progressmanager/futureprogress.cpp \
statusbarwidget.cpp \
coreplugin.cpp \
variablemanager.cpp \
modemanager.cpp \
basefilewizard.cpp \
basefilewizardfactory.cpp \
......@@ -165,7 +164,6 @@ HEADERS += corejsextensions.h \
core_global.h \
statusbarwidget.h \
coreplugin.h \
variablemanager.h \
modemanager.h \
basefilewizard.h \
basefilewizardfactory.h \
......
......@@ -100,7 +100,6 @@ QtcPlugin {
"textdocument.cpp", "textdocument.h",
"toolsettings.cpp", "toolsettings.h",
"variablechooser.cpp", "variablechooser.h",
"variablemanager.cpp", "variablemanager.h",
"vcsmanager.cpp", "vcsmanager.h",
"versiondialog.cpp", "versiondialog.h",
"windowsupport.cpp", "windowsupport.h"
......
......@@ -33,13 +33,13 @@
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/fancylineedit.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/variablechooser.h>
#include <coreplugin/variablemanager.h>
#include <QTextStream>
#include <QMimeData>
......@@ -410,10 +410,11 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
connect(ui->toolTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(handleCurrentChanged(QModelIndex,QModelIndex)));
Core::VariableChooser::addVariableSupport(ui->executable->lineEdit());
Core::VariableChooser::addVariableSupport(ui->arguments);
Core::VariableChooser::addVariableSupport(ui->workingDirectory->lineEdit());
Core::VariableChooser::addVariableSupport(ui->inputText);
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(ui->executable->lineEdit());
chooser->addSupportedWidget(ui->arguments);
chooser->addSupportedWidget(ui->workingDirectory->lineEdit());
chooser->addSupportedWidget(ui->inputText);
connect(ui->description, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->executable, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
......@@ -441,7 +442,6 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
showInfoForItem(QModelIndex());
new VariableChooser(this);
}
ExternalToolConfig::~ExternalToolConfig()
......@@ -595,5 +595,5 @@ void ExternalToolConfig::addCategory()
void ExternalToolConfig::updateEffectiveArguments()
{
ui->arguments->setToolTip(Utils::QtcProcess::expandMacros(ui->arguments->text(),
globalMacroExpander()));
Utils::globalMacroExpander()));
}
......@@ -59,7 +59,6 @@
#include <coreplugin/outputpanemanager.h>
#include <coreplugin/rightpane.h>
#include <coreplugin/settingsdatabase.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/vcsmanager.h>
#include <extensionsystem/pluginmanager.h>
......@@ -67,6 +66,7 @@
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QClipboard>
......@@ -87,6 +87,8 @@
#include <QPushButton>
#include <QSplitter>
using namespace Utils;
enum { debugEditorManager=0 };
static const char kCurrentDocumentPrefix[] = "CurrentDocument";
......
......@@ -33,7 +33,6 @@
#include "actionmanager/actionmanager.h"
#include "actionmanager/actioncontainer.h"
#include "coreconstants.h"
#include "variablemanager.h"
#include <app/app_version.h>
#include <coreplugin/icore.h>
......@@ -41,8 +40,10 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QCoreApplication>
......@@ -54,6 +55,7 @@
#include <QDebug>
using namespace Utils;
using namespace Core;
using namespace Core::Internal;
......
......@@ -30,8 +30,8 @@
#include "jsexpander.h"
#include "corejsextensions.h"
#include "variablemanager.h"
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
......@@ -90,7 +90,7 @@ QString JsExpander::evaluate(const QString &expression, QString *errorMessage)
JsExpander::JsExpander()
{
d = new Internal::JsExpanderPrivate;
globalMacroExpander()->registerPrefix("JS",
Utils::globalMacroExpander()->registerPrefix("JS",
QCoreApplication::translate("Core::JsExpander",
"Evaluate simple Javascript statements.\n"
"The statements may not contain '{' nor '}' characters."),
......
......@@ -32,7 +32,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/variablemanager.h>
#include <utils/macroexpander.h>
#include <QMessageBox>
......@@ -91,9 +91,9 @@ void ExecuteFilter::accept(LocatorFilterEntry selection) const
p->m_commandHistory.prepend(value);
bool found;
QString workingDirectory = globalMacroExpander()->value("CurrentDocument:Path", &found);
QString workingDirectory = Utils::globalMacroExpander()->value("CurrentDocument:Path", &found);
if (!found || workingDirectory.isEmpty())
workingDirectory = globalMacroExpander()->value("CurrentProject:Path", &found);
workingDirectory = Utils::globalMacroExpander()->value("CurrentProject:Path", &found);
ExecuteData d;
d.workingDirectory = workingDirectory;
......
......@@ -45,7 +45,6 @@
#include "outputpanemanager.h"
#include "plugindialog.h"
#include "vcsmanager.h"
#include "variablemanager.h"
#include "versiondialog.h"
#include "statusbarmanager.h"
#include "id.h"
......
This diff is collapsed.
......@@ -35,10 +35,16 @@
#include <QWidget>
#include <functional>
namespace Utils { class MacroExpander; }
namespace Core {
namespace Internal { class VariableChooserPrivate; }
typedef std::function<Utils::MacroExpander *()> MacroExpanderProvider;
class CORE_EXPORT VariableChooser : public QWidget
{
Q_OBJECT
......@@ -47,8 +53,8 @@ public:
explicit VariableChooser(QWidget *parent = 0);
~VariableChooser();
static const char kVariableSupportProperty[];
static void addVariableSupport(QWidget *textcontrol);
void addMacroExpanderProvider(const MacroExpanderProvider &provider);
void addSupportedWidget(QWidget *textcontrol, const QByteArray &ownName = QByteArray());
protected:
void keyPressEvent(QKeyEvent *ke);
......
......@@ -51,12 +51,12 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/jsexpander.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/vcsmanager.h>
#include <cppeditor/cppeditorconstants.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QtPlugin>
......@@ -191,7 +191,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mcpptools->addAction(command);
connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit()));
Utils::MacroExpander *expander = globalMacroExpander();
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable("Cpp:LicenseTemplate",
tr("The license template."),
[this]() { return CppToolsPlugin::licenseTemplate(); });
......
......@@ -60,9 +60,10 @@
#include <texteditor/texteditor.h>
#include <utils/savedaction.h>
#include <utils/qtcassert.h>
#include <utils/fileinprojectfinder.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <qmljs/consolemanagerinterface.h>
......@@ -178,7 +179,7 @@ public:
connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(reloadDisassembly()));
globalMacroExpander()->registerFileVariables(PrefixDebugExecutable,
Utils::globalMacroExpander()->registerFileVariables(PrefixDebugExecutable,
tr("Debugged executable"),
[this]() { return m_startParameters.executable; });
}
......@@ -1835,7 +1836,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
SourcePathRegExpMap globalRegExpSourceMap;
globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size());
foreach (auto entry, options->sourcePathRegExpMap) {
const QString expanded = globalMacroExpander()->expandedString(entry.second);
const QString expanded = Utils::globalMacroExpander()->expandedString(entry.second);
if (!expanded.isEmpty())
globalRegExpSourceMap.push_back(qMakePair(entry.first, expanded));
}
......
......@@ -36,7 +36,6 @@
#include "debuggerstartparameters.h"
#include "breakpoint.h" // For BreakpointModelId.
#include "threaddata.h" // For ThreadId.
#include "coreplugin/variablemanager.h"
#include <QObject>
......
......@@ -209,7 +209,6 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
m_sourceLineEdit(new QLineEdit(this)),
m_targetChooser(new PathChooser(this))
{
(void)new Core::VariableChooser(this);
setTitle(tr("Source Paths Mapping"));
setToolTip(tr("<html><head/><body><p>Mappings of source file folders to "
"be used in the debugger can be entered here.</p>"
......@@ -275,7 +274,9 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
editTargetLabel->setBuddy(m_targetChooser);
m_targetChooser->setToolTip(targetToolTip);
editLayout->addRow(editTargetLabel, m_targetChooser);
Core::VariableChooser::addVariableSupport(m_targetChooser->lineEdit());
auto chooser = new Core::VariableChooser(this);
chooser->addSupportedWidget(m_targetChooser->lineEdit());
// Main layout
QVBoxLayout *mainLayout = new QVBoxLayout;
......
......@@ -69,8 +69,10 @@
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/texteditor.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/savedaction.h>
......
......@@ -72,8 +72,6 @@ public:
GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
: QWidget(parent)
{
(void) new VariableChooser(this);
auto groupBoxGeneral = new QGroupBox(this);
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));
......@@ -233,10 +231,11 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"Matching regular expression: "));
*/
VariableChooser::addVariableSupport(textEditCustomDumperCommands);
VariableChooser::addVariableSupport(textEditPostAttachCommands);
VariableChooser::addVariableSupport(textEditStartupCommands);
VariableChooser::addVariableSupport(pathChooserExtraDumperFile->lineEdit());
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(textEditCustomDumperCommands);
chooser->addSupportedWidget(textEditPostAttachCommands);
chooser->addSupportedWidget(textEditStartupCommands);
chooser->addSupportedWidget(pathChooserExtraDumperFile->lineEdit());
auto formLayout = new QFormLayout(groupBoxGeneral);
formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
......
......@@ -897,7 +897,7 @@ QModelIndex WatchModel::parent(const QModelIndex &idx) const
if (!grandparent)
return QModelIndex();
const WatchItems &uncles = grandparent->children;
const auto &uncles = grandparent->children;
for (int i = 0, n = uncles.size(); i < n; ++i)
if (uncles.at(i) == parent)
return createIndex(i, 0, (void*) parent);
......
......@@ -43,7 +43,6 @@
#include <projectexplorer/toolchain.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtparser.h>
#include <coreplugin/variablemanager.h>
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......
......@@ -51,7 +51,6 @@
#include <qmakeprojectmanager/qmakenodes.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtparser.h>
#include <coreplugin/variablemanager.h>
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......
......@@ -45,7 +45,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtparser.h>
#include <coreplugin/variablemanager.h>
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......
......@@ -38,7 +38,6 @@
#include "kit.h"
#include "projectmacroexpander.h"
#include <coreplugin/variablemanager.h>
#include <projectexplorer/buildenvironmentwidget.h>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/idocument.h>
......
......@@ -32,8 +32,7 @@
#include "jsonwizard.h"
#include <coreplugin/variablemanager.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QVariant>
......@@ -59,7 +58,7 @@ bool JsonWizardExpander::resolveMacro(const QString &name, QString *ret)
return true;
}
return Core::globalMacroExpander()->resolveMacro(name, ret);
return Utils::globalMacroExpander()->resolveMacro(name, ret);
}
} // namespace Internal
......
......@@ -32,8 +32,9 @@
#include "buildconfiguration.h"
#include <utils/macroexpander.h>
#include <utils/stringutils.h>
#include <coreplugin/variablemanager.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
......@@ -58,7 +59,7 @@ bool FallBackMacroExpander::resolveMacro(const QString &name, QString *ret)
return true;
}
bool found;
*ret = Core::globalMacroExpander()->value(name.toUtf8(), &found);
*ret = Utils::globalMacroExpander()->value(name.toUtf8(), &found);
return found;
}
} // namespace Internal
......
......@@ -35,7 +35,7 @@
#include "target.h"
#include "kit.h"
#include <coreplugin/variablemanager.h>
#include <utils/macroexpander.h>
#include <QDebug>
......@@ -82,7 +82,7 @@ bool ProcessStep::init()
if (!bc)
bc = target()->activeBuildConfiguration();
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc ? bc->macroExpander() : Core::globalMacroExpander());
pp->setMacroExpander(bc ? bc->macroExpander() : Utils::globalMacroExpander());
pp->setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
pp->setWorkingDirectory(workingDirectory());
pp->setCommand(m_command);
......@@ -272,7 +272,7 @@ void ProcessStepConfigWidget::updateDetails()
BuildConfiguration *bc = m_step->buildConfiguration();
if (!bc) // iff the step is actually in the deploy list
bc = m_step->target()->activeBuildConfiguration();
param.setMacroExpander(bc ? bc->macroExpander() : Core::globalMacroExpander());
param.setMacroExpander(bc ? bc->macroExpander() : Utils::globalMacroExpander());
param.setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
param.setWorkingDirectory(m_step->workingDirectory());
......
......@@ -117,12 +117,13 @@
#include <coreplugin/findplaceholder.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/fileutils.h>
#include <coreplugin/removefiledialog.h>
#include <texteditor/findinfiles.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
......@@ -1135,7 +1136,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
updateWelcomePage();
Utils::MacroExpander *expander = globalMacroExpander();
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
tr("Current project's main file"),
[this]() -> QString {
......
......@@ -48,8 +48,6 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
new Core::VariableChooser(this);
Core::VariableChooser::addVariableSupport(m_ui.buildDirectoryEdit);
setJomVisible(Utils::HostOsInfo::isWindowsHost());
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
......@@ -58,6 +56,9 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
this, SLOT(slotDirectoryButtonGroupChanged()));
connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetDefaultBuildDirectory()));
connect(m_ui.buildDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(updateResetButton()));
auto chooser = new Core::VariableChooser(this);
chooser->addSupportedWidget(m_ui.buildDirectoryEdit);
}
void ProjectExplorerSettingsWidget::setJomVisible(bool v)
......
......@@ -33,7 +33,7 @@
#include "kitinformation.h"
#include "projectexplorerconstants.h"
#include <coreplugin/variablemanager.h>
#include <utils/macroexpander.h>
#include <ssh/sshconnection.h>
using namespace ProjectExplorer;
......@@ -99,7 +99,7 @@ bool ProjectMacroExpander::resolveMacro(const QString &name, QString *ret)
{
bool found = resolveProjectMacro(name, ret);
if (!found) {
QString result = Core::globalMacroExpander()->value(name.toUtf8(), &found);
QString result = Utils::globalMacroExpander()->value(name.toUtf8(), &found);
if (ret)
*ret = result;
}
......
......@@ -250,6 +250,9 @@ void BaseQtVersion::setupExpander()
// m_expander.registerVariable("Qt:name",
// QCoreApplication::translate("QtSupport::QtKitInformation", "The display name of the current Qt version."),
// [this]() { return displayName(); });
m_expander.setDisplayName(
QCoreApplication::translate("QtSupport::QtKitInformation", "Qt version"));
}
BaseQtVersion::~BaseQtVersion()
......@@ -606,7 +609,8 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
QString BaseQtVersion::displayName() const
{
return Utils::expandMacros(m_unexpandedDisplayName, &m_expander);
QString ret = Utils::expandMacros(m_unexpandedDisplayName, &m_expander);
return Utils::expandMacros(ret, Utils::globalMacroExpander());
}
QString BaseQtVersion::unexpandedDisplayName() const
......
......@@ -146,6 +146,9 @@ bool QtKitInformation::resolveMacro(const ProjectExplorer::Kit *kit, const QStri
}
}
if (Utils::globalMacroExpander()->resolveMacro(name, ret))
return true;
return false;
}
......
......@@ -41,6 +41,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/variablechooser.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/hostosinfo.h>
......@@ -192,6 +193,14 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
this, SLOT(toolChainsUpdated()));
auto chooser = new Core::VariableChooser(this);
chooser->addSupportedWidget(m_versionUi->nameEdit, "Qt:name");
chooser->addMacroExpanderProvider(
[this]() -> Utils::MacroExpander * {
BaseQtVersion *version = currentVersion();
return version ? version->macroExpander() : 0;
});
}
int QtOptionsPageWidget::currentIndex() const
......
......@@ -46,12 +46,12 @@
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/jsexpander.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <utils/macroexpander.h>
#include <QtPlugin>
......@@ -114,7 +114,7 @@ static QString qmakeProperty(const char *propertyName)
void QtSupportPlugin::extensionsInitialized()
{
Utils::MacroExpander *expander = globalMacroExpander();
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable(kHostBins,
tr("Full path to the host bin directory of the current project's Qt version."),
......
......@@ -45,11 +45,11 @@
#include "textmarkregistry.h"
#include <coreplugin/icore.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/externaltoolmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/macroexpander.h>
#include <QtPlugin>
#include <QAction>
......@@ -147,7 +147,7 @@ void TextEditorPlugin::extensionsInitialized()
addAutoReleasedObject(new FindInCurrentFile);
addAutoReleasedObject(new FindInOpenFiles);
Utils::MacroExpander *expander = globalMacroExpander();
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable(kCurrentDocumentSelection,
tr("Selected text within the current document."),
......
......@@ -39,11 +39,13 @@
#include <coreplugin/iversioncontrol.h>