2021-07-21 14:37:57 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QQmlEngine>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
class SingleImagePackModel;
|
|
|
|
class ImagePackListModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2021-08-06 05:31:30 +03:00
|
|
|
Q_PROPERTY(bool containsAccountPack READ containsAccountPack CONSTANT)
|
2021-07-21 14:37:57 +03:00
|
|
|
public:
|
|
|
|
enum Roles
|
|
|
|
{
|
|
|
|
DisplayName = Qt::UserRole,
|
|
|
|
AvatarUrl,
|
|
|
|
FromAccountData,
|
|
|
|
FromCurrentRoom,
|
|
|
|
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);
|
2021-08-06 05:31:30 +03:00
|
|
|
Q_INVOKABLE SingleImagePackModel *newPack(bool inRoom);
|
|
|
|
|
|
|
|
bool containsAccountPack() const;
|
2021-07-21 14:37:57 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string room_id;
|
|
|
|
|
|
|
|
std::vector<QSharedPointer<SingleImagePackModel>> packs;
|
|
|
|
};
|