| 252 | } |
| 253 | |
| 254 | bool ScanFilesThread::doScan(const QString &path, QDir::Filters filters) { |
| 255 | QString myPath = QFileInfo(path).absoluteFilePath(); |
| 256 | |
| 257 | if (!QDir().exists(myPath)) return false; |
| 258 | |
| 259 | QString myCPath = QDir(path).canonicalPath(); |
| 260 | |
| 261 | if (visited.contains(myCPath)) return true; |
| 262 | |
| 263 | visited << myCPath; |
| 264 | |
| 265 | emit folderChange(myPath); |
| 266 | |
| 267 | QFileInfoList list = QDir(myPath).entryInfoList(scanFilters, filters); |
| 268 | |
| 269 | for (QFileInfoList::iterator p = list.begin(); p != list.end(); p++) { |
| 270 | if (abort) return false; |
| 271 | |
| 272 | if ((*p).isDir() && ((*p).absoluteFilePath() != myPath)) { |
| 273 | if (!doScan((*p).absoluteFilePath(), filters)) return false; |
| 274 | } else { |
| 275 | if (!QFile::exists((*p).absoluteFilePath())) continue; |
| 276 | |
| 277 | bool subtitleFileFound = false; |
| 278 | if (skipIfSubtitlesExists) { |
| 279 | foreach (QString subExt, staticConfig->subtitleExtensions()) { |
| 280 | if (QFile::exists((*p).absolutePath() + "/" + |
| 281 | (*p).completeBaseName() + "." + subExt)) { |
| 282 | subtitleFileFound = true; |
| 283 | break; |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | if (subtitleFileFound) { |
| 289 | continue; |
| 290 | } |
| 291 | |
| 292 | bool skip = false; |
| 293 | for (QStringList::iterator s = skipFilters.begin(); |
| 294 | s != skipFilters.end(); s++) { |
| 295 | if ((*s).isEmpty()) continue; |
| 296 | if ((*p).fileName().indexOf(*s) >= 0) { |
| 297 | skip = true; |
| 298 | break; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | if (skip) continue; |
| 303 | |
| 304 | fileList << (*p).absoluteFilePath(); |
| 305 | emit addFile((*p).absoluteFilePath()); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | return true; |
| 310 | } |
nothing calls this directly
no outgoing calls
no test coverage detected