本文整理汇总了C++中FolderNode::fileNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ FolderNode::fileNodes方法的具体用法?C++ FolderNode::fileNodes怎么用?C++ FolderNode::fileNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FolderNode
的用法示例。
在下文中一共展示了FolderNode::fileNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
void GenericProjectNode::refresh(QSet<QString> oldFileList)
{
if (oldFileList.isEmpty()) {
// Only do this once
FileNode *projectFilesNode = new FileNode(m_project->filesFileName(),
ProjectFileType,
/* generated = */ false);
FileNode *projectIncludesNode = new FileNode(m_project->includesFileName(),
ProjectFileType,
/* generated = */ false);
FileNode *projectConfigNode = new FileNode(m_project->configFileName(),
ProjectFileType,
/* generated = */ false);
addFileNodes(QList<FileNode *>()
<< projectFilesNode
<< projectIncludesNode
<< projectConfigNode,
this);
}
// Do those separately
oldFileList.remove(m_project->filesFileName());
oldFileList.remove(m_project->includesFileName());
oldFileList.remove(m_project->configFileName());
QSet<QString> newFileList = m_project->files().toSet();
newFileList.remove(m_project->filesFileName());
newFileList.remove(m_project->includesFileName());
newFileList.remove(m_project->configFileName());
QSet<QString> removed = oldFileList;
removed.subtract(newFileList);
QSet<QString> added = newFileList;
added.subtract(oldFileList);
QString baseDir = QFileInfo(path()).absolutePath();
QHash<QString, QStringList> filesInPaths = sortFilesIntoPaths(baseDir, added);
foreach (const QString &filePath, filesInPaths.keys()) {
QStringList components = filePath.split(QLatin1Char('/'));
FolderNode *folder = findFolderByName(components, components.size());
if (!folder)
folder = createFolderByName(components, components.size());
QList<FileNode *> fileNodes;
foreach (const QString &file, filesInPaths.value(filePath)) {
FileType fileType = SourceType; // ### FIXME
FileNode *fileNode = new FileNode(file, fileType, /*generated = */ false);
fileNodes.append(fileNode);
}
addFileNodes(fileNodes, folder);
}
filesInPaths = sortFilesIntoPaths(baseDir, removed);
foreach (const QString &filePath, filesInPaths.keys()) {
QStringList components = filePath.split(QLatin1Char('/'));
FolderNode *folder = findFolderByName(components, components.size());
QList<FileNode *> fileNodes;
foreach (const QString &file, filesInPaths.value(filePath)) {
foreach (FileNode *fn, folder->fileNodes())
if (fn->path() == file)
fileNodes.append(fn);
}
removeFileNodes(fileNodes, folder);
}
foreach (FolderNode *fn, subFolderNodes())
removeEmptySubFolders(this, fn);
}