From a28d92f3458218d6effbfdd9a42bf8fbe8b8aa72 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Sun, 26 Jul 2009 13:39:50 +0100 Subject: Begin to assage Swift model into Qt Model/View. diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 6328156..2e08adb 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -1,7 +1,7 @@ #include "QtChatWindow.h" #include "QtSwiftUtil.h" -#include "QtTreeWidget.h" -#include "QtTreeWidgetFactory.h" +#include "Roster/QtTreeWidget.h" +#include "Roster/QtTreeWidgetFactory.h" #include "QtChatView.h" #include "MessageSnippet.h" #include "SystemMessageSnippet.h" diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index 927447c..47c943f 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -3,7 +3,7 @@ #include "QtChatTabs.h" #include "QtChatWindow.h" #include "QtSwiftUtil.h" -#include "QtTreeWidgetFactory.h" +#include "Roster/QtTreeWidgetFactory.h" namespace Swift { diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index a9ffc51..fffd478 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -2,8 +2,8 @@ #include "QtJoinMUCDialog.h" #include "QtSwiftUtil.h" -#include "QtTreeWidgetFactory.h" -#include "QtTreeWidget.h" +#include "Roster/QtTreeWidgetFactory.h" +#include "Roster/QtTreeWidget.h" #include "QtStatusWidget.h" #include diff --git a/Swift/QtUI/QtMainWindowFactory.cpp b/Swift/QtUI/QtMainWindowFactory.cpp index 288d182..9594ade 100644 --- a/Swift/QtUI/QtMainWindowFactory.cpp +++ b/Swift/QtUI/QtMainWindowFactory.cpp @@ -1,6 +1,6 @@ #include "QtMainWindowFactory.h" #include "QtMainWindow.h" -#include "QtTreeWidgetFactory.h" +#include "Roster/QtTreeWidgetFactory.h" namespace Swift { diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index e1fac9c..00efc17 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -3,7 +3,7 @@ #include "QtLoginWindowFactory.h" #include "QtChatWindowFactory.h" #include "QtMainWindowFactory.h" -#include "QtTreeWidgetFactory.h" +#include "Roster/QtTreeWidgetFactory.h" #include "QtSystemTray.h" #include "QtSoundPlayer.h" diff --git a/Swift/QtUI/QtTreeWidget.cpp b/Swift/QtUI/QtTreeWidget.cpp deleted file mode 100644 index 66c653e..0000000 --- a/Swift/QtUI/QtTreeWidget.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "QtTreeWidget.h" - -#include "Swiften/Base/Platform.h" -#include "Swiften/Roster/OpenChatRosterAction.h" - -namespace Swift { - -QtTreeWidget::QtTreeWidget(QWidget* parent) : QTreeWidget(parent) { - setHeaderHidden(true); -#ifdef SWIFT_PLATFORM_MACOSX - setAlternatingRowColors(true); -#endif - setAnimated(true); - setIndentation(0); - setRootIsDecorated(true); - connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(handleItemActivated(QTreeWidgetItem*, int))); -} - -void QtTreeWidget::handleItemActivated(QTreeWidgetItem* item, int column) { - QtTreeWidgetItem* qtItem = dynamic_cast(item); - if (qtItem) { - qtItem->performUserAction(boost::shared_ptr(new OpenChatRosterAction())); - } -} - -void QtTreeWidget::drawBranches(QPainter*, const QRect&, const QModelIndex&) const { -} - -} diff --git a/Swift/QtUI/QtTreeWidget.h b/Swift/QtUI/QtTreeWidget.h deleted file mode 100644 index e1d83de..0000000 --- a/Swift/QtUI/QtTreeWidget.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef SWIFT_QtTreeWidget_H -#define SWIFT_QtTreeWidget_H - -#include - -#include "Swiften/Roster/TreeWidgetFactory.h" -#include "Swiften/Roster/TreeWidget.h" -#include "Swiften/Roster/TreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidget.h" - -namespace Swift { - -class QtTreeWidget : public QTreeWidget, public TreeWidget { - Q_OBJECT - public: - QtTreeWidget(QWidget* parent = 0); - - private slots: - void handleItemActivated(QTreeWidgetItem*, int); - - private: - void drawBranches(QPainter*, const QRect&, const QModelIndex&) const; -}; - -} -#endif - diff --git a/Swift/QtUI/QtTreeWidgetFactory.cpp b/Swift/QtUI/QtTreeWidgetFactory.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Swift/QtUI/QtTreeWidgetFactory.h b/Swift/QtUI/QtTreeWidgetFactory.h deleted file mode 100644 index e0140d2..0000000 --- a/Swift/QtUI/QtTreeWidgetFactory.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SWIFT_QtTreeWidgetFactory_H -#define SWIFT_QtTreeWidgetFactory_H - -#include "Swiften/Roster/TreeWidgetFactory.h" -#include "Swiften/Roster/TreeWidget.h" -#include "Swiften/Roster/TreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidget.h" - -namespace Swift { - -class QtTreeWidgetFactory : public TreeWidgetFactory { - public: - QtTreeWidgetFactory() { - } - - TreeWidget* createTreeWidget() { - return new QtTreeWidget(); - } - - TreeWidgetItem* createTreeWidgetItem(TreeWidgetItem* item) { - QtTreeWidgetItem* qtItem = dynamic_cast(item); - assert(qtItem); - return new QtTreeWidgetItem(qtItem); - } - - TreeWidgetItem* createTreeWidgetItem(TreeWidget* item) { - QtTreeWidget* qtItem = dynamic_cast(item); - assert(qtItem); - return new QtTreeWidgetItem(qtItem); - } -}; - -} -#endif - diff --git a/Swift/QtUI/QtTreeWidgetItem.cpp b/Swift/QtUI/QtTreeWidgetItem.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Swift/QtUI/QtTreeWidgetItem.h b/Swift/QtUI/QtTreeWidgetItem.h deleted file mode 100644 index 34ad93c..0000000 --- a/Swift/QtUI/QtTreeWidgetItem.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef SWIFT_QtTreeWidgetItem_H -#define SWIFT_QtTreeWidgetItem_H - -#include - -#include "Swiften/Base/String.h" -#include "Swiften/Roster/TreeWidgetFactory.h" -#include "Swiften/Roster/TreeWidget.h" -#include "Swiften/Roster/TreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidgetItem.h" -#include "Swift/QtUI/QtTreeWidget.h" -#include "Swift/QtUI/QtSwiftUtil.h" - -namespace Swift { - -class QtTreeWidgetItem : public QTreeWidgetItem, public TreeWidgetItem { - public: - QtTreeWidgetItem(QTreeWidget* parent) : QTreeWidgetItem(parent) { - } - - QtTreeWidgetItem(QTreeWidgetItem* parent) : QTreeWidgetItem(parent) { - } - - void setText(const String& text) { - QTreeWidgetItem::setText(0, P2QSTRING(text)); - } - - void setTextColor(unsigned long color) { - QTreeWidgetItem::setTextColor(0, QColor( - ((color & 0xFF0000)>>16), - ((color & 0xFF00)>>8), - (color & 0xFF))); - } - - void setBackgroundColor(unsigned long color) { - QTreeWidgetItem::setBackgroundColor(0, QColor( - ((color & 0xFF0000)>>16), - ((color & 0xFF00)>>8), - (color & 0xFF))); - } - - void setExpanded(bool b) { - treeWidget()->setItemExpanded(this, b); - } - - void hide() { - setHidden(true); - } - - void show() { - setHidden(false); - } -}; - -} -#endif - diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp new file mode 100644 index 0000000..d40169f --- /dev/null +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -0,0 +1,37 @@ +#include "Roster/QtTreeWidget.h" + +#include "Swiften/Base/Platform.h" +#include "Swiften/Roster/OpenChatRosterAction.h" + +namespace Swift { + +QtTreeWidget::QtTreeWidget(QWidget* parent) : QTreeView(parent), RosterItem(NULL) { + model_ = new RosterModel(this); + setModel(model_); + //setWindowTitle("A roster"); + //show(); + setHeaderHidden(true); +#ifdef SWIFT_PLATFORM_MACOSX + setAlternatingRowColors(true); +#endif + setAnimated(true); + setIndentation(0); + setRootIsDecorated(true); + connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(handleItemActivated(QTreeWidgetItem*, int))); +} + +// void QtTreeWidget::handleItemActivated(QTreeWidgetItem* item, int column) { +// QtTreeWidgetItem* qtItem = dynamic_cast(item); +// if (qtItem) { +// qtItem->performUserAction(boost::shared_ptr(new OpenChatRosterAction())); +// } +// } + +void QtTreeWidget::drawBranches(QPainter*, const QRect&, const QModelIndex&) const { +} + +void QtTreeWidget::show() { + QWidget::show(); +} + +} diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h new file mode 100644 index 0000000..f246e83 --- /dev/null +++ b/Swift/QtUI/Roster/QtTreeWidget.h @@ -0,0 +1,32 @@ +#ifndef SWIFT_QtTreeWidget_H +#define SWIFT_QtTreeWidget_H + +#include + +#include "Swiften/Roster/TreeWidgetFactory.h" +#include "Swiften/Roster/TreeWidget.h" +#include "Swiften/Roster/TreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidget.h" +#include "Swift/QtUI/Roster/RosterModel.h" +#include "Swift/QtUI/Roster/RosterItem.h" + +namespace Swift { + +class QtTreeWidget : public QTreeView, public TreeWidget, public RosterItem { + Q_OBJECT + public: + QtTreeWidget(QWidget* parent = 0); + void show(); + //private slots: + // void handleItemActivated(QTreeWidgetItem*, int); + + private: + void drawBranches(QPainter*, const QRect&, const QModelIndex&) const; + RosterModel* model_; + +}; + +} +#endif + diff --git a/Swift/QtUI/Roster/QtTreeWidgetFactory.cpp b/Swift/QtUI/Roster/QtTreeWidgetFactory.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Swift/QtUI/Roster/QtTreeWidgetFactory.h b/Swift/QtUI/Roster/QtTreeWidgetFactory.h new file mode 100644 index 0000000..353f697 --- /dev/null +++ b/Swift/QtUI/Roster/QtTreeWidgetFactory.h @@ -0,0 +1,41 @@ +#ifndef SWIFT_QtTreeWidgetFactory_H +#define SWIFT_QtTreeWidgetFactory_H + +#include "Swiften/Roster/TreeWidgetFactory.h" +#include "Swiften/Roster/TreeWidget.h" +#include "Swiften/Roster/TreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidget.h" + +namespace Swift { + +class QtTreeWidgetFactory : public TreeWidgetFactory { + public: + QtTreeWidgetFactory() { + } + + TreeWidget* createTreeWidget() { + return new QtTreeWidget(); + } + + TreeWidgetItem* createTreeWidgetItem(TreeWidgetItem* item) { + QtTreeWidgetItem* qtItem = dynamic_cast(item); + assert(qtItem); + QtTreeWidgetItem* newItem = new QtTreeWidgetItem(qtItem); + qtItem->addChild(newItem); + return newItem; + } + + TreeWidgetItem* createTreeWidgetItem(TreeWidget* item) { + QtTreeWidget* qtItem = dynamic_cast(item); + assert(qtItem); + QtTreeWidgetItem* newItem = new QtTreeWidgetItem(qtItem); + //qtItem->setItemWidget(newItem, 0, newItem->getCollapsedRosterWidget()); + qtItem->addChild(newItem); + return newItem; + } +}; + +} +#endif + diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp new file mode 100644 index 0000000..f65c3bf --- /dev/null +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -0,0 +1,17 @@ +#include "Swift/QtUI/Roster/QtTreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidget.h" +namespace Swift { + +QWidget* QtTreeWidgetItem::getCollapsedRosterWidget() { + QWidget* widget = new QWidget(); + + return widget; +} + +QWidget* QtTreeWidgetItem::getExpandedRosterWidget() { + QWidget* widget = new QWidget(); + + return widget; +} + +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h new file mode 100644 index 0000000..c35a840 --- /dev/null +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -0,0 +1,65 @@ +#ifndef SWIFT_QtTreeWidgetItem_H +#define SWIFT_QtTreeWidgetItem_H + +#include + +#include "Swiften/Base/String.h" +#include "Swiften/Roster/TreeWidgetFactory.h" +#include "Swiften/Roster/TreeWidget.h" +#include "Swiften/Roster/TreeWidgetItem.h" +#include "Swift/QtUI/Roster/QtTreeWidgetItem.h" +#include "Swift/QtUI/Roster/RosterItem.h" + + +#include "Swift/QtUI/QtSwiftUtil.h" + + +namespace Swift { +class QtTreeWidget; +class QtTreeWidgetItem : public TreeWidgetItem, public RosterItem { + public: + QtTreeWidgetItem(RosterItem* parentItem) : RosterItem(parentItem) { + + } + + void setText(const String& text) { + displayName_ = P2QSTRING(text); + // QTreeWidgetItem::setText(0, P2QSTRING(text)); + } + + void setTextColor(unsigned long color) { + // QTreeWidgetItem::setTextColor(0, QColor( + // ((color & 0xFF0000)>>16), + // ((color & 0xFF00)>>8), + // (color & 0xFF))); + } + + void setBackgroundColor(unsigned long color) { + // QTreeWidgetItem::setBackgroundColor(0, QColor( + // ((color & 0xFF0000)>>16), + // ((color & 0xFF00)>>8), + // (color & 0xFF))); + } + + void setExpanded(bool b) { + //treeWidget()->setItemExpanded(this, b); + } + + void hide() { + //setHidden(true); + } + + void show() { + //setHidden(false); + } + + QWidget* getCollapsedRosterWidget(); + QWidget* getExpandedRosterWidget(); + + private: + QString displayName_; +}; + +} +#endif + diff --git a/Swift/QtUI/Roster/Roster.pri b/Swift/QtUI/Roster/Roster.pri new file mode 100644 index 0000000..56ff472 --- /dev/null +++ b/Swift/QtUI/Roster/Roster.pri @@ -0,0 +1,12 @@ +SOURCES += $$PWD/RosterDelegate.cpp \ + $$PWD/RosterItem.cpp \ + $$PWD/RosterModel.cpp \ + $$PWD/QtTreeWidget.cpp \ + $$PWD/QtTreeWidgetItem.cpp + +HEADERS += $$PWD/RosterDelegate.h \ + $$PWD/RosterItem.h \ + $$PWD/RosterModel.h \ + $$PWD/QtTreeWidget.h \ + $$PWD/QtTreeWidgetFactory.h \ + $$PWD/QtTreeWidgetItem.h diff --git a/Swift/QtUI/Roster/Roster.pro b/Swift/QtUI/Roster/Roster.pro new file mode 100644 index 0000000..c829d5c --- /dev/null +++ b/Swift/QtUI/Roster/Roster.pro @@ -0,0 +1,12 @@ +include(Roster.pri) +SOURCES += main.cpp + +DEPENDPATH += ../. ../../.. ../../../3rdParty/Boost +INCLUDEPATH += ../. ../../.. ../../../3rdParty/Boost + +DEFINES += BOOST_SIGNALS_NAMESPACE=bsignals BOOST_ALL_NO_LIB + +exists(../config.pri) { + LIBS += ../../Controllers/Controllers.a ../../../Swiften/Swiften.a + include(../config.pri) +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Swift/QtUI/Roster/RosterDelegate.h b/Swift/QtUI/Roster/RosterDelegate.h new file mode 100644 index 0000000..e69de29 diff --git a/Swift/QtUI/Roster/RosterItem.cpp b/Swift/QtUI/Roster/RosterItem.cpp new file mode 100644 index 0000000..14b4525 --- /dev/null +++ b/Swift/QtUI/Roster/RosterItem.cpp @@ -0,0 +1,28 @@ +#include "RosterItem.h" + +namespace Swift { + +RosterItem::RosterItem(RosterItem* parent) { + parent_ = parent; +} + +RosterItem* RosterItem::getParentItem() { + return parent_; +} + +void RosterItem::addChild(RosterItem* child) { + children_.append(child); +} + +int RosterItem::rowCount() { + return children_.size(); +} + +int RosterItem::rowOf(RosterItem* item) { + return children_.indexOf(item);; +} + +RosterItem* RosterItem::getItem(int row) { + return children_[row]; +} +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/RosterItem.h b/Swift/QtUI/Roster/RosterItem.h new file mode 100644 index 0000000..f7cd804 --- /dev/null +++ b/Swift/QtUI/Roster/RosterItem.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +namespace Swift { + class RosterItem { + public: + RosterItem(RosterItem* parent); + ~RosterItem(); + void addChild(RosterItem* child); + RosterItem* getParentItem(); + int rowCount(); + int rowOf(RosterItem* item); + RosterItem* getItem(int row); + private: + QList children_; + RosterItem* parent_; + }; + +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp new file mode 100644 index 0000000..2c9a2cc --- /dev/null +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -0,0 +1,56 @@ +#include "RosterModel.h" + +namespace Swift { + +RosterModel::RosterModel(RosterItem* tree) { + tree_ = tree; +} + +RosterModel::~RosterModel() { + +} + +int RosterModel::columnCount(const QModelIndex& parent) const { + Q_UNUSED(parent); + return 1; +} + +QVariant RosterModel::data(const QModelIndex& index, int role) const { + if (!index.isValid()) { + return QVariant(); + } + return QVariant("bob"); +} + +QModelIndex RosterModel::index(int row, int column, const QModelIndex& parent) const { + RosterItem* parentItem = parent.isValid() ? static_cast(parent.internalPointer()) : tree_; + Q_ASSERT(parentItem); + + return row < parentItem->rowCount() ? createIndex(row, column, parentItem->getItem(row)) : QModelIndex(); +} + +QModelIndex RosterModel::parent(const QModelIndex& index) const { + if (!index.isValid()) { + return QModelIndex(); + } + + RosterItem* item = static_cast(index.internalPointer()); + Q_ASSERT(item); + + RosterItem* parentItem = item->getParentItem(); + return parentItem == tree_ ? QModelIndex() : createIndex(parentItem->getParentItem()->rowOf(parentItem), 0, parentItem); + +} + +int RosterModel::rowCount(const QModelIndex& parent) const { + if (!parent.isValid()) { + return 0; + } + + RosterItem* item = static_cast(parent.internalPointer()); + Q_ASSERT(item); + + return item->rowCount(); +} + +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/RosterModel.h b/Swift/QtUI/Roster/RosterModel.h new file mode 100644 index 0000000..a958f0d --- /dev/null +++ b/Swift/QtUI/Roster/RosterModel.h @@ -0,0 +1,22 @@ +#pragma once + +#include "Swift/QtUI/Roster/RosterItem.h" + +#include +#include + +namespace Swift { +class RosterModel : public QAbstractItemModel { +public: + RosterModel(RosterItem* tree); + ~RosterModel(); + 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; + QModelIndex parent(const QModelIndex& index) const; + int rowCount(const QModelIndex& parent = QModelIndex()) const; +private: + RosterItem* tree_; +}; + +} \ No newline at end of file diff --git a/Swift/QtUI/Roster/main.cpp b/Swift/QtUI/Roster/main.cpp new file mode 100644 index 0000000..f3623ac --- /dev/null +++ b/Swift/QtUI/Roster/main.cpp @@ -0,0 +1,31 @@ +#include +#include "QtTreeWidget.h" +#include "QtTreeWidgetFactory.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + //Swift::RosterModel model; + + //QTreeView view; + //view.setModel(&model); + //view.setWindowTitle("A roster"); + //view.show(); + + Swift::QtTreeWidgetFactory treeWidgetFactory; + Swift::QtTreeWidget* tree = dynamic_cast(treeWidgetFactory.createTreeWidget()); + Swift::QtTreeWidgetItem* group = dynamic_cast(treeWidgetFactory.createTreeWidgetItem(tree)); + group->setText("People"); + group->setBackgroundColor(0xBBBBBB); + Swift::QtTreeWidgetItem* item1 = dynamic_cast(treeWidgetFactory.createTreeWidgetItem(group)); + Swift::QtTreeWidgetItem* item2 = dynamic_cast(treeWidgetFactory.createTreeWidgetItem(group)); + Swift::QtTreeWidgetItem* item3 = dynamic_cast(treeWidgetFactory.createTreeWidgetItem(group)); + Swift::QtTreeWidgetItem* item4 = dynamic_cast(treeWidgetFactory.createTreeWidgetItem(group)); + item1->setText("Remko"); + item2->setText("Kevin"); + item3->setText("Cath"); + item4->setText("Kim"); + tree->show(); + return app.exec(); +} \ No newline at end of file diff --git a/Swift/QtUI/Swift.pro b/Swift/QtUI/Swift.pro index 0af8216..7c36c07 100644 --- a/Swift/QtUI/Swift.pro +++ b/Swift/QtUI/Swift.pro @@ -55,9 +55,6 @@ HEADERS += \ QtSettingsProvider.h \ QtStatusWidget.h \ QtSwift.h \ - QtTreeWidget.h \ - QtTreeWidgetFactory.h \ - QtTreeWidgetItem.h \ QtChatView.h \ QtChatTabs.h \ QtSoundPlayer.h \ @@ -79,7 +76,6 @@ SOURCES += \ QtSettingsProvider.cpp \ QtStatusWidget.cpp \ QtSwift.cpp \ - QtTreeWidget.cpp \ QtChatView.cpp \ QtChatTabs.cpp \ QtSoundPlayer.cpp \ @@ -91,6 +87,8 @@ SOURCES += \ FORMS += QtJoinMUCDialog.ui +include(Roster/Roster.pri) + RESOURCES += Swift.qrc DefaultTheme.qrc win32 { diff --git a/Swiften/Roster/Roster.cpp b/Swiften/Roster/Roster.cpp index 61c0286..b51d8eb 100644 --- a/Swiften/Roster/Roster.cpp +++ b/Swiften/Roster/Roster.cpp @@ -39,7 +39,7 @@ GroupRosterItem* Roster::getGroup(const String& groupName) { } GroupRosterItem* group = new GroupRosterItem(groupName, treeWidget_, widgetFactory_); children_.push_back(group); - items_.push_back(group); + items_.push_back(group); return group; } @@ -49,7 +49,7 @@ void Roster::handleUserAction(boost::shared_ptr action) { void Roster::addContact(const JID& jid, const String& name, const String& group) { ContactRosterItem *item = new ContactRosterItem(jid, name, getGroup(group), widgetFactory_); - items_.push_back(item); + items_.push_back(item); item->onUserAction.connect(boost::bind(&Roster::handleUserAction, this, _1)); filterItem(item); -- cgit v0.10.2-6-g49f6