summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-05-30 12:40:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-09-08 16:14:27 (GMT)
commitfe8a8aa031da734f3112184420b372021d9e10c7 (patch)
tree9f8e0b7d11d7612eb25a8682cf940fa647ca67f2 /Swift/QtUI/ChatList/ChatListDelegate.cpp
parent0174723efbc1f612433d45c6916a2ad4596b96ba (diff)
downloadswift-contrib-fe8a8aa031da734f3112184420b372021d9e10c7.zip
swift-contrib-fe8a8aa031da734f3112184420b372021d9e10c7.tar.bz2
Support whiteboarding.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListDelegate.cpp')
-rw-r--r--Swift/QtUI/ChatList/ChatListDelegate.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Swift/QtUI/ChatList/ChatListDelegate.cpp b/Swift/QtUI/ChatList/ChatListDelegate.cpp
index bcd1585..5b879df 100644
--- a/Swift/QtUI/ChatList/ChatListDelegate.cpp
+++ b/Swift/QtUI/ChatList/ChatListDelegate.cpp
@@ -12,6 +12,7 @@
#include "Swift/QtUI/ChatList/ChatListItem.h"
#include "Swift/QtUI/ChatList/ChatListMUCItem.h"
#include "Swift/QtUI/ChatList/ChatListRecentItem.h"
+#include "Swift/QtUI/ChatList/ChatListWhiteboardItem.h"
#include "Swift/QtUI/ChatList/ChatListGroupItem.h"
namespace Swift {
@@ -38,6 +39,9 @@ QSize ChatListDelegate::sizeHint(const QStyleOptionViewItem& option, const QMode
}
else if (item && dynamic_cast<ChatListGroupItem*>(item)) {
return groupDelegate_->sizeHint(option, index);
+ }
+ else if (item && dynamic_cast<ChatListWhiteboardItem*>(item)) {
+ return common_.contactSizeHint(option, index, compact_);
}
return QStyledItemDelegate::sizeHint(option, index);
}
@@ -65,6 +69,9 @@ void ChatListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opti
ChatListGroupItem* group = dynamic_cast<ChatListGroupItem*>(item);
groupDelegate_->paint(painter, option, group->data(Qt::DisplayRole).toString(), group->rowCount(), option.state & QStyle::State_Open);
}
+ else if (item && dynamic_cast<ChatListWhiteboardItem*>(item)) {
+ paintWhiteboard(painter, option, dynamic_cast<ChatListWhiteboardItem*>(item));
+ }
else {
QStyledItemDelegate::paint(painter, option, index);
}
@@ -116,4 +123,19 @@ void ChatListDelegate::paintRecent(QPainter* painter, const QStyleOptionViewItem
common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, item->getChat().unreadCount, compact_);
}
+void ChatListDelegate::paintWhiteboard(QPainter* painter, const QStyleOptionViewItem& option, ChatListWhiteboardItem* item) const {
+ QColor nameColor = item->data(Qt::TextColorRole).value<QColor>();
+ QString avatarPath;
+ if (item->data(ChatListWhiteboardItem::AvatarRole).isValid() && !item->data(ChatListWhiteboardItem::AvatarRole).value<QString>().isNull()) {
+ avatarPath = item->data(ChatListWhiteboardItem::AvatarRole).value<QString>();
+ }
+ QIcon presenceIcon;/* = item->data(ChatListWhiteboardItem::PresenceIconRole).isValid() && !item->data(ChatListWhiteboardItem::PresenceIconRole).value<QIcon>().isNull()
+ ? item->data(ChatListWhiteboardItem::PresenceIconRole).value<QIcon>()
+ : QIcon(":/icons/offline.png");*/
+ QString name = item->data(Qt::DisplayRole).toString();
+ //qDebug() << "Avatar for " << name << " = " << avatarPath;
+ QString statusText = item->data(ChatListWhiteboardItem::DetailTextRole).toString();
+ common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, item->getChat().unreadCount, compact_);
+}
+
}