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