| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <QAbstractListModel> |
| 8 |
#include <QQmlEngine> |
| 9 |
#include <QSharedPointer> |
| 10 |
|
| 11 |
#include "SingleImagePackModel.h" |
| 12 |
|
| 13 |
class ImagePackListModel : public QAbstractListModel |
| 14 |
{ |
| 15 |
Q_OBJECT |
| 16 |
QML_ELEMENT |
| 17 |
QML_UNCREATABLE("") |
| 18 |
|
| 19 |
Q_PROPERTY(bool containsAccountPack READ containsAccountPack CONSTANT) |
| 20 |
public: |
| 21 |
enum Roles |
| 22 |
{ |
| 23 |
DisplayName = Qt::UserRole, |
| 24 |
AvatarUrl, |
| 25 |
FromAccountData, |
| 26 |
FromCurrentRoom, |
| 27 |
FromSpace, |
| 28 |
StateKey, |
| 29 |
RoomId, |
| 30 |
}; |
| 31 |
|
| 32 |
ImagePackListModel(const std::string &roomId, QObject *parent = nullptr); |
| 33 |
QHash<int, QByteArray> roleNames() const override; |
| 34 |
int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 35 |
QVariant data(const QModelIndex &index, int role) const override; |
| 36 |
|
| 37 |
Q_INVOKABLE SingleImagePackModel *packAt(int row); |
| 38 |
Q_INVOKABLE SingleImagePackModel *newPack(bool inRoom); |
| 39 |
|
| 40 |
bool containsAccountPack() const; |
| 41 |
|
| 42 |
private: |
| 43 |
std::string room_id; |
| 44 |
|
| 45 |
std::vector<QSharedPointer<SingleImagePackModel>> packs; |
| 46 |
}; |