forked from qt-creator/qt-creator
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: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -651,7 +651,7 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|||||||
|
|
||||||
// check if this project is in the source directory:
|
// check if this project is in the source directory:
|
||||||
Utils::FileName projectFilePath = Utils::FileName::fromString(projectPath);
|
Utils::FileName projectFilePath = Utils::FileName::fromString(projectPath);
|
||||||
if (version->isInSourceDirectory(projectFilePath)) {
|
if (version->isSubProject(projectFilePath)) {
|
||||||
// assemble build directory
|
// assemble build directory
|
||||||
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
|
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
|
||||||
QDir qtSourceDir = QDir(version->sourcePath().toString());
|
QDir qtSourceDir = QDir(version->sourcePath().toString());
|
||||||
|
|||||||
@@ -1628,7 +1628,7 @@ bool QmakeProject::matchesKit(const Kit *kit)
|
|||||||
QList<QtSupport::BaseQtVersion *> parentQts;
|
QList<QtSupport::BaseQtVersion *> parentQts;
|
||||||
Utils::FileName filePath = projectFilePath();
|
Utils::FileName filePath = projectFilePath();
|
||||||
foreach (QtSupport::BaseQtVersion *version, QtSupport::QtVersionManager::validVersions()) {
|
foreach (QtSupport::BaseQtVersion *version, QtSupport::QtVersionManager::validVersions()) {
|
||||||
if (version->isInSourceDirectory(filePath))
|
if (version->isSubProject(filePath))
|
||||||
parentQts.append(version);
|
parentQts.append(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1478,16 +1478,27 @@ FileName BaseQtVersion::sourcePath(const QHash<QString, QString> &versionInfo)
|
|||||||
return FileName::fromUserInput(sourcePath);
|
return FileName::fromUserInput(sourcePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseQtVersion::isInSourceDirectory(const Utils::FileName &filePath)
|
bool BaseQtVersion::isSubProject(const Utils::FileName &filePath)
|
||||||
{
|
{
|
||||||
const Utils::FileName &source = sourcePath();
|
const Utils::FileName &source = sourcePath();
|
||||||
if (source.isEmpty())
|
if (!source.isEmpty()) {
|
||||||
return false;
|
|
||||||
QDir dir = QDir(source.toString());
|
QDir dir = QDir(source.toString());
|
||||||
if (dir.dirName() == QLatin1String("qtbase"))
|
if (dir.dirName() == QLatin1String("qtbase"))
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
|
|
||||||
return filePath.isChildOf(dir);
|
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 false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason)
|
bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
virtual Utils::Environment qmakeRunEnvironment() const;
|
virtual Utils::Environment qmakeRunEnvironment() const;
|
||||||
|
|
||||||
virtual Utils::FileName sourcePath() const;
|
virtual Utils::FileName sourcePath() const;
|
||||||
bool isInSourceDirectory(const Utils::FileName &filePath);
|
bool isSubProject(const Utils::FileName &filePath);
|
||||||
|
|
||||||
// used by UiCodeModelSupport
|
// used by UiCodeModelSupport
|
||||||
virtual QString uicCommand() const;
|
virtual QString uicCommand() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user