diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-29 07:32:51 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-29 07:33:48 (GMT) |
commit | a8f57139d663a176af87d7bc71dd85c62f6274cf (patch) | |
tree | e1c4def39b63d64e6f4ad7baefceae0f154789ce /Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp | |
parent | dc04410eb678b8db257dc04b04662f974f6b3b83 (diff) | |
download | swift-contrib-a8f57139d663a176af87d7bc71dd85c62f6274cf.zip swift-contrib-a8f57139d663a176af87d7bc71dd85c62f6274cf.tar.bz2 |
Improved handling of IDs
Added ID parsing to every element and added function to get prefixes from
session to be able to distinguish elements between clients
Diffstat (limited to 'Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp')
-rw-r--r-- | Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 6e259a2..9aa6eb0 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -205,6 +205,7 @@ namespace Swift { void QtWhiteboardWindow::setSession(WhiteboardSession::ref session) { whiteboardSession_ = session; + graphicsView->setIDPrefix(P2QSTRING(whiteboardSession_->getClientID())); whiteboardSession_->onElementReceived.connect(boost::bind(&QtWhiteboardWindow::handleWhiteboardElementReceive, this, _1)); whiteboardSession_->onRequestAccepted.connect(boost::bind(&QWidget::show, this)); whiteboardSession_->onSessionTerminateReceived.connect(boost::bind(&QtWhiteboardWindow::handleSessionTerminate, this)); @@ -224,7 +225,7 @@ namespace Swift { element->setColor(Color(color.red(), color.green(), color.blue(), color.alpha())); element->setPenWidth(lineItem->pen().width()); - element->setID(lineItem->data(0).toString().toStdString()); + element->setID(lineItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } @@ -242,7 +243,7 @@ namespace Swift { element->setPenWidth(freehandLineItem->pen().width()); element->setPoints(points); - element->setID(freehandLineItem->data(0).toString().toStdString()); + element->setID(freehandLineItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } @@ -257,7 +258,7 @@ namespace Swift { element->setPenColor(Color(penColor.red(), penColor.green(), penColor.blue(), penColor.alpha())); element->setPenWidth(rectItem->pen().width()); - element->setID(rectItem->data(1).toString().toStdString()); + element->setID(rectItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } @@ -270,7 +271,7 @@ namespace Swift { QColor color = textItem->defaultTextColor(); element->setColor(Color(color.red(), color.green(), color.blue(), color.alpha())); - element->setID(rectItem->data(0).toString().toStdString()); + element->setID(rectItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } @@ -292,7 +293,7 @@ namespace Swift { element->setBrushColor(Color(brushColor.red(), brushColor.green(), brushColor.blue(), brushColor.alpha())); element->setPenWidth(polygonItem->pen().width()); - element->setID(polygonItem->data(0).toString().toStdString()); + element->setID(polygonItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } @@ -311,7 +312,7 @@ namespace Swift { element->setBrushColor(Color(brushColor.red(), brushColor.green(), brushColor.blue(), brushColor.alpha())); element->setPenWidth(ellipseItem->pen().width()); - element->setID(ellipseItem->data(1).toString().toStdString()); + element->setID(ellipseItem->data(100).toString().toStdString()); whiteboardSession_->sendElement(element); } } |