-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadlistmodel.h
54 lines (41 loc) · 1.29 KB
/
uploadlistmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef UPLOADLISTMODEL_H
#define UPLOADLISTMODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include <QJsonArray>
#include <QMutex>
class UploadListModel : public QAbstractListModel
{
Q_OBJECT
enum UPLOAD_FILE_INFO {
FILE_NAME = 1,
FILE_SIZE,
FILE_ICON,
FILE_SIZE_FORMAT,
FILE_UP_SIZE,
UPLOAD_SPEED,
UPLOAD_PROGRESS,
LOCAL_PATH
};
Q_PROPERTY(QString uploadNum MEMBER m_uploadNum NOTIFY uploadNumChanged FINAL)
signals:
void uploadNumChanged();
public slots :
void removeItem(int index, bool uploadSuccess, bool cancel);
void updateProgress(double uNow, double uTotal,
const QString& speedVal, const QString& upSize);
public:
explicit UploadListModel(QObject *parent = nullptr);
static UploadListModel* pUploadListModel;
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int,QByteArray> roleNames() const override;
public:
Q_INVOKABLE void addUploadList(const QJsonObject& fileItem);
private:
QMutex m_oMutex;
QString m_uploadNum;
QList<QJsonObject> m_uploadFileList;
};
#endif // UPLOADLISTMODEL_H