Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
4b9e6c77
Commit
4b9e6c77
authored
Jun 22, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Play_tool_implementation'
parents
07aaa19b
93bb9244
Changes
28
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
768 additions
and
104 deletions
+768
-104
mainWindow.ui
resources/forms/mainWindow.ui
+16
-0
handPlay.png
resources/images/stylusPalette/handPlay.png
+0
-0
handPlayOn.png
resources/images/stylusPalette/handPlayOn.png
+0
-0
sankore.qrc
resources/sankore.qrc
+2
-0
UBWidgetUniboardAPI.cpp
src/api/UBWidgetUniboardAPI.cpp
+4
-0
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+2
-1
UBBoardView.cpp
src/board/UBBoardView.cpp
+374
-53
UBBoardView.h
src/board/UBBoardView.h
+21
-0
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+9
-0
UBDrawingController.h
src/board/UBDrawingController.h
+1
-0
UB.h
src/core/UB.h
+1
-0
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+4
-4
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+20
-3
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+7
-2
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+4
-10
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+4
-0
UBGraphicsMediaItemDelegate.cpp
src/domain/UBGraphicsMediaItemDelegate.cpp
+26
-2
UBGraphicsMediaItemDelegate.h
src/domain/UBGraphicsMediaItemDelegate.h
+6
-0
UBGraphicsProxyWidget.cpp
src/domain/UBGraphicsProxyWidget.cpp
+6
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+3
-7
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+7
-4
UBRubberBand.cpp
src/gui/UBRubberBand.cpp
+199
-0
UBRubberBand.h
src/gui/UBRubberBand.h
+24
-0
UBStylusPalette.cpp
src/gui/UBStylusPalette.cpp
+1
-0
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+12
-6
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+7
-7
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+3
-2
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+5
-2
No files found.
resources/forms/mainWindow.ui
View file @
4b9e6c77
...
@@ -1649,6 +1649,22 @@
...
@@ -1649,6 +1649,22 @@
<string>
Group items
</string>
<string>
Group items
</string>
</property>
</property>
</action>
</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>
</widget>
<resources>
<resources>
<include
location=
"../sankore.qrc"
/>
<include
location=
"../sankore.qrc"
/>
...
...
resources/images/stylusPalette/handPlay.png
0 → 100644
View file @
4b9e6c77
444 Bytes
resources/images/stylusPalette/handPlayOn.png
0 → 100644
View file @
4b9e6c77
603 Bytes
resources/sankore.qrc
View file @
4b9e6c77
...
@@ -125,6 +125,8 @@
...
@@ -125,6 +125,8 @@
<file>images/toolbar/tools.png</file>
<file>images/toolbar/tools.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrowOn.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/eraser.png</file>
<file>images/stylusPalette/eraserOn.png</file>
<file>images/stylusPalette/eraserOn.png</file>
<file>images/stylusPalette/hand.png</file>
<file>images/stylusPalette/hand.png</file>
...
...
src/api/UBWidgetUniboardAPI.cpp
View file @
4b9e6c77
...
@@ -123,6 +123,10 @@ void UBWidgetUniboardAPI::setTool(const QString& toolString)
...
@@ -123,6 +123,10 @@ void UBWidgetUniboardAPI::setTool(const QString& toolString)
{
{
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
lower
==
"play"
)
{
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Play
);
}
else
if
(
lower
==
"line"
)
else
if
(
lower
==
"line"
)
{
{
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Line
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Line
);
...
...
src/board/UBBoardPaletteManager.h
View file @
4b9e6c77
...
@@ -89,6 +89,8 @@ class UBBoardPaletteManager : public QObject
...
@@ -89,6 +89,8 @@ class UBBoardPaletteManager : public QObject
void
slot_changeMainMode
(
UBApplicationController
::
MainMode
);
void
slot_changeMainMode
(
UBApplicationController
::
MainMode
);
void
slot_changeDesktopMode
(
bool
);
void
slot_changeDesktopMode
(
bool
);
void
toggleErasePalette
(
bool
ckecked
);
private
:
private
:
void
setupPalettes
();
void
setupPalettes
();
...
@@ -168,7 +170,6 @@ class UBBoardPaletteManager : public QObject
...
@@ -168,7 +170,6 @@ class UBBoardPaletteManager : public QObject
void
erasePaletteButtonPressed
();
void
erasePaletteButtonPressed
();
void
erasePaletteButtonReleased
();
void
erasePaletteButtonReleased
();
void
toggleErasePalette
(
bool
ckecked
);
void
erasePaletteClosed
();
void
erasePaletteClosed
();
void
togglePagePalette
(
bool
ckecked
);
void
togglePagePalette
(
bool
ckecked
);
...
...
src/board/UBBoardView.cpp
View file @
4b9e6c77
This diff is collapsed.
Click to expand it.
src/board/UBBoardView.h
View file @
4b9e6c77
...
@@ -42,6 +42,9 @@ class UBBoardView : public QGraphicsView
...
@@ -42,6 +42,9 @@ class UBBoardView : public QGraphicsView
void
setToolCursor
(
int
tool
);
void
setToolCursor
(
int
tool
);
void
rubberItems
();
void
moveRubberedItems
(
QPointF
movingVector
);
signals
:
signals
:
void
resized
(
QResizeEvent
*
event
);
void
resized
(
QResizeEvent
*
event
);
...
@@ -51,6 +54,15 @@ class UBBoardView : public QGraphicsView
...
@@ -51,6 +54,15 @@ class UBBoardView : public QGraphicsView
protected
:
protected
:
bool
itemIsLocked
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveMousePressEvent
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveSuspendedMousePressEvent
(
QGraphicsItem
*
item
);
bool
itemHaveParentWithType
(
QGraphicsItem
*
item
,
int
type
);
bool
itemShouldBeMoved
(
QGraphicsItem
*
item
);
QGraphicsItem
*
determineItemToMove
(
QGraphicsItem
*
item
);
void
handleItemMousePress
(
QMouseEvent
*
event
);
void
handleItemMouseMove
(
QMouseEvent
*
event
);
virtual
bool
event
(
QEvent
*
e
);
virtual
bool
event
(
QEvent
*
e
);
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
...
@@ -124,9 +136,17 @@ class UBBoardView : public QGraphicsView
...
@@ -124,9 +136,17 @@ class UBBoardView : public QGraphicsView
QGraphicsItem
*
movingItem
;
QGraphicsItem
*
movingItem
;
QMouseEvent
*
suspendedMousePressEvent
;
QMouseEvent
*
suspendedMousePressEvent
;
bool
moveRubberBand
;
UBRubberBand
*
mUBRubberBand
;
UBRubberBand
*
mUBRubberBand
;
QList
<
QGraphicsItem
*>
mRubberedItems
;
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
int
mLongPressInterval
;
QTimer
mLongPressTimer
;
bool
mIsDragInProgress
;
private
slots
:
private
slots
:
void
settingChanged
(
QVariant
newValue
);
void
settingChanged
(
QVariant
newValue
);
...
@@ -134,6 +154,7 @@ class UBBoardView : public QGraphicsView
...
@@ -134,6 +154,7 @@ class UBBoardView : public QGraphicsView
public
slots
:
public
slots
:
void
virtualKeyboardActivated
(
bool
b
);
void
virtualKeyboardActivated
(
bool
b
);
void
longPressEvent
();
};
};
...
...
src/board/UBDrawingController.cpp
View file @
4b9e6c77
...
@@ -54,6 +54,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
...
@@ -54,6 +54,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
connect
(
UBApplication
::
mainWindow
->
actionEraser
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
eraserToolSelected
(
bool
)));
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
->
actionMarker
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
markerToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionSelector
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
selectorToolSelected
(
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
->
actionHand
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
handToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomIn
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
zoomInToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomIn
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
zoomInToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomOut
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
zoomOutToolSelected
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomOut
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
zoomOutToolSelected
(
bool
)));
...
@@ -120,6 +121,8 @@ void UBDrawingController::setStylusTool(int tool)
...
@@ -120,6 +121,8 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Selector
)
else
if
(
mStylusTool
==
UBStylusTool
::
Selector
)
UBApplication
::
mainWindow
->
actionSelector
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionSelector
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Play
)
UBApplication
::
mainWindow
->
actionPlay
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Hand
)
else
if
(
mStylusTool
==
UBStylusTool
::
Hand
)
UBApplication
::
mainWindow
->
actionHand
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionHand
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
ZoomIn
)
else
if
(
mStylusTool
==
UBStylusTool
::
ZoomIn
)
...
@@ -347,6 +350,12 @@ void UBDrawingController::selectorToolSelected(bool checked)
...
@@ -347,6 +350,12 @@ void UBDrawingController::selectorToolSelected(bool checked)
setStylusTool
(
UBStylusTool
::
Selector
);
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
void
UBDrawingController
::
playToolSelected
(
bool
checked
)
{
if
(
checked
)
setStylusTool
(
UBStylusTool
::
Play
);
}
void
UBDrawingController
::
handToolSelected
(
bool
checked
)
void
UBDrawingController
::
handToolSelected
(
bool
checked
)
{
{
if
(
checked
)
if
(
checked
)
...
...
src/board/UBDrawingController.h
View file @
4b9e6c77
...
@@ -88,6 +88,7 @@ class UBDrawingController : public QObject
...
@@ -88,6 +88,7 @@ class UBDrawingController : public QObject
void
eraserToolSelected
(
bool
checked
);
void
eraserToolSelected
(
bool
checked
);
void
markerToolSelected
(
bool
checked
);
void
markerToolSelected
(
bool
checked
);
void
selectorToolSelected
(
bool
checked
);
void
selectorToolSelected
(
bool
checked
);
void
playToolSelected
(
bool
checked
);
void
handToolSelected
(
bool
checked
);
void
handToolSelected
(
bool
checked
);
void
zoomInToolSelected
(
bool
checked
);
void
zoomInToolSelected
(
bool
checked
);
void
zoomOutToolSelected
(
bool
checked
);
void
zoomOutToolSelected
(
bool
checked
);
...
...
src/core/UB.h
View file @
4b9e6c77
...
@@ -28,6 +28,7 @@ struct UBStylusTool
...
@@ -28,6 +28,7 @@ struct UBStylusTool
Eraser
,
Eraser
,
Marker
,
Marker
,
Selector
,
Selector
,
Play
,
Hand
,
Hand
,
ZoomIn
,
ZoomIn
,
ZoomOut
,
ZoomOut
,
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
4b9e6c77
...
@@ -249,7 +249,7 @@ bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qr
...
@@ -249,7 +249,7 @@ bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qr
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
if
(
mDelegate
->
delegated
()
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
()
)
if
(
None
==
mCurrentTool
)
return
;
return
;
QLineF
move
(
mStartingPoint
,
event
->
scenePos
());
QLineF
move
(
mStartingPoint
,
event
->
scenePos
());
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
4b9e6c77
...
@@ -328,8 +328,10 @@ void UBGraphicsItemDelegate::positionHandles()
...
@@ -328,8 +328,10 @@ void UBGraphicsItemDelegate::positionHandles()
if
(
mDelegated
->
isSelected
())
{
if
(
mDelegated
->
isSelected
())
{
bool
shownOnDisplay
=
mDelegated
->
data
(
UBGraphicsItemData
::
ItemLayerType
).
toInt
()
!=
UBItemLayerType
::
Control
;
bool
shownOnDisplay
=
mDelegated
->
data
(
UBGraphicsItemData
::
ItemLayerType
).
toInt
()
!=
UBItemLayerType
::
Control
;
showHide
(
shownOnDisplay
);
showHide
(
shownOnDisplay
);
lock
(
isLocked
(
));
mDelegated
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
QVariant
(
isLocked
()
));
updateFrame
();
updateFrame
();
if
(
UBStylusTool
::
Play
!=
UBDrawingController
::
drawingController
()
->
stylusTool
())
mFrame
->
show
();
mFrame
->
show
();
updateButtons
(
true
);
updateButtons
(
true
);
...
@@ -451,6 +453,7 @@ void UBGraphicsItemDelegate::lock(bool locked)
...
@@ -451,6 +453,7 @@ void UBGraphicsItemDelegate::lock(bool locked)
}
}
mDelegated
->
update
();
mDelegated
->
update
();
positionHandles
();
mFrame
->
positionHandles
();
mFrame
->
positionHandles
();
}
}
...
@@ -676,7 +679,7 @@ UBGraphicsToolBarItem::UBGraphicsToolBarItem(QGraphicsItem * parent) :
...
@@ -676,7 +679,7 @@ UBGraphicsToolBarItem::UBGraphicsToolBarItem(QGraphicsItem * parent) :
rect
.
setWidth
(
parent
->
boundingRect
().
width
());
rect
.
setWidth
(
parent
->
boundingRect
().
width
());
this
->
setRect
(
rect
);
this
->
setRect
(
rect
);
setBrush
(
QColor
(
UBSettings
::
paletteColor
));
//
setBrush(QColor(UBSettings::paletteColor));
setPen
(
Qt
::
NoPen
);
setPen
(
Qt
::
NoPen
);
hide
();
hide
();
...
@@ -708,6 +711,17 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI
...
@@ -708,6 +711,17 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI
QPainterPath
path
;
QPainterPath
path
;
path
.
addRoundedRect
(
rect
(),
10
,
10
);
path
.
addRoundedRect
(
rect
(),
10
,
10
);
if
(
parentItem
()
&&
parentItem
()
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
{
QColor
baseColor
=
UBSettings
::
paletteColor
;
baseColor
.
setAlphaF
(
baseColor
.
alphaF
()
/
3
);
setBrush
(
QBrush
(
baseColor
));
}
else
{
setBrush
(
QBrush
(
UBSettings
::
paletteColor
));
}
painter
->
fillPath
(
path
,
brush
());
painter
->
fillPath
(
path
,
brush
());
}
}
...
@@ -1215,6 +1229,7 @@ void DelegateMediaControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -1215,6 +1229,7 @@ void DelegateMediaControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
seekToMousePos
(
event
->
pos
());
seekToMousePos
(
event
->
pos
());
this
->
update
();
this
->
update
();
event
->
accept
();
event
->
accept
();
emit
used
();
}
}
}
}
...
@@ -1227,6 +1242,7 @@ void DelegateMediaControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -1227,6 +1242,7 @@ void DelegateMediaControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
seekToMousePos
(
event
->
pos
());
seekToMousePos
(
event
->
pos
());
this
->
update
();
this
->
update
();
event
->
accept
();
event
->
accept
();
emit
used
();
}
}
}
}
...
@@ -1251,6 +1267,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos)
...
@@ -1251,6 +1267,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos)
//OSX is a bit lazy
//OSX is a bit lazy
updateTicker
(
tickPos
);
updateTicker
(
tickPos
);
}
}
emit
used
();
}
}
void
DelegateMediaControl
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
DelegateMediaControl
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
4b9e6c77
...
@@ -102,8 +102,10 @@ uint smallPoint : 1;
...
@@ -102,8 +102,10 @@ uint smallPoint : 1;
};
};
class
DelegateMediaControl
:
public
QGraphicsRectItem
class
DelegateMediaControl
:
public
Q
Object
,
public
Q
GraphicsRectItem
{
{
Q_OBJECT
public
:
public
:
DelegateMediaControl
(
UBGraphicsMediaItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
);
DelegateMediaControl
(
UBGraphicsMediaItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
);
...
@@ -127,6 +129,9 @@ class DelegateMediaControl: public QGraphicsRectItem
...
@@ -127,6 +129,9 @@ class DelegateMediaControl: public QGraphicsRectItem
void
updateTicker
(
qint64
time
);
void
updateTicker
(
qint64
time
);
void
totalTimeChanged
(
qint64
newTotalTime
);
void
totalTimeChanged
(
qint64
newTotalTime
);
signals
:
void
used
();
protected
:
protected
:
void
seekToMousePos
(
QPointF
mousePos
);
void
seekToMousePos
(
QPointF
mousePos
);
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
4b9e6c77
...
@@ -34,8 +34,8 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
...
@@ -34,8 +34,8 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
,
mInitialPos
(
0
)
,
mInitialPos
(
0
)
,
mVideoWidget
(
NULL
)
,
mVideoWidget
(
NULL
)
,
mAudioWidget
(
NULL
)
,
mAudioWidget
(
NULL
)
,
mLinkedImage
(
NULL
)
{
{
update
();
update
();
QString
s
=
pMediaFileUrl
.
toLocalFile
();
QString
s
=
pMediaFileUrl
.
toLocalFile
();
...
@@ -60,6 +60,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
...
@@ -60,6 +60,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mVideoWidget
->
resize
(
320
,
240
);
mVideoWidget
->
resize
(
320
,
240
);
}
}
setWidget
(
mVideoWidget
);
setWidget
(
mVideoWidget
);
haveLinkedImage
=
true
;
}
}
else
else
if
(
pMediaFileUrl
.
toLocalFile
().
contains
(
"audios"
))
if
(
pMediaFileUrl
.
toLocalFile
().
contains
(
"audios"
))
...
@@ -71,6 +72,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
...
@@ -71,6 +72,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mAudioWidget
=
new
QWidget
();
mAudioWidget
=
new
QWidget
();
mAudioWidget
->
resize
(
320
,
26
);
mAudioWidget
->
resize
(
320
,
26
);
setWidget
(
mAudioWidget
);
setWidget
(
mAudioWidget
);
haveLinkedImage
=
false
;
}
}
Phonon
::
createPath
(
mMediaObject
,
mAudioOutput
);
Phonon
::
createPath
(
mMediaObject
,
mAudioOutput
);
...
@@ -226,7 +228,7 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -226,7 +228,7 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if
(
mDelegate
)
if
(
mDelegate
)
{
{
mDelegate
->
mousePressEvent
(
event
);
mDelegate
->
mousePressEvent
(
event
);
if
(
mDelegate
&&
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
parentItem
()
->
type
())
if
(
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
parentItem
()
->
type
())
{
{
UBGraphicsGroupContainerItem
*
group
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
parentItem
());
UBGraphicsGroupContainerItem
*
group
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
parentItem
());
if
(
group
)
if
(
group
)
...
@@ -242,11 +244,6 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -242,11 +244,6 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
}
}
else
{
mDelegate
->
getToolBarItem
()
->
show
();
}
}
}
if
(
parentItem
()
&&
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
)
if
(
parentItem
()
&&
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
)
...
@@ -271,9 +268,6 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -271,9 +268,6 @@ void UBGraphicsMediaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsMediaItem
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsMediaItem
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
if
(
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
return
;
if
(
mShouldMove
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
))
if
(
mShouldMove
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
))
{
{
QPointF
offset
=
event
->
scenePos
()
-
mMousePressPos
;
QPointF
offset
=
event
->
scenePos
()
-
mMousePressPos
;
...
...
src/domain/UBGraphicsMediaItem.h
View file @
4b9e6c77
...
@@ -73,6 +73,8 @@ public:
...
@@ -73,6 +73,8 @@ public:
return
mVideoWidget
;
return
mVideoWidget
;
}
}
bool
hasLinkedImage
(){
return
haveLinkedImage
;}
mediaType
getMediaType
()
{
return
mMediaType
;
}
mediaType
getMediaType
()
{
return
mMediaType
;
}
virtual
UBGraphicsScene
*
scene
();
virtual
UBGraphicsScene
*
scene
();
...
@@ -115,6 +117,8 @@ private:
...
@@ -115,6 +117,8 @@ private:
QPointF
mMousePressPos
;
QPointF
mMousePressPos
;
QPointF
mMouseMovePos
;
QPointF
mMouseMovePos
;
bool
haveLinkedImage
;
QGraphicsPixmapItem
*
mLinkedImage
;
};
};
...
...
src/domain/UBGraphicsMediaItemDelegate.cpp
View file @
4b9e6c77
...
@@ -33,6 +33,8 @@
...
@@ -33,6 +33,8 @@
UBGraphicsMediaItemDelegate
::
UBGraphicsMediaItemDelegate
(
UBGraphicsMediaItem
*
pDelegated
,
Phonon
::
MediaObject
*
pMedia
,
QObject
*
parent
)
UBGraphicsMediaItemDelegate
::
UBGraphicsMediaItemDelegate
(
UBGraphicsMediaItem
*
pDelegated
,
Phonon
::
MediaObject
*
pMedia
,
QObject
*
parent
)
:
UBGraphicsItemDelegate
(
pDelegated
,
parent
,
true
,
false
)
:
UBGraphicsItemDelegate
(
pDelegated
,
parent
,
true
,
false
)
,
mMedia
(
pMedia
)
,
mMedia
(
pMedia
)
,
mToolBarShowTimer
(
NULL
)
,
m_iToolBarShowingInterval
(
5000
)
{
{
QPalette
palette
;
QPalette
palette
;
palette
.
setBrush
(
QPalette
::
Light
,
Qt
::
darkGray
);
palette
.
setBrush
(
QPalette
::
Light
,
Qt
::
darkGray
);
...
@@ -42,26 +44,46 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
...
@@ -42,26 +44,46 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
connect
(
mMedia
,
SIGNAL
(
finished
()),
this
,
SLOT
(
updatePlayPauseState
()));
connect
(
mMedia
,
SIGNAL
(
finished
()),
this
,
SLOT
(
updatePlayPauseState
()));
connect
(
mMedia
,
SIGNAL
(
tick
(
qint64
)),
this
,
SLOT
(
updateTicker
(
qint64
)));
connect
(
mMedia
,
SIGNAL
(
tick
(
qint64
)),
this
,
SLOT
(
updateTicker
(
qint64
)));
connect
(
mMedia
,
SIGNAL
(
totalTimeChanged
(
qint64
)),
this
,
SLOT
(
totalTimeChanged
(
qint64
)));
connect
(
mMedia
,
SIGNAL
(
totalTimeChanged
(
qint64
)),
this
,
SLOT
(
totalTimeChanged
(
qint64
)));
if
(
delegated
()
->
hasLinkedImage
())
{
mToolBarShowTimer
=
new
QTimer
();
connect
(
mToolBarShowTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
hideToolBar
()));
mToolBarShowTimer
->
setInterval
(
m_iToolBarShowingInterval
);
}
}
}
bool
UBGraphicsMediaItemDelegate
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
bool
UBGraphicsMediaItemDelegate
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
Q_UNUSED
(
event
);
Q_UNUSED
(
event
);
mToolBarItem
->
show
();
mToolBarItem
->
show
();
if
(
mToolBarShowTimer
)
mToolBarShowTimer
->
start
();
return
UBGraphicsItemDelegate
::
mousePressEvent
(
event
);
return
UBGraphicsItemDelegate
::
mousePressEvent
(
event
);
}
}
void
UBGraphicsMediaItemDelegate
::
hideToolBar
()
{
mToolBarItem
->
hide
();
}
void
UBGraphicsMediaItemDelegate
::
buildButtons
()
void
UBGraphicsMediaItemDelegate
::
buildButtons
()
{
{
mPlayPauseButton
=
new
DelegateButton
(
":/images/play.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
mPlayPauseButton
=
new
DelegateButton
(
":/images/play.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
connect
(
mPlayPauseButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
togglePlayPause
()));
connect
(
mPlayPauseButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
togglePlayPause
()));
connect
(
mPlayPauseButton
,
SIGNAL
(
clicked
(
bool
)),
mToolBarShowTimer
,
SLOT
(
start
()));
mStopButton
=
new
DelegateButton
(
":/images/stop.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
mStopButton
=
new
DelegateButton
(
":/images/stop.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
connect
(
mStopButton
,
SIGNAL
(
clicked
(
bool
)),
mMedia
,
SLOT
(
stop
()));
connect
(
mStopButton
,
SIGNAL
(
clicked
(
bool
)),
mMedia
,
SLOT
(
stop
()));
connect
(
mStopButton
,
SIGNAL
(
clicked
(
bool
)),
mToolBarShowTimer
,
SLOT
(
start
()));
mMediaControl
=
new
DelegateMediaControl
(
delegated
(),
mToolBarItem
);
mMediaControl
=
new
DelegateMediaControl
(
delegated
(),
mToolBarItem
);
mMediaControl
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
mMediaControl
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
UBGraphicsItem
::
assignZValue
(
mMediaControl
,
delegated
()
->
zValue
());
UBGraphicsItem
::
assignZValue
(
mMediaControl
,
delegated
()
->
zValue
());
connect
(
mMediaControl
,
SIGNAL
(
used
()),
mToolBarShowTimer
,
SLOT
(
start
()));
if
(
delegated
()
->
isMuted
())
if
(
delegated
()
->
isMuted
())
mMuteButton
=
new
DelegateButton
(
":/images/soundOff.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
mMuteButton
=
new
DelegateButton
(
":/images/soundOff.svg"
,
mDelegated
,
mToolBarItem
,
Qt
::
TitleBarArea
);
...
@@ -70,6 +92,7 @@ void UBGraphicsMediaItemDelegate::buildButtons()
...
@@ -70,6 +92,7 @@ void UBGraphicsMediaItemDelegate::buildButtons()
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
delegated
(),
SLOT
(
toggleMute
()));
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
delegated
(),
SLOT
(
toggleMute
()));
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleMute
()));
// for changing button image
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleMute
()));
// for changing button image
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
mToolBarShowTimer
,
SLOT
(
start
()));
mButtons
<<
mPlayPauseButton
<<
mStopButton
<<
mMuteButton
;
mButtons
<<
mPlayPauseButton
<<
mStopButton
<<
mMuteButton
;
...
@@ -89,7 +112,8 @@ void UBGraphicsMediaItemDelegate::buildButtons()
...
@@ -89,7 +112,8 @@ void UBGraphicsMediaItemDelegate::buildButtons()
UBGraphicsMediaItemDelegate
::~
UBGraphicsMediaItemDelegate
()
UBGraphicsMediaItemDelegate
::~
UBGraphicsMediaItemDelegate
()
{
{
//NOOP
if
(
mToolBarShowTimer
)
delete
mToolBarShowTimer
;
}
}
void
UBGraphicsMediaItemDelegate
::
positionHandles
()
void
UBGraphicsMediaItemDelegate
::
positionHandles
()
...
...
src/domain/UBGraphicsMediaItemDelegate.h
View file @
4b9e6c77
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <QtGui>
#include <QtGui>
#include <phonon/MediaObject>
#include <phonon/MediaObject>
#include <QTimer>
#include "core/UB.h"
#include "core/UB.h"
#include "UBGraphicsItemDelegate.h"
#include "UBGraphicsItemDelegate.h"
...
@@ -54,6 +55,8 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
...
@@ -54,6 +55,8 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
void
totalTimeChanged
(
qint64
newTotalTime
);
void
totalTimeChanged
(
qint64
newTotalTime
);
void
hideToolBar
();
protected
:
protected
:
virtual
void
buildButtons
();
virtual
void
buildButtons
();
...
@@ -65,6 +68,9 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
...
@@ -65,6 +68,9 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
DelegateMediaControl
*
mMediaControl
;
DelegateMediaControl
*
mMediaControl
;
Phonon
::
MediaObject
*
mMedia
;
Phonon
::
MediaObject
*
mMedia
;
QTimer
*
mToolBarShowTimer
;
int
m_iToolBarShowingInterval
;
};
};
#endif
/* UBGRAPHICSMEDIAITEMDELEGATE_H_ */
#endif
/* UBGRAPHICSMEDIAITEMDELEGATE_H_ */
\ No newline at end of file
src/domain/UBGraphicsProxyWidget.cpp
View file @
4b9e6c77
...
@@ -47,6 +47,10 @@ UBGraphicsProxyWidget::~UBGraphicsProxyWidget()
...
@@ -47,6 +47,10 @@ UBGraphicsProxyWidget::~UBGraphicsProxyWidget()
QVariant
UBGraphicsProxyWidget
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
QVariant
UBGraphicsProxyWidget
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
{
if
(
change
==
QGraphicsItem
::
ItemCursorHasChanged
&&
scene
())
{
unsetCursor
();
}
if
((
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
if
((
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
&&
scene
())
&&
scene
())
{
{
...
@@ -82,9 +86,10 @@ void UBGraphicsProxyWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -82,9 +86,10 @@ void UBGraphicsProxyWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
else
else
{
{
// QT Proxy Widget is a bit lazy, we force the selection ...
// QT Proxy Widget is a bit lazy, we force the selection ...
QGraphicsProxyWidget
::
mousePressEvent
(
event
);
setSelected
(
true
);
setSelected
(
true
);
}
}
QGraphicsProxyWidget
::
mousePressEvent
(
event
);
}
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
4b9e6c77
...
@@ -2366,14 +2366,10 @@ void UBGraphicsScene::createPointer()
...
@@ -2366,14 +2366,10 @@ void UBGraphicsScene::createPointer()
void
UBGraphicsScene
::
setToolCursor
(
int
tool
)
void
UBGraphicsScene
::
setToolCursor
(
int
tool
)
{
{
if
(
tool
!=
(
int
)
UBStylusTool
::
Selector
if
(
tool
==
(
int
)
UBStylusTool
::
Selector
||
&&
tool
!=
(
int
)
UBStylusTool
::
Text
)
tool
==
(
int
)
UBStylusTool
::
Text
||
tool
==
(
int
)
UBStylusTool
::
Play
)
{
{
deselectAllItems
();
deselectAllItems
();
}
}
if
(
tool
!=
(
int
)
UBStylusTool
::
Eraser
)
{
hideEraser
();
}
}
}
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
4b9e6c77
...
@@ -303,11 +303,14 @@ void UBGraphicsTextItemDelegate::positionHandles()
...
@@ -303,11 +303,14 @@ void UBGraphicsTextItemDelegate::positionHandles()
UBGraphicsGroupContainerItem
*
group
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
mDelegated
->
parentItem
());
UBGraphicsGroupContainerItem
*
group
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
mDelegated
->
parentItem
());
mToolBarItem
->
hide
();
mToolBarItem
->
hide
();
if
(
mToolBarItem
->
parentItem
()
&&
!
mToolBarItem
->
parentItem
()
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
{
if
(
group
&&
group
->
getCurrentItem
()
==
mDelegated
&&
group
->
isSelected
())
if
(
group
&&
group
->
getCurrentItem
()
==
mDelegated
&&
group
->
isSelected
())
mToolBarItem
->
show
();
mToolBarItem
->
show
();
if
(
!
group
)
if
(
!
group
)
mToolBarItem
->
show
();
mToolBarItem
->
show
();
}
}
}
}
}
...
...
src/gui/UBRubberBand.cpp
View file @
4b9e6c77
...
@@ -23,10 +23,18 @@
...
@@ -23,10 +23,18 @@
#include <QtGui/QMacStyle>
#include <QtGui/QMacStyle>
#endif
#endif
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
UBRubberBand
::
UBRubberBand
(
Shape
s
,
QWidget
*
p
)
UBRubberBand
::
UBRubberBand
(
Shape
s
,
QWidget
*
p
)
:
QRubberBand
(
s
,
p
)
:
QRubberBand
(
s
,
p
)
,
mResizingMode
(
None
)
,
mMouseIsPressed
(
false
)
,
mLastPressedPoint
(
QPoint
())
,
mResizingBorderHeight
(
20
)
{
{
customStyle
=
NULL
;
customStyle
=
NULL
;
...
@@ -41,6 +49,8 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p)
...
@@ -41,6 +49,8 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p)
if
(
customStyle
)
if
(
customStyle
)
QRubberBand
::
setStyle
(
customStyle
);
QRubberBand
::
setStyle
(
customStyle
);
setAttribute
(
Qt
::
WA_TransparentForMouseEvents
,
false
);
setMouseTracking
(
true
);
}
}
UBRubberBand
::~
UBRubberBand
()
UBRubberBand
::~
UBRubberBand
()
...
@@ -48,3 +58,192 @@ UBRubberBand::~UBRubberBand()
...
@@ -48,3 +58,192 @@ UBRubberBand::~UBRubberBand()
if
(
customStyle
)
if
(
customStyle
)
delete
customStyle
;
delete
customStyle
;
}
}
UBRubberBand
::
enm_resizingMode
UBRubberBand
::
determineResizingMode
(
QPoint
pos
)
{
if
(
mMouseIsPressed
)
return
mResizingMode
;
QRect
resizerTop
(
mResizingBorderHeight
,
0
,
rect
().
width
()
-
2
*
mResizingBorderHeight
,
mResizingBorderHeight
);
QRect
resizerBottom
(
mResizingBorderHeight
,
rect
().
height
()
-
mResizingBorderHeight
,
rect
().
width
()
-
2
*
mResizingBorderHeight
,
mResizingBorderHeight
);
QRect
resizerLeft
(
0
,
mResizingBorderHeight
,
mResizingBorderHeight
,
rect
().
height
()
-
2
*
mResizingBorderHeight
);
QRect
resizerRight
(
rect
().
width
()
-
mResizingBorderHeight
,
mResizingBorderHeight
,
mResizingBorderHeight
,
rect
().
height
()
-
2
*
mResizingBorderHeight
);
QRect
resizerTopLeft
(
0
,
0
,
mResizingBorderHeight
,
mResizingBorderHeight
);
QRect
resizerTopRight
(
rect
().
width
()
-
mResizingBorderHeight
,
0
,
mResizingBorderHeight
,
mResizingBorderHeight
);
QRect
resizerBottomLeft
(
0
,
rect
().
height
()
-
mResizingBorderHeight
,
mResizingBorderHeight
,
mResizingBorderHeight
);
QRect
resizerBottomRight
(
rect
().
width
()
-
mResizingBorderHeight
,
rect
().
height
()
-
mResizingBorderHeight
,
mResizingBorderHeight
,
mResizingBorderHeight
);
enm_resizingMode
resizingMode
;
QTransform
cursorTransrofm
;
if
(
resizerTop
.
contains
(
pos
))
{
resizingMode
=
Top
;
cursorTransrofm
.
rotate
(
90
);
}
else
if
(
resizerBottom
.
contains
(
pos
))
{
resizingMode
=
Bottom
;
cursorTransrofm
.
rotate
(
90
);
}
else
if
(
resizerLeft
.
contains
(
pos
))
{
resizingMode
=
Left
;
}
else
if
(
resizerRight
.
contains
(
pos
))
{
resizingMode
=
Right
;
}
else
if
(
resizerTopLeft
.
contains
(
pos
))
{
resizingMode
=
TopLeft
;
cursorTransrofm
.
rotate
(
45
);
}
else
if
(
resizerTopRight
.
contains
(
pos
))
{
resizingMode
=
TopRight
;
cursorTransrofm
.
rotate
(
-
45
);
}
else
if
(
resizerBottomLeft
.
contains
(
pos
))
{
resizingMode
=
BottomLeft
;
cursorTransrofm
.
rotate
(
-
45
);
}
else
if
(
resizerBottomRight
.
contains
(
pos
))
{
resizingMode
=
BottomRight
;
cursorTransrofm
.
rotate
(
45
);
}
else
resizingMode
=
None
;
if
(
None
!=
resizingMode
)
{
QPixmap
pix
(
":/images/cursors/resize.png"
);
QCursor
resizeCursor
=
QCursor
(
pix
.
transformed
(
cursorTransrofm
,
Qt
::
SmoothTransformation
),
pix
.
width
()
/
2
,
pix
.
height
()
/
2
);
setCursor
(
resizeCursor
);
}
else
unsetCursor
();
return
resizingMode
;
}
void
UBRubberBand
::
mousePressEvent
(
QMouseEvent
*
event
)
{
mResizingMode
=
determineResizingMode
(
event
->
pos
());
mMouseIsPressed
=
true
;
mLastPressedPoint
=
event
->
pos
();
mLastMousePos
=
event
->
pos
();
if
(
None
==
mResizingMode
)
{
UBApplication
::
boardController
->
controlView
()
->
rubberItems
();
setCursor
(
QCursor
(
Qt
::
SizeAllCursor
));
}
}
void
UBRubberBand
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
determineResizingMode
(
event
->
pos
());
if
(
mMouseIsPressed
)
{
UBBoardView
*
view
=
UBApplication
::
boardController
->
controlView
();
QRect
currentGeometry
=
geometry
();
QPoint
pressPoint
(
event
->
pos
());
QPoint
pressPointGlobal
(
view
->
mapToGlobal
(
pressPoint
));
QPoint
prevPressPointGlobal
(
view
->
mapToGlobal
(
mLastPressedPoint
));
QPoint
movePointGlogal
=
(
view
->
mapToGlobal
(
mLastMousePos
));
QPoint
topLeftResizeVector
(
pressPointGlobal
-
prevPressPointGlobal
);
QPoint
rightBottomResizeVector
(
pressPointGlobal
-
movePointGlogal
);
bool
bGeometryChange
=
true
;
switch
(
mResizingMode
)
{
case
None
:
{
QPointF
itemsMoveVector
(
view
->
mapToScene
(
pressPointGlobal
)
-
view
->
mapToScene
(
prevPressPointGlobal
));
move
(
pos
()
+
pressPointGlobal
-
prevPressPointGlobal
);
view
->
moveRubberedItems
(
itemsMoveVector
);
bGeometryChange
=
false
;
break
;
}
case
Top
:
{
currentGeometry
.
setY
(
currentGeometry
.
y
()
+
topLeftResizeVector
.
y
());
}
break
;
case
Bottom
:
{
currentGeometry
.
setHeight
(
currentGeometry
.
height
()
+
rightBottomResizeVector
.
y
());
}
break
;
case
Left
:
{
currentGeometry
.
setX
(
currentGeometry
.
x
()
+
topLeftResizeVector
.
x
());
}
break
;
case
Right
:
{
currentGeometry
.
setWidth
(
currentGeometry
.
width
()
+
rightBottomResizeVector
.
x
());
}
break
;
case
TopLeft
:
{
currentGeometry
.
setX
(
currentGeometry
.
x
()
+
topLeftResizeVector
.
x
());
currentGeometry
.
setY
(
currentGeometry
.
y
()
+
topLeftResizeVector
.
y
());
}
break
;
case
TopRight
:
{
currentGeometry
.
setY
(
currentGeometry
.
y
()
+
topLeftResizeVector
.
y
());
currentGeometry
.
setWidth
(
currentGeometry
.
width
()
+
rightBottomResizeVector
.
x
());
}
break
;
case
BottomLeft
:
{
currentGeometry
.
setX
(
currentGeometry
.
x
()
+
topLeftResizeVector
.
x
());
currentGeometry
.
setHeight
(
currentGeometry
.
height
()
+
rightBottomResizeVector
.
y
());
}
break
;
case
BottomRight
:
{
currentGeometry
.
setWidth
(
currentGeometry
.
width
()
+
rightBottomResizeVector
.
x
());
currentGeometry
.
setHeight
(
currentGeometry
.
height
()
+
rightBottomResizeVector
.
y
());
}
break
;
}
if
(
bGeometryChange
)
{
setGeometry
(
currentGeometry
);
}
mLastMousePos
=
event
->
pos
();
}
QRubberBand
::
mouseMoveEvent
(
event
);
}
void
UBRubberBand
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
mMouseIsPressed
=
false
;
unsetCursor
();
}
\ No newline at end of file
src/gui/UBRubberBand.h
View file @
4b9e6c77
...
@@ -26,8 +26,32 @@ class UBRubberBand : public QRubberBand
...
@@ -26,8 +26,32 @@ class UBRubberBand : public QRubberBand
UBRubberBand
(
Shape
s
,
QWidget
*
p
=
0
);
UBRubberBand
(
Shape
s
,
QWidget
*
p
=
0
);
virtual
~
UBRubberBand
();
virtual
~
UBRubberBand
();
private
:
enum
enm_resizingMode
{
None
,
Top
,
TopLeft
,
TopRight
,
Bottom
,
BottomLeft
,
BottomRight
,
Left
,
Right
};
enm_resizingMode
determineResizingMode
(
QPoint
pos
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
private
:
private
:
QStyle
*
customStyle
;
QStyle
*
customStyle
;
enm_resizingMode
mResizingMode
;
int
mResizingBorderHeight
;
bool
mMouseIsPressed
;
QPoint
mLastPressedPoint
;
QPoint
mLastMousePos
;
};
};
#endif
/* UBRUBBERBAND_H_ */
#endif
/* UBRUBBERBAND_H_ */
src/gui/UBStylusPalette.cpp
View file @
4b9e6c77
...
@@ -39,6 +39,7 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
...
@@ -39,6 +39,7 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
actions
<<
UBApplication
::
mainWindow
->
actionPlay
;
actions
<<
UBApplication
::
mainWindow
->
actionHand
;
actions
<<
UBApplication
::
mainWindow
->
actionHand
;
actions
<<
UBApplication
::
mainWindow
->
actionZoomIn
;
actions
<<
UBApplication
::
mainWindow
->
actionZoomIn
;
...
...
src/tools/UBGraphicsCompass.cpp
View file @
4b9e6c77
...
@@ -170,7 +170,8 @@ QVariant UBGraphicsCompass::itemChange(GraphicsItemChange change, const QVariant
...
@@ -170,7 +170,8 @@ QVariant UBGraphicsCompass::itemChange(GraphicsItemChange change, const QVariant
void
UBGraphicsCompass
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsCompass
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
)
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
if
(
resizeButtonRect
().
contains
(
event
->
pos
()))
if
(
resizeButtonRect
().
contains
(
event
->
pos
()))
...
@@ -205,7 +206,8 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -205,7 +206,8 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
mouseMoveEvent
(
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
;
return
;
if
(
!
mResizing
&&
!
mRotating
&&
!
mDrawing
)
if
(
!
mResizing
&&
!
mRotating
&&
!
mDrawing
)
...
@@ -249,7 +251,8 @@ void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -249,7 +251,8 @@ void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
mouseReleaseEvent
(
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
;
return
;
if
(
mResizing
)
if
(
mResizing
)
...
@@ -289,7 +292,8 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
...
@@ -289,7 +292,8 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
void
UBGraphicsCompass
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
)
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
mOuterCursor
=
cursor
();
mOuterCursor
=
cursor
();
...
@@ -318,7 +322,8 @@ void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
...
@@ -318,7 +322,8 @@ void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void
UBGraphicsCompass
::
hoverLeaveEvent
(
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
;
return
;
mShowButtons
=
false
;
mShowButtons
=
false
;
...
@@ -331,7 +336,8 @@ void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -331,7 +336,8 @@ void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void
UBGraphicsCompass
::
hoverMoveEvent
(
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
;
return
;
mShowButtons
=
shape
().
contains
(
event
->
pos
());
mShowButtons
=
shape
().
contains
(
event
->
pos
());
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
4b9e6c77
...
@@ -250,13 +250,19 @@ void UBGraphicsProtractor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
...
@@ -250,13 +250,19 @@ void UBGraphicsProtractor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if
(
scene
())
if
(
scene
())
scene
()
->
setModified
(
true
);
scene
()
->
setModified
(
true
);
if
(
!
mShowButtons
)
{
mShowButtons
=
true
;
update
();
}
mCurrentTool
=
None
;
mCurrentTool
=
None
;
}
}
void
UBGraphicsProtractor
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
void
UBGraphicsProtractor
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
)
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
if
(
!
mShowButtons
)
if
(
!
mShowButtons
)
...
@@ -292,12 +298,6 @@ void UBGraphicsProtractor::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -292,12 +298,6 @@ void UBGraphicsProtractor::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Tool
currentTool
=
toolFromPos
(
event
->
pos
());
Tool
currentTool
=
toolFromPos
(
event
->
pos
());
if
(
!
mShowButtons
)
{
mShowButtons
=
true
;
update
();
}
if
(
currentTool
==
Move
)
if
(
currentTool
==
Move
)
setCursor
(
Qt
::
SizeAllCursor
);
setCursor
(
Qt
::
SizeAllCursor
);
else
else
...
...
src/tools/UBGraphicsRuler.cpp
View file @
4b9e6c77
...
@@ -268,7 +268,7 @@ void UBGraphicsRuler::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -268,7 +268,7 @@ void UBGraphicsRuler::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
{
mCloseSvgItem
->
setVisible
(
mShowButtons
);
mCloseSvgItem
->
setVisible
(
mShowButtons
);
mResizeSvgItem
->
setVisible
(
mShowButtons
);
mResizeSvgItem
->
setVisible
(
mShowButtons
);
...
@@ -376,7 +376,8 @@ void UBGraphicsRuler::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
...
@@ -376,7 +376,8 @@ void UBGraphicsRuler::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
{
mCloseSvgItem
->
setParentItem
(
this
);
mCloseSvgItem
->
setParentItem
(
this
);
mResizeSvgItem
->
setParentItem
(
this
);
mResizeSvgItem
->
setParentItem
(
this
);
...
...
src/tools/UBGraphicsTriangle.cpp
View file @
4b9e6c77
...
@@ -763,7 +763,9 @@ void UBGraphicsTriangle::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
...
@@ -763,7 +763,9 @@ void UBGraphicsTriangle::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
mCloseSvgItem
->
setParentItem
(
this
);
mCloseSvgItem
->
setParentItem
(
this
);
mShowButtons
=
true
;
mShowButtons
=
true
;
...
@@ -813,7 +815,8 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -813,7 +815,8 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
{
mCloseSvgItem
->
setVisible
(
mShowButtons
);
mCloseSvgItem
->
setVisible
(
mShowButtons
);
mVFlipSvgItem
->
setVisible
(
mShowButtons
);
mVFlipSvgItem
->
setVisible
(
mShowButtons
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment