From 6181e316ce8cfc1bef05c466a2470427ceb2deac Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Wed, 15 Sep 2010 21:21:33 +0200 Subject: Prompt user before restoring session after a crash. Shows the about:closedTabs page in the background. Task: https://bugs.kde.org/show_bug.cgi?id=249228 --- src/notificationbar.h | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'src/notificationbar.h') 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 +#include +#include +#include +#include #include // 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(); }; -- cgit v1.2.1