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
a75ce302
Commit
a75ce302
authored
Aug 03, 2012
by
Yimgo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tool widgets supported.
The old code has to be removed and remaining bugs fixed.
parent
9a623707
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
189 deletions
+108
-189
UBBoardController.cpp
src/board/UBBoardController.cpp
+13
-86
UBBoardController.h
src/board/UBBoardController.h
+0
-6
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+3
-0
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+3
-0
UBToolWidget.cpp
src/gui/UBToolWidget.cpp
+74
-83
UBToolWidget.h
src/gui/UBToolWidget.h
+15
-14
No files found.
src/board/UBBoardController.cpp
View file @
a75ce302
...
...
@@ -1543,52 +1543,15 @@ qreal UBBoardController::currentZoom()
return
1.0
;
}
UBToolWidget
*
UBBoardController
::
addTool
(
const
QUrl
&
toolUrl
)
{
return
addTool
(
toolUrl
,
mControlView
->
mapToScene
(
mControlView
->
rect
().
center
()));
}
UBToolWidget
*
UBBoardController
::
addTool
(
const
QUrl
&
toolUrl
,
QPointF
scenePos
)
{
UBToolWidget
*
toolWidget
=
new
UBToolWidget
(
toolUrl
,
mMainWindow
);
// Deleted in UBBoardController::removeTool
QPoint
pos
=
mControlView
->
mapToGlobal
(
mControlView
->
mapFromScene
(
scenePos
));
pos
-=
QPoint
(
toolWidget
->
width
()
/
2
,
toolWidget
->
height
()
/
2
);
toolWidget
->
move
(
pos
);
mTools
.
append
(
toolWidget
);
toolWidget
->
show
();
return
toolWidget
;
}
void
UBBoardController
::
removeTool
(
UBToolWidget
*
toolWidget
)
{
toolWidget
->
hide
();
mTools
.
removeAll
(
toolWidget
);
delete
toolWidget
;
}
void
UBBoardController
::
hide
()
{
UBApplication
::
mainWindow
->
actionLibrary
->
setChecked
(
false
);
controlViewHidden
();
}
void
UBBoardController
::
show
()
{
UBApplication
::
mainWindow
->
actionLibrary
->
setChecked
(
false
);
controlViewShown
();
}
...
...
@@ -1813,25 +1776,6 @@ void UBBoardController::grabScene(const QRectF& pSceneRect)
}
}
void
UBBoardController
::
controlViewHidden
()
{
foreach
(
UBToolWidget
*
tool
,
mTools
)
{
tool
->
hide
();
}
}
void
UBBoardController
::
controlViewShown
()
{
foreach
(
UBToolWidget
*
tool
,
mTools
)
{
tool
->
show
();
}
}
UBGraphicsMediaItem
*
UBBoardController
::
addVideo
(
const
QUrl
&
pSourceUrl
,
bool
startPlay
,
const
QPointF
&
pos
)
{
QUuid
uuid
=
QUuid
::
createUuid
();
...
...
@@ -2098,56 +2042,39 @@ void UBBoardController::togglePodcast(bool checked)
void
UBBoardController
::
moveGraphicsWidgetToControlView
(
UBGraphicsWidgetItem
*
graphicsWidget
)
{
/*QPoint controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center());
graphicsWidget->setSelected(false);
UBAbstractWidget *aw = graphicsWidget->widgetWebView();
graphicsWidget->setWidget(0);
graphicsWidget
->
remove
();
UBToolWidget *toolWidget = new UBToolWidget(aw, mControlContainer);
graphicsWidget->scene()->removeItem(graphicsWidget); // TODO UB 4.6 probably leaking the frame
toolWidget->centerOn(mControlView->mapTo(mControlContainer, controlViewPos));
toolWidget->show();*/
UBToolWidget
*
toolWidget
=
new
UBToolWidget
(
graphicsWidget
);
mActiveScene
->
addItem
(
toolWidget
);
}
void
UBBoardController
::
moveToolWidgetToScene
(
UBToolWidget
*
toolWidget
)
{
/*int xIsOdd = toolWidget->width() % 2;
int yIsOdd = toolWidget->height() % 2;
QPoint mainWindowCenter = toolWidget->mapTo(mMainWindow, QPoint(toolWidget->width(), toolWidget->height()) / 2);
UBAbstractWidget* webWidget = toolWidget->webWidget();
webWidget->setParent(0);
QPoint
mainWindowCenter
=
(
QPointF
(
toolWidget
->
preferredWidth
(),
toolWidget
->
preferredHeight
())
/
2
).
toPoint
();
UBGraphicsWidgetItem* graphicsWidget = 0;
UBGraphicsWidgetItem
*
graphicsWidgetItem
=
toolWidget
->
graphicsWidgetItem
();
graphicsWidgetItem
->
setParent
(
0
);
UBW3CWidget* w3cWidget = qobject_cast<UBW3CWidget*>(webWidget);
if (w3cWidget)
if
(
qobject_cast
<
UBGraphicsW3CWidgetItem
*>
(
graphicsWidgetItem
))
{
graphicsWidget
= new UBGraphicsW3CWidgetItem(w3cWidget
);
graphicsWidget
Item
=
qobject_cast
<
UBGraphicsW3CWidgetItem
*>
(
graphicsWidgetItem
);
}
else
{
UBAppleWidget* appleWidget = qobject_cast<UBAppleWidget*>(webWidget);
if (appleWidget)
if
(
qobject_cast
<
UBGraphicsAppleWidgetItem
*>
(
graphicsWidgetItem
))
{
graphicsWidget
= new UBGraphicsAppleWidgetItem(appleWidget
);
graphicsWidget
Item
=
qobject_cast
<
UBGraphicsAppleWidgetItem
*>
(
graphicsWidgetItem
);
}
}
QPoint
controlViewCenter
=
mControlView
->
mapFrom
(
mMainWindow
,
mainWindowCenter
);
QPointF scenePos = mControlView->mapToScene(controlViewCenter)
+ QPointF(xIsOdd * 0.5, yIsOdd * 0.5)
;
QPointF
scenePos
=
mControlView
->
mapToScene
(
controlViewCenter
);
mActiveScene->addGraphicsWidget(graphicsWidget, scenePos);
mActiveScene
->
addGraphicsWidget
(
graphicsWidget
Item
,
scenePos
);
toolWidget
->
hide
();
toolWidget->deleteLater();
*/
toolWidget
->
deleteLater
();
}
...
...
src/board/UBBoardController.h
View file @
a75ce302
...
...
@@ -195,17 +195,12 @@ class UBBoardController : public UBDocumentContainer
void
hideMessage
();
void
setDisabled
(
bool
disable
);
void
setColorIndex
(
int
pColorIndex
);
UBToolWidget
*
addTool
(
const
QUrl
&
toolUrl
,
QPointF
scenePos
);
UBToolWidget
*
addTool
(
const
QUrl
&
toolUrl
);
void
removeTool
(
UBToolWidget
*
toolWidget
);
void
hide
();
void
show
();
void
setWidePageSize
(
bool
checked
);
void
setRegularPageSize
(
bool
checked
);
void
stylusToolChanged
(
int
tool
);
void
grabScene
(
const
QRectF
&
pSceneRect
);
void
controlViewHidden
();
void
controlViewShown
();
UBGraphicsMediaItem
*
addVideo
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
);
UBGraphicsMediaItem
*
addAudio
(
const
QUrl
&
pUrl
,
bool
startPlay
,
const
QPointF
&
pos
);
UBGraphicsWidgetItem
*
addW3cWidget
(
const
QUrl
&
pUrl
,
const
QPointF
&
pos
);
...
...
@@ -275,7 +270,6 @@ class UBBoardController : public UBDocumentContainer
QColor
mPenColorOnLightBackground
;
QColor
mMarkerColorOnDarkBackground
;
QColor
mMarkerColorOnLightBackground
;
QList
<
UBToolWidget
*>
mTools
;
qreal
mSystemScaleFactor
;
bool
mCleanupDone
;
QMap
<
QAction
*
,
QPair
<
QString
,
QString
>
>
mActionTexts
;
...
...
src/domain/UBGraphicsScene.cpp
View file @
a75ce302
...
...
@@ -31,6 +31,7 @@
#include "gui/UBMagnifer.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolWidget.h"
#include "tools/UBGraphicsRuler.h"
#include "tools/UBGraphicsProtractor.h"
...
...
@@ -1464,6 +1465,8 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
UBApplication
::
boardController
->
controlView
()
->
setFocus
();
}
UBGraphicsW3CWidgetItem
*
UBGraphicsScene
::
addOEmbed
(
const
QUrl
&
pContentUrl
,
const
QPointF
&
pPos
)
{
QStringList
widgetPaths
=
UBPersistenceManager
::
persistenceManager
()
->
allWidgets
(
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
());
...
...
src/domain/UBGraphicsScene.h
View file @
a75ce302
...
...
@@ -35,6 +35,7 @@ class UBGraphicsAudioItem;
class
UBGraphicsWidgetItem
;
class
UBGraphicsW3CWidgetItem
;
class
UBGraphicsAppleWidgetItem
;
class
UBToolWidget
;
class
UBGraphicsPDFItem
;
class
UBGraphicsTextItem
;
class
UBGraphicsRuler
;
...
...
@@ -133,6 +134,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsW3CWidgetItem
*
addW3CWidget
(
const
QUrl
&
pWidgetUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
void
addGraphicsWidget
(
UBGraphicsWidgetItem
*
graphicsWidget
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsMediaItem
*
addMedia
(
const
QUrl
&
pMediaFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsMediaItem
*
addVideo
(
const
QUrl
&
pVideoFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsMediaItem
*
addAudio
(
const
QUrl
&
pAudioFileUrl
,
bool
shouldPlayAsap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
...
...
src/gui/UBToolWidget.cpp
View file @
a75ce302
This diff is collapsed.
Click to expand it.
src/gui/UBToolWidget.h
View file @
a75ce302
...
...
@@ -18,32 +18,33 @@
#include <QtGui>
class
UB
AbstractWidget
;
class
UB
GraphicsWidgetItem
;
class
QWidget
;
class
UBGraphicsScene
;
class
UBToolWidget
:
public
QWidget
class
UBToolWidget
:
public
Q
Graphics
Widget
{
Q_OBJECT
;
Q_OBJECT
public
:
UBToolWidget
(
const
QUrl
&
pUrl
,
Q
Widget
*
pParent
=
0
);
UBToolWidget
(
UB
AbstractWidget
*
pWidget
,
QWidget
*
pParent
=
0
);
UBToolWidget
(
const
QUrl
&
pUrl
,
Q
GraphicsItem
*
pParent
=
0
);
UBToolWidget
(
UB
GraphicsWidgetItem
*
pGraphicsWidgetItem
,
QGraphicsItem
*
pParent
=
0
);
virtual
~
UBToolWidget
();
void
centerOn
(
const
QPoint
&
pos
);
void
centerOn
(
const
QPoint
F
&
pos
);
QPoint
naturalCenter
()
const
;
QPoint
F
naturalCenter
()
const
;
UBAbstractWidget
*
webWidget
()
const
;
UBGraphicsWidgetItem
*
graphicsWidgetItem
()
const
;
virtual
UBGraphicsScene
*
scene
();
protected
:
void
initialize
();
virtual
void
paint
Event
(
QPaintEvent
*
);
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
eventFilter
(
QObject
*
obj
,
QEvent
*
event
);
...
...
@@ -55,9 +56,9 @@ class UBToolWidget : public QWidget
static
QPixmap
*
sClosePixmap
;
static
QPixmap
*
sUnpinPixmap
;
UB
AbstractWidget
*
mToolWidget
;
UB
GraphicsWidgetItem
*
mGraphicsWidgetItem
;
QPoint
mMousePressPos
;
QPoint
F
mMousePressPos
;
bool
mShouldMoveWidget
;
...
...
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