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