diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-08-28 12:23:37 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-09-03 13:15:31 +0000 |
commit | c7e3bbcd118f4b7aec7f56f2e8301d91a418703d (patch) | |
tree | edc69ed3e0265048539c175bd040e1f6ce63cd68 /src/plugins/qbsprojectmanager | |
parent | b4dd2ea2cc29458a4d5e5746da7707f88b81af25 (diff) | |
download | qt-creator-c7e3bbcd118f4b7aec7f56f2e8301d91a418703d.tar.gz |
CppTools: Remove dependency of RawProjectPart to ProjectFile
The feature to category files to ProjectFiles was used by the qmake
project manager to specify if the file is "active", and by the Qbs
project manager to avoid unnecessary MIME type checking.
Make these two different use-cases explicit in the API.
Change-Id: Ia5a7da37f100149366fc75060fe04687e15f2bd3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/qbsprojectmanager')
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsproject.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index b17aaa6835..92f7fa6519 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -45,6 +45,7 @@ #include <coreplugin/vcsmanager.h> #include <cpptools/cppmodelmanager.h> #include <cpptools/cppprojectupdater.h> +#include <cpptools/cpptoolsconstants.h> #include <cpptools/generatedcodemodelsupport.h> #include <extensionsystem/pluginmanager.h> #include <projectexplorer/buildenvironmentwidget.h> @@ -731,22 +732,22 @@ void QbsProject::updateDocuments(const std::set<QString> &files) setExtraProjectFiles(nonBuildDirFilePaths); } -static CppTools::ProjectFile::Kind cppFileType(const qbs::ArtifactData &sourceFile) +static QString getMimeType(const qbs::ArtifactData &sourceFile) { - if (sourceFile.fileTags().contains(QLatin1String("hpp"))) { + if (sourceFile.fileTags().contains("hpp")) { if (CppTools::ProjectFile::isAmbiguousHeader(sourceFile.filePath())) - return CppTools::ProjectFile::AmbiguousHeader; - return CppTools::ProjectFile::CXXHeader; + return CppTools::Constants::AMBIGUOUS_HEADER_MIMETYPE; + return CppTools::Constants::CPP_HEADER_MIMETYPE; } - if (sourceFile.fileTags().contains(QLatin1String("cpp"))) - return CppTools::ProjectFile::CXXSource; - if (sourceFile.fileTags().contains(QLatin1String("c"))) - return CppTools::ProjectFile::CSource; - if (sourceFile.fileTags().contains(QLatin1String("objc"))) - return CppTools::ProjectFile::ObjCSource; - if (sourceFile.fileTags().contains(QLatin1String("objcpp"))) - return CppTools::ProjectFile::ObjCXXSource; - return CppTools::ProjectFile::Unsupported; + if (sourceFile.fileTags().contains("cpp")) + return CppTools::Constants::CPP_SOURCE_MIMETYPE; + if (sourceFile.fileTags().contains("c")) + return CppTools::Constants::C_SOURCE_MIMETYPE; + if (sourceFile.fileTags().contains("objc")) + return CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE; + if (sourceFile.fileTags().contains("objcpp")) + return CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE; + return {}; } static QString groupLocationToCallGroupId(const qbs::CodeLocation &location) @@ -1011,11 +1012,12 @@ void QbsProject::updateCppCodeModel() qCWarning(qbsPmLog) << "Expect problems with code model"; } rpp.setPreCompiledHeaders(Utils::toList(pchFiles)); - rpp.setFiles(grp.allFilePaths(), [filePathToSourceArtifact](const QString &filePath) { - // Keep this lambda thread-safe! - return CppTools::ProjectFile(filePath, - cppFileType(filePathToSourceArtifact.value(filePath))); - }); + rpp.setFiles(grp.allFilePaths(), + {}, + [filePathToSourceArtifact](const QString &filePath) { + // Keep this lambda thread-safe! + return getMimeType(filePathToSourceArtifact.value(filePath)); + }); rpps.append(rpp); |