-
Notifications
You must be signed in to change notification settings - Fork 25
/
telegrammemberslistmodel.h
84 lines (65 loc) · 2.16 KB
/
telegrammemberslistmodel.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef TELEGRAMMEMBERSLISTMODEL_H
#define TELEGRAMMEMBERSLISTMODEL_H
#include "telegramabstractenginelistmodel.h"
class InputPeerObject;
class TelegramMembersListModelPrivate;
class TELEGRAMQMLSHARED_EXPORT TelegramMembersListModel : public TelegramAbstractEngineListModel
{
Q_OBJECT
Q_ENUMS(Types)
Q_ENUMS(DataRoles)
Q_PROPERTY(InputPeerObject* currentPeer READ currentPeer WRITE setCurrentPeer NOTIFY currentPeerChanged)
Q_PROPERTY(qint32 filter READ filter WRITE setFilter NOTIFY filterChanged)
Q_PROPERTY(bool refreshing READ refreshing NOTIFY refreshingChanged)
Q_PROPERTY(QJSValue dateConvertorMethod READ dateConvertorMethod WRITE setDateConvertorMethod NOTIFY dateConvertorMethodChanged)
public:
enum DataRoles {
RoleDate = Qt::UserRole,
RoleInviter,
RoleUser,
RoleKickedBy,
RoleType,
RolePeer,
RoleStatus
};
enum Types {
TypeNormal,
TypeSelf,
TypeAdmin,
TypeModerator,
TypeEditor,
TypeKicked,
TypeCreator,
TypeUnknown
};
TelegramMembersListModel(QObject *parent = 0);
virtual ~TelegramMembersListModel();
void setCurrentPeer(InputPeerObject *peer);
InputPeerObject *currentPeer() const;
void setFilter(qint32 filter);
qint32 filter() const;
void setRefreshing(bool refreshing);
bool refreshing() const;
QJSValue dateConvertorMethod() const;
void setDateConvertorMethod(const QJSValue &method);
class TelegramChatsMemebrsListModelItem id(const QModelIndex &index) const;
int count() const;
QVariant data(const QModelIndex &index, int role) const;
QHash<int, QByteArray> roleNames() const;
static QStringList requiredProperties();
Q_SIGNALS:
void currentPeerChanged();
void filterChanged();
void refreshingChanged();
void dateConvertorMethodChanged();
public Q_SLOTS:
private:
void refresh();
void clean();
void changed(const QList<class TelegramChatsMemebrsListModelItem> &list);
protected:
QString convertDate(const QDateTime &td) const;
private:
TelegramMembersListModelPrivate *p;
};
#endif // TELEGRAMMEMBERSLISTMODEL_H