┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private/kdirectorycontentscounterworker.h
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2023-06-28 09:49:46 +0200
committerMéven Car <[email protected]>2023-06-28 09:49:46 +0200
commitcd2e64154fd5446a7e19aff4cb147efe2f2ba31e (patch)
tree37f4e2c8644129f809a66fd2f6b2c9b28d52fed8 /src/kitemviews/private/kdirectorycontentscounterworker.h
parentdcd5c994bb1d331b94fdea8a5c6cd55a471b34b8 (diff)
parentea56e1f75eae435c18e3934c402c94ae76ec9c11 (diff)
Merge branch 'master' into kf6
Diffstat (limited to 'src/kitemviews/private/kdirectorycontentscounterworker.h')
-rw-r--r--src/kitemviews/private/kdirectorycontentscounterworker.h33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.h b/src/kitemviews/private/kdirectorycontentscounterworker.h
index 5266960cd..077df9f69 100644
--- a/src/kitemviews/private/kdirectorycontentscounterworker.h
+++ b/src/kitemviews/private/kdirectorycontentscounterworker.h
@@ -17,32 +17,20 @@ class KDirectoryContentsCounterWorker : public QObject
Q_OBJECT
public:
- enum Option { NoOptions = 0x0, CountHiddenFiles = 0x1, CountDirectoriesOnly = 0x2 };
+ enum Option { NoOptions = 0x0, CountHiddenFiles = 0x1 };
Q_DECLARE_FLAGS(Options, Option)
- struct CountResult {
- /// number of elements in the directory
- int count;
- /// Recursive sum of the size of the directory content files and folders
- /// Calculation depends on DetailsModeSettings::recursiveDirectorySizeLimit
- long size;
- };
-
explicit KDirectoryContentsCounterWorker(QObject *parent = nullptr);
- /**
- * Counts the items inside the directory \a path using the options
- * \a options.
- *
- * @return The number of items.
- */
- CountResult subItemsCount(const QString &path, Options options);
-
+ bool stopping() const;
+ QString scannedPath() const;
Q_SIGNALS:
/**
* Signals that the directory \a path contains \a count items and optionally the size of its content.
*/
- void result(const QString &path, int count, long size);
+ void result(const QString &path, int count, long long size);
+ void intermediateResult(const QString &path, int count, long long size);
+ void finished();
public Q_SLOTS:
/**
@@ -52,16 +40,17 @@ public Q_SLOTS:
// Note that the full type name KDirectoryContentsCounterWorker::Options
// is needed here. Just using 'Options' is OK for the compiler, but
// confuses moc.
- void countDirectoryContents(const QString &path, KDirectoryContentsCounterWorker::Options options);
+ void countDirectoryContents(const QString &path, KDirectoryContentsCounterWorker::Options options, int maxRecursiveLevel);
void stop();
private:
#ifndef Q_OS_WIN
- KDirectoryContentsCounterWorker::CountResult
- walkDir(const QString &dirPath, const bool countHiddenFiles, const bool countDirectoriesOnly, const uint allowedRecursiveLevel);
+ void walkDir(const QString &dirPath, bool countHiddenFiles, uint allowedRecursiveLevel);
#endif
- bool m_stopping = false;
+ QString m_scannedPath;
+
+ std::atomic<bool> m_stopping = false;
};
Q_DECLARE_METATYPE(KDirectoryContentsCounterWorker::Options)