summary refs log tree commit diff
path: root/src/CombinedImagePackModel.h
blob: 64387390ccd09693f6d63ef4c6e3d4dc1e4f456d (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
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QAbstractListModel>

#include <mtx/events/mscs/image_packs.hpp>

class CombinedImagePackModel final : public QAbstractListModel
{
    Q_OBJECT
public:
    enum Roles
    {
        Url = Qt::UserRole,
        ShortCode,
        Body,
        PackName,
        Unicode,
    };

    CombinedImagePackModel(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;

private:
    std::string room_id;

    struct ImageDesc
    {
        QString shortcode;
        QString packname;

        mtx::events::msc2545::PackImage image;
    };

    std::vector<ImageDesc> images;
};