forked from qt-creator/qt-creator
MacroExpander: Fall back to global expander
... and use that all over the place. Change-Id: Ie6e0ed0f0d9eaba9b4466761e6b455f33a905086 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -221,9 +221,17 @@ QString MacroExpander::value(const QByteArray &variable, bool *found)
|
||||
* \sa MacroExpander
|
||||
* \sa macroExpander()
|
||||
*/
|
||||
QString MacroExpander::expandedString(const QString &stringWithVariables)
|
||||
QString MacroExpander::expand(const QString &stringWithVariables)
|
||||
{
|
||||
return Utils::expandMacros(stringWithVariables, this);
|
||||
QString res = Utils::expandMacros(stringWithVariables, this);
|
||||
if (this != globalMacroExpander())
|
||||
res = Utils::expandMacros(res, this);
|
||||
return res;
|
||||
}
|
||||
|
||||
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables)
|
||||
{
|
||||
return expand(QString::fromLatin1(stringWithVariables)).toLatin1();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -49,7 +49,8 @@ public:
|
||||
|
||||
QString value(const QByteArray &variable, bool *found = 0);
|
||||
|
||||
QString expandedString(const QString &stringWithVariables);
|
||||
QString expand(const QString &stringWithVariables);
|
||||
QByteArray expand(const QByteArray &stringWithVariables);
|
||||
|
||||
typedef std::function<QString(QString)> PrefixFunction;
|
||||
typedef std::function<QString()> StringFunction;
|
||||
|
||||
@@ -186,7 +186,7 @@ QString CMakeProject::shadowBuildDirectory(const QString &projectFilePath, const
|
||||
const QString projectName = QFileInfo(info.absolutePath()).fileName();
|
||||
ProjectExplorer::ProjectMacroExpander expander(projectFilePath, projectName, k, bcName);
|
||||
QDir projectDir = QDir(projectDirectory(Utils::FileName::fromString(projectFilePath)).toString());
|
||||
QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ QString CMakeRunConfiguration::workingDirectory() const
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return QString());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
macroExpander()->expand(baseWorkingDirectory())));
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::baseWorkingDirectory() const
|
||||
|
||||
@@ -556,8 +556,8 @@ bool ExternalToolRunner::resolve()
|
||||
{ // executable
|
||||
QStringList expandedExecutables; /* for error message */
|
||||
foreach (const QString &executable, m_tool->executables()) {
|
||||
QString expanded = expander->expandedString(executable);
|
||||
expandedExecutables << expanded;
|
||||
QString expanded = expander->expand(executable);
|
||||
expandedExecutables.append(expanded);
|
||||
m_resolvedExecutable = Environment::systemEnvironment().searchInPath(expanded);
|
||||
if (!m_resolvedExecutable.isEmpty())
|
||||
break;
|
||||
@@ -575,15 +575,11 @@ bool ExternalToolRunner::resolve()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{ // arguments
|
||||
|
||||
m_resolvedArguments = QtcProcess::expandMacros(m_tool->arguments(), expander);
|
||||
}
|
||||
{ // input
|
||||
m_resolvedInput = expander->expandedString(m_tool->input());
|
||||
}
|
||||
{ // working directory
|
||||
m_resolvedWorkingDirectory = expander->expandedString(m_tool->workingDirectory());
|
||||
}
|
||||
m_resolvedInput = expander->expand(m_tool->input());
|
||||
m_resolvedWorkingDirectory = expander->expand(m_tool->workingDirectory());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1836,7 +1836,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
|
||||
SourcePathRegExpMap globalRegExpSourceMap;
|
||||
globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size());
|
||||
foreach (auto entry, options->sourcePathRegExpMap) {
|
||||
const QString expanded = Utils::globalMacroExpander()->expandedString(entry.second);
|
||||
const QString expanded = Utils::globalMacroExpander()->expand(entry.second);
|
||||
if (!expanded.isEmpty())
|
||||
globalRegExpSourceMap.push_back(qMakePair(entry.first, expanded));
|
||||
}
|
||||
|
||||
@@ -3334,7 +3334,7 @@ bool boolSetting(int code)
|
||||
QString stringSetting(int code)
|
||||
{
|
||||
QString raw = theDebuggerCore->m_debuggerSettings->item(code)->value().toString();
|
||||
return globalMacroExpander()->expandedString(raw);
|
||||
return globalMacroExpander()->expand(raw);
|
||||
}
|
||||
|
||||
QStringList stringListSetting(int code)
|
||||
|
||||
@@ -4404,9 +4404,8 @@ void GdbEngine::abortDebugger()
|
||||
void GdbEngine::resetInferior()
|
||||
{
|
||||
if (!startParameters().commandsForReset.isEmpty()) {
|
||||
QByteArray substitutedCommands = globalMacroExpander()->expandedString(
|
||||
QString::fromLatin1(startParameters().commandsForReset)).toLatin1();
|
||||
foreach (QByteArray command, substitutedCommands.split('\n')) {
|
||||
QByteArray commands = globalMacroExpander()->expand(startParameters().commandsForReset);
|
||||
foreach (QByteArray command, commands.split('\n')) {
|
||||
command = command.trimmed();
|
||||
if (!command.isEmpty()) {
|
||||
if (state() == InferiorStopOk) {
|
||||
@@ -4455,8 +4454,8 @@ void GdbEngine::handleInferiorPrepared()
|
||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||
|
||||
if (!sp.commandsAfterConnect.isEmpty()) {
|
||||
QByteArray substitutedCommands = globalMacroExpander()->expandedString(QString::fromLatin1(sp.commandsAfterConnect)).toLatin1();
|
||||
foreach (QByteArray command, substitutedCommands.split('\n')) {
|
||||
QByteArray commands = globalMacroExpander()->expand(sp.commandsAfterConnect);
|
||||
foreach (QByteArray command, commands.split('\n')) {
|
||||
postCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -155,7 +155,7 @@ QList<NamedWidget *> BuildConfiguration::createSubConfigWidgets()
|
||||
return QList<NamedWidget *>() << new BuildEnvironmentWidget(this);
|
||||
}
|
||||
|
||||
Utils::AbstractMacroExpander *BuildConfiguration::macroExpander()
|
||||
Utils::MacroExpander *BuildConfiguration::macroExpander()
|
||||
{
|
||||
if (!m_macroExpander)
|
||||
m_macroExpander = new Internal::BuildConfigMacroExpander(this);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace Utils { class AbstractMacroExpander; }
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
virtual bool isEnabled() const;
|
||||
virtual QString disabledReason() const;
|
||||
|
||||
Utils::AbstractMacroExpander *macroExpander();
|
||||
Utils::MacroExpander *macroExpander();
|
||||
|
||||
enum BuildType {
|
||||
Unknown,
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
bool m_clearSystemEnvironment;
|
||||
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
|
||||
QList<BuildStepList *> m_stepLists;
|
||||
Utils::AbstractMacroExpander *m_macroExpander;
|
||||
Utils::MacroExpander *m_macroExpander;
|
||||
Utils::FileName m_buildDirectory;
|
||||
Utils::FileName m_lastEmmitedBuildDirectory;
|
||||
mutable Utils::Environment m_cachedEnvironment;
|
||||
|
||||
@@ -53,15 +53,16 @@
|
||||
#include <QVariantMap>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
static const char NAME_KEY[] = "name";
|
||||
static const char DISPLAY_NAME_KEY[] = "trDisplayName";
|
||||
static const char MANDATORY_KEY[] = "mandatory";
|
||||
static const char VISIBLE_KEY[] = "visible";
|
||||
static const char ENABLED_KEY[] = "enabled";
|
||||
static const char SPAN_KEY[] = "span";
|
||||
static const char TYPE_KEY[] = "type";
|
||||
static const char DATA_KEY[] = "data";
|
||||
using namespace Utils;
|
||||
|
||||
const char NAME_KEY[] = "name";
|
||||
const char DISPLAY_NAME_KEY[] = "trDisplayName";
|
||||
const char MANDATORY_KEY[] = "mandatory";
|
||||
const char VISIBLE_KEY[] = "visible";
|
||||
const char ENABLED_KEY[] = "enabled";
|
||||
const char SPAN_KEY[] = "span";
|
||||
const char TYPE_KEY[] = "type";
|
||||
const char DATA_KEY[] = "data";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -158,13 +159,13 @@ void JsonFieldPage::Field::createWidget(JsonFieldPage *page)
|
||||
setup(page, name);
|
||||
}
|
||||
|
||||
void JsonFieldPage::Field::adjustState(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::Field::adjustState(MacroExpander *expander)
|
||||
{
|
||||
setVisible(JsonWizard::boolFromVariant(m_visibleExpression, expander));
|
||||
setEnabled(JsonWizard::boolFromVariant(m_enabledExpression, expander));
|
||||
}
|
||||
|
||||
void JsonFieldPage::Field::initialize(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::Field::initialize(MacroExpander *expander)
|
||||
{
|
||||
adjustState(expander);
|
||||
initializeData(expander);
|
||||
@@ -326,16 +327,16 @@ void JsonFieldPage::LineEditField::setup(JsonFieldPage *page, const QString &nam
|
||||
connect(w, &QLineEdit::textChanged, page, [page](QString) { page->completeChanged(); });
|
||||
}
|
||||
|
||||
bool JsonFieldPage::LineEditField::validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
bool JsonFieldPage::LineEditField::validate(MacroExpander *expander, QString *message)
|
||||
{
|
||||
Q_UNUSED(message);
|
||||
QLineEdit *w = static_cast<QLineEdit *>(m_widget);
|
||||
|
||||
if (!m_isModified) {
|
||||
w->setText(Utils::expandMacros(m_defaultText, expander));
|
||||
w->setText(expander->expand(m_defaultText));
|
||||
} else if (!w->isEnabled() && !m_disabledText.isNull() && m_currentText.isNull()) {
|
||||
m_currentText = w->text();
|
||||
w->setText(Utils::expandMacros(m_disabledText, expander));
|
||||
w->setText(expander->expand(m_disabledText));
|
||||
} else if (w->isEnabled() && !m_currentText.isNull()) {
|
||||
w->setText(m_currentText);
|
||||
m_currentText.clear();
|
||||
@@ -345,14 +346,14 @@ bool JsonFieldPage::LineEditField::validate(Utils::AbstractMacroExpander *expand
|
||||
return !w->text().isEmpty();
|
||||
}
|
||||
|
||||
void JsonFieldPage::LineEditField::initializeData(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::LineEditField::initializeData(MacroExpander *expander)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
|
||||
m_isModified = false;
|
||||
|
||||
QLineEdit *w = static_cast<QLineEdit *>(m_widget);
|
||||
w->setText(Utils::expandMacros(m_defaultText, expander));
|
||||
w->setText(expander->expand(m_defaultText));
|
||||
w->setPlaceholderText(m_placeholderText);
|
||||
}
|
||||
|
||||
@@ -403,7 +404,7 @@ void JsonFieldPage::TextEditField::setup(JsonFieldPage *page, const QString &nam
|
||||
connect(w, &QTextEdit::textChanged, page, &QWizardPage::completeChanged);
|
||||
}
|
||||
|
||||
bool JsonFieldPage::TextEditField::validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
bool JsonFieldPage::TextEditField::validate(MacroExpander *expander, QString *message)
|
||||
{
|
||||
Q_UNUSED(expander);
|
||||
Q_UNUSED(message);
|
||||
@@ -412,7 +413,7 @@ bool JsonFieldPage::TextEditField::validate(Utils::AbstractMacroExpander *expand
|
||||
|
||||
if (!w->isEnabled() && !m_disabledText.isNull() && m_currentText.isNull()) {
|
||||
m_currentText = w->toHtml();
|
||||
w->setPlainText(Utils::expandMacros(m_disabledText, expander));
|
||||
w->setPlainText(expander->expand(m_disabledText));
|
||||
} else if (w->isEnabled() && !m_currentText.isNull()) {
|
||||
w->setText(m_currentText);
|
||||
m_currentText.clear();
|
||||
@@ -421,10 +422,10 @@ bool JsonFieldPage::TextEditField::validate(Utils::AbstractMacroExpander *expand
|
||||
return !w->toPlainText().isEmpty();
|
||||
}
|
||||
|
||||
void JsonFieldPage::TextEditField::initializeData(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::TextEditField::initializeData(MacroExpander *expander)
|
||||
{
|
||||
QTextEdit *w = static_cast<QTextEdit *>(m_widget);
|
||||
w->setPlainText(Utils::expandMacros(m_defaultText, expander));
|
||||
w->setPlainText(expander->expand(m_defaultText));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -432,7 +433,7 @@ void JsonFieldPage::TextEditField::initializeData(Utils::AbstractMacroExpander *
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
JsonFieldPage::PathChooserField::PathChooserField() :
|
||||
m_kind(Utils::PathChooser::ExistingDirectory)
|
||||
m_kind(PathChooser::ExistingDirectory)
|
||||
{ }
|
||||
|
||||
bool JsonFieldPage::PathChooserField::parseData(const QVariant &data, QString *errorMessage)
|
||||
@@ -453,19 +454,19 @@ bool JsonFieldPage::PathChooserField::parseData(const QVariant &data, QString *e
|
||||
|
||||
QString kindStr = tmp.value(QLatin1String("kind"), QLatin1String("existingDirectory")).toString();
|
||||
if (kindStr == QLatin1String("existingDirectory")) {
|
||||
m_kind = Utils::PathChooser::ExistingDirectory;
|
||||
m_kind = PathChooser::ExistingDirectory;
|
||||
} else if (kindStr == QLatin1String("directory")) {
|
||||
m_kind = Utils::PathChooser::Directory;
|
||||
m_kind = PathChooser::Directory;
|
||||
} else if (kindStr == QLatin1String("file")) {
|
||||
m_kind = Utils::PathChooser::File;
|
||||
m_kind = PathChooser::File;
|
||||
} else if (kindStr == QLatin1String("saveFile")) {
|
||||
m_kind = Utils::PathChooser::SaveFile;
|
||||
m_kind = PathChooser::SaveFile;
|
||||
} else if (kindStr == QLatin1String("existingCommand")) {
|
||||
m_kind = Utils::PathChooser::ExistingCommand;
|
||||
m_kind = PathChooser::ExistingCommand;
|
||||
} else if (kindStr == QLatin1String("command")) {
|
||||
m_kind = Utils::PathChooser::Command;
|
||||
m_kind = PathChooser::Command;
|
||||
} else if (kindStr == QLatin1String("any")) {
|
||||
m_kind = Utils::PathChooser::Any;
|
||||
m_kind = PathChooser::Any;
|
||||
} else {
|
||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
|
||||
"kind '%1' is not one of the supported 'existingDirectory', "
|
||||
@@ -482,41 +483,41 @@ QWidget *JsonFieldPage::PathChooserField::widget(const QString &displayName)
|
||||
{
|
||||
Q_UNUSED(displayName);
|
||||
QTC_ASSERT(!m_widget, return m_widget);
|
||||
m_widget = new Utils::PathChooser;
|
||||
m_widget = new PathChooser;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void JsonFieldPage::PathChooserField::setEnabled(bool e)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
Utils::PathChooser *w = static_cast<Utils::PathChooser *>(m_widget);
|
||||
PathChooser *w = static_cast<PathChooser *>(m_widget);
|
||||
w->setReadOnly(!e);
|
||||
}
|
||||
|
||||
void JsonFieldPage::PathChooserField::setup(JsonFieldPage *page, const QString &name)
|
||||
{
|
||||
Utils::PathChooser *w = static_cast<Utils::PathChooser *>(m_widget);
|
||||
PathChooser *w = static_cast<PathChooser *>(m_widget);
|
||||
page->registerFieldWithName(name, w, "path", SIGNAL(changed(QString)));
|
||||
connect(w, &Utils::PathChooser::changed, page, [page](QString) { page->completeChanged(); });
|
||||
connect(w, &PathChooser::changed, page, [page](QString) { page->completeChanged(); });
|
||||
}
|
||||
|
||||
bool JsonFieldPage::PathChooserField::validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
bool JsonFieldPage::PathChooserField::validate(MacroExpander *expander, QString *message)
|
||||
{
|
||||
Q_UNUSED(expander);
|
||||
Q_UNUSED(message);
|
||||
Utils::PathChooser *w = static_cast<Utils::PathChooser *>(m_widget);
|
||||
PathChooser *w = static_cast<PathChooser *>(m_widget);
|
||||
return w->isValid();
|
||||
}
|
||||
|
||||
void JsonFieldPage::PathChooserField::initializeData(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::PathChooserField::initializeData(MacroExpander *expander)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
Utils::PathChooser *w = static_cast<Utils::PathChooser *>(m_widget);
|
||||
w->setBaseDirectory(Utils::expandMacros(m_basePath, expander));
|
||||
PathChooser *w = static_cast<PathChooser *>(m_widget);
|
||||
w->setBaseDirectory(expander->expand(m_basePath));
|
||||
w->setExpectedKind(m_kind);
|
||||
|
||||
if (m_currentPath.isNull())
|
||||
w->setPath(Utils::expandMacros(m_path, expander));
|
||||
w->setPath(expander->expand(m_path));
|
||||
else
|
||||
w->setPath(m_currentPath);
|
||||
}
|
||||
@@ -559,35 +560,35 @@ bool JsonFieldPage::CheckBoxField::parseData(const QVariant &data, QString *erro
|
||||
QWidget *JsonFieldPage::CheckBoxField::widget(const QString &displayName)
|
||||
{
|
||||
QTC_ASSERT(!m_widget, return m_widget);
|
||||
Utils::TextFieldCheckBox *w = new Utils::TextFieldCheckBox(displayName);
|
||||
TextFieldCheckBox *w = new TextFieldCheckBox(displayName);
|
||||
m_widget = w;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void JsonFieldPage::CheckBoxField::setup(JsonFieldPage *page, const QString &name)
|
||||
{
|
||||
Utils::TextFieldCheckBox *w = static_cast<Utils::TextFieldCheckBox *>(m_widget);
|
||||
connect(w, &Utils::TextFieldCheckBox::clicked, [this]() { m_isModified = true; });
|
||||
TextFieldCheckBox *w = static_cast<TextFieldCheckBox *>(m_widget);
|
||||
connect(w, &TextFieldCheckBox::clicked, [this]() { m_isModified = true; });
|
||||
page->registerFieldWithName(name, w, "text", SIGNAL(textChanged(QString)));
|
||||
}
|
||||
|
||||
bool JsonFieldPage::CheckBoxField::validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
bool JsonFieldPage::CheckBoxField::validate(MacroExpander *expander, QString *message)
|
||||
{
|
||||
Q_UNUSED(message);
|
||||
if (!m_isModified) {
|
||||
Utils::TextFieldCheckBox *w = static_cast<Utils::TextFieldCheckBox *>(m_widget);
|
||||
TextFieldCheckBox *w = static_cast<TextFieldCheckBox *>(m_widget);
|
||||
w->setChecked(JsonWizard::boolFromVariant(m_checkedExpression, expander));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void JsonFieldPage::CheckBoxField::initializeData(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::CheckBoxField::initializeData(MacroExpander *expander)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
|
||||
Utils::TextFieldCheckBox *w = static_cast<Utils::TextFieldCheckBox *>(m_widget);
|
||||
w->setTrueText(Utils::expandMacros(m_checkedValue, expander));
|
||||
w->setFalseText(Utils::expandMacros(m_uncheckedValue, expander));
|
||||
TextFieldCheckBox *w = static_cast<TextFieldCheckBox *>(m_widget);
|
||||
w->setTrueText(expander->expand(m_checkedValue));
|
||||
w->setFalseText(expander->expand(m_uncheckedValue));
|
||||
|
||||
w->setChecked(JsonWizard::boolFromVariant(m_checkedExpression, expander));
|
||||
}
|
||||
@@ -675,23 +676,23 @@ QWidget *JsonFieldPage::ComboBoxField::widget(const QString &displayName)
|
||||
{
|
||||
Q_UNUSED(displayName);
|
||||
QTC_ASSERT(!m_widget, return m_widget);
|
||||
m_widget = new Utils::TextFieldComboBox;
|
||||
m_widget = new TextFieldComboBox;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void JsonFieldPage::ComboBoxField::setup(JsonFieldPage *page, const QString &name)
|
||||
{
|
||||
Utils::TextFieldComboBox *w = static_cast<Utils::TextFieldComboBox *>(m_widget);
|
||||
TextFieldComboBox *w = static_cast<TextFieldComboBox *>(m_widget);
|
||||
page->registerFieldWithName(name, w, "text", SIGNAL(text4Changed(QString)));
|
||||
connect(w, &Utils::TextFieldComboBox::text4Changed, page, [page](QString) { page->completeChanged(); });
|
||||
connect(w, &TextFieldComboBox::text4Changed, page, [page](QString) { page->completeChanged(); });
|
||||
}
|
||||
|
||||
bool JsonFieldPage::ComboBoxField::validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
bool JsonFieldPage::ComboBoxField::validate(MacroExpander *expander, QString *message)
|
||||
{
|
||||
Q_UNUSED(expander);
|
||||
Q_UNUSED(message);
|
||||
|
||||
Utils::TextFieldComboBox *w = static_cast<Utils::TextFieldComboBox *>(m_widget);
|
||||
TextFieldComboBox *w = static_cast<TextFieldComboBox *>(m_widget);
|
||||
if (!w->isEnabled() && m_disabledIndex >= 0 && m_savedIndex < 0) {
|
||||
m_savedIndex = w->currentIndex();
|
||||
w->setCurrentIndex(m_disabledIndex);
|
||||
@@ -703,15 +704,15 @@ bool JsonFieldPage::ComboBoxField::validate(Utils::AbstractMacroExpander *expand
|
||||
return true;
|
||||
}
|
||||
|
||||
void JsonFieldPage::ComboBoxField::initializeData(Utils::AbstractMacroExpander *expander)
|
||||
void JsonFieldPage::ComboBoxField::initializeData(MacroExpander *expander)
|
||||
{
|
||||
Utils::TextFieldComboBox *w = static_cast<Utils::TextFieldComboBox *>(m_widget);
|
||||
TextFieldComboBox *w = static_cast<TextFieldComboBox *>(m_widget);
|
||||
QStringList tmpItems
|
||||
= Utils::transform(m_itemList,
|
||||
[expander](const QString &i) { return Utils::expandMacros(i, expander); });
|
||||
[expander](const QString &i) { return expander->expand(i); });
|
||||
QStringList tmpData
|
||||
= Utils::transform(m_itemDataList,
|
||||
[expander](const QString &i) { return Utils::expandMacros(i, expander); });
|
||||
[expander](const QString &i) { return expander->expand(i); });
|
||||
w->setItems(tmpItems, tmpData);
|
||||
w->setInsertPolicy(QComboBox::NoInsert);
|
||||
|
||||
@@ -725,8 +726,8 @@ void JsonFieldPage::ComboBoxField::initializeData(Utils::AbstractMacroExpander *
|
||||
// JsonFieldPage:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
JsonFieldPage::JsonFieldPage(Utils::AbstractMacroExpander *expander, QWidget *parent) :
|
||||
Utils::WizardPage(parent),
|
||||
JsonFieldPage::JsonFieldPage(MacroExpander *expander, QWidget *parent) :
|
||||
WizardPage(parent),
|
||||
m_formLayout(new QFormLayout),
|
||||
m_errorLabel(new QLabel),
|
||||
m_expander(expander)
|
||||
@@ -812,7 +813,7 @@ void JsonFieldPage::clearError() const
|
||||
m_errorLabel->setVisible(false);
|
||||
}
|
||||
|
||||
Utils::AbstractMacroExpander *JsonFieldPage::expander()
|
||||
MacroExpander *JsonFieldPage::expander()
|
||||
{
|
||||
return m_expander;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class QTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class AbstractMacroExpander;
|
||||
class MacroExpander;
|
||||
class TextFieldCheckBox;
|
||||
class TextFieldComboBox;
|
||||
} // namespace Utils
|
||||
@@ -67,15 +67,15 @@ public:
|
||||
static Field *parse(const QVariant &input, QString *errorMessage);
|
||||
void createWidget(JsonFieldPage *page);
|
||||
|
||||
void adjustState(Utils::AbstractMacroExpander *expander);
|
||||
void adjustState(Utils::MacroExpander *expander);
|
||||
virtual void setEnabled(bool e) { m_widget->setEnabled(e); }
|
||||
void setVisible(bool v) { m_widget->setVisible(v); }
|
||||
|
||||
virtual bool validate(Utils::AbstractMacroExpander *expander, QString *message)
|
||||
virtual bool validate(Utils::MacroExpander *expander, QString *message)
|
||||
{ Q_UNUSED(expander); Q_UNUSED(message); return true; }
|
||||
|
||||
void initialize(Utils::AbstractMacroExpander *expander);
|
||||
virtual void cleanup(Utils::AbstractMacroExpander *expander) { Q_UNUSED(expander); }
|
||||
void initialize(Utils::MacroExpander *expander);
|
||||
virtual void cleanup(Utils::MacroExpander *expander) { Q_UNUSED(expander); }
|
||||
|
||||
virtual bool suppressName() const { return false; }
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
QVariant m_enabledExpression;
|
||||
|
||||
virtual bool parseData(const QVariant &data, QString *errorMessage) = 0;
|
||||
virtual void initializeData(Utils::AbstractMacroExpander *expander) { Q_UNUSED(expander); }
|
||||
virtual void initializeData(Utils::MacroExpander *expander) { Q_UNUSED(expander); }
|
||||
virtual QWidget *widget(const QString &displayName) = 0;
|
||||
virtual void setup(JsonFieldPage *page, const QString &name)
|
||||
{ Q_UNUSED(page); Q_UNUSED(name); }
|
||||
@@ -136,8 +136,8 @@ public:
|
||||
|
||||
void setup(JsonFieldPage *page, const QString &name);
|
||||
|
||||
bool validate(Utils::AbstractMacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::AbstractMacroExpander *expander);
|
||||
bool validate(Utils::MacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::MacroExpander *expander);
|
||||
|
||||
QString m_placeholderText;
|
||||
QString m_defaultText;
|
||||
@@ -159,8 +159,8 @@ public:
|
||||
|
||||
void setup(JsonFieldPage *page, const QString &name);
|
||||
|
||||
bool validate(Utils::AbstractMacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::AbstractMacroExpander *expander);
|
||||
bool validate(Utils::MacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::MacroExpander *expander);
|
||||
|
||||
QString m_defaultText;
|
||||
bool m_acceptRichText;
|
||||
@@ -182,8 +182,8 @@ public:
|
||||
|
||||
void setup(JsonFieldPage *page, const QString &name);
|
||||
|
||||
bool validate(Utils::AbstractMacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::AbstractMacroExpander *expander);
|
||||
bool validate(Utils::MacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::MacroExpander *expander);
|
||||
|
||||
QString m_path;
|
||||
QString m_basePath;
|
||||
@@ -206,8 +206,8 @@ public:
|
||||
|
||||
void setup(JsonFieldPage *page, const QString &name);
|
||||
|
||||
bool validate(Utils::AbstractMacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::AbstractMacroExpander *expander);
|
||||
bool validate(Utils::MacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::MacroExpander *expander);
|
||||
|
||||
QString m_checkedValue;
|
||||
QString m_uncheckedValue;
|
||||
@@ -228,8 +228,8 @@ public:
|
||||
|
||||
void setup(JsonFieldPage *page, const QString &name);
|
||||
|
||||
bool validate(Utils::AbstractMacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::AbstractMacroExpander *expander);
|
||||
bool validate(Utils::MacroExpander *expander, QString *message);
|
||||
void initializeData(Utils::MacroExpander *expander);
|
||||
|
||||
QStringList m_itemList;
|
||||
QStringList m_itemDataList;
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
int m_currentIndex;
|
||||
};
|
||||
|
||||
JsonFieldPage(Utils::AbstractMacroExpander *expander, QWidget *parent = 0);
|
||||
JsonFieldPage(Utils::MacroExpander *expander, QWidget *parent = 0);
|
||||
~JsonFieldPage();
|
||||
|
||||
bool setup(const QVariant &data);
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
void showError(const QString &m) const;
|
||||
void clearError() const;
|
||||
|
||||
Utils::AbstractMacroExpander *expander();
|
||||
Utils::MacroExpander *expander();
|
||||
|
||||
private:
|
||||
QFormLayout *m_formLayout;
|
||||
@@ -262,7 +262,7 @@ private:
|
||||
|
||||
QList<Field *> m_fields;
|
||||
|
||||
Utils::AbstractMacroExpander *m_expander;
|
||||
Utils::MacroExpander *m_expander;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -61,7 +61,7 @@ void JsonWizard::addGenerator(JsonWizardGenerator *gen)
|
||||
m_generators.append(gen);
|
||||
}
|
||||
|
||||
Utils::AbstractMacroExpander *JsonWizard::expander() const
|
||||
Utils::MacroExpander *JsonWizard::expander() const
|
||||
{
|
||||
return m_expander;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ QVariant JsonWizard::value(const QString &n) const
|
||||
QVariant v = property(n.toUtf8());
|
||||
if (v.isValid()) {
|
||||
if (v.type() == QVariant::String)
|
||||
return Utils::expandMacros(v.toString(), m_expander);
|
||||
return m_expander->expand(v.toString());
|
||||
else
|
||||
return v;
|
||||
}
|
||||
@@ -128,10 +128,10 @@ void JsonWizard::setValue(const QString &key, const QVariant &value)
|
||||
setProperty(key.toUtf8(), value);
|
||||
}
|
||||
|
||||
bool JsonWizard::boolFromVariant(const QVariant &v, Utils::AbstractMacroExpander *expander)
|
||||
bool JsonWizard::boolFromVariant(const QVariant &v, Utils::MacroExpander *expander)
|
||||
{
|
||||
if (v.type() == QVariant::String)
|
||||
return !Utils::expandMacros(v.toString(), expander).isEmpty();
|
||||
return !expander->expand(v.toString()).isEmpty();
|
||||
return v.toBool();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <utils/wizard.h>
|
||||
|
||||
namespace Utils { class AbstractMacroExpander; }
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void addGenerator(JsonWizardGenerator *gen);
|
||||
|
||||
Utils::AbstractMacroExpander *expander() const;
|
||||
Utils::MacroExpander *expander() const;
|
||||
|
||||
void resetFileList();
|
||||
GeneratorFiles fileList();
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
QVariant value(const QString &n) const;
|
||||
void setValue(const QString &key, const QVariant &value);
|
||||
|
||||
static bool boolFromVariant(const QVariant &v, Utils::AbstractMacroExpander *expander);
|
||||
static bool boolFromVariant(const QVariant &v, Utils::MacroExpander *expander);
|
||||
|
||||
void removeAttributeFromAllFiles(Core::GeneratedFile::Attribute a);
|
||||
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#ifndef JSONWIZARDEXPANDER_H
|
||||
#define JSONWIZARDEXPANDER_H
|
||||
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QString>
|
||||
#include <utils/macroexpander.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -42,7 +40,7 @@ class JsonWizard;
|
||||
namespace Internal {
|
||||
|
||||
// Documentation inside.
|
||||
class JsonWizardExpander : public Utils::AbstractMacroExpander
|
||||
class JsonWizardExpander : public Utils::MacroExpander
|
||||
{
|
||||
public:
|
||||
explicit JsonWizardExpander(JsonWizard *wizard);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/macroexpander.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@@ -48,7 +48,7 @@
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
static QString processTextFileContents(Utils::AbstractMacroExpander *expander,
|
||||
static QString processTextFileContents(Utils::MacroExpander *expander,
|
||||
const QString &input, QString *errorMessage)
|
||||
{
|
||||
errorMessage->clear();
|
||||
@@ -57,7 +57,7 @@ static QString processTextFileContents(Utils::AbstractMacroExpander *expander,
|
||||
return input;
|
||||
|
||||
QString tmp;
|
||||
if (!customWizardPreprocess(Utils::expandMacros(input, expander), &tmp, errorMessage))
|
||||
if (!customWizardPreprocess(expander->expand(input), &tmp, errorMessage))
|
||||
return QString();
|
||||
|
||||
// Expand \n, \t and handle line continuation:
|
||||
@@ -124,7 +124,7 @@ bool JsonWizardFileGenerator::setup(const QVariant &data, QString *errorMessage)
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::GeneratedFiles JsonWizardFileGenerator::fileList(Utils::AbstractMacroExpander *expander,
|
||||
Core::GeneratedFiles JsonWizardFileGenerator::fileList(Utils::MacroExpander *expander,
|
||||
const QString &wizardDir, const QString &projectDir,
|
||||
QString *errorMessage)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ Core::GeneratedFiles JsonWizardFileGenerator::fileList(Utils::AbstractMacroExpan
|
||||
continue;
|
||||
|
||||
// Read contents of source file
|
||||
const QString src = wizard.absoluteFilePath(Utils::expandMacros(f.source, expander));
|
||||
const QString src = wizard.absoluteFilePath(expander->expand(f.source));
|
||||
const QFile::OpenMode openMode
|
||||
= JsonWizard::boolFromVariant(f.isBinary, expander)
|
||||
? QIODevice::ReadOnly : (QIODevice::ReadOnly|QIODevice::Text);
|
||||
@@ -151,7 +151,7 @@ Core::GeneratedFiles JsonWizardFileGenerator::fileList(Utils::AbstractMacroExpan
|
||||
|
||||
// Generate file information:
|
||||
Core::GeneratedFile gf;
|
||||
gf.setPath(project.absoluteFilePath(Utils::expandMacros(f.target, expander)));
|
||||
gf.setPath(project.absoluteFilePath(expander->expand(f.target)));
|
||||
|
||||
if (JsonWizard::boolFromVariant(f.isBinary, expander)) {
|
||||
gf.setBinary(true);
|
||||
|
||||
@@ -44,7 +44,7 @@ class JsonWizardFileGenerator : public JsonWizardGenerator
|
||||
public:
|
||||
bool setup(const QVariant &data, QString *errorMessage);
|
||||
|
||||
Core::GeneratedFiles fileList(Utils::AbstractMacroExpander *expander,
|
||||
Core::GeneratedFiles fileList(Utils::MacroExpander *expander,
|
||||
const QString &wizardDir, const QString &projectDir,
|
||||
QString *errorMessage);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
namespace Utils { class AbstractMacroExpander; }
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -49,7 +49,7 @@ class JsonWizardGenerator
|
||||
public:
|
||||
virtual ~JsonWizardGenerator() { }
|
||||
|
||||
virtual Core::GeneratedFiles fileList(Utils::AbstractMacroExpander *expander,
|
||||
virtual Core::GeneratedFiles fileList(Utils::MacroExpander *expander,
|
||||
const QString &baseDir, const QString &projectDir,
|
||||
QString *errorMessage) = 0;
|
||||
virtual bool formatFile(const JsonWizard *wizard, Core::GeneratedFile *file, QString *errorMessage);
|
||||
|
||||
@@ -300,7 +300,7 @@ QString Kit::unexpandedDisplayName() const
|
||||
|
||||
QString Kit::displayName() const
|
||||
{
|
||||
return Utils::expandMacros(d->m_unexpandedDisplayName, &d->m_macroExpander);
|
||||
return d->m_macroExpander.expand(d->m_unexpandedDisplayName);
|
||||
}
|
||||
|
||||
static QString candidateName(const QString &name, const QString &postfix)
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -43,7 +42,7 @@
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class FallBackMacroExpander : public Utils::AbstractMacroExpander
|
||||
class FallBackMacroExpander : public Utils::MacroExpander
|
||||
{
|
||||
public:
|
||||
explicit FallBackMacroExpander(const Target *target) : m_target(target) {}
|
||||
@@ -58,9 +57,7 @@ bool FallBackMacroExpander::resolveMacro(const QString &name, QString *ret)
|
||||
*ret = m_target->project()->projectDirectory().toUserOutput();
|
||||
return true;
|
||||
}
|
||||
bool found;
|
||||
*ret = Utils::globalMacroExpander()->value(name.toUtf8(), &found);
|
||||
return found;
|
||||
return false;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
@@ -84,7 +81,7 @@ void LocalApplicationRunConfiguration::addToBaseEnvironment(Utils::Environment &
|
||||
Q_UNUSED(env);
|
||||
}
|
||||
|
||||
Utils::AbstractMacroExpander *LocalApplicationRunConfiguration::macroExpander() const
|
||||
Utils::MacroExpander *LocalApplicationRunConfiguration::macroExpander() const
|
||||
{
|
||||
if (BuildConfiguration *bc = activeBuildConfiguration())
|
||||
return bc->macroExpander();
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "applicationlauncher.h"
|
||||
|
||||
namespace Utils {
|
||||
class AbstractMacroExpander;
|
||||
class MacroExpander;
|
||||
class Environment;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ protected:
|
||||
explicit LocalApplicationRunConfiguration(Target *target, Core::Id id);
|
||||
explicit LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
|
||||
|
||||
Utils::AbstractMacroExpander *macroExpander() const;
|
||||
Utils::MacroExpander *macroExpander() const;
|
||||
|
||||
private:
|
||||
mutable Utils::AbstractMacroExpander *m_macroExpander;
|
||||
mutable Utils::MacroExpander *m_macroExpander;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "processparameters.h"
|
||||
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
@@ -97,7 +97,7 @@ void ProcessParameters::setWorkingDirectory(const QString &workingDirectory)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ProjectExplorer::ProcessParameters::setMacroExpander(Utils::AbstractMacroExpander *mx)
|
||||
\fn void ProjectExplorer::ProcessParameters::setMacroExpander(Utils::MacroExpander *mx)
|
||||
Sets the macro expander \a mx to use on the command, arguments, and working
|
||||
dir.
|
||||
|
||||
@@ -113,7 +113,7 @@ QString ProcessParameters::effectiveWorkingDirectory() const
|
||||
if (m_effectiveWorkingDirectory.isEmpty()) {
|
||||
QString wds = m_workingDirectory;
|
||||
if (m_macroExpander)
|
||||
Utils::expandMacros(&wds, m_macroExpander);
|
||||
wds = m_macroExpander->expand(wds);
|
||||
m_effectiveWorkingDirectory = QDir::cleanPath(m_environment.expandVariables(wds));
|
||||
}
|
||||
return m_effectiveWorkingDirectory;
|
||||
@@ -128,7 +128,7 @@ QString ProcessParameters::effectiveCommand() const
|
||||
if (m_effectiveCommand.isEmpty()) {
|
||||
QString cmd = m_command;
|
||||
if (m_macroExpander)
|
||||
Utils::expandMacros(&cmd, m_macroExpander);
|
||||
cmd = m_macroExpander->expand(cmd);
|
||||
m_effectiveCommand =
|
||||
m_environment.searchInPath(cmd, QStringList(effectiveWorkingDirectory())).toString();
|
||||
m_commandMissing = m_effectiveCommand.isEmpty();
|
||||
@@ -153,7 +153,7 @@ QString ProcessParameters::effectiveArguments() const
|
||||
if (m_effectiveArguments.isEmpty()) {
|
||||
m_effectiveArguments = m_arguments;
|
||||
if (m_macroExpander)
|
||||
Utils::expandMacros(&m_effectiveArguments, m_macroExpander);
|
||||
m_effectiveArguments = m_macroExpander->expand(m_effectiveArguments);
|
||||
}
|
||||
return m_effectiveArguments;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ QString ProcessParameters::prettyCommand() const
|
||||
{
|
||||
QString cmd = m_command;
|
||||
if (m_macroExpander)
|
||||
Utils::expandMacros(&cmd, m_macroExpander);
|
||||
cmd = m_macroExpander->expand(cmd);
|
||||
return QFileInfo(cmd).fileName();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
namespace Utils { class AbstractMacroExpander; }
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
void setEnvironment(const Utils::Environment &env) { m_environment = env; }
|
||||
Utils::Environment environment() const { return m_environment; }
|
||||
|
||||
void setMacroExpander(Utils::AbstractMacroExpander *mx) { m_macroExpander = mx; }
|
||||
Utils::AbstractMacroExpander *macroExpander() const { return m_macroExpander; }
|
||||
void setMacroExpander(Utils::MacroExpander *mx) { m_macroExpander = mx; }
|
||||
Utils::MacroExpander *macroExpander() const { return m_macroExpander; }
|
||||
|
||||
/// Get the fully expanded working directory:
|
||||
QString effectiveWorkingDirectory() const;
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
QString m_command;
|
||||
QString m_arguments;
|
||||
Utils::Environment m_environment;
|
||||
Utils::AbstractMacroExpander *m_macroExpander;
|
||||
Utils::MacroExpander *m_macroExpander;
|
||||
|
||||
mutable QString m_effectiveWorkingDirectory;
|
||||
mutable QString m_effectiveCommand;
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
#define PROJECTMACROEXPANDER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Kit;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::AbstractMacroExpander
|
||||
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander
|
||||
{
|
||||
public:
|
||||
ProjectMacroExpander(const QString &projectFilePath, const QString &projectName, const Kit *k, const QString &bcName);
|
||||
|
||||
@@ -372,7 +372,7 @@ Utils::FileName QbsProject::defaultBuildDirectory(const QString &projectFilePath
|
||||
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
||||
ProjectExplorer::ProjectMacroExpander expander(projectFilePath, projectName, k, bcName);
|
||||
QString projectDir = projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
|
||||
QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ QString QbsRunConfiguration::workingDirectory() const
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
macroExpander()->expand(baseWorkingDirectory())));
|
||||
}
|
||||
|
||||
QString QbsRunConfiguration::baseWorkingDirectory() const
|
||||
|
||||
@@ -479,7 +479,7 @@ QString DesktopQmakeRunConfiguration::workingDirectory() const
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
macroExpander()->expand(baseWorkingDirectory())));
|
||||
}
|
||||
|
||||
QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const
|
||||
|
||||
@@ -1455,7 +1455,7 @@ QString QmakeProject::shadowBuildDirectory(const QString &proFilePath, const Kit
|
||||
const QString projectName = QFileInfo(proFilePath).completeBaseName();
|
||||
ProjectExplorer::ProjectMacroExpander expander(proFilePath, projectName, k, suffix);
|
||||
QString projectDir = projectDirectory(Utils::FileName::fromString(proFilePath)).toString();
|
||||
QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return Utils::FileUtils::resolvePath(projectDir, buildPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -609,8 +609,7 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
|
||||
|
||||
QString BaseQtVersion::displayName() const
|
||||
{
|
||||
QString ret = Utils::expandMacros(m_unexpandedDisplayName, &m_expander);
|
||||
return Utils::expandMacros(ret, Utils::globalMacroExpander());
|
||||
return m_expander.expand(m_unexpandedDisplayName);
|
||||
}
|
||||
|
||||
QString BaseQtVersion::unexpandedDisplayName() const
|
||||
|
||||
@@ -200,7 +200,7 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
if (aspect)
|
||||
env = aspect->environment();
|
||||
const Utils::FileName exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()),
|
||||
const Utils::FileName exec = env.searchInPath(macroExpander()->expand(m_executable),
|
||||
QStringList(workingDirectory()));
|
||||
if (exec.isEmpty()) {
|
||||
if (errorMessage)
|
||||
@@ -240,7 +240,7 @@ QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
macroExpander()->expand(baseWorkingDirectory())));
|
||||
}
|
||||
|
||||
QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
|
||||
|
||||
Reference in New Issue
Block a user