2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-09-07 12:51:28 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
|
|
|
class UsersModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
public:
|
2021-09-18 01:22:33 +03:00
|
|
|
enum Roles
|
|
|
|
{
|
|
|
|
AvatarUrl = Qt::UserRole,
|
|
|
|
DisplayName,
|
|
|
|
UserID,
|
|
|
|
};
|
2020-09-07 12:51:28 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
UsersModel(const std::string &roomId, QObject *parent = nullptr);
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
|
|
|
{
|
|
|
|
(void)parent;
|
|
|
|
return (int)roomMembers_.size();
|
|
|
|
}
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
2020-09-07 12:51:28 +03:00
|
|
|
|
|
|
|
private:
|
2021-09-18 01:22:33 +03:00
|
|
|
std::string room_id;
|
|
|
|
std::vector<std::string> roomMembers_;
|
|
|
|
std::vector<QString> displayNames;
|
|
|
|
std::vector<QString> userids;
|
2020-09-07 12:51:28 +03:00
|
|
|
};
|