summaryrefslogtreecommitdiff
path: root/src/notificationbar.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/notificationbar.h')
-rw-r--r--src/notificationbar.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/notificationbar.h b/src/notificationbar.h
index 858fac80..74372f0a 100644
--- a/src/notificationbar.h
+++ b/src/notificationbar.h
@@ -27,14 +27,52 @@
#define NOTIFICATIONBAR_H
// Qt Includes
+#include <QApplication>
+#include <QColor>
+#include <QGraphicsEffect>
+#include <QPainter>
+#include <QPropertyAnimation>
#include <QWidget>
// Forward Declarations
class QPropertyAnimation;
-class BlinkEffect;
+
+class BlinkEffect : public QGraphicsEffect
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
+
+public:
+ BlinkEffect(QObject *parent = 0)
+ : QGraphicsEffect(parent)
+ , m_opacity(0)
+ , m_backgroundColor(QApplication::palette().highlight().color().lighter())
+ {}
+
+ qreal opacity() const { return m_opacity; }
+ void setOpacity(qreal opacity)
+ {
+ m_opacity = opacity;
+ update();
+ }
+
+protected:
+ void draw(QPainter *painter)
+ {
+ painter->drawPixmap(QPoint(0,0), sourcePixmap());
+ painter->setOpacity(m_opacity);
+ painter->fillRect(boundingRect(), m_backgroundColor);
+ }
+
+private:
+ double m_opacity;
+ QColor m_backgroundColor;
+
+};
class NotificationBar : public QWidget
{
+ Q_OBJECT
public:
explicit NotificationBar(QWidget *parent = 0);
~NotificationBar();
@@ -44,6 +82,8 @@ public:
private:
BlinkEffect *m_blinkEffect;
QPropertyAnimation *m_opacityAnimation;
+protected slots:
+ void destroy();
};