First implementation of Play Tool.

It's icon is temporary.

Behavior implemented:
1. Can interact with all items without showing items frames (but ToolBar shows).
2. Cannot move items, but can drag images.
3. Selected items appears deselected when Play tool chosen.
4. Play tool don't requires selecting of item before interacts.
5. Cursor looks like tool icon in text and image widgets (should be the same in any others widgets, but now in w3c is not).
preferencesAboutTextFull
Aleksei Kanash 13 years ago
parent 47cdb04800
commit aa59455407
  1. 16
      resources/forms/mainWindow.ui
  2. BIN
      resources/images/stylusPalette/handPlay.png
  3. BIN
      resources/images/stylusPalette/handPlayOn.png
  4. 2
      resources/sankore.qrc
  5. 4
      src/api/UBWidgetUniboardAPI.cpp
  6. 20
      src/board/UBBoardView.cpp
  7. 9
      src/board/UBDrawingController.cpp
  8. 1
      src/board/UBDrawingController.h
  9. 1
      src/core/UB.h
  10. 2
      src/domain/UBGraphicsItemDelegate.cpp
  11. 3
      src/domain/UBGraphicsProxyWidget.cpp
  12. 5
      src/domain/UBGraphicsScene.cpp
  13. 1
      src/gui/UBStylusPalette.cpp
  14. 18
      src/tools/UBGraphicsCompass.cpp
  15. 14
      src/tools/UBGraphicsProtractor.cpp
  16. 5
      src/tools/UBGraphicsRuler.cpp
  17. 7
      src/tools/UBGraphicsTriangle.cpp

@ -1649,6 +1649,22 @@
<string>Group items</string>
</property>
</action>
<action name="actionPlay">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/stylusPalette/handPlay.png</normaloff>
<normalon>:/images/stylusPalette/handPlayOn.png</normalon>:/images/stylusPalette/handPlay.png</iconset>
</property>
<property name="text">
<string>Play</string>
</property>
<property name="toolTip">
<string>Interact with items</string>
</property>
</action>
</widget>
<resources>
<include location="../sankore.qrc"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

@ -125,6 +125,8 @@
<file>images/toolbar/tools.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrowOn.png</file>
<file>images/stylusPalette/handPlay.png</file>
<file>images/stylusPalette/handPlayOn.png</file>
<file>images/stylusPalette/eraser.png</file>
<file>images/stylusPalette/eraserOn.png</file>
<file>images/stylusPalette/hand.png</file>

@ -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);

@ -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;

@ -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)

@ -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);

@ -28,6 +28,7 @@ struct UBStylusTool
Eraser,
Marker,
Selector,
Play,
Hand,
ZoomIn,
ZoomOut,

@ -330,6 +330,8 @@ void UBGraphicsItemDelegate::positionHandles()
showHide(shownOnDisplay);
lock(isLocked());
updateFrame();
if (UBStylusTool::Play != UBDrawingController::drawingController()->stylusTool())
mFrame->show();
updateButtons(true);

@ -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);
}

@ -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();
}

@ -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;

@ -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());

@ -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

@ -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);

@ -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);

Loading…
Cancel
Save