Commit f5d42871 authored by Daniel Teske's avatar Daniel Teske
Browse files

Use Utils::FileName for various bits in QtVersion



Change-Id: I3afc3a4f2e0dd2671279c2d071779f1d7b277849
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent c6936d9e
......@@ -50,7 +50,7 @@ public:
QByteArray predefinedMacros() const;
void addToEnvironment(Utils::Environment &env) const;
QString makeCommand() const;
QString mkspec() const;
Utils::FileName mkspec() const;
QString defaultMakeTarget() const;
void setCompilerPath(const QString &);
......
......@@ -225,9 +225,9 @@ void RvctToolChain::addToEnvironment(Utils::Environment &env) const
env.set(QLatin1String("LANG"), QString(QLatin1Char('C')));
}
QString RvctToolChain::mkspec() const
Utils::FileName RvctToolChain::mkspec() const
{
return QString(); // Always use default from Qt version
return Utils::FileName(); // Always use default from Qt version
}
QString RvctToolChain::makeCommand() const
......
......@@ -89,7 +89,7 @@ public:
QByteArray predefinedMacros() const;
QList<ProjectExplorer::HeaderPath> systemHeaderPaths() const;
void addToEnvironment(Utils::Environment &env) const;
QString mkspec() const;
Utils::FileName mkspec() const;
QString makeCommand() const;
QString defaultMakeTarget() const;
ProjectExplorer::IOutputParser *outputParser() const;
......
......@@ -59,7 +59,7 @@ SymbianQtVersion::SymbianQtVersion()
{
}
SymbianQtVersion::SymbianQtVersion(const QString &path, bool isAutodetected, const QString &autodetectionSource)
SymbianQtVersion::SymbianQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource),
m_validSystemRoot(false)
{
......
......@@ -42,7 +42,7 @@ class SymbianQtVersion : public QtSupport::BaseQtVersion
{
public:
SymbianQtVersion();
SymbianQtVersion(const QString &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
SymbianQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
SymbianQtVersion *clone() const;
~SymbianQtVersion();
......
......@@ -73,9 +73,9 @@ int SymbianQtVersionFactory::priority() const
return 50;
}
QtSupport::BaseQtVersion *SymbianQtVersionFactory::create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
QtSupport::BaseQtVersion *SymbianQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
{
QFileInfo fi(qmakePath);
QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0;
......
......@@ -48,7 +48,7 @@ public:
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
};
} // Internal
......
......@@ -183,9 +183,9 @@ void WinscwToolChain::addToEnvironment(Utils::Environment &env) const
}
QString WinscwToolChain::mkspec() const
Utils::FileName WinscwToolChain::mkspec() const
{
return QString(); // Always use default from Qt version
return Utils::FileName(); // Always use default from Qt version
}
QString WinscwToolChain::makeCommand() const
......
......@@ -60,7 +60,7 @@ public:
QByteArray predefinedMacros() const;
QList<ProjectExplorer::HeaderPath> systemHeaderPaths() const;
void addToEnvironment(Utils::Environment &env) const;
QString mkspec() const;
Utils::FileName mkspec() const;
QString makeCommand() const;
virtual QString debuggerCommand() const;
QString defaultMakeTarget() const;
......
......@@ -123,7 +123,7 @@ static inline QString msgBuildConfigNotApplicable(const QString &d, const QtSupp
const Target *target)
{
return QString::fromLatin1("Warning: Buildconfiguration '%1' : Qt '%2' from %3 not supported by target '%4'").
arg(d, qtVersion->displayName(), qtVersion->qmakeCommand(), target->id());
arg(d, qtVersion->displayName(), qtVersion->qmakeCommand().toUserOutput(), target->id());
}
bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
......@@ -171,7 +171,7 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
if (!toolChain()) {
if (version && version->isValid()) {
qWarning("Warning: No tool chain available for '%s' from %s used in '%s'.",
qPrintable(version->displayName()), qPrintable(version->qmakeCommand()),
qPrintable(version->displayName()), qPrintable(version->qmakeCommand().toUserOutput()),
qPrintable(target()->id()));
} else {
qWarning("Warning: No tool chain available for invalid Qt version used in '%s'.",
......@@ -475,7 +475,7 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
{
QMakeStep *qs = qmakeStep();
if (QFileInfo(makefile).exists() && qs) {
QString qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
QtSupport::BaseQtVersion *version = qtVersion();
if (!version)
return false;
......@@ -495,17 +495,17 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
// are not interested in), splitting them up into individual strings:
extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs),
actualArgs = qs->moreArguments() + actualArgs + qs->moreArgumentsAfter();
QString actualSpec = qs->mkspec();
Utils::FileName actualSpec = qs->mkspec();
QString qmakeArgs = result.second;
QStringList parsedArgs;
QString parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
Utils::FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
if (debug) {
qDebug()<<"Actual args:"<<actualArgs;
qDebug()<<"Parsed args:"<<parsedArgs;
qDebug()<<"Actual spec:"<<actualSpec;
qDebug()<<"Parsed spec:"<<parsedSpec;
qDebug()<<"Actual spec:"<<actualSpec.toString();
qDebug()<<"Parsed spec:"<<parsedSpec.toString();
}
// Comparing the sorted list is obviously wrong
......@@ -530,15 +530,15 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
return true;
// Actual spec is the default one
// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
if ((actualSpec == version->mkspec() || actualSpec == "default")
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty()))
if ((actualSpec == version->mkspec() || actualSpec == Utils::FileName::fromString(QLatin1String("default")))
&& (parsedSpec == version->mkspec() || parsedSpec == Utils::FileName::fromString(QLatin1String("default")) || parsedSpec.isEmpty()))
return true;
}
} else if (debug) {
qDebug()<<"different qmake buildconfigurations buildconfiguration:"<<qmakeBuildConfiguration()<<" Makefile:"<<result.first;
}
} else if (debug) {
qDebug()<<"diffrent qt versions, buildconfiguration:"<<version->qmakeCommand()<<" Makefile:"<<qmakePath;
qDebug()<<"diffrent qt versions, buildconfiguration:"<<version->qmakeCommand().toString()<<" Makefile:"<<qmakePath.toString();
}
}
return false;
......@@ -558,11 +558,11 @@ bool Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
return removedArgument;
}
QString Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
const QString &directory, const QtSupport::BaseQtVersion *version,
QStringList *outArgs)
Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
const QString &directory, const QtSupport::BaseQtVersion *version,
QStringList *outArgs)
{
QString parsedSpec;
Utils::FileName parsedSpec;
bool ignoreNext = false;
bool nextIsSpec = false;
......@@ -572,7 +572,7 @@ QString Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
ait.deleteArg();
} else if (nextIsSpec) {
nextIsSpec = false;
parsedSpec = QDir::cleanPath(ait.value());
parsedSpec = Utils::FileName::fromUserInput(ait.value());
ait.deleteArg();
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
nextIsSpec = true;
......@@ -592,49 +592,39 @@ QString Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
}
if (parsedSpec.isEmpty())
return QString();
return Utils::FileName();
QString baseMkspecDir = version->versionInfo().value("QMAKE_MKSPECS");
Utils::FileName baseMkspecDir = Utils::FileName::fromUserInput(version->versionInfo().value("QMAKE_MKSPECS"));
if (baseMkspecDir.isEmpty())
baseMkspecDir = version->versionInfo().value("QT_INSTALL_DATA") + "/mkspecs";
baseMkspecDir = Utils::FileName::fromUserInput(version->versionInfo().value("QT_INSTALL_DATA") + "/mkspecs");
#ifdef Q_OS_WIN
baseMkspecDir = baseMkspecDir.toLower();
parsedSpec = parsedSpec.toLower();
#endif
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
// or relatively to the mkspec directory
// if it is the former we need to get the canonical form
// for the other one we don't need to do anything
if (QFileInfo(parsedSpec).isRelative()) {
if(QFileInfo(directory + QLatin1Char('/') + parsedSpec).exists()) {
parsedSpec = QDir::cleanPath(directory + QLatin1Char('/') + parsedSpec);
#ifdef Q_OS_WIN
parsedSpec = parsedSpec.toLower();
#endif
if (parsedSpec.toFileInfo().isRelative()) {
if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) {
parsedSpec = Utils::FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
} else {
parsedSpec = baseMkspecDir + QLatin1Char('/') + parsedSpec;
parsedSpec = Utils::FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
}
}
QFileInfo f2(parsedSpec);
QFileInfo f2 = parsedSpec.toFileInfo();
while (f2.isSymLink()) {
parsedSpec = f2.symLinkTarget();
f2.setFile(parsedSpec);
parsedSpec = Utils::FileName::fromString(f2.symLinkTarget());
f2.setFile(parsedSpec.toString());
}
if (parsedSpec.startsWith(baseMkspecDir)) {
parsedSpec = parsedSpec.mid(baseMkspecDir.length() + 1);
if (parsedSpec.isChildOf(baseMkspecDir)) {
parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir);
} else {
QString sourceMkSpecPath = version->sourcePath() + "/mkspecs";
if (parsedSpec.startsWith(sourceMkSpecPath)) {
parsedSpec = parsedSpec.mid(sourceMkSpecPath.length() + 1);
Utils::FileName sourceMkSpecPath = Utils::FileName::fromString(version->sourcePath().toString() + "/mkspecs");
if (parsedSpec.isChildOf(sourceMkSpecPath)) {
parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath);
}
}
#ifdef Q_OS_WIN
parsedSpec = parsedSpec.toLower();
#endif
return parsedSpec;
}
......@@ -837,7 +827,7 @@ void Qt4BuildConfiguration::importFromBuildDirectory()
else
mkfile.append(makefile());
QString qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(mkfile);
Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(mkfile);
if (!qmakePath.isEmpty()) {
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
QtSupport::BaseQtVersion *version = vm->qtVersionForQMakeBinary(qmakePath);
......@@ -851,7 +841,7 @@ void Qt4BuildConfiguration::importFromBuildDirectory()
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
QString additionalArguments = result.second;
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
Utils::FileName parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
const bool enableQmlDebugger =
Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
......@@ -861,8 +851,8 @@ void Qt4BuildConfiguration::importFromBuildDirectory()
QMakeStep *qs = qmakeStep();
qs->setUserArguments(additionalArguments);
qs->setLinkQmlDebuggingLibrary(enableQmlDebugger);
if (!parsedSpec.isEmpty() && parsedSpec != QLatin1String("default") && qs->mkspec() != parsedSpec) {
Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << "-spec" << parsedSpec));
if (!parsedSpec.isEmpty() && parsedSpec != Utils::FileName::fromString(QLatin1String("default")) && qs->mkspec() != parsedSpec) {
Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << QLatin1String("-spec") << parsedSpec.toUserOutput()));
qs->setUserArguments(additionalArguments);
}
......
......@@ -108,7 +108,7 @@ public:
bool compareToImportFrom(const QString &makefile);
static bool removeQMLInspectorFromArguments(QString *args);
static QString extractSpecFromArguments(QString *arguments,
static Utils::FileName extractSpecFromArguments(QString *arguments,
const QString &directory, const QtSupport::BaseQtVersion *version,
QStringList *outArgs = 0);
......
......@@ -559,7 +559,7 @@ void Qt4Project::updateCppCodeModel()
if (rootQt4ProjectNode())
allIncludePaths.append(rootQt4ProjectNode()->resolvedMkspecPath());
else if (activeBC->qtVersion())
allIncludePaths.append(activeBC->qtVersion()->mkspecPath());
allIncludePaths.append(activeBC->qtVersion()->mkspecPath().toString());
allIncludePaths.append(predefinedIncludePaths);
......@@ -966,7 +966,7 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
QStringList args;
if (QMakeStep *qs = bc->qmakeStep()) {
args = qs->parserArguments();
m_proFileOption->qmakespec = qs->mkspec();
m_proFileOption->qmakespec = qs->mkspec().toString();
} else {
args = bc->configCommandLineArguments();
}
......
......@@ -357,7 +357,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
else
makefile.append(m_buildConfiguration->makefile());
QString qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
// check that there's a makefile
if (!qmakePath.isEmpty()) {
......@@ -367,7 +367,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
if (mc == QtSupport::QtVersionManager::DifferentProject) {
incompatibleBuild = true;
} else if (mc == QtSupport::QtVersionManager::SameProject) {
if (qmakePath != (version ? version->qmakeCommand() : QString())) {
if (qmakePath != (version ? version->qmakeCommand() : Utils::FileName())) {
// and that the qmake path is different from the current version
// import enable
visible = true;
......
......@@ -303,21 +303,21 @@ ProjectExplorer::ToolChain *Qt4BaseTarget::preferredToolChain(ProjectExplorer::B
return Target::preferredToolChain(bc);
QList<ProjectExplorer::ToolChain *> tcs = possibleToolChains(bc);
const QString mkspec = qtBc->qtVersion()->mkspec();
const Utils::FileName mkspec = qtBc->qtVersion()->mkspec();
foreach (ProjectExplorer::ToolChain *tc, tcs)
if (tc->mkspec() == mkspec)
return tc;
return tcs.isEmpty() ? 0 : tcs.at(0);
}
QString Qt4BaseTarget::mkspec(const Qt4BuildConfiguration *bc) const
Utils::FileName Qt4BaseTarget::mkspec(const Qt4BuildConfiguration *bc) const
{
QtSupport::BaseQtVersion *version = bc->qtVersion();
// We do not know which abi the Qt version has, so let's stick with the defaults
if (version && version->qtAbis().count() == 1 && version->qtAbis().first().isNull())
return QString();
return Utils::FileName();
const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
const Utils::FileName tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : Utils::FileName();
if (!version)
return tcSpec;
if (!tcSpec.isEmpty() && version->hasMkspec(tcSpec))
......@@ -1185,7 +1185,7 @@ QList<BuildConfigurationInfo> BuildConfigurationInfo::checkForBuild(const QStrin
QList<BuildConfigurationInfo> infos;
foreach (const QString &file, makefiles) {
QString makefile = directory + '/' + file;
QString qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
if (qmakeBinary.isEmpty())
continue;
if (QtSupport::QtVersionManager::makefileIsFor(makefile, proFilePath) != QtSupport::QtVersionManager::SameProject)
......@@ -1204,15 +1204,15 @@ QList<BuildConfigurationInfo> BuildConfigurationInfo::checkForBuild(const QStrin
QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
QString additionalArguments = makefileBuildConfig.second;
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
QString versionSpec = version->mkspec();
Utils::FileName parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
Utils::FileName versionSpec = version->mkspec();
QString specArgument;
// Compare mkspecs and add to additional arguments
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == Utils::FileName::fromString("default")) {
// using the default spec, don't modify additional arguments
} else {
specArgument = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
specArgument = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec.toUserOutput());
}
Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
......
......@@ -92,7 +92,7 @@ public:
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
ProjectExplorer::ToolChain *preferredToolChain(ProjectExplorer::BuildConfiguration *) const;
virtual QString mkspec(const Qt4BuildConfiguration *bc) const;
virtual Utils::FileName mkspec(const Qt4BuildConfiguration *bc) const;
signals:
void buildDirectoryInitialized();
......
......@@ -44,7 +44,7 @@ WinCeQtVersion::WinCeQtVersion()
{
}
WinCeQtVersion::WinCeQtVersion(const QString &path, const QString &archType,
WinCeQtVersion::WinCeQtVersion(const Utils::FileName &path, const QString &archType,
bool isAutodetected, const QString &autodetectionSource)
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource),
m_archType(ProjectExplorer::Abi::ArmArchitecture)
......@@ -104,7 +104,7 @@ void WinCeQtVersion::fromMap(const QVariantMap &map)
// named <Description>-<Architecture>-<Compiler> with no other '-' characters.
m_archType = ProjectExplorer::Abi::ArmArchitecture;
const QStringList splitSpec = mkspec().split("-");
const QStringList splitSpec = mkspec().toString().split("-");
if (splitSpec.length() == 3) {
const QString archString = splitSpec.value(1);
if (archString.contains("x86", Qt::CaseInsensitive))
......
......@@ -42,7 +42,7 @@ class WinCeQtVersion : public QtSupport::BaseQtVersion
{
public:
WinCeQtVersion();
WinCeQtVersion(const QString &path, const QString &archType,
WinCeQtVersion(const Utils::FileName &path, const QString &archType,
bool isAutodetected = false, const QString &autodetectionSource = QString());
~WinCeQtVersion();
WinCeQtVersion *clone() const;
......
......@@ -69,9 +69,9 @@ int WinCeQtVersionFactory::priority() const
return 50;
}
QtSupport::BaseQtVersion *WinCeQtVersionFactory::create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
QtSupport::BaseQtVersion *WinCeQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
{
QFileInfo fi(qmakePath);
QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0;
......
......@@ -49,8 +49,9 @@ public:
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator,
bool isAutoDetected = false, const QString &autoDetectionSource = QString());
virtual QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator,
bool isAutoDetected = false, const QString &autoDetectionSource = QString());
};
} // Internal
......
......@@ -162,7 +162,7 @@ int BaseQtVersion::getUniqueId()
return QtVersionManager::instance()->getUniqueId();
}
BaseQtVersion::BaseQtVersion(const QString &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
: m_id(getUniqueId()),
m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
......@@ -202,17 +202,12 @@ BaseQtVersion::BaseQtVersion()
m_hasDocumentation(false),
m_qmakeIsExecutable(true)
{
ctor(QString());
ctor(Utils::FileName());
}
void BaseQtVersion::ctor(const QString& qmakePath)
void BaseQtVersion::ctor(const Utils::FileName &qmakePath)
{
m_qmakeCommand = QDir::fromNativeSeparators(qmakePath);
#ifdef Q_OS_WIN
m_qmakeCommand = m_qmakeCommand.toLower();
#endif
if (m_qmakeCommand.startsWith('~'))
m_qmakeCommand.remove(0, 1).prepend(QDir::homePath());
m_qmakeCommand = qmakePath;
m_designerCommand.clear();
m_linguistCommand.clear();
m_qmlviewerCommand.clear();
......@@ -228,7 +223,7 @@ BaseQtVersion::~BaseQtVersion()
{
}
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const QString &qmakePath,
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath,
bool fromPath)
{
QString location;
......@@ -237,7 +232,7 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const QS
} else {
// Deduce a description from '/foo/qt-folder/[qtbase]/bin/qmake' -> '/foo/qt-folder'.
// '/usr' indicates System Qt 4.X on Linux.
QDir dir = QFileInfo(qmakePath).absoluteDir();
QDir dir = qmakePath.toFileInfo().absoluteDir();
do {
const QString dirName = dir.dirName();
if (dirName == QLatin1String("usr")) { // System-installed Qt.
......@@ -276,7 +271,10 @@ void BaseQtVersion::fromMap(const QVariantMap &map)
m_isAutodetected = map.value(QLatin1String(QTVERSIONAUTODETECTED)).toBool();
if (m_isAutodetected)
m_autodetectionSource = map.value(QLatin1String(QTVERSIONAUTODETECTIONSOURCE)).toString();
ctor(map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString());
QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString();
if (string.startsWith('~'))
string.remove(0, 1).prepend(QDir::homePath());
ctor(Utils::FileName::fromUserInput(string));
}
QVariantMap BaseQtVersion::toMap() const
......@@ -287,7 +285,7 @@ QVariantMap BaseQtVersion::toMap() const
result.insert(QLatin1String(QTVERSIONAUTODETECTED), isAutodetected());
if (isAutodetected())
result.insert(QLatin1String(QTVERSIONAUTODETECTIONSOURCE), autodetectionSource());
result.insert(QLatin1String(QTVERSIONQMAKEPATH), qmakeCommand());
result.insert(QLatin1String(QTVERSIONQMAKEPATH), qmakeCommand().toString());
return result;
}
......@@ -328,7 +326,7 @@ QString BaseQtVersion::warningReason() const
return QString();
}
QString BaseQtVersion::qmakeCommand() const
Utils::FileName BaseQtVersion::qmakeCommand() const
{
return m_qmakeCommand;
}
......@@ -411,11 +409,11 @@ QString BaseQtVersion::toHtml(bool verbose) const
prefix = QLatin1String("<tr><td></td>");
}
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "Source:")
<< "</b></td><td>" << sourcePath() << "</td></tr>";
<< "</b></td><td>" << sourcePath().toUserOutput() << "</td></tr>";
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "mkspec:")
<< "</b></td><td>" << mkspec() << "</td></tr>";
<< "</b></td><td>" << mkspec().toUserOutput() << "</td></tr>";
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "qmake:")
<< "</b></td><td>" << m_qmakeCommand << "</td></tr>";
<< "</b></td><td>" << m_qmakeCommand.toUserOutput() << "</td></tr>";
ensureMkSpecParsed();
if (!mkspecPath().isEmpty()) {
if (m_defaultConfigIsDebug || m_defaultConfigIsDebugAndRelease) {
......@@ -447,7 +445,7 @@ void BaseQtVersion::updateSourcePath() const
return;
updateVersionInfo();
const QString installData = m_versionInfo["QT_INSTALL_DATA"];
m_sourcePath = installData;
QString sourcePath = installData;
QFile qmakeCache(installData + QLatin1String("/.qmake.cache"));
if (qmakeCache.exists()) {
qmakeCache.open(QIODevice::ReadOnly | QIODevice::Text);
......@@ -455,22 +453,19 @@ void BaseQtVersion::updateSourcePath() const
while (!stream.atEnd()) {
QString line = stream.readLine().trimmed();
if (line.startsWith(QLatin1String("QT_SOURCE_TREE"))) {
m_sourcePath = line.split(QLatin1Char('=')).at(1).trimmed();
if (m_sourcePath.startsWith(QLatin1String("$$quote("))) {
m_sourcePath.remove(0, 8);
m_sourcePath.chop(1);
sourcePath = line.split(QLatin1Char('=')).at(1).trimmed();
if (sourcePath.startsWith(QLatin1String("$$quote("))) {
sourcePath.remove(0, 8);
sourcePath.chop(1);
}
break;
}
}
}
m_sourcePath = QDir::cleanPath(m_sourcePath);
#ifdef Q_OS_WIN
m_sourcePath = m_sourcePath.toLower();
#endif