From ba930ddb3635fe2d94d727e72aaf261513b28060 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sun, 12 Feb 2023 11:21:53 +0000 Subject: Optimize Directory size counting Two changes: * Prioritise size counting for visible path * stop the worker when switching dirs --- src/kitemviews/private/kdirectorycontentscounterworker.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/private/kdirectorycontentscounterworker.h') diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.h b/src/kitemviews/private/kdirectorycontentscounterworker.h index 6bbe099a5..5266960cd 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.h +++ b/src/kitemviews/private/kdirectorycontentscounterworker.h @@ -36,7 +36,7 @@ public: * * @return The number of items. */ - static CountResult subItemsCount(const QString &path, Options options); + CountResult subItemsCount(const QString &path, Options options); Q_SIGNALS: /** @@ -53,6 +53,15 @@ public Q_SLOTS: // is needed here. Just using 'Options' is OK for the compiler, but // confuses moc. void countDirectoryContents(const QString &path, KDirectoryContentsCounterWorker::Options options); + void stop(); + +private: +#ifndef Q_OS_WIN + KDirectoryContentsCounterWorker::CountResult + walkDir(const QString &dirPath, const bool countHiddenFiles, const bool countDirectoriesOnly, const uint allowedRecursiveLevel); +#endif + + bool m_stopping = false; }; Q_DECLARE_METATYPE(KDirectoryContentsCounterWorker::Options) -- cgit v1.3.1