summary refs log tree commit diff
path: root/src/dialogs/UserProfile.h
blob: 9901771d23d604433aa57da5574a0ef839faa7c3 (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
61
62
63
64
65
66
67
68
69
#pragma once

#include <QString>
#include <QWidget>

class Avatar;
class FlatButton;
class QLabel;
class QListWidget;
class Toggle;

struct DeviceInfo
{
        QString device_id;
        QString display_name;
};

Q_DECLARE_METATYPE(std::vector<DeviceInfo>)

namespace dialogs {

class DeviceItem : public QWidget
{
        Q_OBJECT

public:
        explicit DeviceItem(DeviceInfo device, QWidget *parent);

private:
        DeviceInfo info_;

        // Toggle *verifyToggle_;
};

class UserProfile : public QWidget
{
        Q_OBJECT
public:
        explicit UserProfile(QWidget *parent = nullptr);

        void init(const QString &userId, const QString &roomId);

protected:
        void paintEvent(QPaintEvent *) override;

signals:
        void devicesRetrieved(const QString &user_id, const std::vector<DeviceInfo> &devices);

private slots:
        void updateDeviceList(const QString &user_id, const std::vector<DeviceInfo> &devices);

private:
        void resetToDefaults();

        Avatar *avatar_;

        QLabel *userIdLabel_;
        QLabel *displayNameLabel_;

        FlatButton *banBtn_;
        FlatButton *kickBtn_;
        FlatButton *ignoreBtn_;
        FlatButton *startChat_;

        QLabel *devicesLabel_;
        QListWidget *devices_;
};

} // dialogs