MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / scanFS

Method scanFS

src/board/UBFeaturesController.cpp:67–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66
67void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet)
68{
69// Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
70// if(QFileInfo(currentPath.toLocalFile()).exists())
71// return;
72
73 QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
74
75 QFileInfoList::iterator fileInfo;
76 for ( fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end(); fileInfo += 1) {
77 if (abort) {
78 return;
79 }
80
81 QString fullFileName = fileInfo->absoluteFilePath();
82 UBFeatureElementType featureType = UBFeaturesController::fileTypeFromUrl(fullFileName);
83 QString fileName = fileInfo->fileName();
84
85 QImage icon = UBFeaturesController::getIcon(fullFileName, featureType);
86
87 if ( fullFileName.contains(".thumbnail."))
88 continue;
89
90 UBFeature testFeature(currVirtualPath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType);
91
92 emit sendFeature(testFeature);
93 emit featureSent();
94 emit scanPath(fullFileName);
95
96 if ( pFavoriteSet.find(QUrl::fromLocalFile(fullFileName)) != pFavoriteSet.end()) {
97 //TODO send favoritePath from the controller or make favoritePath public and static
98 emit sendFeature(UBFeature( UBFeaturesController::favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType));
99 }
100
101 if (featureType == FEATURE_FOLDER) {
102 scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName, pFavoriteSet);
103 }
104 }
105}
106
107void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, UBFeature> > pScanningData, const QSet<QUrl> &pFavoriteSet)
108{

Callers

nothing calls this directly

Calls 8

UBFeatureClass · 0.85
allToolsMethod · 0.80
setIsInFavoristeListMethod · 0.80
containsMethod · 0.45
clearMethod · 0.45
nameMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected