Commit 5e596e89 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

introduce qmakeProperty(), use instead of versionInfo() where applicable

the idea is to encapsulate accesses to specific variables.

Change-Id: Icafd2c85de6178db1a492a5dd36dde7f1925ea21
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 7324d1f9
......@@ -161,9 +161,10 @@ QStringList AndroidDebugSupport::qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
QSet<QString> paths;
for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) {
if (!qtVersion->versionInfo().contains(QLatin1String(qMakeVariables[i])))
QString path = qtVersion->qmakeProperty(qMakeVariables[i]);
if (path.isNull())
continue;
QDirIterator it(qtVersion->versionInfo()[QLatin1String(qMakeVariables[i])], QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories);
QDirIterator it(path, QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
paths.insert(it.fileInfo().absolutePath());
......
......@@ -407,7 +407,7 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
return false;
Utils::FileName javaSrcPath
= Utils::FileName::fromString(version->versionInfo()[QLatin1String("QT_INSTALL_PREFIX")])
= Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX"))
.appendPath(QLatin1String("src/android/java"));
QDir projectDir(qt4Project->projectDirectory());
Utils::FileName androidPath = dirPath(target);
......@@ -571,7 +571,7 @@ Utils::FileName AndroidManager::localLibsRulesFilePath(ProjectExplorer::Target *
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
if (!version)
return Utils::FileName();
return Utils::FileName::fromString(version->versionInfo()[QLatin1String("QT_INSTALL_LIBS")] + QLatin1String("/rules.xml"));
return Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_LIBS") + QLatin1String("/rules.xml"));
}
QString AndroidManager::loadLocalLibs(ProjectExplorer::Target *target, int apiLevel)
......@@ -596,7 +596,7 @@ QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
= qobject_cast<const Qt4ProjectManager::Qt4Project *>(target->project());
if (!qt4Project || !version)
return libs;
QString qtLibsPath = version->versionInfo()[QLatin1String("QT_INSTALL_LIBS")];
QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS");
if (!readelfPath.toFileInfo().exists()) {
QDirIterator libsIt(qtLibsPath, QStringList() << QLatin1String("libQt*.so"));
while (libsIt.hasNext()) {
......
......@@ -224,7 +224,7 @@ QString DesignDocumentController::pathToQt() const
if (activeQtVersion && (activeQtVersion->qtVersion().majorVersion > 3)
&& (activeQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
|| activeQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
return activeQtVersion->versionInfo().value("QT_INSTALL_DATA");
return activeQtVersion->qmakeProperty("QT_INSTALL_DATA");
return QString();
}
......
......@@ -165,7 +165,7 @@ void QmlProject::refresh(RefreshOptions options)
}
if (version) {
pinfo.tryQmlDump = true;
pinfo.qtImportsPath = version->versionInfo().value("QT_INSTALL_IMPORTS");
pinfo.qtImportsPath = version->qmakeProperty("QT_INSTALL_IMPORTS");
pinfo.qtVersionString = version->qtVersionString();
}
m_modelManager->updateProjectInfo(pinfo);
......@@ -219,7 +219,7 @@ QStringList QmlProject::importPaths() const
if (runConfig) {
const QtSupport::BaseQtVersion *qtVersion = runConfig->qtVersion();
if (qtVersion && qtVersion->isValid()) {
const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS");
const QString qtVersionImportPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
if (!qtVersionImportPath.isEmpty())
importPaths += qtVersionImportPath;
}
......
......@@ -623,7 +623,7 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (qtVersion)
env.prependOrSetLibrarySearchPath(qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
return env;
}
......
......@@ -503,7 +503,7 @@ Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
return Utils::FileName();
Utils::FileName baseMkspecDir = Utils::FileName::fromUserInput(
version->versionInfo().value(QLatin1String("QT_HOST_DATA")) + QLatin1String("/mkspecs"));
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
......
......@@ -606,7 +606,7 @@ void Qt4Project::updateQmlJSCodeModel()
if (qtVersion && qtVersion->isValid()) {
projectInfo.tryQmlDump = qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
|| qtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT);
projectInfo.qtImportsPath = qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS"));
projectInfo.qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
if (!projectInfo.qtImportsPath.isEmpty())
projectInfo.importPaths += projectInfo.qtImportsPath;
projectInfo.qtVersionString = qtVersion->qtVersionString();
......
......@@ -207,9 +207,7 @@ void Qt4Manager::updateVariable(const QByteArray &variable)
qtv = QtSupport::QtProfileInformation::qtVersion(ProjectExplorer::ProfileManager::instance()->defaultProfile());
if (qtv)
value = qtv->versionInfo().value(variable == kHostBins
? QLatin1String("QT_HOST_BINS")
: QLatin1String("QT_INSTALL_BINS"));
value = qtv->qmakeProperty(variable == kHostBins ? "QT_HOST_BINS" : "QT_INSTALL_BINS");
Core::VariableManager::instance()->insert(variable, value);
}
}
......
This diff is collapsed.
......@@ -133,6 +133,8 @@ public:
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
QHash<QString,QString> versionInfo() const;
static QString qmakeProperty(const QHash<QString,QString> &versionInfo, const QByteArray &name);
QString qmakeProperty(const QByteArray &name) const;
virtual void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
virtual Utils::FileName sourcePath() const;
......
......@@ -75,7 +75,7 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
// of the version pointer while compiling
//
m_qtId = version->uniqueId();
m_qtInstallData = version->versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
m_qtInstallData = version->qmakeProperty("QT_INSTALL_DATA");
if (m_qtInstallData.isEmpty()) {
const QString error
= QCoreApplication::translate(
......
......@@ -196,7 +196,7 @@ static bool hasPrivateHeaders(const QString &qtInstallHeaders) {
bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
const QString installHeaders = qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_HEADERS"));
const QString installHeaders = qtVersion->qmakeProperty("QT_INSTALL_HEADERS");
if (qtVersion->type() != QLatin1String(Constants::DESKTOPQT)
&& qtVersion->type() != QLatin1String(Constants::SIMULATORQT)) {
......@@ -227,9 +227,9 @@ bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
QString QmlDumpTool::toolForVersion(BaseQtVersion *version, bool debugDump)
{
if (version) {
const QString qtInstallData = version->versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
const QString qtInstallBins = version->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
const QString qtInstallHeaders = version->versionInfo().value(QLatin1String("QT_INSTALL_HEADERS"));
const QString qtInstallData = version->qmakeProperty("QT_INSTALL_DATA");
const QString qtInstallBins = version->qmakeProperty("QT_INSTALL_BINS");
const QString qtInstallHeaders = version->qmakeProperty("QT_INSTALL_HEADERS");
return toolForQtPaths(qtInstallData, qtInstallBins, qtInstallHeaders, debugDump);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment