diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-06 08:00:44 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-06 10:49:49 (GMT) |
commit | 081fc03556708447610e9697a57235fa191a4f0d (patch) | |
tree | 505c8cc9129d2b44968d183a180f0ccddaa08810 /Swift/QtUI/QtMainWindow.cpp | |
parent | 8c53236875d2ca77f1b463449918458f6b424ab1 (diff) | |
download | swift-contrib-081fc03556708447610e9697a57235fa191a4f0d.zip swift-contrib-081fc03556708447610e9697a57235fa191a4f0d.tar.bz2 |
Rewrite of large amounts of roster code.
Now keeps widgets out of Swiften, keeps sorting inside Swiften,
and keeps track of presences to show the correct presence per
roster item.
Resolves: #316
Resolves: #81
Resolves: #239
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index fe4b179..0381d9e 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -23,14 +23,13 @@ #include "QtJoinMUCDialog.h" #include "QtSwiftUtil.h" #include "QtTabWidget.h" -#include "Roster/QtTreeWidgetFactory.h" #include "Roster/QtTreeWidget.h" #include "Swift/Controllers/UIEvents/AddContactUIEvent.h" #include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h" namespace Swift { -QtMainWindow::QtMainWindow(UIEventStream* uiEventStream, QtTreeWidgetFactory *treeWidgetFactory) : QWidget() { +QtMainWindow::QtMainWindow(UIEventStream* uiEventStream) : QWidget() { uiEventStream_ = uiEventStream; setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); @@ -53,7 +52,7 @@ QtMainWindow::QtMainWindow(UIEventStream* uiEventStream, QtTreeWidgetFactory *tr contactTabLayout->setSpacing(0); contactTabLayout->setContentsMargins(0, 0, 0, 0); - treeWidget_ = dynamic_cast<QtTreeWidget*>(treeWidgetFactory->createTreeWidget()); + treeWidget_ = new QtTreeWidget(uiEventStream_); contextMenu_ = new QtRosterContextMenu(uiEventStream_); treeWidget_->setContextMenu(contextMenu_); treeWidget_->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); @@ -104,6 +103,10 @@ QtChatListWindow* QtMainWindow::getChatListWindow() { return chatListWindow_; } +void QtMainWindow::setRosterModel(Roster* roster) { + treeWidget_->setRosterModel(roster); +} + void QtMainWindow::handleEventCountUpdated(int count) { QColor eventTabColor = (count == 0) ? QColor(-1, -1, -1) : QColor(255, 0, 0); // invalid resets to default int eventIndex = 1; @@ -131,10 +134,6 @@ void QtMainWindow::handleAddContactDialogComplete(const JID& contact, const QStr uiEventStream_->send(event); } -TreeWidget* QtMainWindow::getTreeWidget() { - return treeWidget_; -} - void QtMainWindow::handleJoinMUCAction() { QtJoinMUCDialog* joinMUC = new QtJoinMUCDialog("jabber@conference.jabber.org", "SwiftUser", this); connect(joinMUC, SIGNAL(onJoinCommand(const JID&, const QString&)), SLOT(handleJoinMUCDialogComplete(const JID&, const QString&))); |