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

#pragma once

#include <QAbstractListModel>

class UsersModel : public QAbstractListModel
{
public:
        enum Roles
        {
                AvatarUrl = Qt::UserRole,
                DisplayName,
                UserID,
        };

        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;

private:
        std::string room_id;
        std::vector<std::string> roomMembers_;
        std::vector<QString> displayNames;
        std::vector<QString> userids;
};