From b55dcace49c6dc8c18c854f27fbb75f96e846f24 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 13 Sep 2016 12:43:50 +0200
Subject: Improve roster item readability for selected items

Due to the style independent fixed text color for the status
message of non-compact roster item, it was barely readable on
Windows 7. This commit has the color for the status message
in non-compact roster items depend on the used text color
for the name. It uses a brightness adjusted highlight text
color for the second line.

Test-Information:

Tested on OS X 10.11.6 with Qt 5.5.1 and Windows 8 with Qt
5.5.1.

Change-Id: I41beb0f3eaede3f9413a39662c213a4e904bdd69

diff --git a/Swift/QtUI/Roster/DelegateCommons.cpp b/Swift/QtUI/Roster/DelegateCommons.cpp
index 21d42ef..a8dd8a7 100644
--- a/Swift/QtUI/Roster/DelegateCommons.cpp
+++ b/Swift/QtUI/Roster/DelegateCommons.cpp
@@ -13,10 +13,6 @@
 
 namespace Swift {
 
-namespace {
-    const QColor secondLineColor = QColor(160,160,160);
-}
-
 void DelegateCommons::drawElidedText(QPainter* painter, const QRect& region, const QString& text, int flags) {
     QString adjustedText(painter->fontMetrics().elidedText(text, Qt::ElideRight, region.width(), Qt::TextShowMnemonic));
     painter->setClipRect(region);
@@ -27,11 +23,14 @@ void DelegateCommons::drawElidedText(QPainter* painter, const QRect& region, con
 void DelegateCommons::paintContact(QPainter* painter, const QStyleOptionViewItem& option, const QColor& nameColor, const QString& avatarPath, const QIcon& presenceIcon, const QString& name, const QString& statusText, bool isIdle, int unreadCount, bool compact) const {
     painter->save();
     QRect fullRegion(option.rect);
+    QPen secondLineColor;
     if ( option.state & QStyle::State_Selected ) {
         painter->fillRect(fullRegion, option.palette.highlight());
         painter->setPen(option.palette.highlightedText().color());
+        secondLineColor = painter->pen().color().darker(125);
     } else {
         painter->setPen(QPen(nameColor));
+        secondLineColor = painter->pen().color().lighter();
     }
 
     QRect presenceIconRegion(QPoint(farLeftMargin, fullRegion.top()), QSize(presenceIconWidth, fullRegion.height() - verticalMargin));
-- 
cgit v0.10.2-6-g49f6