diff options
Diffstat (limited to 'Swift/QtUI/Whiteboard')
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp | 18 | ||||
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.h | 10 |
2 files changed, 10 insertions, 18 deletions
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_; }; } |