CCIMXDesktop
 
Loading...
Searching...
No Matches
DirentSizeCounter.h
1#ifndef DIRENTSIZECOUNTER_H
2#define DIRENTSIZECOUNTER_H
3
4#include "FileInfoProvider.h"
5#include <QFuture>
6#include <QObject>
11class DirentSizeWorker : public QObject {
12 Q_OBJECT
13public:
19 explicit DirentSizeWorker(QObject* object = nullptr) { }
26 void depatch_sizeCount_task(const QPersistentModelIndex& index, const QString& path);
27signals:
33 void sizeCountFinish(QPersistentModelIndex index, qint64 size);
34
35private:
36 QList<QFuture<void>> results;
37};
38
43class DirentSizeCounter : public QObject, public FileInfoProvider {
44 Q_OBJECT
45public:
52 explicit DirentSizeCounter(CCIMXFileSystemModel* model, QObject* parent = nullptr);
57 inline QString provide_section_name() {
58 return "File Size";
59 }
60
68 std::pair<bool, QVariant> data(const QModelIndex& index, int role);
69private slots:
75 void onHandleWorkFinishJob(QPersistentModelIndex index, qint64 size);
76
77private:
78 DirentSizeWorker* worker;
79 /* Thus I must copy the session... */
80 /* Thanks AI, I solved the persis issue */
81 /* These are using in caching the already in s */
82 mutable QHash<QPersistentModelIndex, qint64> cache;
83 mutable QSet<QPersistentModelIndex> requested;
84};
85
86#endif // DIRENTSIZECOUNTER_H
The CCIMXFileSystemModel class Extends QFileSystemModel to support additional information providers....
Definition CCIMXFileSystemModel.h:13
The DirentSizeCounter class wrapped the worker and provides non-implement-relative interfaces to the ...
Definition DirentSizeCounter.h:43
std::pair< bool, QVariant > data(const QModelIndex &index, int role)
data provide the data to the views
Definition DirentSizeCounter.cpp:85
QString provide_section_name()
provide_section_name means everything in the name lol
Definition DirentSizeCounter.h:57
The DirentSizeWorker class really counts the dirent below size and, this is asyncronous,...
Definition DirentSizeCounter.h:11
void sizeCountFinish(QPersistentModelIndex index, qint64 size)
sizeCountFinish signals the finish of the count
void depatch_sizeCount_task(const QPersistentModelIndex &index, const QString &path)
functions depatch an asyncronous count issues,
Definition DirentSizeCounter.cpp:60
DirentSizeWorker(QObject *object=nullptr)
Construct a new Dirent Size Worker object.
Definition DirentSizeCounter.h:19
The FileInfoProvider class is such an abstract class that using in CCIMXFileSystemModel to provide th...
Definition FileInfoProvider.h:15