┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private/kdirectorycontentscounter.h
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2020-05-04 07:26:26 +0200
committerMéven Car <[email protected]>2020-05-04 07:26:59 +0200
commite6ea3ab4c41dcc115143a237aafd3a1152849433 (patch)
tree73c849d42ac69d2c0dc8412228c6203963ffa6f9 /src/kitemviews/private/kdirectorycontentscounter.h
parentd34559d1c12a152afa235af8ba6eeb536aa31a9e (diff)
[Details mode] Allow to fill the column size of directories with actual size
Summary: Allow to compute the recursive size of directories to fill the details view size column. A setting allow to set a limit to the recursive level, allowing the user to have some power over the setting. When sorting by size and the feature is on, we get progressive ordering as the directory size are gathered. KDirectoryContentsCounter uses a cache internally to keep results so that it can display directory size faster, but counts the dir size of directories each time it is asked to count the size a directory nevertheless and when the size has changed, it is updated. KDirectoryContentsCounter uses one worker per instance only, meaning one process per view makes the disk spin. FIXED-IN: 20.08 BUG: 190580 BUG: 158090 Test Plan: With some recursion allowed: {F8267580} Without any recursion allowed (default): {F8267581} Reviewers: elvisangelaccio, ngraham, #dolphin Reviewed By: elvisangelaccio, ngraham, #dolphin Subscribers: feverfew, anthonyfieroni, iasensio, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D25335
Diffstat (limited to 'src/kitemviews/private/kdirectorycontentscounter.h')
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounter.h b/src/kitemviews/private/kdirectorycontentscounter.h
index 349860757..0c900ec64 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.h
+++ b/src/kitemviews/private/kdirectorycontentscounter.h
@@ -25,6 +25,7 @@
#include <QQueue>
#include <QSet>
+#include <QHash>
class KDirWatch;
class KFileItemModel;
@@ -45,28 +46,23 @@ public:
*
* The directory \a path is watched for changes, and the signal is emitted
* again if a change occurs.
- */
- void addDirectory(const QString& path);
-
- /**
- * In contrast to \a addDirectory, this function counts the items inside
- * the directory \a path synchronously and returns the result.
*
- * The directory is watched for changes, and the signal \a result is
- * emitted if a change occurs.
+ * Uses a cache internally to speed up first result,
+ * but emit again result when the cache was updated
*/
- int countDirectoryContentsSynchronously(const QString& path);
+ void scanDirectory(const QString& path);
signals:
/**
- * Signals that the directory \a path contains \a count items.
+ * Signals that the directory \a path contains \a count items of size \a
+ * Size calculation depends on parameter DetailsModeSettings::recursiveDirectorySizeLimit
*/
- void result(const QString& path, int count);
+ void result(const QString& path, int count, long size);
void requestDirectoryContentsCount(const QString& path, KDirectoryContentsCounterWorker::Options options);
private slots:
- void slotResult(const QString& path, int count);
+ void slotResult(const QString& path, int count, long size);
void slotDirWatchDirty(const QString& path);
void slotItemsRemoved();
@@ -79,7 +75,6 @@ private:
QQueue<QString> m_queue;
static QThread* m_workerThread;
- static int m_workersCount;
KDirectoryContentsCounterWorker* m_worker;
bool m_workerIsBusy;