cache background color for applications

This commit is contained in:
Patrick von Reth 2014-07-04 11:38:54 +02:00
parent 6edbbd3df4
commit 4c5f916b30
1 changed files with 11 additions and 1 deletions

View File

@ -101,7 +101,17 @@ void NotifyWidget::update(const Notification &notification)
m_dest = QPoint(desktop.topRight().x() - width(), desktop.topRight().y() + space + (space + height()) * m_id); m_dest = QPoint(desktop.topRight().x() - width(), desktop.topRight().y() + space + (space + height()) * m_id);
m_start = QPoint(desktop.topRight().x(), m_dest.y()); m_start = QPoint(desktop.topRight().x(), m_dest.y());
QColor color = computeBackgrondColor(notification.application().icon().image()); QColor color;
QVariant vcolor = notification.application().constHints().privateValue(parent(), "backgroundColor");
if(vcolor.isValid())
{
color = vcolor.value<QColor>();
}
else
{
color = computeBackgrondColor(notification.application().icon().image().scaled(20,20));
notification.application().constHints().setPrivateValue(parent(), "backgroundColor", color);
}
QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb())); QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb()));
QColor textColor = QColor(gray, gray, gray); QColor textColor = QColor(gray, gray, gray);
QMetaObject::invokeMethod(qmlNotification, "update", Qt::QueuedConnection, QMetaObject::invokeMethod(qmlNotification, "update", Qt::QueuedConnection,