summary refs log tree commit diff
path: root/src/TypingDisplay.h
blob: 332d9c666f6f17b95256ddbfd370ce1cb0fe6c2d (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
#pragma once

#include "ui/OverlayWidget.h"

class QPaintEvent;

class TypingDisplay : public OverlayWidget
{
        Q_OBJECT

        Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
        Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)

public:
        TypingDisplay(QWidget *parent = nullptr);

        void setUsers(const QStringList &user_ids);

        void setTextColor(const QColor &color) { textColor_ = color; };
        QColor textColor() const { return textColor_; };

        void setBackgroundColor(const QColor &color) { bgColor_ = color; };
        QColor backgroundColor() const { return bgColor_; };

public slots:
        void setOffset(int margin);

protected:
        void paintEvent(QPaintEvent *event) override;

private:
        int offset_;
        QColor textColor_;
        QColor bgColor_;
        QString text_;
};