forked from qt-creator/qt-creator
BaseQtVersion: Make sourcePath calculation available as static method
Change-Id: I7a4c4d4ad2cdf1c36d1bc3eb046725e29716bba3 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -613,25 +613,7 @@ void BaseQtVersion::updateSourcePath() const
|
|||||||
if (!m_sourcePath.isEmpty())
|
if (!m_sourcePath.isEmpty())
|
||||||
return;
|
return;
|
||||||
updateVersionInfo();
|
updateVersionInfo();
|
||||||
const QString installData = qmakeProperty("QT_INSTALL_PREFIX");
|
m_sourcePath = sourcePath(m_versionInfo);
|
||||||
QString sourcePath = installData;
|
|
||||||
QFile qmakeCache(installData + QLatin1String("/.qmake.cache"));
|
|
||||||
if (qmakeCache.exists()) {
|
|
||||||
qmakeCache.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
||||||
QTextStream stream(&qmakeCache);
|
|
||||||
while (!stream.atEnd()) {
|
|
||||||
QString line = stream.readLine().trimmed();
|
|
||||||
if (line.startsWith(QLatin1String("QT_SOURCE_TREE"))) {
|
|
||||||
sourcePath = line.split(QLatin1Char('=')).at(1).trimmed();
|
|
||||||
if (sourcePath.startsWith(QLatin1String("$$quote("))) {
|
|
||||||
sourcePath.remove(0, 8);
|
|
||||||
sourcePath.chop(1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_sourcePath = FileName::fromUserInput(sourcePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName BaseQtVersion::sourcePath() const
|
FileName BaseQtVersion::sourcePath() const
|
||||||
@@ -1441,6 +1423,29 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &ver
|
|||||||
return mkspecFullPath;
|
return mkspecFullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileName BaseQtVersion::sourcePath(const QHash<QString, QString> &versionInfo)
|
||||||
|
{
|
||||||
|
const QString installData = qmakeProperty(versionInfo, "QT_INSTALL_PREFIX");
|
||||||
|
QString sourcePath = installData;
|
||||||
|
QFile qmakeCache(installData + QLatin1String("/.qmake.cache"));
|
||||||
|
if (qmakeCache.exists()) {
|
||||||
|
qmakeCache.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
QTextStream stream(&qmakeCache);
|
||||||
|
while (!stream.atEnd()) {
|
||||||
|
QString line = stream.readLine().trimmed();
|
||||||
|
if (line.startsWith(QLatin1String("QT_SOURCE_TREE"))) {
|
||||||
|
sourcePath = line.split(QLatin1Char('=')).at(1).trimmed();
|
||||||
|
if (sourcePath.startsWith(QLatin1String("$$quote("))) {
|
||||||
|
sourcePath.remove(0, 8);
|
||||||
|
sourcePath.chop(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FileName::fromUserInput(sourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
bool BaseQtVersion::isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason)
|
bool BaseQtVersion::isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(k, return false);
|
QTC_ASSERT(k, return false);
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ public:
|
|||||||
QHash<QString, QString> *versionInfo, QString *error = 0);
|
QHash<QString, QString> *versionInfo, QString *error = 0);
|
||||||
static Utils::FileName mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo);
|
static Utils::FileName mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo);
|
||||||
static Utils::FileName mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo);
|
static Utils::FileName mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo);
|
||||||
|
static Utils::FileName sourcePath(const QHash<QString, QString> &versionInfo);
|
||||||
|
|
||||||
static bool isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason = 0);
|
static bool isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason = 0);
|
||||||
bool isQmlDebuggingSupported(QString *reason = 0) const;
|
bool isQmlDebuggingSupported(QString *reason = 0) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user