style updates

This commit is contained in:
Patrick von Reth 2014-07-03 11:23:59 +02:00
parent 55e4784f29
commit d19ece3b05
3 changed files with 15 additions and 9 deletions

View File

@ -18,13 +18,16 @@ Rectangle {
function update(nTitle, bBody, nImage, nAppIcon, color) function update(nTitle, bBody, nImage, nAppIcon, color, textColor)
{ {
title.text = nTitle title.text = nTitle
title.color = textColor
body.text = bBody body.text = bBody
body.color = textColor
appIcon.source = nAppIcon appIcon.source = nAppIcon
image.source = nImage image.source = nImage
root.color = color root.color = color
} }
@ -36,6 +39,9 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
z: -1 z: -1
onClicked: root.invoked() onClicked: root.invoked()
hoverEnabled: true
onEntered: closeButton.visible = true
onExited: closeButton.visible = false
} }
Text { Text {
@ -48,7 +54,6 @@ Rectangle {
text: qsTr("Title") text: qsTr("Title")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: 12
} }
Text { Text {
@ -60,7 +65,6 @@ Rectangle {
color: "#ffffff" color: "#ffffff"
text: qsTr("Body") text: qsTr("Body")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: 12
onLinkActivated: root.linkClicked(link) onLinkActivated: root.linkClicked(link)
} }
@ -94,6 +98,7 @@ Rectangle {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
z: 3 z: 3
source: "qrc:/resources/close.png" source: "qrc:/resources/close.png"
visible: false
MouseArea { MouseArea {
id: mouseArea1 id: mouseArea1
@ -106,4 +111,5 @@ Rectangle {
} }

View File

@ -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_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()); m_start = QPoint(m_desktop.topRight().x(), m_dest.y());
snoreDebug( SNORE_DEBUG ) << m_dest << m_start << size();
m_moveTimer->setInterval(1); m_moveTimer->setInterval(1);
connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove())); connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove()));
@ -97,12 +93,16 @@ void NotifyWidget::display(const Notification &notification)
void NotifyWidget::update(const Notification &notification) void NotifyWidget::update(const Notification &notification)
{ {
m_notification = notification; 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, QMetaObject::invokeMethod(qmlNotification, "update", Qt::QueuedConnection,
Q_ARG( QVariant, notification.title()), Q_ARG( QVariant, notification.title()),
Q_ARG( QVariant, notification.text()), Q_ARG( QVariant, notification.text()),
Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())), Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())),
Q_ARG( QVariant, QUrl::fromLocalFile(notification.application().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 ));
} }

View File

@ -49,7 +49,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification)
if(notification.isUpdate()) if(notification.isUpdate())
{ {
NotifyWidget *w = m_widgets[notification.old().hints().privateValue(this, "id").toInt()]; 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); w->update(notification);
notification.hints().setPrivateValue(this, "id", w->id()); notification.hints().setPrivateValue(this, "id", w->id());