| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qfileinfogatherer.cpp | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | #include "qfileinfogatherer_p.h" | - | ||||||||||||||||||
| 41 | #include <qdebug.h> | - | ||||||||||||||||||
| 42 | #include <qdiriterator.h> | - | ||||||||||||||||||
| 43 | #ifndef Q_OS_WIN | - | ||||||||||||||||||
| 44 | # include <unistd.h> | - | ||||||||||||||||||
| 45 | # include <sys/types.h> | - | ||||||||||||||||||
| 46 | #endif | - | ||||||||||||||||||
| 47 | #if defined(Q_OS_VXWORKS) | - | ||||||||||||||||||
| 48 | # include "qplatformdefs.h" | - | ||||||||||||||||||
| 49 | #endif | - | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | #ifndef QT_NO_FILESYSTEMMODEL | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | #ifdef QT_BUILD_INTERNAL | - | ||||||||||||||||||
| 56 | static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false); | - | ||||||||||||||||||
| 57 | Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot() | - | ||||||||||||||||||
| 58 | { | - | ||||||||||||||||||
| 59 | fetchedRoot.store(false); | - | ||||||||||||||||||
| 60 | } never executed:  end of block | 0 | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot() | - | ||||||||||||||||||
| 63 | { | - | ||||||||||||||||||
| 64 |     return fetchedRoot.load(); never executed:  return fetchedRoot.load(); | 0 | ||||||||||||||||||
| 65 | } | - | ||||||||||||||||||
| 66 | #endif | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | /*! | - | ||||||||||||||||||
| 69 | Creates thread | - | ||||||||||||||||||
| 70 | */ | - | ||||||||||||||||||
| 71 | QFileInfoGatherer::QFileInfoGatherer(QObject *parent) | - | ||||||||||||||||||
| 72 | : QThread(parent), abort(false), | - | ||||||||||||||||||
| 73 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 74 | watcher(0), | - | ||||||||||||||||||
| 75 | #endif | - | ||||||||||||||||||
| 76 | #ifdef Q_OS_WIN | - | ||||||||||||||||||
| 77 | m_resolveSymlinks(true), | - | ||||||||||||||||||
| 78 | #endif | - | ||||||||||||||||||
| 79 | m_iconProvider(&defaultProvider) | - | ||||||||||||||||||
| 80 | { | - | ||||||||||||||||||
| 81 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 82 | watcher = new QFileSystemWatcher(this); | - | ||||||||||||||||||
| 83 | connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); | - | ||||||||||||||||||
| 84 | connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); | - | ||||||||||||||||||
| 85 | #endif | - | ||||||||||||||||||
| 86 | start(LowPriority); | - | ||||||||||||||||||
| 87 | } never executed:  end of block | 0 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | /*! | - | ||||||||||||||||||
| 90 | Destroys thread | - | ||||||||||||||||||
| 91 | */ | - | ||||||||||||||||||
| 92 | QFileInfoGatherer::~QFileInfoGatherer() | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | abort.store(true); | - | ||||||||||||||||||
| 95 | QMutexLocker locker(&mutex); | - | ||||||||||||||||||
| 96 | condition.wakeAll(); | - | ||||||||||||||||||
| 97 | locker.unlock(); | - | ||||||||||||||||||
| 98 | wait(); | - | ||||||||||||||||||
| 99 | } never executed:  end of block | 0 | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | void QFileInfoGatherer::setResolveSymlinks(bool enable) | - | ||||||||||||||||||
| 102 | { | - | ||||||||||||||||||
| 103 | Q_UNUSED(enable); | - | ||||||||||||||||||
| 104 | #ifdef Q_OS_WIN | - | ||||||||||||||||||
| 105 | m_resolveSymlinks = enable; | - | ||||||||||||||||||
| 106 | #endif | - | ||||||||||||||||||
| 107 | } never executed:  end of block | 0 | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | bool QFileInfoGatherer::resolveSymlinks() const | - | ||||||||||||||||||
| 110 | { | - | ||||||||||||||||||
| 111 | #ifdef Q_OS_WIN | - | ||||||||||||||||||
| 112 | return m_resolveSymlinks; | - | ||||||||||||||||||
| 113 | #else | - | ||||||||||||||||||
| 114 |     return false; never executed:  return false; | 0 | ||||||||||||||||||
| 115 | #endif | - | ||||||||||||||||||
| 116 | } | - | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | void QFileInfoGatherer::setIconProvider(QFileIconProvider *provider) | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | m_iconProvider = provider; | - | ||||||||||||||||||
| 121 | } never executed:  end of block | 0 | ||||||||||||||||||
| 122 | - | |||||||||||||||||||
| 123 | QFileIconProvider *QFileInfoGatherer::iconProvider() const | - | ||||||||||||||||||
| 124 | { | - | ||||||||||||||||||
| 125 |     return m_iconProvider; never executed:  return m_iconProvider; | 0 | ||||||||||||||||||
| 126 | } | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | /*! | - | ||||||||||||||||||
| 129 | Fetch extended information for all \a files in \a path | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | \sa updateFile(), update(), resolvedName() | - | ||||||||||||||||||
| 132 | */ | - | ||||||||||||||||||
| 133 | void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStringList &files) | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | QMutexLocker locker(&mutex); | - | ||||||||||||||||||
| 136 | // See if we already have this dir/file in our queue | - | ||||||||||||||||||
| 137 | int loc = this->path.lastIndexOf(path); | - | ||||||||||||||||||
| 138 |     while (loc > 0)  {
  | 0 | ||||||||||||||||||
| 139 |         if (this->files.at(loc) == files) {
  | 0 | ||||||||||||||||||
| 140 |             return; never executed:  return; | 0 | ||||||||||||||||||
| 141 | } | - | ||||||||||||||||||
| 142 | loc = this->path.lastIndexOf(path, loc - 1); | - | ||||||||||||||||||
| 143 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 144 | this->path.push(path); | - | ||||||||||||||||||
| 145 | this->files.push(files); | - | ||||||||||||||||||
| 146 | condition.wakeAll(); | - | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 149 |     if (files.isEmpty()
  | 0 | ||||||||||||||||||
| 150 |         && !path.isEmpty()
  | 0 | ||||||||||||||||||
| 151 |         && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
  | 0 | ||||||||||||||||||
| 152 |         if (!watcher->directories().contains(path))
  | 0 | ||||||||||||||||||
| 153 |             watcher->addPath(path); never executed:  watcher->addPath(path); | 0 | ||||||||||||||||||
| 154 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 155 | #endif | - | ||||||||||||||||||
| 156 | } never executed:  end of block | 0 | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | /*! | - | ||||||||||||||||||
| 159 | Fetch extended information for all \a filePath | - | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | \sa fetchExtendedInformation() | - | ||||||||||||||||||
| 162 | */ | - | ||||||||||||||||||
| 163 | void QFileInfoGatherer::updateFile(const QString &filePath) | - | ||||||||||||||||||
| 164 | { | - | ||||||||||||||||||
| 165 | QString dir = filePath.mid(0, filePath.lastIndexOf(QDir::separator())); | - | ||||||||||||||||||
| 166 | QString fileName = filePath.mid(dir.length() + 1); | - | ||||||||||||||||||
| 167 | fetchExtendedInformation(dir, QStringList(fileName)); | - | ||||||||||||||||||
| 168 | } never executed:  end of block | 0 | ||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | /* | - | ||||||||||||||||||
| 171 | List all files in \a directoryPath | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | \sa listed() | - | ||||||||||||||||||
| 174 | */ | - | ||||||||||||||||||
| 175 | void QFileInfoGatherer::clear() | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 178 | QMutexLocker locker(&mutex); | - | ||||||||||||||||||
| 179 | watcher->removePaths(watcher->files()); | - | ||||||||||||||||||
| 180 | watcher->removePaths(watcher->directories()); | - | ||||||||||||||||||
| 181 | #endif | - | ||||||||||||||||||
| 182 | } never executed:  end of block | 0 | ||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | /* | - | ||||||||||||||||||
| 185 | Remove a \a path from the watcher | - | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | \sa listed() | - | ||||||||||||||||||
| 188 | */ | - | ||||||||||||||||||
| 189 | void QFileInfoGatherer::removePath(const QString &path) | - | ||||||||||||||||||
| 190 | { | - | ||||||||||||||||||
| 191 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 192 | QMutexLocker locker(&mutex); | - | ||||||||||||||||||
| 193 | watcher->removePath(path); | - | ||||||||||||||||||
| 194 | #else | - | ||||||||||||||||||
| 195 | Q_UNUSED(path); | - | ||||||||||||||||||
| 196 | #endif | - | ||||||||||||||||||
| 197 | } never executed:  end of block | 0 | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | /* | - | ||||||||||||||||||
| 200 | List all files in \a directoryPath | - | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | \sa listed() | - | ||||||||||||||||||
| 203 | */ | - | ||||||||||||||||||
| 204 | void QFileInfoGatherer::list(const QString &directoryPath) | - | ||||||||||||||||||
| 205 | { | - | ||||||||||||||||||
| 206 | fetchExtendedInformation(directoryPath, QStringList()); | - | ||||||||||||||||||
| 207 | } never executed:  end of block | 0 | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | /* | - | ||||||||||||||||||
| 210 | Until aborted wait to fetch a directory or files | - | ||||||||||||||||||
| 211 | */ | - | ||||||||||||||||||
| 212 | void QFileInfoGatherer::run() | - | ||||||||||||||||||
| 213 | { | - | ||||||||||||||||||
| 214 | forever { | - | ||||||||||||||||||
| 215 | QMutexLocker locker(&mutex); | - | ||||||||||||||||||
| 216 |         while (!abort.load() && path.isEmpty())
 
  | 0 | ||||||||||||||||||
| 217 |             condition.wait(&mutex); never executed:  condition.wait(&mutex); | 0 | ||||||||||||||||||
| 218 |         if (abort.load())
  | 0 | ||||||||||||||||||
| 219 |             return; never executed:  return; | 0 | ||||||||||||||||||
| 220 | const QString thisPath = qAsConst(path).front(); | - | ||||||||||||||||||
| 221 | path.pop_front(); | - | ||||||||||||||||||
| 222 | const QStringList thisList = qAsConst(files).front(); | - | ||||||||||||||||||
| 223 | files.pop_front(); | - | ||||||||||||||||||
| 224 | locker.unlock(); | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | getFileInfos(thisPath, thisList); | - | ||||||||||||||||||
| 227 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 228 | } never executed:  end of block | 0 | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const | - | ||||||||||||||||||
| 231 | { | - | ||||||||||||||||||
| 232 | QExtendedInformation info(fileInfo); | - | ||||||||||||||||||
| 233 | info.icon = m_iconProvider->icon(fileInfo); | - | ||||||||||||||||||
| 234 | info.displayType = m_iconProvider->type(fileInfo); | - | ||||||||||||||||||
| 235 | #ifndef QT_NO_FILESYSTEMWATCHER | - | ||||||||||||||||||
| 236 | // ### Not ready to listen all modifications | - | ||||||||||||||||||
| 237 | #if 0 | - | ||||||||||||||||||
| 238 | // Enable the next two commented out lines to get updates when the file sizes change... | - | ||||||||||||||||||
| 239 | if (!fileInfo.exists() && !fileInfo.isSymLink()) { | - | ||||||||||||||||||
| 240 | info.size = -1; | - | ||||||||||||||||||
| 241 | //watcher->removePath(fileInfo.absoluteFilePath()); | - | ||||||||||||||||||
| 242 | } else { | - | ||||||||||||||||||
| 243 | if (!fileInfo.absoluteFilePath().isEmpty() && fileInfo.exists() && fileInfo.isReadable() | - | ||||||||||||||||||
| 244 | && !watcher->files().contains(fileInfo.absoluteFilePath())) { | - | ||||||||||||||||||
| 245 | //watcher->addPath(fileInfo.absoluteFilePath()); | - | ||||||||||||||||||
| 246 | } | - | ||||||||||||||||||
| 247 | } | - | ||||||||||||||||||
| 248 | #endif | - | ||||||||||||||||||
| 249 | #endif | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | #ifdef Q_OS_WIN | - | ||||||||||||||||||
| 252 | if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) { | - | ||||||||||||||||||
| 253 | QFileInfo resolvedInfo(fileInfo.symLinkTarget()); | - | ||||||||||||||||||
| 254 | resolvedInfo = resolvedInfo.canonicalFilePath(); | - | ||||||||||||||||||
| 255 | if (resolvedInfo.exists()) { | - | ||||||||||||||||||
| 256 | emit nameResolved(fileInfo.filePath(), resolvedInfo.fileName()); | - | ||||||||||||||||||
| 257 | } | - | ||||||||||||||||||
| 258 | } | - | ||||||||||||||||||
| 259 | #endif | - | ||||||||||||||||||
| 260 |     return info; never executed:  return info; | 0 | ||||||||||||||||||
| 261 | } | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | static QString translateDriveName(const QFileInfo &drive) | - | ||||||||||||||||||
| 264 | { | - | ||||||||||||||||||
| 265 | QString driveName = drive.absoluteFilePath(); | - | ||||||||||||||||||
| 266 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) | - | ||||||||||||||||||
| 267 | if (driveName.startsWith(QLatin1Char('/'))) // UNC host | - | ||||||||||||||||||
| 268 | return drive.fileName(); | - | ||||||||||||||||||
| 269 | if (driveName.endsWith(QLatin1Char('/'))) | - | ||||||||||||||||||
| 270 | driveName.chop(1); | - | ||||||||||||||||||
| 271 | #endif | - | ||||||||||||||||||
| 272 |     return driveName; never executed:  return driveName; | 0 | ||||||||||||||||||
| 273 | } | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | /* | - | ||||||||||||||||||
| 276 | Get specific file info's, batch the files so update when we have 100 | - | ||||||||||||||||||
| 277 | items and every 200ms after that | - | ||||||||||||||||||
| 278 | */ | - | ||||||||||||||||||
| 279 | void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &files) | - | ||||||||||||||||||
| 280 | { | - | ||||||||||||||||||
| 281 | // List drives | - | ||||||||||||||||||
| 282 |     if (path.isEmpty()) {
  | 0 | ||||||||||||||||||
| 283 | #ifdef QT_BUILD_INTERNAL | - | ||||||||||||||||||
| 284 | fetchedRoot.store(true); | - | ||||||||||||||||||
| 285 | #endif | - | ||||||||||||||||||
| 286 | QFileInfoList infoList; | - | ||||||||||||||||||
| 287 |         if (files.isEmpty()) {
  | 0 | ||||||||||||||||||
| 288 | infoList = QDir::drives(); | - | ||||||||||||||||||
| 289 |         } else { never executed:  end of block | 0 | ||||||||||||||||||
| 290 | infoList.reserve(files.count()); | - | ||||||||||||||||||
| 291 | for (const auto &file : files) | - | ||||||||||||||||||
| 292 |                 infoList << QFileInfo(file); never executed:  infoList << QFileInfo(file); | 0 | ||||||||||||||||||
| 293 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 294 |         for (int i = infoList.count() - 1; i >= 0; --i) {
  | 0 | ||||||||||||||||||
| 295 | QString driveName = translateDriveName(infoList.at(i)); | - | ||||||||||||||||||
| 296 | QVector<QPair<QString,QFileInfo> > updatedFiles; | - | ||||||||||||||||||
| 297 | updatedFiles.append(QPair<QString,QFileInfo>(driveName, infoList.at(i))); | - | ||||||||||||||||||
| 298 | emit updates(path, updatedFiles); | - | ||||||||||||||||||
| 299 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 300 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 301 | } | - | ||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | QElapsedTimer base; | - | ||||||||||||||||||
| 304 | base.start(); | - | ||||||||||||||||||
| 305 | QFileInfo fileInfo; | - | ||||||||||||||||||
| 306 | bool firstTime = true; | - | ||||||||||||||||||
| 307 | QVector<QPair<QString, QFileInfo> > updatedFiles; | - | ||||||||||||||||||
| 308 | QStringList filesToCheck = files; | - | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | QString itPath = QDir::fromNativeSeparators(files.isEmpty() ? path : QLatin1String("")); | - | ||||||||||||||||||
| 311 | QDirIterator dirIt(itPath, QDir::AllEntries | QDir::System | QDir::Hidden); | - | ||||||||||||||||||
| 312 | QStringList allFiles; | - | ||||||||||||||||||
| 313 |     while (!abort.load() && dirIt.hasNext()) {
 
  | 0 | ||||||||||||||||||
| 314 | dirIt.next(); | - | ||||||||||||||||||
| 315 | fileInfo = dirIt.fileInfo(); | - | ||||||||||||||||||
| 316 | allFiles.append(fileInfo.fileName()); | - | ||||||||||||||||||
| 317 | fetch(fileInfo, base, firstTime, updatedFiles, path); | - | ||||||||||||||||||
| 318 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 319 |     if (!allFiles.isEmpty())
  | 0 | ||||||||||||||||||
| 320 |         emit newListOfFiles(path, allFiles); never executed:  newListOfFiles(path, allFiles); | 0 | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | QStringList::const_iterator filesIt = filesToCheck.constBegin(); | - | ||||||||||||||||||
| 323 |     while (!abort.load() && filesIt != filesToCheck.constEnd()) {
 
  | 0 | ||||||||||||||||||
| 324 | fileInfo.setFile(path + QDir::separator() + *filesIt); | - | ||||||||||||||||||
| 325 | ++filesIt; | - | ||||||||||||||||||
| 326 | fetch(fileInfo, base, firstTime, updatedFiles, path); | - | ||||||||||||||||||
| 327 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 328 |     if (!updatedFiles.isEmpty())
  | 0 | ||||||||||||||||||
| 329 |         emit updates(path, updatedFiles); never executed:  updates(path, updatedFiles); | 0 | ||||||||||||||||||
| 330 | emit directoryLoaded(path); | - | ||||||||||||||||||
| 331 | } never executed:  end of block | 0 | ||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { | - | ||||||||||||||||||
| 334 | updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo)); | - | ||||||||||||||||||
| 335 | QElapsedTimer current; | - | ||||||||||||||||||
| 336 | current.start(); | - | ||||||||||||||||||
| 337 |     if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) {
 
 
  | 0 | ||||||||||||||||||
| 338 | emit updates(path, updatedFiles); | - | ||||||||||||||||||
| 339 | updatedFiles.clear(); | - | ||||||||||||||||||
| 340 | base = current; | - | ||||||||||||||||||
| 341 | firstTime = false; | - | ||||||||||||||||||
| 342 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 343 | } never executed:  end of block | 0 | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | #endif // QT_NO_FILESYSTEMMODEL | - | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | #include "moc_qfileinfogatherer_p.cpp" | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |