Make Qt-related variables available to all projects

Now that we have kits all projects have access to the Qt version, so
those variables should be available in all those projects.

Change-Id: Ia1cf20816f6e66df46c77f5fc823c06053a54a1f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Tobias Hunger
2012-10-25 16:50:13 +02:00
parent c2c58fecd7
commit 3c9874200c
4 changed files with 39 additions and 35 deletions

View File

@@ -45,7 +45,6 @@
#include <coreplugin/id.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/variablemanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/session.h>
@@ -76,9 +75,6 @@ using ProjectExplorer::FormType;
using ProjectExplorer::ResourceType;
using ProjectExplorer::UnknownFileType;
static const char kHostBins[] = "CurrentProject:QT_HOST_BINS";
static const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS";
// Known file types of a Qt 4 project
static const char *qt4FileTypes[] = {
"CppHeaderFiles",
@@ -138,15 +134,6 @@ void Qt4Manager::init()
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(editorChanged(Core::IEditor*)));
Core::VariableManager *vm = Core::VariableManager::instance();
vm->registerVariable(kHostBins,
tr("Full path to the host bin directory of the current project's Qt version."));
vm->registerVariable(kInstallBins,
tr("Full path to the target bin directory of the current project's Qt version."
" You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)));
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
this, SLOT(updateVariable(QByteArray)));
}
void Qt4Manager::editorChanged(Core::IEditor *editor)
@@ -188,27 +175,6 @@ void Qt4Manager::editorAboutToClose(Core::IEditor *editor)
}
}
void Qt4Manager::updateVariable(const QByteArray &variable)
{
if (variable == kHostBins || variable == kInstallBins) {
Qt4Project *qt4pro = qobject_cast<Qt4Project *>(ProjectExplorer::ProjectExplorerPlugin::currentProject());
if (!qt4pro) {
Core::VariableManager::instance()->remove(variable);
return;
}
QString value;
const QtSupport::BaseQtVersion *qtv = 0;
if (ProjectExplorer::Target *t = qt4pro->activeTarget())
qtv = QtSupport::QtKitInformation::qtVersion(t->kit());
else
qtv = QtSupport::QtKitInformation::qtVersion(ProjectExplorer::KitManager::instance()->defaultKit());
if (qtv)
value = qtv->qmakeProperty(variable == kHostBins ? "QT_HOST_BINS" : "QT_INSTALL_BINS");
Core::VariableManager::instance()->insert(variable, value);
}
}
void Qt4Manager::uiEditorContentsChanged()
{
// cast sender, get filename