-
Notifications
You must be signed in to change notification settings - Fork 25
/
telegramstickersmodel.h
73 lines (56 loc) · 2.04 KB
/
telegramstickersmodel.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
#ifndef TELEGRAMSTICKERSMODEL_H
#define TELEGRAMSTICKERSMODEL_H
#include <QStringList>
#include "telegramqml_macros.h"
#include "telegramqml_global.h"
#include "telegramabstractenginelistmodel.h"
class TelegramStickersItem;
class DocumentObject;
class InputStickerSetObject;
class TelegramEngine;
class TelegramStickersModelPrivate;
class TELEGRAMQMLSHARED_EXPORT TelegramStickersModel : public TelegramAbstractEngineListModel
{
Q_OBJECT
Q_ENUMS(DialogsRoles)
Q_PROPERTY(bool refreshing READ refreshing NOTIFY refreshingChanged)
Q_PROPERTY(QString shortName READ shortName WRITE setShortName NOTIFY shortNameChanged)
Q_PROPERTY(InputStickerSetObject* stickerSet READ stickerSet WRITE setStickerSet NOTIFY stickerSetChanged)
Q_PROPERTY(QVariantList documents READ documents WRITE setDocuments NOTIFY documentsChanged)
public:
enum DialogsRoles {
RoleDocument = Qt::UserRole,
RoleAlt
};
TelegramStickersModel(QObject *parent = 0);
virtual ~TelegramStickersModel();
QString shortName() const;
void setShortName(const QString &shortName);
void setStickerSet(InputStickerSetObject *stickerSet);
InputStickerSetObject *stickerSet() const;
void setDocuments(const QVariantList &list);
QVariantList documents() const;
QByteArray id( const QModelIndex &index ) const;
int count() const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QHash<qint32,QByteArray> roleNames() const;
bool refreshing() const;
static QStringList requiredProperties();
public Q_SLOTS:
void showRecents();
void addToRecents(DocumentObject *doc);
Q_SIGNALS:
void engineChanged();
void refreshingChanged();
void stickerSetChanged();
void shortNameChanged();
void documentsChanged();
protected:
void refresh();
void clean();
void getFromServer();
void changed(const QList<QByteArray> &list, const QHash<QByteArray, TelegramStickersItem> &items);
private:
TelegramStickersModelPrivate *p;
};
#endif // TELEGRAMSTICKERSMODEL_H