2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2023-01-02 06:25:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2023 Nheko Contributors
|
2021-03-05 02:35:15 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-09-07 12:51:28 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2022-10-10 15:38:29 +03:00
|
|
|
class UsersModel final : public QAbstractListModel
|
2020-09-07 12:51:28 +03:00
|
|
|
{
|
|
|
|
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;
|
2022-12-13 08:28:57 +03:00
|
|
|
return (int)userids.size();
|
2021-09-18 01:22:33 +03:00
|
|
|
}
|
|
|
|
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;
|
2022-12-13 08:28:57 +03:00
|
|
|
std::vector<QString> avatarUrls;
|
2021-09-18 01:22:33 +03:00
|
|
|
std::vector<QString> displayNames;
|
|
|
|
std::vector<QString> userids;
|
2020-09-07 12:51:28 +03:00
|
|
|
};
|