Changeset View
Changeset View
Standalone View
Standalone View
src/abstractfile/abstractfilelisting.cpp
Show All 16 Lines | |||||
17 | 17 | | |||
18 | #include "abstractfilelisting.h" | 18 | #include "abstractfilelisting.h" | ||
19 | 19 | | |||
20 | #include "config-upnp-qt.h" | 20 | #include "config-upnp-qt.h" | ||
21 | 21 | | |||
22 | #include "abstractfile/indexercommon.h" | 22 | #include "abstractfile/indexercommon.h" | ||
23 | 23 | | |||
24 | #include "musicaudiotrack.h" | 24 | #include "musicaudiotrack.h" | ||
25 | #include "notificationitem.h" | | |||
26 | #include "filescanner.h" | 25 | #include "filescanner.h" | ||
27 | 26 | | |||
28 | #include <QThread> | 27 | #include <QThread> | ||
29 | #include <QHash> | 28 | #include <QHash> | ||
30 | #include <QFileInfo> | 29 | #include <QFileInfo> | ||
31 | #include <QFile> | 30 | #include <QFile> | ||
32 | #include <QDir> | 31 | #include <QDir> | ||
33 | #include <QFileSystemWatcher> | 32 | #include <QFileSystemWatcher> | ||
Show All 25 Lines | 46 | public: | |||
59 | QMimeDatabase mMimeDb; | 58 | QMimeDatabase mMimeDb; | ||
60 | 59 | | |||
61 | QHash<QUrl, QDateTime> mAllFiles; | 60 | QHash<QUrl, QDateTime> mAllFiles; | ||
62 | 61 | | |||
63 | QAtomicInt mStopRequest = 0; | 62 | QAtomicInt mStopRequest = 0; | ||
64 | 63 | | |||
65 | int mImportedTracksCount = 0; | 64 | int mImportedTracksCount = 0; | ||
66 | 65 | | |||
67 | int mNotificationUpdateInterval = 1; | | |||
68 | | ||||
69 | int mNewFilesEmitInterval = 1; | 66 | int mNewFilesEmitInterval = 1; | ||
70 | 67 | | |||
71 | bool mHandleNewFiles = true; | 68 | bool mHandleNewFiles = true; | ||
72 | 69 | | |||
73 | bool mWaitEndTrackRemoval = false; | 70 | bool mWaitEndTrackRemoval = false; | ||
74 | 71 | | |||
75 | bool mErrorWatchingFileSystemChanges = false; | 72 | bool mErrorWatchingFileSystemChanges = false; | ||
76 | 73 | | |||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 199 | for (const auto &newFilePath : currentFilesList) { | |||
226 | 223 | | |||
227 | if (newTrack.isValid() && d->mStopRequest == 0) { | 224 | if (newTrack.isValid() && d->mStopRequest == 0) { | ||
228 | addCover(newTrack); | 225 | addCover(newTrack); | ||
229 | 226 | | |||
230 | addFileInDirectory(newTrack.resourceURI(), path); | 227 | addFileInDirectory(newTrack.resourceURI(), path); | ||
231 | newFiles.push_back(newTrack); | 228 | newFiles.push_back(newTrack); | ||
232 | 229 | | |||
233 | ++d->mImportedTracksCount; | 230 | ++d->mImportedTracksCount; | ||
234 | if (d->mImportedTracksCount % d->mNotificationUpdateInterval == 0) { | | |||
235 | d->mNotificationUpdateInterval = std::min(50, 1 + d->mNotificationUpdateInterval * 2); | | |||
236 | } | | |||
237 | 231 | | |||
238 | if (newFiles.size() > d->mNewFilesEmitInterval && d->mStopRequest == 0) { | 232 | if (newFiles.size() > d->mNewFilesEmitInterval && d->mStopRequest == 0) { | ||
239 | d->mNewFilesEmitInterval = std::min(50, 1 + d->mNewFilesEmitInterval * d->mNewFilesEmitInterval); | 233 | d->mNewFilesEmitInterval = std::min(50, 1 + d->mNewFilesEmitInterval * d->mNewFilesEmitInterval); | ||
240 | emitNewFiles(newFiles); | 234 | emitNewFiles(newFiles); | ||
241 | newFiles.clear(); | 235 | newFiles.clear(); | ||
242 | } | 236 | } | ||
243 | } | 237 | } | ||
244 | 238 | | |||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |