summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h6
-rw-r--r--Swift/Controllers/WhiteboardManager.cpp6
-rw-r--r--Swift/Controllers/WhiteboardManager.h6
-rw-r--r--Swift/QtUI/QtUIFactory.cpp6
-rw-r--r--Swift/QtUI/QtUIFactory.h4
-rw-r--r--Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp18
-rw-r--r--Swift/QtUI/Whiteboard/QtWhiteboardWindow.h10
8 files changed, 26 insertions, 32 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index d9bb249..b3457d8 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -320,7 +320,7 @@ void MainController::handleConnected() {
userSearchControllerChat_ = new UserSearchController(UserSearchController::StartChat, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_);
userSearchControllerAdd_ = new UserSearchController(UserSearchController::AddContact, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_);
adHocManager_ = new AdHocManager(JID(boundJID_.getDomain()), uiFactory_, client_->getIQRouter(), uiEventStream_, rosterController_->getWindow());
- whiteboardManager_ = new WhiteboardManager(uiFactory_, uiEventStream_, client_->getStanzaChannel());
+ whiteboardManager_ = new WhiteboardManager(uiFactory_, uiEventStream_, client_->getStanzaChannel(), client_->getWhiteboardSessionManager());
}
loginWindow_->setIsLoggingIn(false);
diff --git a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h
index 8b52ee1..7e0fe81 100644
--- a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h
@@ -6,16 +6,14 @@
#pragma once
-#include "Swiften/JID/JID.h"
-
namespace Swift {
+ class WhiteboardSession;
class WhiteboardWindow;
- class StanzaChannel;
class WhiteboardWindowFactory {
public :
virtual ~WhiteboardWindowFactory() {};
- virtual WhiteboardWindow* createWhiteboardWindow(StanzaChannel* stanzaChannel, const JID& jid) = 0;
+ virtual WhiteboardWindow* createWhiteboardWindow(WhiteboardSession* whiteboardSession) = 0;
};
}
diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp
index 6237426..86d70d1 100644
--- a/Swift/Controllers/WhiteboardManager.cpp
+++ b/Swift/Controllers/WhiteboardManager.cpp
@@ -11,11 +11,12 @@
#include <Swiften/Base/foreach.h>
#include <Swift/Controllers/UIEvents/RequestWhiteboardUIEvent.h>
#include <Swiften/Client/StanzaChannel.h>
+#include <Swiften/Whiteboard/WhiteboardSessionManager.h>
namespace Swift {
typedef std::pair<JID, WhiteboardWindow*> JIDWhiteboardWindowPair;
- WhiteboardManager::WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, StanzaChannel* stanzaChannel) : whiteboardWindowFactory_(whiteboardWindowFactory), uiEventStream_(uiEventStream), stanzaChannel_(stanzaChannel) {
+ WhiteboardManager::WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, StanzaChannel* stanzaChannel, WhiteboardSessionManager* whiteboardSessionManager) : whiteboardWindowFactory_(whiteboardWindowFactory), uiEventStream_(uiEventStream), stanzaChannel_(stanzaChannel), whiteboardSessionManager_(whiteboardSessionManager) {
uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&WhiteboardManager::handleUIEvent, this, _1));
}
@@ -33,7 +34,8 @@ namespace Swift {
}
WhiteboardWindow* WhiteboardManager::createNewWhiteboardWindow(const JID& contact) {
- WhiteboardWindow *window = whiteboardWindowFactory_->createWhiteboardWindow(stanzaChannel_, contact);
+ WhiteboardSession* session = whiteboardSessionManager_->createSession(contact);
+ WhiteboardWindow *window = whiteboardWindowFactory_->createWhiteboardWindow(session);
whiteboardWindows_[contact] = window;
return window;
}
diff --git a/Swift/Controllers/WhiteboardManager.h b/Swift/Controllers/WhiteboardManager.h
index c28492c..a5a3dd0 100644
--- a/Swift/Controllers/WhiteboardManager.h
+++ b/Swift/Controllers/WhiteboardManager.h
@@ -19,10 +19,11 @@
namespace Swift {
class StanzaChannel;
+ class WhiteboardSessionManager;
class WhiteboardManager {
public:
- WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, StanzaChannel* stanzaChannel);
+ WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, StanzaChannel* stanzaChannel, WhiteboardSessionManager* whiteboardSessionManager);
~WhiteboardManager();
WhiteboardWindow* getWhiteboardWindowOrCreate(const JID& contact);
@@ -33,9 +34,10 @@ namespace Swift {
private:
std::map<JID, WhiteboardWindow*> whiteboardWindows_;
- UIEventStream* uiEventStream_;
WhiteboardWindowFactory* whiteboardWindowFactory_;
+ UIEventStream* uiEventStream_;
boost::bsignals::scoped_connection uiEventConnection_;
StanzaChannel* stanzaChannel_;
+ WhiteboardSessionManager* whiteboardSessionManager_;
};
}
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index d127791..e0fc532 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -28,7 +28,7 @@
#include "Whiteboard/QtWhiteboardWindow.h"
#include <Swift/Controllers/Settings/SettingsProviderHierachy.h>
#include <Swift/QtUI/QtUISettingConstants.h>
-#include <Swiften/Client/StanzaChannel.h>
+#include <Swiften/Whiteboard/WhiteboardSession.h>
namespace Swift {
@@ -136,8 +136,8 @@ ContactEditWindow* QtUIFactory::createContactEditWindow() {
return new QtContactEditWindow();
}
-WhiteboardWindow* QtUIFactory::createWhiteboardWindow(StanzaChannel* stanzaChannel, const JID& jid) {
- return new QtWhiteboardWindow(stanzaChannel, jid);
+WhiteboardWindow* QtUIFactory::createWhiteboardWindow(WhiteboardSession* whiteboardSession) {
+ return new QtWhiteboardWindow(whiteboardSession);
}
void QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) {
diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h
index 0c337f4..951b19c 100644
--- a/Swift/QtUI/QtUIFactory.h
+++ b/Swift/QtUI/QtUIFactory.h
@@ -24,7 +24,7 @@ namespace Swift {
class QtChatWindowFactory;
class QtChatWindow;
class TimerFactory;
- class StanzaChannel;
+ class WhiteboardSession;
class QtUIFactory : public QObject, public UIFactory {
Q_OBJECT
@@ -43,7 +43,7 @@ namespace Swift {
virtual ProfileWindow* createProfileWindow();
virtual ContactEditWindow* createContactEditWindow();
virtual FileTransferListWidget* createFileTransferListWidget();
- virtual WhiteboardWindow* createWhiteboardWindow(StanzaChannel* stanzaChannel, const JID& jid);
+ virtual WhiteboardWindow* createWhiteboardWindow(WhiteboardSession* whiteboardSession);
virtual void createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command);
private slots:
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
index b991e52..e0e68ba 100644
--- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
+++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
@@ -10,13 +10,13 @@
#include <boost/bind.hpp>
-#include <Swiften/Client/StanzaChannel.h>
+#include <Swiften/Whiteboard/WhiteboardSession.h>
#include <Swiften/Elements/WhiteboardPayload.h>
using namespace std;
namespace Swift {
- QtWhiteboardWindow::QtWhiteboardWindow(StanzaChannel* stanzaChannel, const JID& jid) : QWidget(), stanzaChannel_(stanzaChannel), jid_(jid) {
+ QtWhiteboardWindow::QtWhiteboardWindow(WhiteboardSession* whiteboardSession) : QWidget(), whiteboardSession_(whiteboardSession) {
layout = new QVBoxLayout(this);
hLayout = new QHBoxLayout;
sidebarLayout = new QVBoxLayout;
@@ -121,14 +121,7 @@ namespace Swift {
layout->addLayout(hLayout);
this->setLayout(layout);
- stanzaChannel_->onMessageReceived.connect(boost::bind(&QtWhiteboardWindow::handleIncommingMessage, this, _1));
- }
-
- void QtWhiteboardWindow::handleIncommingMessage(boost::shared_ptr<Message> message) {
- boost::shared_ptr<WhiteboardPayload> wb = message->getPayload<WhiteboardPayload>();
- if(wb) {
- addItem(wb->getData());
- }
+ whiteboardSession_->onDataReceived.connect(boost::bind(&QtWhiteboardWindow::addItem, this, _1));
}
void QtWhiteboardWindow::addItem(const std::string& item) {
@@ -259,13 +252,14 @@ namespace Swift {
}
if (!serialized.empty()) {
cout << "serialized: " << serialized << endl;
- boost::shared_ptr<Message> mes(new Message());
+/* boost::shared_ptr<Message> mes(new Message());
mes->setTo(jid_);
boost::shared_ptr<WhiteboardPayload> wbPayload(new WhiteboardPayload);
wbPayload->setData(serialized);
// mes->setType(Swift::Message::Chat);
mes->addPayload(wbPayload);
- stanzaChannel_->sendMessage(mes);
+// stanzaChannel_->sendMessage(mes);*/
+ whiteboardSession_->sendData(serialized);
}
}
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
index 9ced322..f1a9ed5 100644
--- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
+++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
@@ -8,7 +8,6 @@
#include <Swift/Controllers/UIInterfaces/WhiteboardWindow.h>
#include <Swiften/Elements/Message.h>
-#include "Swiften/JID/JID.h"
#include <QWidget>
#include <QGraphicsView>
@@ -25,14 +24,13 @@
#include "GView.h"
namespace Swift {
- class StanzaChannel;
+ class WhiteboardSession;
class QtWhiteboardWindow : public QWidget, public WhiteboardWindow
{
Q_OBJECT;
public:
- QtWhiteboardWindow(StanzaChannel *stanzaChannel, const JID& jid);
- void handleIncommingMessage(boost::shared_ptr<Message> message);
+ QtWhiteboardWindow(WhiteboardSession* whiteboardSession);
void addItem(const std::string& item);
void show();
@@ -50,6 +48,7 @@ namespace Swift {
void setPolygonMode();
void setSelectMode();
void handleLastItemChanged(QGraphicsItem* item);
+
private:
QGraphicsScene* scene;
GView* graphicsView;
@@ -73,7 +72,6 @@ namespace Swift {
QToolButton* polygonButton;
QToolButton* selectButton;
- StanzaChannel* stanzaChannel_;
- JID jid_;
+ WhiteboardSession* whiteboardSession_;
};
}