blob: ac9208a036dc80c7434a04127aa2d2a31e996718 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef INVITEESMODEL_H
#define INVITEESMODEL_H
#include <QAbstractListModel>
#include <QVector>
class Invitee : public QObject
{
Q_OBJECT
public:
Invitee(const QString &mxid, QObject *parent = nullptr);
signals:
void userInfoLoaded();
private:
const QString mxid_;
QString displayName_;
QString avatarUrl_;
friend class InviteesModel;
};
class InviteesModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles
{
Mxid,
DisplayName,
AvatarUrl,
};
InviteesModel(QObject *parent = nullptr);
Q_INVOKABLE void addUser(QString mxid);
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex & = QModelIndex()) const override
{
return (int)invitees_.size();
}
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QStringList mxids();
signals:
void accept();
private:
QVector<Invitee *> invitees_;
};
#endif // INVITEESMODEL_H
|