harbour-fernschreiber/src/chatmodel.h

30 lines
703 B
C
Raw Normal View History

2020-08-22 18:30:02 +03:00
#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