CCIMXDesktop
 
Loading...
Searching...
No Matches
FileCountInfo.h
1#ifndef FILECOUNTINFO_H
2#define FILECOUNTINFO_H
3
4#include <FileInfoProvider.h>
5#include <QFuture>
6#include <QObject>
7#include <QPersistentModelIndex>
8
13class FileCountImplWorker : public QObject {
14 Q_OBJECT
15public:
21 explicit FileCountImplWorker(QObject* parent = nullptr)
22 : QObject(parent) { }
33 void deptach_count_task(const QPersistentModelIndex& index, const QString& path);
34
35signals:
41 void fileCountFinished(QPersistentModelIndex index, int count);
42
43private:
44 QList<QFuture<void>> results;
45};
46
47class FileCountInfo : public QObject, public FileInfoProvider {
48 Q_OBJECT
49public:
56 explicit FileCountInfo(CCIMXFileSystemModel* model, QObject* parent = nullptr);
57
62 inline QString provide_section_name() {
63 return "fileCounts";
64 }
72 std::pair<bool, QVariant> data(const QModelIndex& index, int role);
73private slots:
79 void onHandleWorkFinishJob(QPersistentModelIndex index, int count);
80
81private:
82 FileCountImplWorker* worker;
83 /* Thanks AI, I solved the persis issue */
84 /* These are using in caching the already in s */
85 mutable QHash<QPersistentModelIndex, int> cache;
86 mutable QSet<QPersistentModelIndex> requested;
87};
88
89#endif // FILECOUNTINFO_H
The CCIMXFileSystemModel class Extends QFileSystemModel to support additional information providers....
Definition CCIMXFileSystemModel.h:13
The FileCountImplWorker class makes the file count session actually.
Definition FileCountInfo.h:13
~FileCountImplWorker()
Destroy the File Count Impl Worker object.
Definition FileCountInfo.cpp:6
void deptach_count_task(const QPersistentModelIndex &index, const QString &path)
functions depatch an asyncronous count issues,
Definition FileCountInfo.cpp:14
void fileCountFinished(QPersistentModelIndex index, int count)
fileCountFinished signals the finish of the count
FileCountImplWorker(QObject *parent=nullptr)
Construct a new File Count Impl Worker object.
Definition FileCountInfo.h:21
Definition FileCountInfo.h:47
QString provide_section_name()
provide_section_name means everything in the name lol
Definition FileCountInfo.h:62
std::pair< bool, QVariant > data(const QModelIndex &index, int role)
data provide the data to the views
Definition FileCountInfo.cpp:35
The FileInfoProvider class is such an abstract class that using in CCIMXFileSystemModel to provide th...
Definition FileInfoProvider.h:15