forked from qt-creator/qt-creator
Make variable manager static.
This makes it follow our preferred singleton pattern. Change-Id: I230e5ac5ef7f156da7123f7efe3a49bcb6a20669 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -610,5 +610,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(),
|
||||||
Core::VariableManager::instance()->macroExpander()));
|
Core::VariableManager::macroExpander()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,13 +465,12 @@ void EditorManager::init()
|
|||||||
d->m_openEditorsFactory = new OpenEditorsViewFactory();
|
d->m_openEditorsFactory = new OpenEditorsViewFactory();
|
||||||
ExtensionSystem::PluginManager::addObject(d->m_openEditorsFactory);
|
ExtensionSystem::PluginManager::addObject(d->m_openEditorsFactory);
|
||||||
|
|
||||||
VariableManager *vm = VariableManager::instance();
|
VariableManager::registerFileVariables(kCurrentDocumentPrefix, tr("Current document"));
|
||||||
vm->registerFileVariables(kCurrentDocumentPrefix, tr("Current document"));
|
VariableManager::registerVariable(kCurrentDocumentXPos,
|
||||||
vm->registerVariable(kCurrentDocumentXPos,
|
|
||||||
tr("X-coordinate of the current editor's upper left corner, relative to screen."));
|
tr("X-coordinate of the current editor's upper left corner, relative to screen."));
|
||||||
vm->registerVariable(kCurrentDocumentYPos,
|
VariableManager::registerVariable(kCurrentDocumentYPos,
|
||||||
tr("Y-coordinate of the current editor's upper left corner, relative to screen."));
|
tr("Y-coordinate of the current editor's upper left corner, relative to screen."));
|
||||||
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
|
connect(VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||||
this, SLOT(updateVariable(QByteArray)));
|
this, SLOT(updateVariable(QByteArray)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2293,21 +2292,21 @@ void EditorManager::updateVariable(const QByteArray &variable)
|
|||||||
if (curEditor) {
|
if (curEditor) {
|
||||||
QString fileName = curEditor->document()->fileName();
|
QString fileName = curEditor->document()->fileName();
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
value = VariableManager::instance()->fileVariableValue(variable, kCurrentDocumentPrefix,
|
value = VariableManager::fileVariableValue(variable, kCurrentDocumentPrefix,
|
||||||
fileName);
|
fileName);
|
||||||
}
|
}
|
||||||
VariableManager::instance()->insert(variable, value);
|
VariableManager::insert(variable, value);
|
||||||
} else if (variable == kCurrentDocumentXPos) {
|
} else if (variable == kCurrentDocumentXPos) {
|
||||||
QString value;
|
QString value;
|
||||||
IEditor *curEditor = currentEditor();
|
IEditor *curEditor = currentEditor();
|
||||||
if (curEditor)
|
if (curEditor)
|
||||||
value = QString::number(curEditor->widget()->mapToGlobal(QPoint(0,0)).x());
|
value = QString::number(curEditor->widget()->mapToGlobal(QPoint(0,0)).x());
|
||||||
VariableManager::instance()->insert(variable, value);
|
VariableManager::insert(variable, value);
|
||||||
} else if (variable == kCurrentDocumentYPos) {
|
} else if (variable == kCurrentDocumentYPos) {
|
||||||
QString value;
|
QString value;
|
||||||
IEditor *curEditor = currentEditor();
|
IEditor *curEditor = currentEditor();
|
||||||
if (curEditor)
|
if (curEditor)
|
||||||
value = QString::number(curEditor->widget()->mapToGlobal(QPoint(0,0)).y());
|
value = QString::number(curEditor->widget()->mapToGlobal(QPoint(0,0)).y());
|
||||||
VariableManager::instance()->insert(variable, value);
|
VariableManager::insert(variable, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ bool ExternalToolRunner::resolve()
|
|||||||
QStringList expandedExecutables; /* for error message */
|
QStringList expandedExecutables; /* for error message */
|
||||||
foreach (const QString &executable, m_tool->executables()) {
|
foreach (const QString &executable, m_tool->executables()) {
|
||||||
QString expanded = Utils::expandMacros(executable,
|
QString expanded = Utils::expandMacros(executable,
|
||||||
Core::VariableManager::instance()->macroExpander());
|
Core::VariableManager::macroExpander());
|
||||||
expandedExecutables << expanded;
|
expandedExecutables << expanded;
|
||||||
m_resolvedExecutable =
|
m_resolvedExecutable =
|
||||||
Utils::Environment::systemEnvironment().searchInPath(expanded);
|
Utils::Environment::systemEnvironment().searchInPath(expanded);
|
||||||
@@ -577,15 +577,15 @@ bool ExternalToolRunner::resolve()
|
|||||||
}
|
}
|
||||||
{ // arguments
|
{ // arguments
|
||||||
m_resolvedArguments = Utils::QtcProcess::expandMacros(m_tool->arguments(),
|
m_resolvedArguments = Utils::QtcProcess::expandMacros(m_tool->arguments(),
|
||||||
Core::VariableManager::instance()->macroExpander());
|
Core::VariableManager::macroExpander());
|
||||||
}
|
}
|
||||||
{ // input
|
{ // input
|
||||||
m_resolvedInput = Utils::expandMacros(m_tool->input(),
|
m_resolvedInput = Utils::expandMacros(m_tool->input(),
|
||||||
Core::VariableManager::instance()->macroExpander());
|
Core::VariableManager::macroExpander());
|
||||||
}
|
}
|
||||||
{ // working directory
|
{ // working directory
|
||||||
m_resolvedWorkingDirectory = Utils::expandMacros(m_tool->workingDirectory(),
|
m_resolvedWorkingDirectory = Utils::expandMacros(m_tool->workingDirectory(),
|
||||||
Core::VariableManager::instance()->macroExpander());
|
Core::VariableManager::macroExpander());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
static EditorManager *editorManager();
|
static EditorManager *editorManager();
|
||||||
static ProgressManager *progressManager();
|
static ProgressManager *progressManager();
|
||||||
static ScriptManager *scriptManager();
|
static ScriptManager *scriptManager();
|
||||||
static VariableManager *variableManager();
|
static QT_DEPRECATED VariableManager *variableManager(); // Use VariableManager::... directly.
|
||||||
static VcsManager *vcsManager();
|
static VcsManager *vcsManager();
|
||||||
static QT_DEPRECATED ModeManager *modeManager(); // Use ModeManager::... directly.
|
static QT_DEPRECATED ModeManager *modeManager(); // Use ModeManager::... directly.
|
||||||
static MimeDatabase *mimeDatabase();
|
static MimeDatabase *mimeDatabase();
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ VariableChooser::VariableChooser(QWidget *parent) :
|
|||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setFocusProxy(ui->variableList);
|
setFocusProxy(ui->variableList);
|
||||||
|
|
||||||
VariableManager *vm = VariableManager::instance();
|
foreach (const QByteArray &variable, VariableManager::variables())
|
||||||
foreach (const QByteArray &variable, vm->variables())
|
|
||||||
ui->variableList->addItem(QString::fromLatin1(variable));
|
ui->variableList->addItem(QString::fromLatin1(variable));
|
||||||
|
|
||||||
connect(ui->variableList, SIGNAL(currentTextChanged(QString)),
|
connect(ui->variableList, SIGNAL(currentTextChanged(QString)),
|
||||||
@@ -82,7 +81,7 @@ void VariableChooser::updateDescription(const QString &variable)
|
|||||||
if (variable.isNull())
|
if (variable.isNull())
|
||||||
ui->variableDescription->setText(m_defaultDescription);
|
ui->variableDescription->setText(m_defaultDescription);
|
||||||
else
|
else
|
||||||
ui->variableDescription->setText(VariableManager::instance()->variableDescription(variable.toUtf8()));
|
ui->variableDescription->setText(VariableManager::variableDescription(variable.toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
|
void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
virtual bool resolveMacro(const QString &name, QString *ret)
|
virtual bool resolveMacro(const QString &name, QString *ret)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
*ret = Core::VariableManager::instance()->value(name.toUtf8(), &found);
|
*ret = Core::VariableManager::value(name.toUtf8(), &found);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -77,9 +77,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static VariableManager *variableManagerInstance = 0;
|
static VariableManager *variableManagerInstance = 0;
|
||||||
|
static VariableManagerPrivate *d;
|
||||||
|
|
||||||
VariableManager::VariableManager() : d(new VariableManagerPrivate)
|
|
||||||
|
VariableManager::VariableManager()
|
||||||
{
|
{
|
||||||
|
d = new VariableManagerPrivate;
|
||||||
variableManagerInstance = this;
|
variableManagerInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +104,7 @@ bool VariableManager::remove(const QByteArray &variable)
|
|||||||
|
|
||||||
QString VariableManager::value(const QByteArray &variable, bool *found)
|
QString VariableManager::value(const QByteArray &variable, bool *found)
|
||||||
{
|
{
|
||||||
emit variableUpdateRequested(variable);
|
variableManagerInstance->variableUpdateRequested(variable);
|
||||||
if (found)
|
if (found)
|
||||||
*found = d->m_map.contains(variable);
|
*found = d->m_map.contains(variable);
|
||||||
return d->m_map.value(variable);
|
return d->m_map.value(variable);
|
||||||
@@ -158,12 +161,12 @@ QString VariableManager::fileVariableValue(const QByteArray &variable, const QBy
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QByteArray> VariableManager::variables() const
|
QList<QByteArray> VariableManager::variables()
|
||||||
{
|
{
|
||||||
return d->m_descriptions.keys();
|
return d->m_descriptions.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VariableManager::variableDescription(const QByteArray &variable) const
|
QString VariableManager::variableDescription(const QByteArray &variable)
|
||||||
{
|
{
|
||||||
return d->m_descriptions.value(variable);
|
return d->m_descriptions.value(variable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,30 +54,27 @@ public:
|
|||||||
|
|
||||||
static VariableManager *instance();
|
static VariableManager *instance();
|
||||||
|
|
||||||
void insert(const QByteArray &variable, const QString &value);
|
static void insert(const QByteArray &variable, const QString &value);
|
||||||
bool remove(const QByteArray &variable);
|
static bool remove(const QByteArray &variable);
|
||||||
QString value(const QByteArray &variable, bool *found = 0);
|
static QString value(const QByteArray &variable, bool *found = 0);
|
||||||
Utils::AbstractMacroExpander *macroExpander();
|
static Utils::AbstractMacroExpander *macroExpander();
|
||||||
|
|
||||||
void registerVariable(const QByteArray &variable,
|
static void registerVariable(const QByteArray &variable,
|
||||||
const QString &description);
|
const QString &description);
|
||||||
|
|
||||||
void registerFileVariables(const QByteArray &prefix,
|
static void registerFileVariables(const QByteArray &prefix,
|
||||||
const QString &heading);
|
const QString &heading);
|
||||||
bool isFileVariable(const QByteArray &variable, const QByteArray &prefix);
|
static bool isFileVariable(const QByteArray &variable, const QByteArray &prefix);
|
||||||
QString fileVariableValue(const QByteArray &variable, const QByteArray &prefix,
|
static QString fileVariableValue(const QByteArray &variable, const QByteArray &prefix,
|
||||||
const QString &fileName);
|
const QString &fileName);
|
||||||
QString fileVariableValue(const QByteArray &variable, const QByteArray &prefix,
|
static QString fileVariableValue(const QByteArray &variable, const QByteArray &prefix,
|
||||||
const QFileInfo &fileInfo);
|
const QFileInfo &fileInfo);
|
||||||
|
|
||||||
QList<QByteArray> variables() const;
|
static QList<QByteArray> variables();
|
||||||
QString variableDescription(const QByteArray &variable) const;
|
static QString variableDescription(const QByteArray &variable);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void variableUpdateRequested(const QByteArray &variable);
|
void variableUpdateRequested(const QByteArray &variable);
|
||||||
|
|
||||||
private:
|
|
||||||
VariableManagerPrivate *d;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -89,11 +89,10 @@ void ExecuteFilter::accept(FilterEntry selection) const
|
|||||||
if (index != 0)
|
if (index != 0)
|
||||||
p->m_commandHistory.prepend(value);
|
p->m_commandHistory.prepend(value);
|
||||||
|
|
||||||
VariableManager *vm = Core::VariableManager::instance();
|
|
||||||
bool found;
|
bool found;
|
||||||
QString workingDirectory = vm->value("CurrentDocument:Path", &found);
|
QString workingDirectory = Core::VariableManager::value("CurrentDocument:Path", &found);
|
||||||
if (!found || workingDirectory.isEmpty())
|
if (!found || workingDirectory.isEmpty())
|
||||||
workingDirectory = vm->value("CurrentProject:Path", &found);
|
workingDirectory = Core::VariableManager::value("CurrentProject:Path", &found);
|
||||||
|
|
||||||
ExecuteData d;
|
ExecuteData d;
|
||||||
d.workingDirectory = workingDirectory;
|
d.workingDirectory = workingDirectory;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ bool BuildConfigMacroExpander::resolveMacro(const QString &name, QString *ret)
|
|||||||
*ret = QDir::toNativeSeparators(m_bc->buildDirectory());
|
*ret = QDir::toNativeSeparators(m_bc->buildDirectory());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*ret = Core::VariableManager::instance()->value(name.toUtf8());
|
*ret = Core::VariableManager::value(name.toUtf8());
|
||||||
return !ret->isEmpty();
|
return !ret->isEmpty();
|
||||||
}
|
}
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ Utils::AbstractMacroExpander *LocalApplicationRunConfiguration::macroExpander()
|
|||||||
{
|
{
|
||||||
if (BuildConfiguration *bc = activeBuildConfiguration())
|
if (BuildConfiguration *bc = activeBuildConfiguration())
|
||||||
return bc->macroExpander();
|
return bc->macroExpander();
|
||||||
return Core::VariableManager::instance()->macroExpander();
|
return Core::VariableManager::macroExpander();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -86,7 +86,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::VariableManager::instance()->macroExpander());
|
pp->setMacroExpander(bc ? bc->macroExpander() : Core::VariableManager::macroExpander());
|
||||||
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);
|
||||||
@@ -274,7 +274,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::VariableManager::instance()->macroExpander());
|
param.setMacroExpander(bc ? bc->macroExpander() : Core::VariableManager::macroExpander());
|
||||||
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());
|
||||||
|
|||||||
@@ -1004,19 +1004,18 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
updateWelcomePage();
|
updateWelcomePage();
|
||||||
|
|
||||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
Core::VariableManager::registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX, tr("Current project's main file"));
|
||||||
vm->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX, tr("Current project's main file"));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTPROJECT_BUILDPATH,
|
||||||
vm->registerVariable(Constants::VAR_CURRENTPROJECT_BUILDPATH,
|
|
||||||
tr("Full build path of the current project's active build configuration."));
|
tr("Full build path of the current project's active build configuration."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTPROJECT_NAME, tr("The current project's name."));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTPROJECT_NAME, tr("The current project's name."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTKIT_NAME, tr("The currently active kit's name."));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTKIT_NAME, tr("The currently active kit's name."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
|
||||||
tr("The currently active kit's name in a filesystem friendly version."));
|
tr("The currently active kit's name in a filesystem friendly version."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The currently active kit's id."));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The currently active kit's id."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("The currently active build configuration's name."));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("The currently active build configuration's name."));
|
||||||
vm->registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."));
|
Core::VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."));
|
||||||
|
|
||||||
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
|
connect(Core::VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||||
this, SLOT(updateVariable(QByteArray)));
|
this, SLOT(updateVariable(QByteArray)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1144,10 +1143,10 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
|
|||||||
{
|
{
|
||||||
if (variable == Constants::VAR_CURRENTPROJECT_BUILDPATH) {
|
if (variable == Constants::VAR_CURRENTPROJECT_BUILDPATH) {
|
||||||
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
|
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
|
||||||
Core::VariableManager::instance()->insert(variable,
|
Core::VariableManager::insert(variable,
|
||||||
currentProject()->activeTarget()->activeBuildConfiguration()->buildDirectory());
|
currentProject()->activeTarget()->activeBuildConfiguration()->buildDirectory());
|
||||||
} else {
|
} else {
|
||||||
Core::VariableManager::instance()->remove(variable);
|
Core::VariableManager::remove(variable);
|
||||||
}
|
}
|
||||||
} else if (variable == Constants::VAR_CURRENTBUILD_TYPE) {
|
} else if (variable == Constants::VAR_CURRENTBUILD_TYPE) {
|
||||||
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
|
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
|
||||||
@@ -1159,9 +1158,9 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
|
|||||||
typeString = tr("release");
|
typeString = tr("release");
|
||||||
else
|
else
|
||||||
typeString = tr("unknown");
|
typeString = tr("unknown");
|
||||||
Core::VariableManager::instance()->insert(variable, typeString);
|
Core::VariableManager::insert(variable, typeString);
|
||||||
} else {
|
} else {
|
||||||
Core::VariableManager::instance()->remove(variable);
|
Core::VariableManager::remove(variable);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QString projectName;
|
QString projectName;
|
||||||
@@ -1182,9 +1181,9 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
|
|||||||
ProjectExpander expander(projectFilePath, projectName, kit, buildConfigurationName);
|
ProjectExpander expander(projectFilePath, projectName, kit, buildConfigurationName);
|
||||||
QString result;
|
QString result;
|
||||||
if (expander.resolveProjectMacro(QString::fromUtf8(variable), &result))
|
if (expander.resolveProjectMacro(QString::fromUtf8(variable), &result))
|
||||||
Core::VariableManager::instance()->insert(variable, result);
|
Core::VariableManager::insert(variable, result);
|
||||||
else
|
else
|
||||||
Core::VariableManager::instance()->remove(variable);
|
Core::VariableManager::remove(variable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ bool ProjectExpander::resolveProjectMacro(const QString &name, QString *ret)
|
|||||||
result = m_projectName;
|
result = m_projectName;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
} else if (Core::VariableManager::instance()->isFileVariable(
|
} else if (Core::VariableManager::isFileVariable(
|
||||||
name.toUtf8(), ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX)) {
|
name.toUtf8(), ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX)) {
|
||||||
if (!m_projectFile.filePath().isEmpty()) {
|
if (!m_projectFile.filePath().isEmpty()) {
|
||||||
result = Core::VariableManager::instance()->fileVariableValue(name.toUtf8(),
|
result = Core::VariableManager::fileVariableValue(name.toUtf8(),
|
||||||
ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX,
|
ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||||
m_projectFile);
|
m_projectFile);
|
||||||
found = true;
|
found = true;
|
||||||
@@ -79,7 +79,7 @@ bool ProjectExpander::resolveMacro(const QString &name, QString *ret)
|
|||||||
{
|
{
|
||||||
bool found = resolveProjectMacro(name, ret);
|
bool found = resolveProjectMacro(name, ret);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
QString result = Core::VariableManager::instance()->value(name.toUtf8(), &found);
|
QString result = Core::VariableManager::value(name.toUtf8(), &found);
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = result;
|
*ret = result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,13 +90,12 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
|
|||||||
|
|
||||||
void QtSupportPlugin::extensionsInitialized()
|
void QtSupportPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
Core::VariableManager::registerVariable(kHostBins,
|
||||||
vm->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."));
|
||||||
vm->registerVariable(kInstallBins,
|
Core::VariableManager::registerVariable(kInstallBins,
|
||||||
tr("Full path to the target bin directory of the current project's Qt version."
|
tr("Full path to the target bin directory of the current project's Qt version."
|
||||||
" You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)));
|
" You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)));
|
||||||
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
|
connect(Core::VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||||
this, SLOT(updateVariable(QByteArray)));
|
this, SLOT(updateVariable(QByteArray)));
|
||||||
|
|
||||||
QtVersionManager::instance()->extensionsInitialized();
|
QtVersionManager::instance()->extensionsInitialized();
|
||||||
|
|||||||
@@ -231,20 +231,19 @@ void TextEditorPlugin::extensionsInitialized()
|
|||||||
addAutoReleasedObject(new FindInCurrentFile);
|
addAutoReleasedObject(new FindInCurrentFile);
|
||||||
addAutoReleasedObject(new FindInOpenFiles);
|
addAutoReleasedObject(new FindInOpenFiles);
|
||||||
|
|
||||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
Core::VariableManager::registerVariable(kCurrentDocumentSelection,
|
||||||
vm->registerVariable(kCurrentDocumentSelection,
|
|
||||||
tr("Selected text within the current document."));
|
tr("Selected text within the current document."));
|
||||||
vm->registerVariable(kCurrentDocumentRow,
|
Core::VariableManager::registerVariable(kCurrentDocumentRow,
|
||||||
tr("Line number of the text cursor position in current document (starts with 1)."));
|
tr("Line number of the text cursor position in current document (starts with 1)."));
|
||||||
vm->registerVariable(kCurrentDocumentColumn,
|
Core::VariableManager::registerVariable(kCurrentDocumentColumn,
|
||||||
tr("Column number of the text cursor position in current document (starts with 0)."));
|
tr("Column number of the text cursor position in current document (starts with 0)."));
|
||||||
vm->registerVariable(kCurrentDocumentRowCount,
|
Core::VariableManager::registerVariable(kCurrentDocumentRowCount,
|
||||||
tr("Number of lines visible in current document."));
|
tr("Number of lines visible in current document."));
|
||||||
vm->registerVariable(kCurrentDocumentColumnCount,
|
Core::VariableManager::registerVariable(kCurrentDocumentColumnCount,
|
||||||
tr("Number of columns visible in current document."));
|
tr("Number of columns visible in current document."));
|
||||||
vm->registerVariable(kCurrentDocumentFontSize,
|
Core::VariableManager::registerVariable(kCurrentDocumentFontSize,
|
||||||
tr("Current document's font size in points."));
|
tr("Current document's font size in points."));
|
||||||
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
|
connect(Core::VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||||
this, SLOT(updateVariable(QByteArray)));
|
this, SLOT(updateVariable(QByteArray)));
|
||||||
connect(Core::ExternalToolManager::instance(), SIGNAL(replaceSelectionRequested(QString)),
|
connect(Core::ExternalToolManager::instance(), SIGNAL(replaceSelectionRequested(QString)),
|
||||||
this, SLOT(updateCurrentSelection(QString)));
|
this, SLOT(updateCurrentSelection(QString)));
|
||||||
@@ -313,7 +312,7 @@ void TextEditorPlugin::updateVariable(const QByteArray &variable)
|
|||||||
value = QString::number(editor->widget()->font().pointSize());
|
value = QString::number(editor->widget()->font().pointSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Core::VariableManager::instance()->insert(variable, value);
|
Core::VariableManager::insert(variable, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user