30 lines
703 B
C
30 lines
703 B
C
|
#ifndef CHATMODEL_H
|
||
|
#define CHATMODEL_H
|
||
|
|
||
|
#include <QAbstractListModel>
|
||
|
#include <QDebug>
|
||
|
#include <QMutex>
|
||
|
#include "tdlibwrapper.h"
|
||
|
|
||
|
class ChatModel : public QAbstractListModel
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
ChatModel(TDLibWrapper *tdLibWrapper);
|
||
|
~ChatModel() override;
|
||
|
|
||
|
virtual int rowCount(const QModelIndex&) const override;
|
||
|
virtual QVariant data(const QModelIndex &index, int role) const override;
|
||
|
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||
|
|
||
|
private:
|
||
|
|
||
|
TDLibWrapper *tdLibWrapper;
|
||
|
QVariantList messages;
|
||
|
QVariantList messagesToBeAdded;
|
||
|
QVariantMap messageIndexMap;
|
||
|
QMutex chatListMutex;
|
||
|
};
|
||
|
|
||
|
#endif // CHATMODEL_H
|