summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-07-29 10:55:58 (GMT)
committerTobias Markmann <tm@ayena.de>2016-08-03 11:22:27 (GMT)
commitc135724a9daa6e3dca7bf75abc9c4cabdc585e88 (patch)
tree1ae192d3715dcc3b85b832f716c25072c0590bf1 /Swift
parentcc83a29121707f51a7eb8ff11c7eee7a7a575acf (diff)
downloadswift-c135724a9daa6e3dca7bf75abc9c4cabdc585e88.zip
swift-c135724a9daa6e3dca7bf75abc9c4cabdc585e88.tar.bz2
Draw usernames in contact list in dark gray
It now uses the same dark gray tone as the chat view uses for its text. Moved some constants to named variables for readability. Test-Information: Compact and non-compact contact lists, in the roster and MUC roster and the chats view all show the first line drawn in a dark gray instead of the hard black. Change-Id: Ief36fd4f27d30ace61f04d50e846db571ab84a4e
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/ChatList/ChatListDelegate.cpp9
-rw-r--r--Swift/QtUI/ChatList/ChatListMUCItem.cpp6
-rw-r--r--Swift/QtUI/ChatList/ChatListRecentItem.cpp4
-rw-r--r--Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp11
-rw-r--r--Swift/QtUI/EventViewer/TwoLineDelegate.cpp9
-rw-r--r--Swift/QtUI/Roster/DelegateCommons.cpp8
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp4
7 files changed, 35 insertions, 16 deletions
diff --git a/Swift/QtUI/ChatList/ChatListDelegate.cpp b/Swift/QtUI/ChatList/ChatListDelegate.cpp
index 29eb29a..f818e50 100644
--- a/Swift/QtUI/ChatList/ChatListDelegate.cpp
+++ b/Swift/QtUI/ChatList/ChatListDelegate.cpp
@@ -1,11 +1,12 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/ChatList/ChatListDelegate.h>
+#include <QColor>
#include <QPainter>
#include <QPen>
@@ -18,6 +19,10 @@
namespace Swift {
+namespace {
+ const QColor secondLineColor = QColor(160,160,160);
+}
+
ChatListDelegate::ChatListDelegate(bool compact) : compact_(compact) {
groupDelegate_ = new GroupItemDelegate();
}
@@ -102,7 +107,7 @@ void ChatListDelegate::paintMUC(QPainter* painter, const QStyleOptionViewItem& o
DelegateCommons::drawElidedText(painter, nameRegion, item->data(Qt::DisplayRole).toString());
painter->setFont(common_.detailFont);
- painter->setPen(QPen(QColor(160,160,160)));
+ painter->setPen(QPen(secondLineColor));
QRect detailRegion(textRegion.adjusted(0, nameHeight, 0, 0));
DelegateCommons::drawElidedText(painter, detailRegion, item->data(ChatListMUCItem::DetailTextRole).toString());
diff --git a/Swift/QtUI/ChatList/ChatListMUCItem.cpp b/Swift/QtUI/ChatList/ChatListMUCItem.cpp
index 7d072df..e701ddc 100644
--- a/Swift/QtUI/ChatList/ChatListMUCItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListMUCItem.cpp
@@ -6,6 +6,8 @@
#include <Swift/QtUI/ChatList/ChatListMUCItem.h>
+#include <QColor>
+
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
@@ -21,8 +23,8 @@ QVariant ChatListMUCItem::data(int role) const {
switch (role) {
case Qt::DisplayRole: return P2QSTRING(bookmark_.getName());
case DetailTextRole: return P2QSTRING(bookmark_.getRoom().toString());
- /*case Qt::TextColorRole: return textColor_;
- case Qt::BackgroundColorRole: return backgroundColor_;
+ case Qt::TextColorRole: return QColor(89,89,89);
+ /*case Qt::BackgroundColorRole: return backgroundColor_;
case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
case StatusTextRole: return statusText_;
case AvatarRole: return avatar_;
diff --git a/Swift/QtUI/ChatList/ChatListRecentItem.cpp b/Swift/QtUI/ChatList/ChatListRecentItem.cpp
index 383f312..faac937 100644
--- a/Swift/QtUI/ChatList/ChatListRecentItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListRecentItem.cpp
@@ -24,8 +24,8 @@ QVariant ChatListRecentItem::data(int role) const {
switch (role) {
case Qt::DisplayRole: return chat_.impromptuJIDs.empty() ? P2QSTRING(chat_.chatName) : P2QSTRING(chat_.getImpromptuTitle());
case DetailTextRole: return P2QSTRING(chat_.activity);
- /*case Qt::TextColorRole: return textColor_;
- case Qt::BackgroundColorRole: return backgroundColor_;
+ case Qt::TextColorRole: return QColor(89,89,89);
+ /*case Qt::BackgroundColorRole: return backgroundColor_;
case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
case StatusTextRole: return statusText_;*/
case AvatarRole: return QVariant(P2QSTRING(pathToString(chat_.avatarPath)));
diff --git a/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp b/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
index b6f8951..8a4447e 100644
--- a/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
@@ -12,6 +12,8 @@
#include <Swift/QtUI/ChatList/ChatListWhiteboardItem.h>
+#include <QColor>
+
#include <Swiften/Base/Path.h>
#include <Swift/QtUI/QtResourceHelper.h>
@@ -30,10 +32,11 @@ namespace Swift {
switch (role) {
case Qt::DisplayRole: return P2QSTRING(chat_.chatName);
case DetailTextRole: return P2QSTRING(chat_.activity);
- /*case Qt::TextColorRole: return textColor_;
- case Qt::BackgroundColorRole: return backgroundColor_;
- case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
- case StatusTextRole: return statusText_;*/
+ case Qt::TextColorRole: return QColor(89,89,89);
+ /*case Qt::TextColorRole: return textColor_;
+ case Qt::BackgroundColorRole: return backgroundColor_;
+ case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
+ case StatusTextRole: return statusText_;*/
case AvatarRole: return QVariant(P2QSTRING(pathToString(chat_.avatarPath)));
case PresenceIconRole: return getPresenceIcon();
default: return QVariant();
diff --git a/Swift/QtUI/EventViewer/TwoLineDelegate.cpp b/Swift/QtUI/EventViewer/TwoLineDelegate.cpp
index b90acca..5ba24ec 100644
--- a/Swift/QtUI/EventViewer/TwoLineDelegate.cpp
+++ b/Swift/QtUI/EventViewer/TwoLineDelegate.cpp
@@ -6,11 +6,16 @@
#include <Swift/QtUI/EventViewer/TwoLineDelegate.h>
-#include <QDebug>
+#include <QColor>
#include <QPainter>
#include <QPen>
namespace Swift {
+
+namespace {
+ const QColor secondLineColor = QColor(160,160,160);
+}
+
TwoLineDelegate::TwoLineDelegate(int firstRole, int secondRole, bool wrap) {
firstRole_ = firstRole;
secondRole_ = secondRole;
@@ -51,7 +56,7 @@ void TwoLineDelegate::paint(QPainter* painter, const QStyleOptionViewItem& optio
DelegateCommons::drawElidedText(painter, nameRegion, event->data(firstRole_).toString());
painter->setFont(common_.detailFont);
- painter->setPen(QPen(QColor(160,160,160)));
+ painter->setPen(QPen(secondLineColor));
QRect detailRegion(textRegion.adjusted(0, nameHeight, 0, 0));
DelegateCommons::drawElidedText(painter, detailRegion, event->data(secondRole_).toString());
diff --git a/Swift/QtUI/Roster/DelegateCommons.cpp b/Swift/QtUI/Roster/DelegateCommons.cpp
index c1c1244..21d42ef 100644
--- a/Swift/QtUI/Roster/DelegateCommons.cpp
+++ b/Swift/QtUI/Roster/DelegateCommons.cpp
@@ -6,12 +6,16 @@
#include <Swift/QtUI/Roster/DelegateCommons.h>
+#include <QColor>
#include <QFileInfo>
#include <Swift/QtUI/QtScaledAvatarCache.h>
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));
@@ -21,7 +25,7 @@ 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();
+ painter->save();
QRect fullRegion(option.rect);
if ( option.state & QStyle::State_Selected ) {
painter->fillRect(fullRegion, option.palette.highlight());
@@ -72,7 +76,7 @@ void DelegateCommons::paintContact(QPainter* painter, const QStyleOptionViewItem
if (!compact) {
painter->setFont(detailFont);
- painter->setPen(QPen(QColor(160,160,160)));
+ painter->setPen(QPen(secondLineColor));
QRect statusTextRegion(textRegion.adjusted(0, nameHeight, 0, 0));
DelegateCommons::drawElidedText(painter, statusTextRegion, statusText);
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp
index 22af6ec..3f77c86 100644
--- a/Swift/QtUI/Roster/RosterModel.cpp
+++ b/Swift/QtUI/Roster/RosterModel.cpp
@@ -146,10 +146,10 @@ QColor RosterModel::getTextColor(RosterItem* item) const {
int color = 0;
if (contact) {
switch (contact->getStatusShow()) {
- case StatusShow::Online: color = 0x000000; break;
+ case StatusShow::Online: color = 0x595959; break;
case StatusShow::Away: color = 0x336699; break;
case StatusShow::XA: color = 0x336699; break;
- case StatusShow::FFC: color = 0x000000; break;
+ case StatusShow::FFC: color = 0x595959; break;
case StatusShow::DND: color = 0x990000; break;
case StatusShow::None: color = 0x7F7F7F;break;
}