blob: 435c390214e14b96c7b56d8e134442353f46e076 (
plain) (
blame)
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
|
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QAbstractListModel>
#include <QQmlEngine>
#include <QSharedPointer>
class SingleImagePackModel;
class ImagePackListModel final : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(bool containsAccountPack READ containsAccountPack CONSTANT)
public:
enum Roles
{
DisplayName = Qt::UserRole,
AvatarUrl,
FromAccountData,
FromCurrentRoom,
FromSpace,
StateKey,
RoomId,
};
ImagePackListModel(const std::string &roomId, QObject *parent = nullptr);
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
Q_INVOKABLE SingleImagePackModel *packAt(int row);
Q_INVOKABLE SingleImagePackModel *newPack(bool inRoom);
bool containsAccountPack() const;
private:
std::string room_id;
std::vector<QSharedPointer<SingleImagePackModel>> packs;
};
|