本文整理汇总了C++中Folder::recursive方法的典型用法代码示例。如果您正苦于以下问题:C++ Folder::recursive方法的具体用法?C++ Folder::recursive怎么用?C++ Folder::recursive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::recursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testIfFolderIsAddable
void FileSystemScanner::testIfFolderIsAddable(QDir* dir, bool recursive) const throw(EngineException*)
{
tracer->sinvoked(__func__) << dir->absPath() << ", recursive: " << recursive << "..." << endl;
// test if the given folder is already added
Folder* folder;
for (folder = m_engine->sourceDirs()->first(); folder; folder = m_engine->sourceDirs()->next() ) {
if (*(folder->dir()) == *dir) {
QString detailMsg = QString(i18n("The folder you have chosen is already added to KPhotoBook.\n"
"Folder: %1")).arg(folder->dir()->absPath());
throw new EngineException(
i18n("You cannot add the same folder more than once to KPhotoBook."),
detailMsg
);
}
QString folderPath = folder->dir()->absPath();
QString newFolderPath = dir->absPath();
if (folder->recursive()) {
// test if the new folder is a subfolder of the current sourceFolder
if (newFolderPath.startsWith(folderPath)) {
QString detailMsg = QString(i18n("The folder you have chosen is a subfolder of a recursively added folder.\n"
"Folder: %1\nNew folder: %2")).arg(folderPath).arg(newFolderPath);
throw new EngineException(
i18n("You cannot add a folder which is a subfolder of an already recursively added folder because"
"the chosen folder is already added implicitely."),
detailMsg
);
}
}
if (recursive) {
// test if the current folder is a subfolder of the new folder
if (folderPath.startsWith(newFolderPath)) {
QString detailMsg = QString(i18n("The folder you have chosen to add recursively is the parentfolder of at least "
"one already added folders.\nFolder: %1\nNew folder: %2")).arg(folderPath).arg(newFolderPath);
throw new EngineException(
i18n("You cannot add the parentfolder of an already added folder recursively."),
detailMsg
);
}
}
}
tracer->debug(__func__, "ended");
}
示例2: rescanFolders
void FileSystemScanner::rescanFolders(QPtrList<Folder>* folders, bool forceEXIF, bool fast)
{
Folder* folder = 0;
for (folder = folders->first(); folder; folder = folders->next()) {
QString currentFolderPath = folder->dir()->absPath();
tracer->sdebug(__func__) << "rescanning folder: " << folder->id() << ": " << currentFolderPath << endl;
if (folder->dir()->exists()) {
folder->setFound(true);
if (!fast) {
rescanFolder(folder, forceEXIF);
if (m_cancel) {
return;
}
}
if (folder->children() && folder->children()->count()) {
rescanFolders(folder->children(), forceEXIF, fast);
}
// scan the filesystem for new folders
if (!fast && folder->recursive()) {
delete m_loopDetectionHelper;
m_loopDetectionHelper = new QPtrList<QString>;
m_loopDetectionHelper->setAutoDelete(true);
m_loopDetectionHelper->append(new QString(folder->dir()->canonicalPath()));
addFolders(folder);
}
} else {
folder->setFound(false);
tracer->sdebug(__func__) << "folder: " << folder->id() << ": '" << currentFolderPath << "' not found" << endl;
emit(progress_folderNotFound(currentFolderPath));
}
}
}