From kde-commits Thu Jan 24 00:01:39 2008 From: Alex Merry Date: Thu, 24 Jan 2008 00:01:39 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/applets/tasks Message-Id: <1201132899.259403.10731.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120113291504625 SVN commit 765434 by alexmerry: Highlight windows if they demand attention. As an added bonus, use plasma theme colors for most things. BUG: 155972 M +17 -7 abstracttaskitem.cpp --- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.cpp #765433:765434 @@ -36,6 +36,7 @@ #include #include "plasma/plasma.h" +#include "plasma/theme.h" AbstractTaskItem::AbstractTaskItem(QGraphicsItem *parent, QObject *parentObject) : Widget(parent,parentObject), @@ -208,8 +209,17 @@ { // FIXME Check the usage of KColorScheme here with various color schemes - KColorScheme colorScheme(QPalette::Active); + const qreal hoverAlpha = 0.4; + KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Plasma::Theme::self()->colors()); + + if (taskFlags() & TaskWantsAttention) { + QColor background = colorScheme.background(KColorScheme::ActiveBackground).color(); + background.setAlphaF(hoverAlpha+0.2); + painter->setBrush(QBrush(background)); + painter->drawPath(Plasma::roundedRectangle(option->rect, 6)); + } + if (option->state & QStyle::State_MouseOver || m_animId != -1 || taskFlags() & TaskHasFocus) @@ -229,7 +239,6 @@ endColor = colorScheme.shade(startColor,KColorScheme::DarkShade); const qreal pressedAlpha = 0.2; - const qreal hoverAlpha = 0.4; qreal alpha = 0; @@ -251,11 +260,13 @@ painter->setPen(QPen(QColor(100, 100, 100, startColor.alpha()))); painter->setBrush(background); - painter->drawPath(Plasma::roundedRectangle(option->rect, 6)); } else { - painter->setBrush(QBrush(colorScheme.shade(KColorScheme::ShadowShade).darker(500))); - painter->drawPath(Plasma::roundedRectangle(option->rect, 6)); + QColor background = colorScheme.shade(colorScheme.background(KColorScheme::AlternateBackground).color(), + KColorScheme::DarkShade); + background.setAlphaF(0.2); + painter->setBrush(QBrush(background)); } + painter->drawPath(Plasma::roundedRectangle(option->rect, 6)); } QSize AbstractTaskItem::layoutText(QTextLayout &layout, const QString &text, @@ -402,8 +413,7 @@ } #endif - // FIXME HARDCODE testing - painter->setPen(QPen(QColor(255,255,255), 1.0)); + painter->setPen(QPen(Plasma::Theme::self()->textColor(), 1.0)); QRect rect = textRect().toRect(); rect.adjust(2, 2, -2, -2); // Create a text margin