Commit 92fbbaea authored by Daniel Teske's avatar Daniel Teske

BaseQtVersion: Rename isInSourceDirectory to isSubProject and fix it

The source and examples directory is not a sub directory of the qt
source directory in the sdks. But we still want to treat it as part
of a the matching qt.

Task-number: QTCREATORBUG-13469
Change-Id: Ib63722052a14c29e4198c879dd770fb4ecdcdb80
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 9b5f558b
......@@ -651,7 +651,7 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
// check if this project is in the source directory:
Utils::FileName projectFilePath = Utils::FileName::fromString(projectPath);
if (version->isInSourceDirectory(projectFilePath)) {
if (version->isSubProject(projectFilePath)) {
// assemble build directory
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
QDir qtSourceDir = QDir(version->sourcePath().toString());
......
......@@ -1628,7 +1628,7 @@ bool QmakeProject::matchesKit(const Kit *kit)
QList<QtSupport::BaseQtVersion *> parentQts;
Utils::FileName filePath = projectFilePath();
foreach (QtSupport::BaseQtVersion *version, QtSupport::QtVersionManager::validVersions()) {
if (version->isInSourceDirectory(filePath))
if (version->isSubProject(filePath))
parentQts.append(version);
}
......
......@@ -1478,16 +1478,27 @@ FileName BaseQtVersion::sourcePath(const QHash<QString, QString> &versionInfo)
return FileName::fromUserInput(sourcePath);
}
bool BaseQtVersion::isInSourceDirectory(const Utils::FileName &filePath)
bool BaseQtVersion::isSubProject(const Utils::FileName &filePath)
{
const Utils::FileName &source = sourcePath();
if (source.isEmpty())
return false;
QDir dir = QDir(source.toString());
if (dir.dirName() == QLatin1String("qtbase"))
dir.cdUp();
if (!source.isEmpty()) {
QDir dir = QDir(source.toString());
if (dir.dirName() == QLatin1String("qtbase"))
dir.cdUp();
if (filePath.isChildOf(dir))
return true;
}
const QString &examples = examplesPath();
if (!examples.isEmpty() && filePath.isChildOf(QDir(examples)))
return true;
const QString &demos = demosPath();
if (!demos.isEmpty() && filePath.isChildOf(QDir(demos)))
return true;
return filePath.isChildOf(dir);
return false;
}
bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason)
......
......@@ -124,7 +124,7 @@ public:
virtual Utils::Environment qmakeRunEnvironment() const;
virtual Utils::FileName sourcePath() const;
bool isInSourceDirectory(const Utils::FileName &filePath);
bool isSubProject(const Utils::FileName &filePath);
// used by UiCodeModelSupport
virtual QString uicCommand() const;
......
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