Commit 7a9a1b04 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

ProjectExplorer: Use FileName in NodesVisitor



Change-Id: Ia02b4dc64b343664b5d47fe3743fbdd0782da121
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent ff1fbb2b
......@@ -76,7 +76,7 @@ using namespace ProjectExplorer;
Searches the first node that has the given file as its path.
*/
FindNodesForFileVisitor::FindNodesForFileVisitor(const QString &fileToSearch)
FindNodesForFileVisitor::FindNodesForFileVisitor(const Utils::FileName &fileToSearch)
: m_path(fileToSearch)
{
}
......@@ -93,10 +93,10 @@ void FindNodesForFileVisitor::visitProjectNode(ProjectNode *node)
void FindNodesForFileVisitor::visitFolderNode(FolderNode *node)
{
if (node->path().toString() == m_path)
if (node->path() == m_path)
m_nodes << node;
foreach (FileNode *fileNode, node->fileNodes()) {
if (fileNode->path().toString() == m_path)
if (fileNode->path() == m_path)
m_nodes << fileNode;
}
}
......@@ -112,7 +112,7 @@ void FindNodesForFileVisitor::visitSessionNode(SessionNode *node)
Collects file information from all sub file nodes.
*/
QStringList FindAllFilesVisitor::filePaths() const
Utils::FileNameList FindAllFilesVisitor::filePaths() const
{
return m_filePaths;
}
......@@ -124,7 +124,7 @@ void FindAllFilesVisitor::visitProjectNode(ProjectNode *projectNode)
void FindAllFilesVisitor::visitFolderNode(FolderNode *folderNode)
{
m_filePaths.append(folderNode->path().toString());
m_filePaths.append(folderNode->path());
foreach (const FileNode *fileNode, folderNode->fileNodes())
m_filePaths.append(fileNode->path().toString());
m_filePaths.append(fileNode->path());
}
......@@ -33,6 +33,8 @@
#include "projectexplorer_export.h"
#include <utils/fileutils.h>
#include <QStringList>
namespace ProjectExplorer {
......@@ -58,7 +60,7 @@ protected:
class PROJECTEXPLORER_EXPORT FindNodesForFileVisitor : public NodesVisitor {
public:
FindNodesForFileVisitor(const QString &fileToSearch);
FindNodesForFileVisitor(const Utils::FileName &fileToSearch);
QList<Node*> nodes() const;
......@@ -66,18 +68,18 @@ public:
void visitFolderNode(FolderNode *node);
void visitSessionNode(SessionNode *node);
private:
QString m_path;
Utils::FileName m_path;
QList<Node*> m_nodes;
};
class PROJECTEXPLORER_EXPORT FindAllFilesVisitor : public NodesVisitor {
public:
QStringList filePaths() const;
Utils::FileNameList filePaths() const;
void visitProjectNode(ProjectNode *projectNode);
void visitFolderNode(FolderNode *folderNode);
private:
QStringList m_filePaths;
Utils::FileNameList m_filePaths;
};
} // namespace ProjectExplorer
......
......@@ -540,7 +540,7 @@ QList<Project *> SessionManager::projectOrder(Project *project)
QList<Node *> SessionManager::nodesForFile(const Utils::FileName &fileName)
{
FindNodesForFileVisitor findNodes(fileName.toString());
FindNodesForFileVisitor findNodes(fileName);
sessionNode()->accept(&findNodes);
return findNodes.nodes();
}
......
......@@ -995,11 +995,11 @@ bool QmakePriFileNode::addSubProjects(const QStringList &proFilePaths)
{
FindAllFilesVisitor visitor;
accept(&visitor);
const QStringList &allFiles = visitor.filePaths();
const FileNameList &allFiles = visitor.filePaths();
QStringList uniqueProFilePaths;
foreach (const QString &proFile, proFilePaths)
if (!allFiles.contains(proFile))
if (!allFiles.contains(FileName::fromString(proFile)))
uniqueProFilePaths.append(simplifyProFilePath(proFile));
QStringList failedFiles;
......@@ -1030,7 +1030,7 @@ bool QmakePriFileNode::addFiles(const QStringList &filePaths, QStringList *notAd
FindAllFilesVisitor visitor;
accept(&visitor);
const QStringList &allFiles = visitor.filePaths();
const FileNameList &allFiles = visitor.filePaths();
typedef QMap<QString, QStringList> TypeFileMap;
// Split into lists by file type and bulk-add them.
......@@ -1056,13 +1056,13 @@ bool QmakePriFileNode::addFiles(const QStringList &filePaths, QStringList *notAd
QStringList uniqueQrcFiles;
foreach (const QString &file, qrcFiles) {
if (!allFiles.contains(file))
if (!allFiles.contains(FileName::fromString(file)))
uniqueQrcFiles.append(file);
}
QStringList uniqueFilePaths;
foreach (const QString &file, typeFiles) {
if (!allFiles.contains(file))
if (!allFiles.contains(FileName::fromString(file)))
uniqueFilePaths.append(file);
}
......
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