summary refs log tree commit diff
path: root/include/ui/SnackBar.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-17 16:37:25 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-17 16:37:25 +0300
commit0e814da91c8e041897a4c3f7e6e9234bbc7c6f7a (patch)
tree21f655d30630fe77ba48d07e4b357e2b6c6a5730 /include/ui/SnackBar.h
parentMerge pull request #372 from bebehei/notification (diff)
downloadnheko-0e814da91c8e041897a4c3f7e6e9234bbc7c6f7a.tar.xz
Move all files under src/
Diffstat (limited to 'include/ui/SnackBar.h')
-rw-r--r--include/ui/SnackBar.h79
1 files changed, 0 insertions, 79 deletions
diff --git a/include/ui/SnackBar.h b/include/ui/SnackBar.h
deleted file mode 100644

index eed59c87..00000000 --- a/include/ui/SnackBar.h +++ /dev/null
@@ -1,79 +0,0 @@ -#pragma once - -#include <QCoreApplication> -#include <QPaintEvent> -#include <QTimer> -#include <deque> - -#include "OverlayWidget.h" - -enum class SnackBarPosition -{ - Bottom, - Top, -}; - -class SnackBar : public OverlayWidget -{ - Q_OBJECT - -public: - explicit SnackBar(QWidget *parent); - - inline void setBackgroundColor(const QColor &color); - inline void setTextColor(const QColor &color); - inline void setPosition(SnackBarPosition pos); - -public slots: - void showMessage(const QString &msg); - -protected: - void paintEvent(QPaintEvent *event) override; - void mousePressEvent(QMouseEvent *event) override; - -private slots: - void hideMessage(); - -private: - void stopTimers(); - void start(); - - QColor bgColor_; - QColor textColor_; - - qreal bgOpacity_; - qreal offset_; - - std::deque<QString> messages_; - - QTimer showTimer_; - QTimer hideTimer_; - - int duration_; - int boxWidth_; - int boxHeight_; - int boxPadding_; - - SnackBarPosition position_; -}; - -inline void -SnackBar::setPosition(SnackBarPosition pos) -{ - position_ = pos; - update(); -} - -inline void -SnackBar::setBackgroundColor(const QColor &color) -{ - bgColor_ = color; - update(); -} - -inline void -SnackBar::setTextColor(const QColor &color) -{ - textColor_ = color; - update(); -}