Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/private/kdirectorycontentscounter.h
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 37 | public: | |||
---|---|---|---|---|---|
50 | 50 | | |||
51 | /** | 51 | /** | ||
52 | * In contrast to \a addDirectory, this function counts the items inside | 52 | * In contrast to \a addDirectory, this function counts the items inside | ||
53 | * the directory \a path synchronously and returns the result. | 53 | * the directory \a path synchronously and returns the result. | ||
54 | * | 54 | * | ||
55 | * The directory is watched for changes, and the signal \a result is | 55 | * The directory is watched for changes, and the signal \a result is | ||
56 | * emitted if a change occurs. | 56 | * emitted if a change occurs. | ||
57 | */ | 57 | */ | ||
58 | int countDirectoryContentsSynchronously(const QString& path); | 58 | KDirectoryContentsCounterWorker::CountResult countDirectoryContentsSynchronously(const QString& path); | ||
59 | 59 | | |||
60 | signals: | 60 | signals: | ||
61 | /** | 61 | /** | ||
62 | * Signals that the directory \a path contains \a count items. | 62 | * Signals that the directory \a path contains \a count items of size \a | ||
63 | * Size calculation depends on parameter DetailsModeSettings::recursiveDirectorySizeLimit | ||||
63 | */ | 64 | */ | ||
64 | void result(const QString& path, int count); | 65 | void result(const QString& path, int count, long size); | ||
65 | 66 | | |||
66 | void requestDirectoryContentsCount(const QString& path, KDirectoryContentsCounterWorker::Options options); | 67 | void requestDirectoryContentsCount(const QString& path, KDirectoryContentsCounterWorker::Options options); | ||
67 | 68 | | |||
68 | private slots: | 69 | private slots: | ||
69 | void slotResult(const QString& path, int count); | 70 | void slotResult(const QString& path, int count, long size); | ||
70 | void slotDirWatchDirty(const QString& path); | 71 | void slotDirWatchDirty(const QString& path); | ||
71 | void slotItemsRemoved(); | 72 | void slotItemsRemoved(); | ||
72 | 73 | | |||
73 | private: | 74 | private: | ||
74 | void startWorker(const QString& path); | 75 | void startWorker(const QString& path); | ||
75 | 76 | | |||
76 | private: | 77 | private: | ||
77 | KFileItemModel* m_model; | 78 | KFileItemModel* m_model; | ||
78 | 79 | | |||
79 | QQueue<QString> m_queue; | 80 | QQueue<QString> m_queue; | ||
80 | 81 | | |||
81 | static QThread* m_workerThread; | 82 | static QThread* m_workerThread; | ||
82 | static int m_workersCount; | | |||
83 | 83 | | |||
84 | KDirectoryContentsCounterWorker* m_worker; | 84 | KDirectoryContentsCounterWorker* m_worker; | ||
85 | bool m_workerIsBusy; | 85 | bool m_workerIsBusy; | ||
86 | 86 | | |||
87 | KDirWatch* m_dirWatcher; | 87 | KDirWatch* m_dirWatcher; | ||
88 | QSet<QString> m_watchedDirs; // Required as sadly KDirWatch does not offer a getter method | 88 | QSet<QString> m_watchedDirs; // Required as sadly KDirWatch does not offer a getter method | ||
89 | // to get all watched directories. | 89 | // to get all watched directories. | ||
90 | }; | 90 | }; | ||
91 | 91 | | |||
92 | #endif | 92 | #endif |