summary refs log tree commit diff
path: root/include/ui
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-07 13:39:53 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-07 13:39:53 +0300
commit9a0e18dea75d171e992e7d4a2f173949588674ea (patch)
tree44541c88643db8a49e97340cf5c40692abb8ab70 /include/ui
parentMark all decrypted messages with a padlock (diff)
downloadnheko-9a0e18dea75d171e992e7d4a2f173949588674ea.tar.xz
Add a timeline message when encryption is enabled
Diffstat (limited to 'include/ui')
-rw-r--r--include/ui/InfoMessage.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/ui/InfoMessage.hpp b/include/ui/InfoMessage.hpp
new file mode 100644

index 00000000..58f98b0c --- /dev/null +++ b/include/ui/InfoMessage.hpp
@@ -0,0 +1,47 @@ +#pragma once + +#include <QColor> +#include <QDateTime> +#include <QWidget> + +class InfoMessage : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor) + Q_PROPERTY(QColor boxColor WRITE setBoxColor READ boxColor) + +public: + explicit InfoMessage(QWidget *parent = nullptr); + InfoMessage(QString msg, QWidget *parent = nullptr); + + void setTextColor(QColor color) { textColor_ = color; } + void setBoxColor(QColor color) { boxColor_ = color; } + void saveDatetime(QDateTime datetime) { datetime_ = datetime; } + + QColor textColor() const { return textColor_; } + QColor boxColor() const { return boxColor_; } + QDateTime datetime() const { return datetime_; } + +protected: + void paintEvent(QPaintEvent *event) override; + + int width_; + int height_; + + QString msg_; + QFont font_; + + QDateTime datetime_; + + QColor textColor_ = QColor("black"); + QColor boxColor_ = QColor("white"); +}; + +class DateSeparator : public InfoMessage +{ + Q_OBJECT + +public: + DateSeparator(QDateTime datetime, QWidget *parent = nullptr); +};