forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -49,6 +49,7 @@ public:
|
|||||||
QHash<QByteArray, MacroExpander::StringFunction> m_map;
|
QHash<QByteArray, MacroExpander::StringFunction> m_map;
|
||||||
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
|
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
|
||||||
QMap<QByteArray, QString> m_descriptions;
|
QMap<QByteArray, QString> m_descriptions;
|
||||||
|
QString m_displayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
@@ -320,4 +321,37 @@ QString MacroExpander::variableDescription(const QByteArray &variable)
|
|||||||
return d->m_descriptions.value(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
|
} // namespace Utils
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ public:
|
|||||||
QList<QByteArray> variables();
|
QList<QByteArray> variables();
|
||||||
QString variableDescription(const QByteArray &variable);
|
QString variableDescription(const QByteArray &variable);
|
||||||
|
|
||||||
|
QString displayName() const;
|
||||||
|
void setDisplayName(const QString &displayName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
|
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
|
||||||
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
|
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
|
||||||
@@ -77,6 +80,8 @@ private:
|
|||||||
Internal::MacroExpanderPrivate *d;
|
Internal::MacroExpanderPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT MacroExpander *globalMacroExpander();
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|
||||||
#endif // UTILS_MACROEXPANDER_H
|
#endif // UTILS_MACROEXPANDER_H
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
|||||||
formLayout->addRow(tr("Init commands:"), m_gdbInitCommandsTextEdit);
|
formLayout->addRow(tr("Init commands:"), m_gdbInitCommandsTextEdit);
|
||||||
formLayout->addRow(tr("Reset commands:"), m_gdbResetCommandsTextEdit);
|
formLayout->addRow(tr("Reset commands:"), m_gdbResetCommandsTextEdit);
|
||||||
|
|
||||||
VariableChooser::addVariableSupport(m_gdbResetCommandsTextEdit);
|
auto chooser = new VariableChooser(this);
|
||||||
VariableChooser::addVariableSupport(m_gdbInitCommandsTextEdit);
|
chooser->addSupportedWidget(m_gdbResetCommandsTextEdit);
|
||||||
(void)new VariableChooser(this);
|
chooser->addSupportedWidget(m_gdbInitCommandsTextEdit);
|
||||||
|
|
||||||
connect(m_gdbHostLineEdit, SIGNAL(editingFinished()), SLOT(hostnameChanged()));
|
connect(m_gdbHostLineEdit, SIGNAL(editingFinished()), SLOT(hostnameChanged()));
|
||||||
connect(m_gdbPortSpinBox, SIGNAL(valueChanged(int)), SLOT(portChanged()));
|
connect(m_gdbPortSpinBox, SIGNAL(valueChanged(int)), SLOT(portChanged()));
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ BareMetalDeviceConfigurationWizardSetupPage::BareMetalDeviceConfigurationWizardS
|
|||||||
connect(m_gdbResetCommandsTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
|
connect(m_gdbResetCommandsTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
|
||||||
connect(m_gdbInitCommandsPlainTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
|
connect(m_gdbInitCommandsPlainTextEdit, SIGNAL(textChanged()), SIGNAL(completeChanged()));
|
||||||
|
|
||||||
VariableChooser::addVariableSupport(m_gdbResetCommandsTextEdit);
|
auto chooser = new VariableChooser(this);
|
||||||
VariableChooser::addVariableSupport(m_gdbInitCommandsPlainTextEdit);
|
chooser->addSupportedWidget(m_gdbResetCommandsTextEdit);
|
||||||
(void)new VariableChooser(this);
|
chooser->addSupportedWidget(m_gdbInitCommandsPlainTextEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDeviceConfigurationWizardSetupPage::initializePage()
|
void BareMetalDeviceConfigurationWizardSetupPage::initializePage()
|
||||||
|
|||||||
@@ -64,7 +64,6 @@
|
|||||||
#include <coreplugin/infobar.h>
|
#include <coreplugin/infobar.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ SOURCES += corejsextensions.cpp \
|
|||||||
progressmanager/futureprogress.cpp \
|
progressmanager/futureprogress.cpp \
|
||||||
statusbarwidget.cpp \
|
statusbarwidget.cpp \
|
||||||
coreplugin.cpp \
|
coreplugin.cpp \
|
||||||
variablemanager.cpp \
|
|
||||||
modemanager.cpp \
|
modemanager.cpp \
|
||||||
basefilewizard.cpp \
|
basefilewizard.cpp \
|
||||||
basefilewizardfactory.cpp \
|
basefilewizardfactory.cpp \
|
||||||
@@ -165,7 +164,6 @@ HEADERS += corejsextensions.h \
|
|||||||
core_global.h \
|
core_global.h \
|
||||||
statusbarwidget.h \
|
statusbarwidget.h \
|
||||||
coreplugin.h \
|
coreplugin.h \
|
||||||
variablemanager.h \
|
|
||||||
modemanager.h \
|
modemanager.h \
|
||||||
basefilewizard.h \
|
basefilewizard.h \
|
||||||
basefilewizardfactory.h \
|
basefilewizardfactory.h \
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ QtcPlugin {
|
|||||||
"textdocument.cpp", "textdocument.h",
|
"textdocument.cpp", "textdocument.h",
|
||||||
"toolsettings.cpp", "toolsettings.h",
|
"toolsettings.cpp", "toolsettings.h",
|
||||||
"variablechooser.cpp", "variablechooser.h",
|
"variablechooser.cpp", "variablechooser.h",
|
||||||
"variablemanager.cpp", "variablemanager.h",
|
|
||||||
"vcsmanager.cpp", "vcsmanager.h",
|
"vcsmanager.cpp", "vcsmanager.h",
|
||||||
"versiondialog.cpp", "versiondialog.h",
|
"versiondialog.cpp", "versiondialog.h",
|
||||||
"windowsupport.cpp", "windowsupport.h"
|
"windowsupport.cpp", "windowsupport.h"
|
||||||
|
|||||||
@@ -33,13 +33,13 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/fancylineedit.h>
|
#include <utils/fancylineedit.h>
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/variablechooser.h>
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
@@ -410,10 +410,11 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
|||||||
connect(ui->toolTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
connect(ui->toolTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
this, SLOT(handleCurrentChanged(QModelIndex,QModelIndex)));
|
this, SLOT(handleCurrentChanged(QModelIndex,QModelIndex)));
|
||||||
|
|
||||||
Core::VariableChooser::addVariableSupport(ui->executable->lineEdit());
|
auto chooser = new VariableChooser(this);
|
||||||
Core::VariableChooser::addVariableSupport(ui->arguments);
|
chooser->addSupportedWidget(ui->executable->lineEdit());
|
||||||
Core::VariableChooser::addVariableSupport(ui->workingDirectory->lineEdit());
|
chooser->addSupportedWidget(ui->arguments);
|
||||||
Core::VariableChooser::addVariableSupport(ui->inputText);
|
chooser->addSupportedWidget(ui->workingDirectory->lineEdit());
|
||||||
|
chooser->addSupportedWidget(ui->inputText);
|
||||||
|
|
||||||
connect(ui->description, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
|
connect(ui->description, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
|
||||||
connect(ui->executable, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
|
connect(ui->executable, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
|
||||||
@@ -441,7 +442,6 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
|||||||
|
|
||||||
showInfoForItem(QModelIndex());
|
showInfoForItem(QModelIndex());
|
||||||
|
|
||||||
new VariableChooser(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalToolConfig::~ExternalToolConfig()
|
ExternalToolConfig::~ExternalToolConfig()
|
||||||
@@ -595,5 +595,5 @@ void ExternalToolConfig::addCategory()
|
|||||||
void ExternalToolConfig::updateEffectiveArguments()
|
void ExternalToolConfig::updateEffectiveArguments()
|
||||||
{
|
{
|
||||||
ui->arguments->setToolTip(Utils::QtcProcess::expandMacros(ui->arguments->text(),
|
ui->arguments->setToolTip(Utils::QtcProcess::expandMacros(ui->arguments->text(),
|
||||||
globalMacroExpander()));
|
Utils::globalMacroExpander()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,6 @@
|
|||||||
#include <coreplugin/outputpanemanager.h>
|
#include <coreplugin/outputpanemanager.h>
|
||||||
#include <coreplugin/rightpane.h>
|
#include <coreplugin/rightpane.h>
|
||||||
#include <coreplugin/settingsdatabase.h>
|
#include <coreplugin/settingsdatabase.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -67,6 +66,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
@@ -87,6 +87,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
enum { debugEditorManager=0 };
|
enum { debugEditorManager=0 };
|
||||||
|
|
||||||
static const char kCurrentDocumentPrefix[] = "CurrentDocument";
|
static const char kCurrentDocumentPrefix[] = "CurrentDocument";
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "actionmanager/actionmanager.h"
|
#include "actionmanager/actionmanager.h"
|
||||||
#include "actionmanager/actioncontainer.h"
|
#include "actionmanager/actioncontainer.h"
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "variablemanager.h"
|
|
||||||
|
|
||||||
#include <app/app_version.h>
|
#include <app/app_version.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -41,8 +40,10 @@
|
|||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#include "jsexpander.h"
|
#include "jsexpander.h"
|
||||||
|
|
||||||
#include "corejsextensions.h"
|
#include "corejsextensions.h"
|
||||||
#include "variablemanager.h"
|
|
||||||
|
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -90,7 +90,7 @@ QString JsExpander::evaluate(const QString &expression, QString *errorMessage)
|
|||||||
JsExpander::JsExpander()
|
JsExpander::JsExpander()
|
||||||
{
|
{
|
||||||
d = new Internal::JsExpanderPrivate;
|
d = new Internal::JsExpanderPrivate;
|
||||||
globalMacroExpander()->registerPrefix("JS",
|
Utils::globalMacroExpander()->registerPrefix("JS",
|
||||||
QCoreApplication::translate("Core::JsExpander",
|
QCoreApplication::translate("Core::JsExpander",
|
||||||
"Evaluate simple Javascript statements.\n"
|
"Evaluate simple Javascript statements.\n"
|
||||||
"The statements may not contain '{' nor '}' characters."),
|
"The statements may not contain '{' nor '}' characters."),
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ void ExecuteFilter::accept(LocatorFilterEntry selection) const
|
|||||||
p->m_commandHistory.prepend(value);
|
p->m_commandHistory.prepend(value);
|
||||||
|
|
||||||
bool found;
|
bool found;
|
||||||
QString workingDirectory = globalMacroExpander()->value("CurrentDocument:Path", &found);
|
QString workingDirectory = Utils::globalMacroExpander()->value("CurrentDocument:Path", &found);
|
||||||
if (!found || workingDirectory.isEmpty())
|
if (!found || workingDirectory.isEmpty())
|
||||||
workingDirectory = globalMacroExpander()->value("CurrentProject:Path", &found);
|
workingDirectory = Utils::globalMacroExpander()->value("CurrentProject:Path", &found);
|
||||||
|
|
||||||
ExecuteData d;
|
ExecuteData d;
|
||||||
d.workingDirectory = workingDirectory;
|
d.workingDirectory = workingDirectory;
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
#include "outputpanemanager.h"
|
#include "outputpanemanager.h"
|
||||||
#include "plugindialog.h"
|
#include "plugindialog.h"
|
||||||
#include "vcsmanager.h"
|
#include "vcsmanager.h"
|
||||||
#include "variablemanager.h"
|
|
||||||
#include "versiondialog.h"
|
#include "versiondialog.h"
|
||||||
#include "statusbarmanager.h"
|
#include "statusbarmanager.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|||||||
@@ -29,46 +29,153 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "variablechooser.h"
|
#include "variablechooser.h"
|
||||||
#include "variablemanager.h"
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
|
|
||||||
#include <utils/fancylineedit.h> // IconButton
|
#include <utils/fancylineedit.h> // IconButton
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/treemodel.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
#include <QHeaderView>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QListWidget>
|
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QTreeView>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
/*!
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
class VariableChooserPrivate : public QObject
|
class VariableChooserPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
public:
|
||||||
|
VariableChooserPrivate(VariableChooser *parent);
|
||||||
|
|
||||||
|
void createIconButton()
|
||||||
|
{
|
||||||
|
m_iconButton = new Utils::IconButton;
|
||||||
|
m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png")));
|
||||||
|
m_iconButton->setToolTip(tr("Insert variable"));
|
||||||
|
m_iconButton->hide();
|
||||||
|
connect(m_iconButton.data(), static_cast<void(QAbstractButton::*)(bool)>(&QAbstractButton::clicked),
|
||||||
|
this, &VariableChooserPrivate::updatePositionAndShow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateDescription(const QModelIndex &index);
|
||||||
|
void updateCurrentEditor(QWidget *old, QWidget *widget);
|
||||||
|
void handleItemActivated(const QModelIndex &index);
|
||||||
|
void insertVariable(const QString &variable);
|
||||||
|
void updatePositionAndShow(bool);
|
||||||
|
|
||||||
|
QWidget *currentWidget();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VariableChooserPrivate(VariableChooser *parent)
|
VariableChooser *q;
|
||||||
|
TreeModel m_model;
|
||||||
|
|
||||||
|
QPointer<QLineEdit> m_lineEdit;
|
||||||
|
QPointer<QTextEdit> m_textEdit;
|
||||||
|
QPointer<QPlainTextEdit> m_plainTextEdit;
|
||||||
|
QPointer<Utils::IconButton> m_iconButton;
|
||||||
|
|
||||||
|
QTreeView *m_variableTree;
|
||||||
|
QLabel *m_variableDescription;
|
||||||
|
QString m_defaultDescription;
|
||||||
|
QByteArray m_currentVariableName; // Prevent recursive insertion of currently expanded item
|
||||||
|
};
|
||||||
|
|
||||||
|
class VariableItem : public TreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VariableItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
QVariant data(int column, int role) const
|
||||||
|
{
|
||||||
|
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||||
|
if (column == 0)
|
||||||
|
return m_display;
|
||||||
|
}
|
||||||
|
if (role == Qt::ToolTipRole)
|
||||||
|
return m_description;
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString m_display;
|
||||||
|
QString m_description;
|
||||||
|
};
|
||||||
|
|
||||||
|
class VariableGroupItem : public TreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VariableGroupItem(VariableChooserPrivate *chooser)
|
||||||
|
: m_chooser(chooser), m_expander(0)
|
||||||
|
{
|
||||||
|
setLazy(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ensureExpander() const
|
||||||
|
{
|
||||||
|
if (!m_expander)
|
||||||
|
m_expander = m_provider();
|
||||||
|
return m_expander != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant data(int column, int role) const
|
||||||
|
{
|
||||||
|
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||||
|
if (column == 0 && ensureExpander())
|
||||||
|
return m_expander->displayName();
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
void populate()
|
||||||
|
{
|
||||||
|
if (ensureExpander()) {
|
||||||
|
foreach (const QByteArray &variable, m_expander->variables()) {
|
||||||
|
auto item = new VariableItem;
|
||||||
|
item->m_display = QString::fromLatin1(variable);
|
||||||
|
item->m_description = m_expander->variableDescription(variable);
|
||||||
|
if (variable == m_chooser->m_currentVariableName)
|
||||||
|
item->setFlags(Qt::ItemIsSelectable); // not ItemIsEnabled
|
||||||
|
appendChild(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
VariableChooserPrivate *m_chooser; // Not owned.
|
||||||
|
MacroExpanderProvider m_provider;
|
||||||
|
mutable MacroExpander *m_expander; // Not owned.
|
||||||
|
QString m_displayName;
|
||||||
|
};
|
||||||
|
|
||||||
|
VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
|
||||||
: q(parent),
|
: q(parent),
|
||||||
m_defaultDescription(tr("Select a variable to insert.")),
|
|
||||||
m_lineEdit(0),
|
m_lineEdit(0),
|
||||||
m_textEdit(0),
|
m_textEdit(0),
|
||||||
m_plainTextEdit(0)
|
m_plainTextEdit(0)
|
||||||
{
|
{
|
||||||
m_variableList = new QListWidget(q);
|
m_defaultDescription = VariableChooser::tr("Select a variable to insert.");
|
||||||
m_variableList->setAttribute(Qt::WA_MacSmallSize);
|
|
||||||
m_variableList->setAttribute(Qt::WA_MacShowFocusRect, false);
|
m_variableTree = new QTreeView(q);
|
||||||
foreach (const QByteArray &variable, globalMacroExpander()->variables())
|
m_variableTree->setAttribute(Qt::WA_MacSmallSize);
|
||||||
m_variableList->addItem(QString::fromLatin1(variable));
|
m_variableTree->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
m_variableTree->setModel(&m_model);
|
||||||
|
m_variableTree->header()->hide();
|
||||||
|
m_variableTree->header()->setStretchLastSection(true);
|
||||||
|
|
||||||
m_variableDescription = new QLabel(q);
|
m_variableDescription = new QLabel(q);
|
||||||
m_variableDescription->setText(m_defaultDescription);
|
m_variableDescription->setText(m_defaultDescription);
|
||||||
@@ -79,48 +186,20 @@ public:
|
|||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout(q);
|
QVBoxLayout *verticalLayout = new QVBoxLayout(q);
|
||||||
verticalLayout->setContentsMargins(3, 3, 3, 12);
|
verticalLayout->setContentsMargins(3, 3, 3, 12);
|
||||||
verticalLayout->addWidget(m_variableList);
|
verticalLayout->addWidget(m_variableTree);
|
||||||
verticalLayout->addWidget(m_variableDescription);
|
verticalLayout->addWidget(m_variableDescription);
|
||||||
|
|
||||||
connect(m_variableList, SIGNAL(currentTextChanged(QString)),
|
// connect(m_variableList, &QTreeView::currentChanged,
|
||||||
this, SLOT(updateDescription(QString)));
|
// this, &VariableChooserPrivate::updateDescription);
|
||||||
connect(m_variableList, SIGNAL(itemActivated(QListWidgetItem*)),
|
connect(m_variableTree, &QTreeView::clicked,
|
||||||
this, SLOT(handleItemActivated(QListWidgetItem*)));
|
this, &VariableChooserPrivate::updateDescription);
|
||||||
connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),
|
connect(m_variableTree, &QTreeView::activated,
|
||||||
this, SLOT(updateCurrentEditor(QWidget*,QWidget*)));
|
this, &VariableChooserPrivate::handleItemActivated);
|
||||||
|
connect(qobject_cast<QApplication *>(qApp), &QApplication::focusChanged,
|
||||||
|
this, &VariableChooserPrivate::updateCurrentEditor);
|
||||||
updateCurrentEditor(0, qApp->focusWidget());
|
updateCurrentEditor(0, qApp->focusWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
void createIconButton()
|
|
||||||
{
|
|
||||||
m_iconButton = new Utils::IconButton;
|
|
||||||
m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png")));
|
|
||||||
m_iconButton->setToolTip(tr("Insert variable"));
|
|
||||||
m_iconButton->hide();
|
|
||||||
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(updatePositionAndShow()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updateDescription(const QString &variable);
|
|
||||||
void updateCurrentEditor(QWidget *old, QWidget *widget);
|
|
||||||
void handleItemActivated(QListWidgetItem *item);
|
|
||||||
void insertVariable(const QString &variable);
|
|
||||||
void updatePositionAndShow();
|
|
||||||
|
|
||||||
public:
|
|
||||||
QWidget *currentWidget();
|
|
||||||
|
|
||||||
VariableChooser *q;
|
|
||||||
QString m_defaultDescription;
|
|
||||||
QPointer<QLineEdit> m_lineEdit;
|
|
||||||
QPointer<QTextEdit> m_textEdit;
|
|
||||||
QPointer<QPlainTextEdit> m_plainTextEdit;
|
|
||||||
QPointer<Utils::IconButton> m_iconButton;
|
|
||||||
|
|
||||||
QListWidget *m_variableList;
|
|
||||||
QLabel *m_variableDescription;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
@@ -140,8 +219,7 @@ using namespace Internal;
|
|||||||
*
|
*
|
||||||
* The variable chooser monitors focus changes of all children of its parent widget.
|
* The variable chooser monitors focus changes of all children of its parent widget.
|
||||||
* When a text control gets focus, the variable chooser checks if it has variable support set,
|
* When a text control gets focus, the variable chooser checks if it has variable support set,
|
||||||
* either through the addVariableSupport() function or by manually setting the
|
* either through the addVariableSupport() function. If the control supports variables,
|
||||||
* custom kVariableSupportProperty on the control. If the control supports variables,
|
|
||||||
* a tool button which opens the variable chooser is shown in it while it has focus.
|
* a tool button which opens the variable chooser is shown in it while it has focus.
|
||||||
*
|
*
|
||||||
* Supported text controls are QLineEdit, QTextEdit and QPlainTextEdit.
|
* Supported text controls are QLineEdit, QTextEdit and QPlainTextEdit.
|
||||||
@@ -159,13 +237,15 @@ using namespace Internal;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
* \internal
|
||||||
* \variable VariableChooser::kVariableSupportProperty
|
* \variable VariableChooser::kVariableSupportProperty
|
||||||
* Property name that is checked for deciding if a widget supports \QC variables.
|
* Property name that is checked for deciding if a widget supports \QC variables.
|
||||||
* Can be manually set with
|
* Can be manually set with
|
||||||
* \c{textcontrol->setProperty(VariableChooser::kVariableSupportProperty, true)}
|
* \c{textcontrol->setProperty(VariableChooser::kVariableSupportProperty, true)}
|
||||||
* \sa addVariableSupport()
|
* \sa addVariableSupport()
|
||||||
*/
|
*/
|
||||||
const char VariableChooser::kVariableSupportProperty[] = "QtCreator.VariableSupport";
|
const char kVariableSupportProperty[] = "QtCreator.VariableSupport";
|
||||||
|
const char kVariableNameProperty[] = "QtCreator.VariableName";
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Creates a variable chooser that tracks all children of \a parent for variable support.
|
* Creates a variable chooser that tracks all children of \a parent for variable support.
|
||||||
@@ -179,7 +259,8 @@ VariableChooser::VariableChooser(QWidget *parent) :
|
|||||||
setWindowTitle(tr("Variables"));
|
setWindowTitle(tr("Variables"));
|
||||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setFocusProxy(d->m_variableList);
|
setFocusProxy(d->m_variableTree);
|
||||||
|
addMacroExpanderProvider([]() { return globalMacroExpander(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -191,26 +272,30 @@ VariableChooser::~VariableChooser()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VariableChooser::addMacroExpanderProvider(const MacroExpanderProvider &provider)
|
||||||
|
{
|
||||||
|
auto *item = new VariableGroupItem(d);
|
||||||
|
item->m_provider = provider;
|
||||||
|
d->m_model.rootItem()->prependChild(item);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Marks the control as supporting variables.
|
* Marks the control as supporting variables.
|
||||||
* \sa kVariableSupportProperty
|
* \sa kVariableSupportProperty
|
||||||
*/
|
*/
|
||||||
void VariableChooser::addVariableSupport(QWidget *textcontrol)
|
void VariableChooser::addSupportedWidget(QWidget *textcontrol, const QByteArray &ownName)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(textcontrol, return);
|
QTC_ASSERT(textcontrol, return);
|
||||||
textcontrol->setProperty(kVariableSupportProperty, true);
|
textcontrol->setProperty(kVariableSupportProperty, QVariant::fromValue<QWidget *>(this));
|
||||||
|
textcontrol->setProperty(kVariableNameProperty, ownName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
void VariableChooserPrivate::updateDescription(const QString &variable)
|
void VariableChooserPrivate::updateDescription(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (variable.isNull())
|
m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString());
|
||||||
m_variableDescription->setText(m_defaultDescription);
|
|
||||||
else
|
|
||||||
m_variableDescription->setText(globalMacroExpander()->variableDescription(variable.toUtf8())
|
|
||||||
+ QLatin1String("<p>") + tr("Current Value: %1").arg(globalMacroExpander()->value(variable.toUtf8())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -236,15 +321,16 @@ void VariableChooserPrivate::updateCurrentEditor(QWidget *old, QWidget *widget)
|
|||||||
}
|
}
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
widget->installEventFilter(this); // for intercepting escape key presses
|
widget->installEventFilter(this); // for intercepting escape key presses
|
||||||
QLineEdit *previousLineEdit = m_lineEdit;
|
QLineEdit *previousLineEdit = m_lineEdit;
|
||||||
QWidget *previousWidget = currentWidget();
|
QWidget *previousWidget = currentWidget();
|
||||||
m_lineEdit = 0;
|
m_lineEdit = 0;
|
||||||
m_textEdit = 0;
|
m_textEdit = 0;
|
||||||
m_plainTextEdit = 0;
|
m_plainTextEdit = 0;
|
||||||
QVariant variablesSupportProperty = widget->property(VariableChooser::kVariableSupportProperty);
|
QWidget *chooser = widget->property(kVariableSupportProperty).value<QWidget *>();
|
||||||
bool supportsVariables = (variablesSupportProperty.isValid()
|
m_currentVariableName = widget->property(kVariableNameProperty).value<QByteArray>();
|
||||||
? variablesSupportProperty.toBool() : false);
|
bool supportsVariables = chooser == q;
|
||||||
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget))
|
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget))
|
||||||
m_lineEdit = (supportsVariables ? lineEdit : 0);
|
m_lineEdit = (supportsVariables ? lineEdit : 0);
|
||||||
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(widget))
|
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(widget))
|
||||||
@@ -283,7 +369,7 @@ void VariableChooserPrivate::updateCurrentEditor(QWidget *old, QWidget *widget)
|
|||||||
/*!
|
/*!
|
||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
void VariableChooserPrivate::updatePositionAndShow()
|
void VariableChooserPrivate::updatePositionAndShow(bool)
|
||||||
{
|
{
|
||||||
if (QWidget *w = q->parentWidget()) {
|
if (QWidget *w = q->parentWidget()) {
|
||||||
QPoint parentCenter = w->mapToGlobal(w->geometry().center());
|
QPoint parentCenter = w->mapToGlobal(w->geometry().center());
|
||||||
@@ -309,10 +395,9 @@ QWidget *VariableChooserPrivate::currentWidget()
|
|||||||
/*!
|
/*!
|
||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
void VariableChooserPrivate::handleItemActivated(QListWidgetItem *item)
|
void VariableChooserPrivate::handleItemActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (item)
|
insertVariable(m_model.data(index, Qt::DisplayRole).toString());
|
||||||
insertVariable(item->text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -320,7 +405,7 @@ void VariableChooserPrivate::handleItemActivated(QListWidgetItem *item)
|
|||||||
*/
|
*/
|
||||||
void VariableChooserPrivate::insertVariable(const QString &variable)
|
void VariableChooserPrivate::insertVariable(const QString &variable)
|
||||||
{
|
{
|
||||||
const QString &text = QLatin1String("%{") + variable + QLatin1Char('}');
|
const QString text = QLatin1String("%{") + variable + QLatin1Char('}');
|
||||||
if (m_lineEdit) {
|
if (m_lineEdit) {
|
||||||
m_lineEdit->insert(text);
|
m_lineEdit->insert(text);
|
||||||
m_lineEdit->activateWindow();
|
m_lineEdit->activateWindow();
|
||||||
@@ -367,5 +452,3 @@ bool VariableChooser::eventFilter(QObject *, QEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
#include "variablechooser.moc"
|
|
||||||
|
|||||||
@@ -35,10 +35,16 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace Utils { class MacroExpander; }
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
namespace Internal { class VariableChooserPrivate; }
|
namespace Internal { class VariableChooserPrivate; }
|
||||||
|
|
||||||
|
typedef std::function<Utils::MacroExpander *()> MacroExpanderProvider;
|
||||||
|
|
||||||
class CORE_EXPORT VariableChooser : public QWidget
|
class CORE_EXPORT VariableChooser : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -47,8 +53,8 @@ public:
|
|||||||
explicit VariableChooser(QWidget *parent = 0);
|
explicit VariableChooser(QWidget *parent = 0);
|
||||||
~VariableChooser();
|
~VariableChooser();
|
||||||
|
|
||||||
static const char kVariableSupportProperty[];
|
void addMacroExpanderProvider(const MacroExpanderProvider &provider);
|
||||||
static void addVariableSupport(QWidget *textcontrol);
|
void addSupportedWidget(QWidget *textcontrol, const QByteArray &ownName = QByteArray());
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *ke);
|
void keyPressEvent(QKeyEvent *ke);
|
||||||
|
|||||||
@@ -51,12 +51,12 @@
|
|||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/jsexpander.h>
|
#include <coreplugin/jsexpander.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -191,7 +191,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
mcpptools->addAction(command);
|
mcpptools->addAction(command);
|
||||||
connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit()));
|
connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit()));
|
||||||
|
|
||||||
Utils::MacroExpander *expander = globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
expander->registerVariable("Cpp:LicenseTemplate",
|
expander->registerVariable("Cpp:LicenseTemplate",
|
||||||
tr("The license template."),
|
tr("The license template."),
|
||||||
[this]() { return CppToolsPlugin::licenseTemplate(); });
|
[this]() { return CppToolsPlugin::licenseTemplate(); });
|
||||||
|
|||||||
@@ -60,9 +60,10 @@
|
|||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <utils/savedaction.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/fileinprojectfinder.h>
|
#include <utils/fileinprojectfinder.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
#include <qmljs/consolemanagerinterface.h>
|
||||||
|
|
||||||
@@ -178,7 +179,7 @@ public:
|
|||||||
connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
|
connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
|
||||||
SLOT(reloadDisassembly()));
|
SLOT(reloadDisassembly()));
|
||||||
|
|
||||||
globalMacroExpander()->registerFileVariables(PrefixDebugExecutable,
|
Utils::globalMacroExpander()->registerFileVariables(PrefixDebugExecutable,
|
||||||
tr("Debugged executable"),
|
tr("Debugged executable"),
|
||||||
[this]() { return m_startParameters.executable; });
|
[this]() { return m_startParameters.executable; });
|
||||||
}
|
}
|
||||||
@@ -1835,7 +1836,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
|
|||||||
SourcePathRegExpMap globalRegExpSourceMap;
|
SourcePathRegExpMap globalRegExpSourceMap;
|
||||||
globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size());
|
globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size());
|
||||||
foreach (auto entry, options->sourcePathRegExpMap) {
|
foreach (auto entry, options->sourcePathRegExpMap) {
|
||||||
const QString expanded = globalMacroExpander()->expandedString(entry.second);
|
const QString expanded = Utils::globalMacroExpander()->expandedString(entry.second);
|
||||||
if (!expanded.isEmpty())
|
if (!expanded.isEmpty())
|
||||||
globalRegExpSourceMap.push_back(qMakePair(entry.first, expanded));
|
globalRegExpSourceMap.push_back(qMakePair(entry.first, expanded));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "debuggerstartparameters.h"
|
#include "debuggerstartparameters.h"
|
||||||
#include "breakpoint.h" // For BreakpointModelId.
|
#include "breakpoint.h" // For BreakpointModelId.
|
||||||
#include "threaddata.h" // For ThreadId.
|
#include "threaddata.h" // For ThreadId.
|
||||||
#include "coreplugin/variablemanager.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
|
|||||||
m_sourceLineEdit(new QLineEdit(this)),
|
m_sourceLineEdit(new QLineEdit(this)),
|
||||||
m_targetChooser(new PathChooser(this))
|
m_targetChooser(new PathChooser(this))
|
||||||
{
|
{
|
||||||
(void)new Core::VariableChooser(this);
|
|
||||||
setTitle(tr("Source Paths Mapping"));
|
setTitle(tr("Source Paths Mapping"));
|
||||||
setToolTip(tr("<html><head/><body><p>Mappings of source file folders to "
|
setToolTip(tr("<html><head/><body><p>Mappings of source file folders to "
|
||||||
"be used in the debugger can be entered here.</p>"
|
"be used in the debugger can be entered here.</p>"
|
||||||
@@ -275,7 +274,9 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
|
|||||||
editTargetLabel->setBuddy(m_targetChooser);
|
editTargetLabel->setBuddy(m_targetChooser);
|
||||||
m_targetChooser->setToolTip(targetToolTip);
|
m_targetChooser->setToolTip(targetToolTip);
|
||||||
editLayout->addRow(editTargetLabel, m_targetChooser);
|
editLayout->addRow(editTargetLabel, m_targetChooser);
|
||||||
Core::VariableChooser::addVariableSupport(m_targetChooser->lineEdit());
|
|
||||||
|
auto chooser = new Core::VariableChooser(this);
|
||||||
|
chooser->addSupportedWidget(m_targetChooser->lineEdit());
|
||||||
|
|
||||||
// Main layout
|
// Main layout
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
|||||||
@@ -69,8 +69,10 @@
|
|||||||
#include <projectexplorer/itaskhandler.h>
|
#include <projectexplorer/itaskhandler.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ public:
|
|||||||
GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
(void) new VariableChooser(this);
|
|
||||||
|
|
||||||
auto groupBoxGeneral = new QGroupBox(this);
|
auto groupBoxGeneral = new QGroupBox(this);
|
||||||
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));
|
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));
|
||||||
|
|
||||||
@@ -233,10 +231,11 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
"Matching regular expression: "));
|
"Matching regular expression: "));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VariableChooser::addVariableSupport(textEditCustomDumperCommands);
|
auto chooser = new VariableChooser(this);
|
||||||
VariableChooser::addVariableSupport(textEditPostAttachCommands);
|
chooser->addSupportedWidget(textEditCustomDumperCommands);
|
||||||
VariableChooser::addVariableSupport(textEditStartupCommands);
|
chooser->addSupportedWidget(textEditPostAttachCommands);
|
||||||
VariableChooser::addVariableSupport(pathChooserExtraDumperFile->lineEdit());
|
chooser->addSupportedWidget(textEditStartupCommands);
|
||||||
|
chooser->addSupportedWidget(pathChooserExtraDumperFile->lineEdit());
|
||||||
|
|
||||||
auto formLayout = new QFormLayout(groupBoxGeneral);
|
auto formLayout = new QFormLayout(groupBoxGeneral);
|
||||||
formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
|
formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
|
||||||
|
|||||||
@@ -897,7 +897,7 @@ QModelIndex WatchModel::parent(const QModelIndex &idx) const
|
|||||||
if (!grandparent)
|
if (!grandparent)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
const WatchItems &uncles = grandparent->children;
|
const auto &uncles = grandparent->children;
|
||||||
for (int i = 0, n = uncles.size(); i < n; ++i)
|
for (int i = 0, n = uncles.size(); i < n; ++i)
|
||||||
if (uncles.at(i) == parent)
|
if (uncles.at(i) == parent)
|
||||||
return createIndex(i, 0, (void*) parent);
|
return createIndex(i, 0, (void*) parent);
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtparser.h>
|
#include <qtsupport/qtparser.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
#include <qmakeprojectmanager/qmakenodes.h>
|
#include <qmakeprojectmanager/qmakenodes.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtparser.h>
|
#include <qtsupport/qtparser.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtparser.h>
|
#include <qtsupport/qtparser.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
#include "projectmacroexpander.h"
|
#include "projectmacroexpander.h"
|
||||||
|
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <projectexplorer/buildenvironmentwidget.h>
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
#include "jsonwizard.h"
|
#include "jsonwizard.h"
|
||||||
|
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@@ -59,7 +58,7 @@ bool JsonWizardExpander::resolveMacro(const QString &name, QString *ret)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Core::globalMacroExpander()->resolveMacro(name, ret);
|
return Utils::globalMacroExpander()->resolveMacro(name, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -32,8 +32,9 @@
|
|||||||
|
|
||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ bool FallBackMacroExpander::resolveMacro(const QString &name, QString *ret)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool found;
|
bool found;
|
||||||
*ret = Core::globalMacroExpander()->value(name.toUtf8(), &found);
|
*ret = Utils::globalMacroExpander()->value(name.toUtf8(), &found);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
|
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ bool ProcessStep::init()
|
|||||||
if (!bc)
|
if (!bc)
|
||||||
bc = target()->activeBuildConfiguration();
|
bc = target()->activeBuildConfiguration();
|
||||||
ProcessParameters *pp = processParameters();
|
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->setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
|
||||||
pp->setWorkingDirectory(workingDirectory());
|
pp->setWorkingDirectory(workingDirectory());
|
||||||
pp->setCommand(m_command);
|
pp->setCommand(m_command);
|
||||||
@@ -272,7 +272,7 @@ void ProcessStepConfigWidget::updateDetails()
|
|||||||
BuildConfiguration *bc = m_step->buildConfiguration();
|
BuildConfiguration *bc = m_step->buildConfiguration();
|
||||||
if (!bc) // iff the step is actually in the deploy list
|
if (!bc) // iff the step is actually in the deploy list
|
||||||
bc = m_step->target()->activeBuildConfiguration();
|
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.setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
|
||||||
|
|
||||||
param.setWorkingDirectory(m_step->workingDirectory());
|
param.setWorkingDirectory(m_step->workingDirectory());
|
||||||
|
|||||||
@@ -117,12 +117,13 @@
|
|||||||
#include <coreplugin/findplaceholder.h>
|
#include <coreplugin/findplaceholder.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/fileutils.h>
|
#include <coreplugin/fileutils.h>
|
||||||
#include <coreplugin/removefiledialog.h>
|
#include <coreplugin/removefiledialog.h>
|
||||||
#include <texteditor/findinfiles.h>
|
#include <texteditor/findinfiles.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -1135,7 +1136,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
updateWelcomePage();
|
updateWelcomePage();
|
||||||
|
|
||||||
Utils::MacroExpander *expander = globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||||
tr("Current project's main file"),
|
tr("Current project's main file"),
|
||||||
[this]() -> QString {
|
[this]() -> QString {
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
|
|||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
new Core::VariableChooser(this);
|
|
||||||
Core::VariableChooser::addVariableSupport(m_ui.buildDirectoryEdit);
|
|
||||||
setJomVisible(Utils::HostOsInfo::isWindowsHost());
|
setJomVisible(Utils::HostOsInfo::isWindowsHost());
|
||||||
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
|
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
|
||||||
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
|
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
|
||||||
@@ -58,6 +56,9 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
|
|||||||
this, SLOT(slotDirectoryButtonGroupChanged()));
|
this, SLOT(slotDirectoryButtonGroupChanged()));
|
||||||
connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetDefaultBuildDirectory()));
|
connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetDefaultBuildDirectory()));
|
||||||
connect(m_ui.buildDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(updateResetButton()));
|
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)
|
void ProjectExplorerSettingsWidget::setJomVisible(bool v)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -99,7 +99,7 @@ bool ProjectMacroExpander::resolveMacro(const QString &name, QString *ret)
|
|||||||
{
|
{
|
||||||
bool found = resolveProjectMacro(name, ret);
|
bool found = resolveProjectMacro(name, ret);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
QString result = Core::globalMacroExpander()->value(name.toUtf8(), &found);
|
QString result = Utils::globalMacroExpander()->value(name.toUtf8(), &found);
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = result;
|
*ret = result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,6 +250,9 @@ void BaseQtVersion::setupExpander()
|
|||||||
// m_expander.registerVariable("Qt:name",
|
// m_expander.registerVariable("Qt:name",
|
||||||
// QCoreApplication::translate("QtSupport::QtKitInformation", "The display name of the current Qt version."),
|
// QCoreApplication::translate("QtSupport::QtKitInformation", "The display name of the current Qt version."),
|
||||||
// [this]() { return displayName(); });
|
// [this]() { return displayName(); });
|
||||||
|
|
||||||
|
m_expander.setDisplayName(
|
||||||
|
QCoreApplication::translate("QtSupport::QtKitInformation", "Qt version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseQtVersion::~BaseQtVersion()
|
BaseQtVersion::~BaseQtVersion()
|
||||||
@@ -606,7 +609,8 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
|
|||||||
|
|
||||||
QString BaseQtVersion::displayName() const
|
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
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
@@ -192,6 +193,14 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
|
|||||||
|
|
||||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
|
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
|
||||||
this, SLOT(toolChainsUpdated()));
|
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
|
int QtOptionsPageWidget::currentIndex() const
|
||||||
|
|||||||
@@ -46,12 +46,12 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/jsexpander.h>
|
#include <coreplugin/jsexpander.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ static QString qmakeProperty(const char *propertyName)
|
|||||||
|
|
||||||
void QtSupportPlugin::extensionsInitialized()
|
void QtSupportPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
Utils::MacroExpander *expander = globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
|
|
||||||
expander->registerVariable(kHostBins,
|
expander->registerVariable(kHostBins,
|
||||||
tr("Full path to the host bin directory of the current project's Qt version."),
|
tr("Full path to the host bin directory of the current project's Qt version."),
|
||||||
|
|||||||
@@ -45,11 +45,11 @@
|
|||||||
#include "textmarkregistry.h"
|
#include "textmarkregistry.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/externaltoolmanager.h>
|
#include <coreplugin/externaltoolmanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -147,7 +147,7 @@ void TextEditorPlugin::extensionsInitialized()
|
|||||||
addAutoReleasedObject(new FindInCurrentFile);
|
addAutoReleasedObject(new FindInCurrentFile);
|
||||||
addAutoReleasedObject(new FindInOpenFiles);
|
addAutoReleasedObject(new FindInOpenFiles);
|
||||||
|
|
||||||
Utils::MacroExpander *expander = globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
|
|
||||||
expander->registerVariable(kCurrentDocumentSelection,
|
expander->registerVariable(kCurrentDocumentSelection,
|
||||||
tr("Selected text within the current document."),
|
tr("Selected text within the current document."),
|
||||||
|
|||||||
@@ -39,11 +39,13 @@
|
|||||||
|
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -87,7 +89,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
this, SLOT(slotSettingsChanged()));
|
this, SLOT(slotSettingsChanged()));
|
||||||
slotSettingsChanged();
|
slotSettingsChanged();
|
||||||
|
|
||||||
Utils::MacroExpander *expander = globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
expander->registerVariable(Constants::VAR_VCS_NAME,
|
expander->registerVariable(Constants::VAR_VCS_NAME,
|
||||||
tr("Name of the version control system in use by the current project."),
|
tr("Name of the version control system in use by the current project."),
|
||||||
[]() -> QString {
|
[]() -> QString {
|
||||||
|
|||||||
Reference in New Issue
Block a user