diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui index a2ac84b8..6f81085c 100644 --- a/resources/forms/mainWindow.ui +++ b/resources/forms/mainWindow.ui @@ -1649,6 +1649,22 @@ Group items + + + true + + + + :/images/stylusPalette/handPlay.png + :/images/stylusPalette/handPlayOn.png:/images/stylusPalette/handPlay.png + + + Play + + + Interact with items + + diff --git a/resources/images/stylusPalette/handPlay.png b/resources/images/stylusPalette/handPlay.png new file mode 100644 index 00000000..999f7703 Binary files /dev/null and b/resources/images/stylusPalette/handPlay.png differ diff --git a/resources/images/stylusPalette/handPlayOn.png b/resources/images/stylusPalette/handPlayOn.png new file mode 100644 index 00000000..9191cffa Binary files /dev/null and b/resources/images/stylusPalette/handPlayOn.png differ diff --git a/resources/sankore.qrc b/resources/sankore.qrc index f94729e7..ced5d120 100644 --- a/resources/sankore.qrc +++ b/resources/sankore.qrc @@ -125,6 +125,8 @@ images/toolbar/tools.png images/stylusPalette/arrow.png images/stylusPalette/arrowOn.png + images/stylusPalette/handPlay.png + images/stylusPalette/handPlayOn.png images/stylusPalette/eraser.png images/stylusPalette/eraserOn.png images/stylusPalette/hand.png diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp index 260734ad..b58b3c3f 100644 --- a/src/api/UBWidgetUniboardAPI.cpp +++ b/src/api/UBWidgetUniboardAPI.cpp @@ -123,6 +123,10 @@ void UBWidgetUniboardAPI::setTool(const QString& toolString) { UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } + else if (lower == "play") + { + UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Play); + } else if (lower == "line") { UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Line); diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 59f4e8e5..7d898447 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -453,6 +453,12 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) } + event->accept(); + } + else if (currentTool == UBStylusTool::Play) + { + QGraphicsView::mousePressEvent (event); + event->accept(); } else if (currentTool == UBStylusTool::Text) @@ -584,6 +590,10 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) } else QGraphicsView::mouseMoveEvent (event); } + else if (currentTool == UBStylusTool::Play) + { + QGraphicsView::mouseMoveEvent (event); + } else if ((UBDrawingController::drawingController()->isDrawingTool()) && !mMouseButtonIsPressed) { @@ -616,9 +626,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) { UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); - scene ()->setToolCursor (currentTool); - setToolCursor (currentTool); - // first propagate device release to the scene if (scene ()) scene ()->inputDeviceRelease (); @@ -644,6 +651,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) QGraphicsView::mouseReleaseEvent (event); } + else if (currentTool == UBStylusTool::Play) + { + QGraphicsView::mouseReleaseEvent (event); + } else if (currentTool == UBStylusTool::Text) { if (mRubberBand) @@ -1027,6 +1038,9 @@ UBBoardView::setToolCursor (int tool) case UBStylusTool::Selector: controlViewport->setCursor (UBResources::resources ()->arrowCursor); break; + case UBStylusTool::Play: + controlViewport->setCursor (UBResources::resources ()->drawLineRulerCursor); + break; case UBStylusTool::Line: controlViewport->setCursor (UBResources::resources ()->penCursor); break; diff --git a/src/board/UBDrawingController.cpp b/src/board/UBDrawingController.cpp index e03ef408..70c54905 100644 --- a/src/board/UBDrawingController.cpp +++ b/src/board/UBDrawingController.cpp @@ -54,6 +54,7 @@ UBDrawingController::UBDrawingController(QObject * parent) connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(eraserToolSelected(bool))); connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(markerToolSelected(bool))); connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(selectorToolSelected(bool))); + connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(playToolSelected(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(handToolSelected(bool))); connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(zoomInToolSelected(bool))); connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(zoomOutToolSelected(bool))); @@ -120,6 +121,8 @@ void UBDrawingController::setStylusTool(int tool) UBApplication::mainWindow->actionMarker->setChecked(true); else if (mStylusTool == UBStylusTool::Selector) UBApplication::mainWindow->actionSelector->setChecked(true); + else if (mStylusTool == UBStylusTool::Play) + UBApplication::mainWindow->actionPlay->setChecked(true); else if (mStylusTool == UBStylusTool::Hand) UBApplication::mainWindow->actionHand->setChecked(true); else if (mStylusTool == UBStylusTool::ZoomIn) @@ -347,6 +350,12 @@ void UBDrawingController::selectorToolSelected(bool checked) setStylusTool(UBStylusTool::Selector); } +void UBDrawingController::playToolSelected(bool checked) +{ + if (checked) + setStylusTool(UBStylusTool::Play); +} + void UBDrawingController::handToolSelected(bool checked) { if (checked) diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h index 4c620f1c..429c8b24 100644 --- a/src/board/UBDrawingController.h +++ b/src/board/UBDrawingController.h @@ -88,6 +88,7 @@ class UBDrawingController : public QObject void eraserToolSelected(bool checked); void markerToolSelected(bool checked); void selectorToolSelected(bool checked); + void playToolSelected(bool checked); void handToolSelected(bool checked); void zoomInToolSelected(bool checked); void zoomOutToolSelected(bool checked); diff --git a/src/core/UB.h b/src/core/UB.h index 46fa6e8c..21d635b0 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -28,6 +28,7 @@ struct UBStylusTool Eraser, Marker, Selector, + Play, Hand, ZoomIn, ZoomOut, diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index d1759d3f..ab92ab16 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -330,7 +330,9 @@ void UBGraphicsItemDelegate::positionHandles() showHide(shownOnDisplay); lock(isLocked()); updateFrame(); - mFrame->show(); + + if (UBStylusTool::Play != UBDrawingController::drawingController()->stylusTool()) + mFrame->show(); updateButtons(true); diff --git a/src/domain/UBGraphicsProxyWidget.cpp b/src/domain/UBGraphicsProxyWidget.cpp index 7b949b19..0ed4e3aa 100644 --- a/src/domain/UBGraphicsProxyWidget.cpp +++ b/src/domain/UBGraphicsProxyWidget.cpp @@ -82,9 +82,10 @@ void UBGraphicsProxyWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) else { // QT Proxy Widget is a bit lazy, we force the selection ... - QGraphicsProxyWidget::mousePressEvent(event); + setSelected(true); } + QGraphicsProxyWidget::mousePressEvent(event); } diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 0542e598..d75da6a4 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -2366,8 +2366,9 @@ void UBGraphicsScene::createPointer() void UBGraphicsScene::setToolCursor(int tool) { - if (tool != (int)UBStylusTool::Selector - && tool != (int)UBStylusTool::Text) + if (tool == (int)UBStylusTool::Selector || + tool == (int)UBStylusTool::Text || + tool == (int)UBStylusTool::Play) { deselectAllItems(); } diff --git a/src/gui/UBStylusPalette.cpp b/src/gui/UBStylusPalette.cpp index 93073ccd..50da9720 100644 --- a/src/gui/UBStylusPalette.cpp +++ b/src/gui/UBStylusPalette.cpp @@ -39,6 +39,7 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient) actions << UBApplication::mainWindow->actionEraser; actions << UBApplication::mainWindow->actionMarker; actions << UBApplication::mainWindow->actionSelector; + actions << UBApplication::mainWindow->actionPlay; actions << UBApplication::mainWindow->actionHand; actions << UBApplication::mainWindow->actionZoomIn; diff --git a/src/tools/UBGraphicsCompass.cpp b/src/tools/UBGraphicsCompass.cpp index c0386d1a..f73fd274 100644 --- a/src/tools/UBGraphicsCompass.cpp +++ b/src/tools/UBGraphicsCompass.cpp @@ -170,7 +170,8 @@ QVariant UBGraphicsCompass::itemChange(GraphicsItemChange change, const QVariant void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; if (resizeButtonRect().contains(event->pos())) @@ -205,7 +206,8 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; if (!mResizing && !mRotating && !mDrawing) @@ -249,7 +251,8 @@ void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; if (mResizing) @@ -289,7 +292,8 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; mOuterCursor = cursor(); @@ -318,7 +322,8 @@ void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; mShowButtons = false; @@ -331,7 +336,8 @@ void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void UBGraphicsCompass::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && + UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; mShowButtons = shape().contains(event->pos()); diff --git a/src/tools/UBGraphicsProtractor.cpp b/src/tools/UBGraphicsProtractor.cpp index f00bf275..3d38a21b 100644 --- a/src/tools/UBGraphicsProtractor.cpp +++ b/src/tools/UBGraphicsProtractor.cpp @@ -250,13 +250,19 @@ void UBGraphicsProtractor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (scene()) scene()->setModified(true); + if (!mShowButtons) + { + mShowButtons = true; + update(); + } + mCurrentTool = None; } void UBGraphicsProtractor::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { - if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) + if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; if (!mShowButtons) @@ -292,12 +298,6 @@ void UBGraphicsProtractor::hoverMoveEvent(QGraphicsSceneHoverEvent *event) Tool currentTool = toolFromPos(event->pos()); - if (!mShowButtons) - { - mShowButtons = true; - update(); - } - if (currentTool == Move) setCursor(Qt::SizeAllCursor); else diff --git a/src/tools/UBGraphicsRuler.cpp b/src/tools/UBGraphicsRuler.cpp index 720b7b22..97f37084 100644 --- a/src/tools/UBGraphicsRuler.cpp +++ b/src/tools/UBGraphicsRuler.cpp @@ -268,7 +268,7 @@ void UBGraphicsRuler::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); - if (currentTool == UBStylusTool::Selector) + if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) { mCloseSvgItem->setVisible(mShowButtons); mResizeSvgItem->setVisible(mShowButtons); @@ -376,7 +376,8 @@ void UBGraphicsRuler::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); - if (currentTool == UBStylusTool::Selector) + if (currentTool == UBStylusTool::Selector || + currentTool == UBStylusTool::Play) { mCloseSvgItem->setParentItem(this); mResizeSvgItem->setParentItem(this); diff --git a/src/tools/UBGraphicsTriangle.cpp b/src/tools/UBGraphicsTriangle.cpp index ef946af7..57d77d7f 100644 --- a/src/tools/UBGraphicsTriangle.cpp +++ b/src/tools/UBGraphicsTriangle.cpp @@ -763,7 +763,9 @@ void UBGraphicsTriangle::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); - if (currentTool == UBStylusTool::Selector) { + if (currentTool == UBStylusTool::Selector || + currentTool == UBStylusTool::Play) + { mCloseSvgItem->setParentItem(this); mShowButtons = true; @@ -813,7 +815,8 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); - if (currentTool == UBStylusTool::Selector) + if (currentTool == UBStylusTool::Selector || + currentTool == UBStylusTool::Play) { mCloseSvgItem->setVisible(mShowButtons); mVFlipSvgItem->setVisible(mShowButtons);