forked from kutegram/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
historyitemmodel.h
52 lines (44 loc) · 1.98 KB
/
historyitemmodel.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
#ifndef HISTORYITEMMODEL_H
#define HISTORYITEMMODEL_H
#include <QAbstractItemModel>
#include <QMutex>
#include "library/tlmessages.h"
#include <QMap>
#include <QPixmap>
class TelegramClient;
class HistoryItemModel : public QAbstractItemModel
{
Q_OBJECT
public:
QList<qint32> history;
QMap<qint32, TLMessage> messages;
QMap<qint64, TLChat> chats;
QMap<qint64, TLUser> users;
QMap<qint64, QPixmap> thumbnails; //what about user and chat collision?
TelegramClient* client;
TLInputPeer peer;
QMutex requestLock;
bool gotFull;
qint32 offsetId;
qint32 offsetDate;
qint64 requestId;
qint64 replyRequestId;
QList<qint32> replies;
explicit HistoryItemModel(TelegramClient* cl, TLInputPeer input, 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);
virtual bool canFetchMoreUpwards(const QModelIndex& parent) const;
virtual void fetchMoreUpwards(const QModelIndex& parent);
QString getMessageString(qint32 i) const;
signals:
public slots:
void client_gotMessages(qint64 mtm, qint32 count, QList<TLMessage> m, QList<TLChat> c, QList<TLUser> u, qint32 offsetIdOffset, qint32 nextRate, bool inexact);
void gotHistoryMessages(qint64 mtm, qint32 count, QList<TLMessage> m, QList<TLChat> c, QList<TLUser> u, qint32 offsetIdOffset, qint32 nextRate, bool inexact);
void gotReplyMessages(qint64 mtm, qint32 count, QList<TLMessage> m, QList<TLChat> c, QList<TLUser> u, qint32 offsetIdOffset, qint32 nextRate, bool inexact);
};
#endif // HISTORYITEMMODEL_H