summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppprojectfilecategorizer.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-08-28 12:23:37 +0200
committerEike Ziller <eike.ziller@qt.io>2019-09-03 13:15:31 +0000
commitc7e3bbcd118f4b7aec7f56f2e8301d91a418703d (patch)
treeedc69ed3e0265048539c175bd040e1f6ce63cd68 /src/plugins/cpptools/cppprojectfilecategorizer.cpp
parentb4dd2ea2cc29458a4d5e5746da7707f88b81af25 (diff)
downloadqt-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/cpptools/cppprojectfilecategorizer.cpp')
-rw-r--r--src/plugins/cpptools/cppprojectfilecategorizer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppprojectfilecategorizer.cpp b/src/plugins/cpptools/cppprojectfilecategorizer.cpp
index 35ec2d9263..036022bb43 100644
--- a/src/plugins/cpptools/cppprojectfilecategorizer.cpp
+++ b/src/plugins/cpptools/cppprojectfilecategorizer.cpp
@@ -31,10 +31,11 @@ namespace CppTools {
ProjectFileCategorizer::ProjectFileCategorizer(const QString &projectPartName,
const QStringList &filePaths,
- const FileClassifier &fileClassifier)
+ const FileIsActive &fileIsActive,
+ const GetMimeType &getMimeType)
: m_partName(projectPartName)
{
- const ProjectFiles ambiguousHeaders = classifyFiles(filePaths, fileClassifier);
+ const ProjectFiles ambiguousHeaders = classifyFiles(filePaths, fileIsActive, getMimeType);
expandSourcesWithAmbiguousHeaders(ambiguousHeaders);
m_partCount = (m_cSources.isEmpty() ? 0 : 1)
@@ -53,14 +54,17 @@ QString ProjectFileCategorizer::partName(const QString &languageName) const
}
ProjectFiles ProjectFileCategorizer::classifyFiles(const QStringList &filePaths,
- const FileClassifier &fileClassifier)
+ const FileIsActive &fileIsActive,
+ const GetMimeType &getMimeType)
{
ProjectFiles ambiguousHeaders;
foreach (const QString &filePath, filePaths) {
- const ProjectFile projectFile = fileClassifier
- ? fileClassifier(filePath)
- : ProjectFile(filePath, ProjectFile::classify(filePath));
+ const ProjectFile projectFile(filePath,
+ getMimeType
+ ? ProjectFile::classifyByMimeType(getMimeType(filePath))
+ : ProjectFile::classify(filePath),
+ fileIsActive ? fileIsActive(filePath) : true);
switch (projectFile.kind) {
case ProjectFile::AmbiguousHeader: