summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListDelegate.cpp')
-rw-r--r--Swift/QtUI/ChatList/ChatListDelegate.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Swift/QtUI/ChatList/ChatListDelegate.cpp b/Swift/QtUI/ChatList/ChatListDelegate.cpp
index 29dba62..bcd1585 100644
--- a/Swift/QtUI/ChatList/ChatListDelegate.cpp
+++ b/Swift/QtUI/ChatList/ChatListDelegate.cpp
@@ -16,7 +16,7 @@
namespace Swift {
-ChatListDelegate::ChatListDelegate() {
+ChatListDelegate::ChatListDelegate(bool compact) : compact_(compact) {
groupDelegate_ = new GroupItemDelegate();
}
@@ -24,13 +24,17 @@ ChatListDelegate::~ChatListDelegate() {
delete groupDelegate_;
}
+void ChatListDelegate::setCompact(bool compact) {
+ compact_ = compact;
+}
+
QSize ChatListDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const {
ChatListItem* item = static_cast<ChatListItem*>(index.internalPointer());
if (item && dynamic_cast<ChatListMUCItem*>(item)) {
return mucSizeHint(option, index);
}
else if (item && dynamic_cast<ChatListRecentItem*>(item)) {
- return common_.contactSizeHint(option, index);
+ return common_.contactSizeHint(option, index, compact_);
}
else if (item && dynamic_cast<ChatListGroupItem*>(item)) {
return groupDelegate_->sizeHint(option, index);
@@ -109,7 +113,7 @@ void ChatListDelegate::paintRecent(QPainter* painter, const QStyleOptionViewItem
QString name = item->data(Qt::DisplayRole).toString();
//qDebug() << "Avatar for " << name << " = " << avatarPath;
QString statusText = item->data(ChatListRecentItem::DetailTextRole).toString();
- common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, item->getChat().unreadCount);
+ common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, item->getChat().unreadCount, compact_);
}
}