diff options
Diffstat (limited to 'src/notificationbar.cpp')
-rw-r--r-- | src/notificationbar.cpp | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/src/notificationbar.cpp b/src/notificationbar.cpp index 94c5cba8..e3d9c6b0 100644 --- a/src/notificationbar.cpp +++ b/src/notificationbar.cpp @@ -22,47 +22,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * ============================================================ */ +// Self includes #include "notificationbar.h" +#include "notificationbar.moc" -#include <QApplication> -#include <QColor> -#include <QGraphicsEffect> -#include <QPainter> -#include <QPropertyAnimation> - - -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; +// Qt Includes -}; +#include <QLayout> +#include <QDebug> NotificationBar::NotificationBar(QWidget *parent) @@ -89,4 +56,10 @@ void NotificationBar::notifyUser(int animationDuration) } -#include "notificationbar.moc" +void NotificationBar::destroy() +{ + qDebug() << Q_FUNC_INFO << "deleting the bar" << this; + if (parentWidget() && parentWidget()->layout()) + parentWidget()->layout()->removeWidget(this); + deleteLater(); +} |