diff --git a/src/plugins/backends/snore/notification.qml b/src/plugins/backends/snore/notification.qml index f190966..75feb7d 100644 --- a/src/plugins/backends/snore/notification.qml +++ b/src/plugins/backends/snore/notification.qml @@ -18,13 +18,16 @@ Rectangle { - function update(nTitle, bBody, nImage, nAppIcon, color) + function update(nTitle, bBody, nImage, nAppIcon, color, textColor) { title.text = nTitle + title.color = textColor body.text = bBody + body.color = textColor appIcon.source = nAppIcon image.source = nImage root.color = color + } @@ -36,6 +39,9 @@ Rectangle { anchors.fill: parent z: -1 onClicked: root.invoked() + hoverEnabled: true + onEntered: closeButton.visible = true + onExited: closeButton.visible = false } Text { @@ -48,7 +54,6 @@ Rectangle { text: qsTr("Title") wrapMode: Text.WordWrap - font.pixelSize: 12 } Text { @@ -60,7 +65,6 @@ Rectangle { color: "#ffffff" text: qsTr("Body") wrapMode: Text.WordWrap - font.pixelSize: 12 onLinkActivated: root.linkClicked(link) } @@ -94,6 +98,7 @@ Rectangle { fillMode: Image.PreserveAspectFit z: 3 source: "qrc:/resources/close.png" + visible: false MouseArea { id: mouseArea1 @@ -106,4 +111,5 @@ Rectangle { + } diff --git a/src/plugins/backends/snore/notifywidget.cpp b/src/plugins/backends/snore/notifywidget.cpp index 125aafc..72f3dc1 100644 --- a/src/plugins/backends/snore/notifywidget.cpp +++ b/src/plugins/backends/snore/notifywidget.cpp @@ -67,10 +67,6 @@ NotifyWidget::NotifyWidget(int pos,QWidget *parent) : m_dest = QPoint(m_desktop.topRight().x() - width(), m_desktop.topRight().y() + 10 + 10 + height() * pos); m_start = QPoint(m_desktop.topRight().x(), m_dest.y()); - snoreDebug( SNORE_DEBUG ) << m_dest << m_start << size(); - - - m_moveTimer->setInterval(1); connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove())); @@ -97,12 +93,16 @@ void NotifyWidget::display(const Notification ¬ification) void NotifyWidget::update(const Notification ¬ification) { m_notification = notification; + QColor color = computeBackgrondColor(notification.application().icon().image()); + QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb())); + QColor textColor = QColor(gray, gray, gray); QMetaObject::invokeMethod(qmlNotification, "update", Qt::QueuedConnection, Q_ARG( QVariant, notification.title()), Q_ARG( QVariant, notification.text()), Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())), Q_ARG( QVariant, QUrl::fromLocalFile(notification.application().icon().localUrl())), - Q_ARG( QVariant, computeBackgrondColor(notification.application().icon().image()))); + Q_ARG( QVariant, color), + Q_ARG( QVariant, textColor )); } diff --git a/src/plugins/backends/snore/snorenotifier.cpp b/src/plugins/backends/snore/snorenotifier.cpp index 149289c..63310b3 100644 --- a/src/plugins/backends/snore/snorenotifier.cpp +++ b/src/plugins/backends/snore/snorenotifier.cpp @@ -49,7 +49,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification) if(notification.isUpdate()) { NotifyWidget *w = m_widgets[notification.old().hints().privateValue(this, "id").toInt()]; - if(w->isVisible() && w->notification().id() == notification.old().id()) + if(w->isVisible() && w->notification().isValid() && w->notification().id() == notification.old().id()) { w->update(notification); notification.hints().setPrivateValue(this, "id", w->id());