diff options
author | hjk <hjk@qt.io> | 2019-05-28 13:49:26 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-05-28 12:23:26 +0000 |
commit | 473a741c9fcf09febba312464fab8385e2351181 (patch) | |
tree | 2d328a090993cb5c5fd34b43e9468bcbf7e4d4d0 /src/plugins/compilationdatabaseprojectmanager | |
parent | 4704f49fbb1201ebf10ab9dbaed0275ff25faba8 (diff) |
Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.
Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/compilationdatabaseprojectmanager')
5 files changed, 33 insertions, 33 deletions
diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index cf28412282f..94bc8b40a72 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -132,7 +132,7 @@ ToolChain *toolchainFromFlags(const Kit *kit, const QStringList &flags, const Co return ToolChainKitAspect::toolChain(kit, language); // Try exact compiler match. - const Utils::FileName compiler = Utils::FileName::fromString(compilerPath(flags.front())); + const Utils::FilePath compiler = Utils::FilePath::fromString(compilerPath(flags.front())); ToolChain *toolchain = ToolChainManager::toolChain([&compiler, &language](const ToolChain *tc) { return tc->isValid() && tc->language() == language && tc->compilerCommand() == compiler; }); @@ -168,11 +168,11 @@ void addDriverModeFlagIfNeeded(const ToolChain *toolchain, } } -CppTools::RawProjectPart makeRawProjectPart(const Utils::FileName &projectFile, +CppTools::RawProjectPart makeRawProjectPart(const Utils::FilePath &projectFile, Kit *kit, CppTools::KitInfo &kitInfo, const QString &workingDir, - const Utils::FileName &fileName, + const Utils::FilePath &fileName, QStringList flags) { HeaderPaths headerPaths; @@ -220,7 +220,7 @@ CppTools::RawProjectPart makeRawProjectPart(const Utils::FileName &projectFile, return rpp; } -QStringList relativeDirsList(Utils::FileName currentPath, const Utils::FileName &rootPath) +QStringList relativeDirsList(Utils::FilePath currentPath, const Utils::FilePath &rootPath) { QStringList dirsList; while (!currentPath.isEmpty() && currentPath != rootPath) { @@ -235,7 +235,7 @@ QStringList relativeDirsList(Utils::FileName currentPath, const Utils::FileName FolderNode *addChildFolderNode(FolderNode *parent, const QString &childName) { - const Utils::FileName path = parent->filePath().pathAppended(childName); + const Utils::FilePath path = parent->filePath().pathAppended(childName); auto node = std::make_unique<FolderNode>(path); FolderNode *childNode = node.get(); childNode->setDisplayName(childName); @@ -256,7 +256,7 @@ FolderNode *addOrGetChildFolderNode(FolderNode *parent, const QString &childName } // Return the node for folderPath. -FolderNode *createFoldersIfNeeded(FolderNode *root, const Utils::FileName &folderPath) +FolderNode *createFoldersIfNeeded(FolderNode *root, const Utils::FilePath &folderPath) { const QStringList dirsList = relativeDirsList(folderPath, root->filePath()); @@ -275,7 +275,7 @@ FileType fileTypeForName(const QString &fileName) return FileType::Source; } -void addChild(FolderNode *root, const Utils::FileName &fileName) +void addChild(FolderNode *root, const Utils::FilePath &fileName) { FolderNode *parentNode = createFoldersIfNeeded(root, fileName.parentDir()); if (!parentNode->fileNode(fileName)) { @@ -285,7 +285,7 @@ void addChild(FolderNode *root, const Utils::FileName &fileName) } void createTree(std::unique_ptr<ProjectNode> &root, - const Utils::FileName &rootPath, + const Utils::FilePath &rootPath, const CppTools::RawProjectParts &rpps, const QList<FileNode *> &scannedFiles = QList<FileNode *>()) { @@ -294,12 +294,12 @@ void createTree(std::unique_ptr<ProjectNode> &root, for (const CppTools::RawProjectPart &rpp : rpps) { for (const QString &filePath : rpp.files) { - Utils::FileName fileName = Utils::FileName::fromString(filePath); + Utils::FilePath fileName = Utils::FilePath::fromString(filePath); if (!fileName.isChildOf(rootPath)) { - if (fileName.isChildOf(Utils::FileName::fromString(rpp.buildSystemTarget))) { + if (fileName.isChildOf(Utils::FilePath::fromString(rpp.buildSystemTarget))) { if (!secondRoot) secondRoot = std::make_unique<ProjectNode>( - Utils::FileName::fromString(rpp.buildSystemTarget)); + Utils::FilePath::fromString(rpp.buildSystemTarget)); addChild(secondRoot.get(), fileName); } } else { @@ -312,7 +312,7 @@ void createTree(std::unique_ptr<ProjectNode> &root, if (node->fileType() != FileType::Header) continue; - const Utils::FileName fileName = node->filePath(); + const Utils::FilePath fileName = node->filePath(); if (!fileName.isChildOf(rootPath)) continue; FolderNode *parentNode = createFoldersIfNeeded(root.get(), fileName.parentDir()); @@ -367,7 +367,7 @@ void CompilationDatabaseProject::buildTreeAndProjectParts() } if (!dbContents.extras.empty()) { - const Utils::FileName baseDir = projectFilePath().parentDir(); + const Utils::FilePath baseDir = projectFilePath().parentDir(); QStringList extraFiles; for (const QString &extra : dbContents.extras) @@ -385,7 +385,7 @@ void CompilationDatabaseProject::buildTreeAndProjectParts() root->addNode(std::make_unique<FileNode>(projectFilePath(), FileType::Project)); if (QFile::exists(dbContents.extraFileName)) - root->addNode(std::make_unique<FileNode>(Utils::FileName::fromString(dbContents.extraFileName), + root->addNode(std::make_unique<FileNode>(Utils::FilePath::fromString(dbContents.extraFileName), FileType::Project)); setRootProjectNode(std::move(root)); @@ -393,7 +393,7 @@ void CompilationDatabaseProject::buildTreeAndProjectParts() m_cppCodeModelUpdater->update({this, kitInfo, rpps}); } -CompilationDatabaseProject::CompilationDatabaseProject(const Utils::FileName &projectFile) +CompilationDatabaseProject::CompilationDatabaseProject(const Utils::FilePath &projectFile) : Project(Constants::COMPILATIONDATABASEMIMETYPE, projectFile) , m_cppCodeModelUpdater(std::make_unique<CppTools::CppProjectUpdater>()) , m_parseDelay(new QTimer(this)) @@ -425,10 +425,10 @@ CompilationDatabaseProject::CompilationDatabaseProject(const Utils::FileName &pr m_parseDelay->setInterval(1000); } -Utils::FileName CompilationDatabaseProject::rootPathFromSettings() const +Utils::FilePath CompilationDatabaseProject::rootPathFromSettings() const { #ifdef WITH_TESTS - return Utils::FileName::fromString(projectDirectory().fileName()); + return Utils::FilePath::fromString(projectDirectory().fileName()); #else return Utils::FileName::fromString( namedSettings(ProjectExplorer::Constants::PROJECT_ROOT_PATH_KEY).toString()); @@ -440,7 +440,7 @@ Project::RestoreResult CompilationDatabaseProject::fromMap(const QVariantMap &ma { Project::RestoreResult result = Project::fromMap(map, errorMessage); if (result == Project::RestoreResult::Ok) { - const Utils::FileName rootPath = rootPathFromSettings(); + const Utils::FilePath rootPath = rootPathFromSettings(); if (rootPath.isEmpty()) changeRootProjectDirectory(); // This triggers reparse itself. else diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h index 54ca07a2e3f..376ebcc63bb 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h @@ -55,7 +55,7 @@ class CompilationDatabaseProject : public ProjectExplorer::Project Q_OBJECT public: - explicit CompilationDatabaseProject(const Utils::FileName &filename); + explicit CompilationDatabaseProject(const Utils::FilePath &filename); ~CompilationDatabaseProject() override; bool needsConfiguration() const override { return false; } bool needsBuildConfigurations() const override { return true; } @@ -65,7 +65,7 @@ private: void reparseProject(); void buildTreeAndProjectParts(); - Utils::FileName rootPathFromSettings() const; + Utils::FilePath rootPathFromSettings() const; QFutureWatcher<void> m_parserWatcher; std::unique_ptr<CppTools::CppProjectUpdater> m_cppCodeModelUpdater; diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h index c1686fce0ff..d2c062e7c3b 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h @@ -44,7 +44,7 @@ namespace Internal { class DbEntry { public: QStringList flags; - Utils::FileName fileName; + Utils::FilePath fileName; QString workingDir; }; diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp index f36eec46e5e..d75bf7be404 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp @@ -43,8 +43,8 @@ using namespace Utils; namespace CompilationDatabaseProjectManager { namespace Internal { -CompilationDbParser::CompilationDbParser(const QString &projectName, const FileName &projectPath, - const FileName &rootPath, MimeBinaryCache &mimeBinaryCache, +CompilationDbParser::CompilationDbParser(const QString &projectName, const FilePath &projectPath, + const FilePath &rootPath, MimeBinaryCache &mimeBinaryCache, QObject *parent) : QObject(parent), m_projectName(projectName), @@ -64,7 +64,7 @@ void CompilationDbParser::start() // Thread 1: Scan disk. if (!m_rootPath.isEmpty()) { m_treeScanner = new TreeScanner(this); - m_treeScanner->setFilter([this](const MimeType &mimeType, const FileName &fn) { + m_treeScanner->setFilter([this](const MimeType &mimeType, const FilePath &fn) { // Mime checks requires more resources, so keep it last in check list bool isIgnored = fn.toString().startsWith(m_projectFilePath.toString() + ".user") || TreeScanner::isWellKnownBinary(mimeType, fn); @@ -82,7 +82,7 @@ void CompilationDbParser::start() return isIgnored; }); - m_treeScanner->setTypeFactory([](const Utils::MimeType &mimeType, const Utils::FileName &fn) { + m_treeScanner->setTypeFactory([](const Utils::MimeType &mimeType, const Utils::FilePath &fn) { return TreeScanner::genericFileType(mimeType, fn); }); m_treeScanner->asyncScanForFiles(m_rootPath); @@ -144,12 +144,12 @@ static QStringList jsonObjectFlags(const QJsonObject &object, QSet<QString> &fla return flags; } -static FileName jsonObjectFilename(const QJsonObject &object) +static FilePath jsonObjectFilename(const QJsonObject &object) { const QString workingDir = QDir::fromNativeSeparators(object["directory"].toString()); - FileName fileName = FileName::fromString(QDir::fromNativeSeparators(object["file"].toString())); + FilePath fileName = FilePath::fromString(QDir::fromNativeSeparators(object["file"].toString())); if (fileName.toFileInfo().isRelative()) - fileName = FileName::fromString(workingDir + "/" + fileName.toString()).canonicalPath(); + fileName = FilePath::fromString(workingDir + "/" + fileName.toString()).canonicalPath(); return fileName; } @@ -175,7 +175,7 @@ static std::vector<DbEntry> readJsonObjects(const QString &filePath) } const QJsonObject object = document.object(); - const Utils::FileName fileName = jsonObjectFilename(object); + const Utils::FilePath fileName = jsonObjectFilename(object); const QStringList flags = filterFromFileName(jsonObjectFlags(object, flagsCache), fileName.toFileInfo().baseName()); result.push_back({flags, fileName, object["directory"].toString()}); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.h b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.h index 571f38d3692..ded713d5904 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.h @@ -48,8 +48,8 @@ class CompilationDbParser : public QObject { Q_OBJECT public: - explicit CompilationDbParser(const QString &projectName, const Utils::FileName &projectPath, - const Utils::FileName &rootPath, MimeBinaryCache &mimeBinaryCache, + explicit CompilationDbParser(const QString &projectName, const Utils::FilePath &projectPath, + const Utils::FilePath &rootPath, MimeBinaryCache &mimeBinaryCache, QObject *parent = nullptr); void start(); @@ -66,8 +66,8 @@ private: DbContents parseProject(); const QString m_projectName; - const Utils::FileName m_projectFilePath; - const Utils::FileName m_rootPath; + const Utils::FilePath m_projectFilePath; + const Utils::FilePath m_rootPath; MimeBinaryCache &m_mimeBinaryCache; ProjectExplorer::TreeScanner *m_treeScanner = nullptr; QFutureWatcher<DbContents> m_parserWatcher; |