diff options
| author | Méven Car <[email protected]> | 2023-02-12 11:21:53 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2023-02-12 11:21:53 +0000 |
| commit | ba930ddb3635fe2d94d727e72aaf261513b28060 (patch) | |
| tree | 9199f7944d1b02830eb05f15a58fe1b1be1edbce /src/kitemviews/private/kdirectorycontentscounter.h | |
| parent | a15def4e64dc08d508e7a511a20ad06e7e8a2e0c (diff) | |
Optimize Directory size counting
Two changes:
* Prioritise size counting for visible path
* stop the worker when switching dirs
Diffstat (limited to 'src/kitemviews/private/kdirectorycontentscounter.h')
| -rw-r--r-- | src/kitemviews/private/kdirectorycontentscounter.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounter.h b/src/kitemviews/private/kdirectorycontentscounter.h index f74565b73..9a5e4a86b 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.h +++ b/src/kitemviews/private/kdirectorycontentscounter.h @@ -21,6 +21,8 @@ class KDirectoryContentsCounter : public QObject Q_OBJECT public: + enum PathCountPriority { Normal, High }; + explicit KDirectoryContentsCounter(KFileItemModel *model, QObject *parent = nullptr); ~KDirectoryContentsCounter() override; @@ -35,7 +37,12 @@ public: * Uses a cache internally to speed up first result, * but emit again result when the cache was updated */ - void scanDirectory(const QString &path); + void scanDirectory(const QString &path, PathCountPriority priority); + + /** + * Stops the work until new input is passed + */ + void stopWorker(); Q_SIGNALS: /** @@ -46,15 +53,14 @@ Q_SIGNALS: void requestDirectoryContentsCount(const QString &path, KDirectoryContentsCounterWorker::Options options); + void stop(); + private Q_SLOTS: void slotResult(const QString &path, int count, long size); void slotDirWatchDirty(const QString &path); void slotItemsRemoved(); private: - void startWorker(const QString &path); - -private: KFileItemModel *m_model; // Used as FIFO queues. |
