summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-05-07 18:45:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-05-07 18:45:47 (GMT)
commit203ca1c122db89c4a9f9f01bff2cadb3b9daca04 (patch)
treee57d7f5997aad1832146d2806418b184e1dfe6bb /Swift/QtUI/ChatList
parent61620db053088fac637799b27f04efa44d0bcc6b (diff)
downloadswift-contrib-203ca1c122db89c4a9f9f01bff2cadb3b9daca04.zip
swift-contrib-203ca1c122db89c4a9f9f01bff2cadb3b9daca04.tar.bz2
Cleaned up MUC code.
Diffstat (limited to 'Swift/QtUI/ChatList')
-rw-r--r--Swift/QtUI/ChatList/ChatListMUCItem.cpp8
-rw-r--r--Swift/QtUI/ChatList/ChatListMUCItem.h6
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.cpp4
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.h4
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.cpp6
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.h4
6 files changed, 16 insertions, 16 deletions
diff --git a/Swift/QtUI/ChatList/ChatListMUCItem.cpp b/Swift/QtUI/ChatList/ChatListMUCItem.cpp
index ec643d1..370956e 100644
--- a/Swift/QtUI/ChatList/ChatListMUCItem.cpp
+++ b/Swift/QtUI/ChatList/ChatListMUCItem.cpp
@@ -9,18 +9,18 @@
#include "Swift/QtUI/QtSwiftUtil.h"
namespace Swift {
-ChatListMUCItem::ChatListMUCItem(boost::shared_ptr<MUCBookmark> bookmark, ChatListGroupItem* parent) : ChatListItem(parent), bookmark_(bookmark) {
+ChatListMUCItem::ChatListMUCItem(const MUCBookmark& bookmark, ChatListGroupItem* parent) : ChatListItem(parent), bookmark_(bookmark) {
}
-boost::shared_ptr<MUCBookmark> ChatListMUCItem::getBookmark() {
+const MUCBookmark& ChatListMUCItem::getBookmark() {
return bookmark_;
}
QVariant ChatListMUCItem::data(int role) {
switch (role) {
- case Qt::DisplayRole: return P2QSTRING(bookmark_->getName());
- case DetailTextRole: return P2QSTRING(bookmark_->getRoom().toString());
+ 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::ToolTipRole: return isContact() ? toolTipString() : QVariant();
diff --git a/Swift/QtUI/ChatList/ChatListMUCItem.h b/Swift/QtUI/ChatList/ChatListMUCItem.h
index 4170c6f..f5e3242 100644
--- a/Swift/QtUI/ChatList/ChatListMUCItem.h
+++ b/Swift/QtUI/ChatList/ChatListMUCItem.h
@@ -23,11 +23,11 @@ namespace Swift {
};
class ChatListMUCItem : public ChatListItem {
public:
- ChatListMUCItem(boost::shared_ptr<MUCBookmark> bookmark, ChatListGroupItem* parent);
- boost::shared_ptr<MUCBookmark> getBookmark();
+ ChatListMUCItem(const MUCBookmark& bookmark, ChatListGroupItem* parent);
+ const MUCBookmark& getBookmark();
QVariant data(int role);
private:
- boost::shared_ptr<MUCBookmark> bookmark_;
+ MUCBookmark bookmark_;
QList<ChatListItem*> items_;
};
}
diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp
index 0e4af55..50a6ad3 100644
--- a/Swift/QtUI/ChatList/ChatListModel.cpp
+++ b/Swift/QtUI/ChatList/ChatListModel.cpp
@@ -16,7 +16,7 @@ ChatListModel::ChatListModel() {
root_->addItem(mucBookmarks_);
}
-void ChatListModel::addMUCBookmark(boost::shared_ptr<Swift::MUCBookmark> bookmark) {
+void ChatListModel::addMUCBookmark(const Swift::MUCBookmark& bookmark) {
emit layoutAboutToBeChanged();
mucBookmarks_->addItem(new ChatListMUCItem(bookmark, mucBookmarks_));
emit layoutChanged();
@@ -25,7 +25,7 @@ void ChatListModel::addMUCBookmark(boost::shared_ptr<Swift::MUCBookmark> bookmar
//emit dataChanged(parent(index), parent(index));
}
-void ChatListModel::removeMUCBookmark(boost::shared_ptr<Swift::MUCBookmark> bookmark) {
+void ChatListModel::removeMUCBookmark(const Swift::MUCBookmark& bookmark) {
for (int i = 0; i < mucBookmarks_->rowCount(); i++) {
ChatListMUCItem* item = dynamic_cast<ChatListMUCItem*>(mucBookmarks_->item(i));
if (item->getBookmark() == bookmark) {
diff --git a/Swift/QtUI/ChatList/ChatListModel.h b/Swift/QtUI/ChatList/ChatListModel.h
index 71849cc..05fa60b 100644
--- a/Swift/QtUI/ChatList/ChatListModel.h
+++ b/Swift/QtUI/ChatList/ChatListModel.h
@@ -20,8 +20,8 @@ namespace Swift {
Q_OBJECT
public:
ChatListModel();
- void addMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark);
- void removeMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark);
+ void addMUCBookmark(const MUCBookmark& bookmark);
+ void removeMUCBookmark(const MUCBookmark& bookmark);
int columnCount(const QModelIndex& parent = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp
index 9b70881..8dbb501 100644
--- a/Swift/QtUI/ChatList/QtChatListWindow.cpp
+++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp
@@ -58,16 +58,16 @@ void QtChatListWindow::handleItemActivated(const QModelIndex& index) {
ChatListItem* item = model_->getItemForIndex(index);
ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(item);
if (mucItem) {
- boost::shared_ptr<UIEvent> event(new JoinMUCUIEvent(mucItem->getBookmark()->getRoom(), mucItem->getBookmark()->getNick()));
+ boost::shared_ptr<UIEvent> event(new JoinMUCUIEvent(mucItem->getBookmark().getRoom(), mucItem->getBookmark().getNick()));
eventStream_->send(event);
}
}
-void QtChatListWindow::addMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark) {
+void QtChatListWindow::addMUCBookmark(const MUCBookmark& bookmark) {
model_->addMUCBookmark(bookmark);
}
-void QtChatListWindow::removeMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark) {
+void QtChatListWindow::removeMUCBookmark(const MUCBookmark& bookmark) {
model_->removeMUCBookmark(bookmark);
}
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h
index 2055e6b..7d0dbb1 100644
--- a/Swift/QtUI/ChatList/QtChatListWindow.h
+++ b/Swift/QtUI/ChatList/QtChatListWindow.h
@@ -21,8 +21,8 @@ namespace Swift {
public:
QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent = NULL);
virtual ~QtChatListWindow();
- void addMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark);
- void removeMUCBookmark(boost::shared_ptr<MUCBookmark> bookmark);
+ void addMUCBookmark(const MUCBookmark& bookmark);
+ void removeMUCBookmark(const MUCBookmark& bookmark);
private slots:
void handleItemActivated(const QModelIndex&);
void handleAddBookmark();