matrixion/src/CombinedImagePackModel.h

42 lines
888 B
C
Raw Normal View History

// SPDX-FileCopyrightText: Nheko Contributors
2021-07-15 21:37:52 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QAbstractListModel>
#include <mtx/events/mscs/image_packs.hpp>
2022-10-10 15:38:29 +03:00
class CombinedImagePackModel final : public QAbstractListModel
2021-07-15 21:37:52 +03:00
{
2021-09-18 01:22:33 +03:00
Q_OBJECT
2021-07-15 21:37:52 +03:00
public:
2021-09-18 01:22:33 +03:00
enum Roles
{
Url = Qt::UserRole,
ShortCode,
Body,
PackName,
Unicode,
2021-09-18 01:22:33 +03:00
};
CombinedImagePackModel(const std::string &roomId, QObject *parent = nullptr);
2021-09-18 01:22:33 +03:00
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
2021-07-15 21:37:52 +03:00
private:
2021-09-18 01:22:33 +03:00
std::string room_id;
2021-07-15 21:37:52 +03:00
2021-09-18 01:22:33 +03:00
struct ImageDesc
{
QString shortcode;
QString packname;
2021-07-15 21:37:52 +03:00
2021-09-18 01:22:33 +03:00
mtx::events::msc2545::PackImage image;
};
2021-07-15 21:37:52 +03:00
2021-09-18 01:22:33 +03:00
std::vector<ImageDesc> images;
2021-07-15 21:37:52 +03:00
};