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

#pragma once

#include <QDateTime>
#include <QFrame>

class Avatar;
class QLabel;
class QListWidget;
class QHBoxLayout;
class QVBoxLayout;

namespace dialogs {

class ReceiptItem : public QWidget
{
        Q_OBJECT

public:
        ReceiptItem(QWidget *parent,
                    const QString &user_id,
                    uint64_t timestamp,
                    const QString &room_id);

protected:
        void paintEvent(QPaintEvent *) override;

private:
        QString dateFormat(const QDateTime &then) const;

        QHBoxLayout *topLayout_;
        QVBoxLayout *textLayout_;

        Avatar *avatar_;

        QLabel *userName_;
        QLabel *timestamp_;
};

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

public slots:
        void addUsers(const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users);

protected:
        void paintEvent(QPaintEvent *event) override;
        void hideEvent(QHideEvent *event) override;

private:
        QLabel *topLabel_;

        QListWidget *userList_;
};
} // dialogs