summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/ChatList')
-rw-r--r--Swift/QtUI/ChatList/ChatListDelegate.cpp5
-rw-r--r--Swift/QtUI/ChatList/ChatListGroupItem.h16
-rw-r--r--Swift/QtUI/ChatList/ChatListItem.h4
-rw-r--r--Swift/QtUI/ChatList/ChatListRecentItem.cpp5
-rw-r--r--Swift/QtUI/ChatList/ChatListRecentItem.h3
-rw-r--r--Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp9
6 files changed, 26 insertions, 16 deletions
diff --git a/Swift/QtUI/ChatList/ChatListDelegate.cpp b/Swift/QtUI/ChatList/ChatListDelegate.cpp
index 5b879df..5b03ac5 100644
--- a/Swift/QtUI/ChatList/ChatListDelegate.cpp
+++ b/Swift/QtUI/ChatList/ChatListDelegate.cpp
@@ -120,7 +120,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, compact_);
+ common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, false, item->getChat().unreadCount, compact_);
}
void ChatListDelegate::paintWhiteboard(QPainter* painter, const QStyleOptionViewItem& option, ChatListWhiteboardItem* item) const {
@@ -135,7 +135,8 @@ void ChatListDelegate::paintWhiteboard(QPainter* painter, const QStyleOptionView
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_);
+ common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, false, item->getChat().unreadCount, compact_);
+
}
}
diff --git a/Swift/QtUI/ChatList/ChatListGroupItem.h b/Swift/QtUI/ChatList/ChatListGroupItem.h
index a1e479f..17defea 100644
--- a/Swift/QtUI/ChatList/ChatListGroupItem.h
+++ b/Swift/QtUI/ChatList/ChatListGroupItem.h
@@ -13,14 +13,14 @@
namespace Swift {
class ChatListGroupItem : public ChatListItem {
public:
- ChatListGroupItem(const QString& name, ChatListGroupItem* parent, bool sorted = true) : ChatListItem(parent), name_(name), sorted_(sorted) {};
- void addItem(ChatListItem* item) {items_.push_back(item); if (sorted_) {qStableSort(items_.begin(), items_.end(), pointerItemLessThan);}};
- void remove(int index) {items_.removeAt(index);};
- int rowCount() {return items_.size();};
- ChatListItem* item(int i) {return items_[i];};
- int row(ChatListItem* item) {return items_.indexOf(item);};
- QVariant data(int role) const {return (role == Qt::DisplayRole) ? name_ : QVariant();};
- void clear() {items_.clear();};
+ ChatListGroupItem(const QString& name, ChatListGroupItem* parent, bool sorted = true) : ChatListItem(parent), name_(name), sorted_(sorted) {}
+ void addItem(ChatListItem* item) {items_.push_back(item); if (sorted_) {qStableSort(items_.begin(), items_.end(), pointerItemLessThan);}}
+ void remove(int index) {items_.removeAt(index);}
+ int rowCount() {return items_.size();}
+ ChatListItem* item(int i) {return items_[i];}
+ int row(ChatListItem* item) {return items_.indexOf(item);}
+ QVariant data(int role) const {return (role == Qt::DisplayRole) ? name_ : QVariant();}
+ void clear() {items_.clear();}
private:
static bool pointerItemLessThan(const ChatListItem* first, const ChatListItem* second) {
QString myName = first->data(Qt::DisplayRole).toString().toLower();
diff --git a/Swift/QtUI/ChatList/ChatListItem.h b/Swift/QtUI/ChatList/ChatListItem.h
index e7be614..28c0f9c 100644
--- a/Swift/QtUI/ChatList/ChatListItem.h
+++ b/Swift/QtUI/ChatList/ChatListItem.h
@@ -13,10 +13,10 @@ namespace Swift {
class ChatListGroupItem;
class ChatListItem {
public:
- ChatListItem(ChatListGroupItem* parent) {parent_ = parent;};
+ ChatListItem(ChatListGroupItem* parent) {parent_ = parent;}
virtual ~ChatListItem() {}
- ChatListGroupItem* parent() {return parent_;};
+ ChatListGroupItem* parent() {return parent_;}
virtual QVariant data(int role) const = 0;
private:
diff --git a/Swift/QtUI/ChatList/ChatListRecentItem.cpp b/Swift/QtUI/ChatList/ChatListRecentItem.cpp
index 6c9807f..5a4d1e1 100644
--- a/Swift/QtUI/ChatList/ChatListRecentItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListRecentItem.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Kevin Smith
+ * Copyright (c) 2011-2013 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -7,6 +7,7 @@
#include <Swift/QtUI/ChatList/ChatListRecentItem.h>
#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swiften/Base/Path.h>
namespace Swift {
ChatListRecentItem::ChatListRecentItem(const ChatListWindow::Chat& chat, ChatListGroupItem* parent) : ChatListItem(parent), chat_(chat) {
@@ -25,7 +26,7 @@ QVariant ChatListRecentItem::data(int role) const {
case Qt::BackgroundColorRole: return backgroundColor_;
case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
case StatusTextRole: return statusText_;*/
- case AvatarRole: return QVariant(QString(chat_.avatarPath.string().c_str()));
+ case AvatarRole: return QVariant(P2QSTRING(pathToString(chat_.avatarPath)));
case PresenceIconRole: return getPresenceIcon();
default: return QVariant();
}
diff --git a/Swift/QtUI/ChatList/ChatListRecentItem.h b/Swift/QtUI/ChatList/ChatListRecentItem.h
index 4e7bc3e..3f27a68 100644
--- a/Swift/QtUI/ChatList/ChatListRecentItem.h
+++ b/Swift/QtUI/ChatList/ChatListRecentItem.h
@@ -23,7 +23,8 @@ namespace Swift {
DetailTextRole = Qt::UserRole,
AvatarRole = Qt::UserRole + 1,
PresenceIconRole = Qt::UserRole + 2/*,
- StatusShowTypeRole = Qt::UserRole + 3*/
+ StatusShowTypeRole = Qt::UserRole + 3,
+ IdleRole = Qt::UserRole + 4*/
};
ChatListRecentItem(const ChatListWindow::Chat& chat, ChatListGroupItem* parent);
const ChatListWindow::Chat& getChat() const;
diff --git a/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp b/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
index 41648b6..6791aa5 100644
--- a/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListWhiteboardItem.cpp
@@ -4,9 +4,16 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License.
+ * See the COPYING file for more information.
+ */
+
#include <Swift/QtUI/ChatList/ChatListWhiteboardItem.h>
#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swiften/Base/Path.h>
namespace Swift {
ChatListWhiteboardItem::ChatListWhiteboardItem(const ChatListWindow::Chat& chat, ChatListGroupItem* parent) : ChatListItem(parent), chat_(chat) {
@@ -25,7 +32,7 @@ namespace Swift {
case Qt::BackgroundColorRole: return backgroundColor_;
case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
case StatusTextRole: return statusText_;*/
- case AvatarRole: return QVariant(QString(chat_.avatarPath.string().c_str()));
+ case AvatarRole: return QVariant(P2QSTRING(pathToString(chat_.avatarPath)));
case PresenceIconRole: return getPresenceIcon();
default: return QVariant();
}