diff options
| author | Kevin Smith <git@kismith.co.uk> | 2011-11-01 23:04:03 (GMT) | 
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2011-11-01 23:04:03 (GMT) | 
| commit | 16d50c0df983e96a28a6572da27b3633b40a41d7 (patch) | |
| tree | 9b7a74f074e33d00966b2e8bf71d31162fa619dc /Swift/QtUI/ChatList/ChatListDelegate.cpp | |
| parent | a710cb325c7827679c35c61ab41b821a5bc77673 (diff) | |
| download | swift-contrib-16d50c0df983e96a28a6572da27b3633b40a41d7.zip swift-contrib-16d50c0df983e96a28a6572da27b3633b40a41d7.tar.bz2  | |
Having a play with a compact roster mode
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListDelegate.cpp')
| -rw-r--r-- | Swift/QtUI/ChatList/ChatListDelegate.cpp | 10 | 
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_);  }  }  | 
 Swift