forked from kutegram/client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdialogitemmodel.h
49 lines (42 loc) · 1.66 KB
/
dialogitemmodel.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
#ifndef DIALOGITEMMODEL_H
#define DIALOGITEMMODEL_H
#include <QAbstractItemModel>
#include <QMutex>
#include <QPixmap>
#include "library/tlmessages.h"
class TelegramClient;
class DialogItemModel : public QAbstractItemModel
{
Q_OBJECT
public:
QList<TLDialog> dialogs;
QMap<qint64, TLMessage> messages;
QMap<qint64, TLChat> chats;
QMap<qint64, TLUser> users;
QMap<qint64, QVariant> avatars;
QMap<qint64, QPixmap> thumbnails;
TelegramClient* client;
QMutex requestLock;
qint32 offsetId;
qint32 offsetDate;
TLInputPeer offsetPeer;
bool gotFull;
qint64 requestId;
explicit DialogItemModel(TelegramClient* cl, QObject *parent = 0);
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
virtual QModelIndex parent(const QModelIndex& index) const;
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
virtual bool canFetchMore(const QModelIndex& parent) const;
virtual void fetchMore(const QModelIndex& parent);
QString getDialogTitle(qint32 i) const;
QString getMessageString(qint32 i) const;
qint64 getDialogId(qint32 i) const;
TLInputPeer getInputPeer(qint32 i) const;
signals:
public slots:
void client_gotDialogs(qint64 mtm, qint32 count, QList<TLDialog> dialogs, QList<TLMessage> messages, QList<TLChat> chats, QList<TLUser> users);
void client_gotFilePart(qint64 mtMessageId, TLType::Types type, qint32 mtime, QByteArray bytes);
};
#endif // DIALOGITEMMODEL_H