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
42d1fcb6
Commit
42d1fcb6
authored
Aug 09, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
3c0d021b
bda4b918
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
453 additions
and
164 deletions
+453
-164
UBBoardController.cpp
src/board/UBBoardController.cpp
+115
-12
UBBoardController.h
src/board/UBBoardController.h
+3
-1
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+4
-9
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+17
-6
UBGraphicsGroupContainerItem.h
src/domain/UBGraphicsGroupContainerItem.h
+2
-0
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+14
-1
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+22
-14
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+2
-0
UBGraphicsPDFItem.cpp
src/domain/UBGraphicsPDFItem.cpp
+16
-7
UBGraphicsPDFItem.h
src/domain/UBGraphicsPDFItem.h
+2
-0
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+17
-9
UBGraphicsPixmapItem.h
src/domain/UBGraphicsPixmapItem.h
+2
-0
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+22
-14
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+1
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+6
-2
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+3
-1
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+15
-6
UBGraphicsStrokesGroup.h
src/domain/UBGraphicsStrokesGroup.h
+1
-0
UBGraphicsSvgItem.cpp
src/domain/UBGraphicsSvgItem.cpp
+17
-8
UBGraphicsSvgItem.h
src/domain/UBGraphicsSvgItem.h
+2
-0
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+24
-16
UBGraphicsTextItem.h
src/domain/UBGraphicsTextItem.h
+3
-0
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+45
-27
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+5
-0
UBItem.h
src/domain/UBItem.h
+3
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+2
-2
UBGraphicsCache.cpp
src/tools/UBGraphicsCache.cpp
+12
-3
UBGraphicsCache.h
src/tools/UBGraphicsCache.h
+2
-0
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+12
-3
UBGraphicsCompass.h
src/tools/UBGraphicsCompass.h
+2
-0
UBGraphicsCurtainItem.cpp
src/tools/UBGraphicsCurtainItem.cpp
+16
-8
UBGraphicsCurtainItem.h
src/tools/UBGraphicsCurtainItem.h
+1
-0
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+16
-9
UBGraphicsProtractor.h
src/tools/UBGraphicsProtractor.h
+1
-0
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+12
-3
UBGraphicsRuler.h
src/tools/UBGraphicsRuler.h
+1
-0
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+12
-3
UBGraphicsTriangle.h
src/tools/UBGraphicsTriangle.h
+1
-0
No files found.
src/board/UBBoardController.cpp
View file @
42d1fcb6
...
...
@@ -53,6 +53,7 @@
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBPageSizeUndoCommand.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBItem.h"
#include "tools/UBToolsManager.h"
...
...
@@ -529,6 +530,92 @@ void UBBoardController::duplicateScene()
duplicateScene
(
mActiveSceneIndex
);
}
void
UBBoardController
::
duplicateItem
(
UBItem
*
item
)
{
if
(
!
item
)
return
;
QUrl
sourceUrl
;
QByteArray
pData
;
//common parameters for any item
QPointF
itemPos
;
QSizeF
itemSize
;
QGraphicsItem
*
commonItem
=
dynamic_cast
<
QGraphicsItem
*>
(
item
);
if
(
commonItem
)
{
itemPos
=
commonItem
->
pos
();
itemSize
=
commonItem
->
boundingRect
().
size
();
}
QString
contentTypeHeader
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
item
->
sourceUrl
().
toLocalFile
());
UBMimeType
::
Enum
itemMimeType
=
UBFileSystemUtils
::
mimeTypeFromString
(
contentTypeHeader
);
switch
(
static_cast
<
int
>
(
itemMimeType
))
{
case
UBMimeType
:
:
AppleWidget
:
case
UBMimeType
:
:
W3CWidget
:
{
UBGraphicsWidgetItem
*
witem
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
item
);
if
(
witem
)
{
sourceUrl
=
witem
->
getOwnFolder
();
}
}
break
;
case
UBMimeType
:
:
Video
:
case
UBMimeType
:
:
Audio
:
{
UBGraphicsMediaItem
*
mitem
=
dynamic_cast
<
UBGraphicsMediaItem
*>
(
item
);
if
(
mitem
)
{
sourceUrl
=
mitem
->
mediaFileUrl
();
}
}
break
;
case
UBMimeType
:
:
VectorImage
:
{
UBGraphicsSvgItem
*
viitem
=
dynamic_cast
<
UBGraphicsSvgItem
*>
(
item
);
if
(
viitem
)
{
pData
=
viitem
->
fileData
();
sourceUrl
=
item
->
sourceUrl
();
}
}
break
;
case
UBMimeType
:
:
RasterImage
:
{
UBGraphicsPixmapItem
*
pixitem
=
dynamic_cast
<
UBGraphicsPixmapItem
*>
(
item
);
if
(
pixitem
)
{
QBuffer
buffer
(
&
pData
);
buffer
.
open
(
QIODevice
::
WriteOnly
);
QString
format
=
UBFileSystemUtils
::
extension
(
item
->
sourceUrl
().
toLocalFile
());
pixitem
->
pixmap
().
save
(
&
buffer
,
format
.
toLatin1
());
}
}
break
;
case
UBMimeType
:
:
UNKNOWN
:
{
QGraphicsItem
*
gitem
=
dynamic_cast
<
QGraphicsItem
*>
(
item
->
deepCopy
());
if
(
gitem
)
{
mActiveScene
->
addItem
(
gitem
);
gitem
->
setPos
(
itemPos
);
}
return
;
}
break
;
}
UBItem
*
createdItem
=
downloadFinished
(
true
,
sourceUrl
,
contentTypeHeader
,
pData
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
);
if
(
createdItem
)
{
createdItem
->
setSourceUrl
(
item
->
sourceUrl
());
item
->
copyItemParameters
(
createdItem
);
}
}
void
UBBoardController
::
deleteScene
(
int
nIndex
)
{
if
(
selectedDocument
()
->
pageCount
()
>
2
)
...
...
@@ -854,7 +941,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
}
void
UBBoardController
::
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
UBItem
*
UBBoardController
::
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
{
QString
mimeType
=
pContentTypeHeader
;
...
...
@@ -869,7 +956,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
if
(
!
pSuccess
)
{
UBApplication
::
showMessage
(
tr
(
"Downloading content %1 failed"
).
arg
(
sourceUrl
.
toString
()));
return
;
return
NULL
;
}
if
(
!
sourceUrl
.
toString
().
startsWith
(
"file://"
)
&&
!
sourceUrl
.
toString
().
startsWith
(
"uniboardTool://"
))
...
...
@@ -897,12 +984,14 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
pixItem
->
setSelected
(
true
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
return
pixItem
;
}
else
if
(
UBMimeType
::
VectorImage
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as vecto image"
;
UBGraphicsSvgItem
*
svgItem
=
mActiveScene
->
addSvg
(
sourceUrl
,
pPos
);
UBGraphicsSvgItem
*
svgItem
=
mActiveScene
->
addSvg
(
sourceUrl
,
pPos
,
pData
);
svgItem
->
setSourceUrl
(
sourceUrl
);
if
(
isBackground
)
...
...
@@ -915,6 +1004,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
svgItem
->
setSelected
(
true
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
return
svgItem
;
}
else
if
(
UBMimeType
::
AppleWidget
==
itemMimeType
)
//mime type invented by us :-(
{
...
...
@@ -939,6 +1030,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
{
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
return
appleWidgetItem
;
}
else
if
(
UBMimeType
::
W3CWidget
==
itemMimeType
)
{
...
...
@@ -960,6 +1053,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
{
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
return
w3cWidgetItem
;
}
else
if
(
UBMimeType
::
Video
==
itemMimeType
)
{
...
...
@@ -989,6 +1084,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
}
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
return
mediaVideoItem
;
}
else
if
(
UBMimeType
::
Audio
==
itemMimeType
)
{
...
...
@@ -1018,6 +1115,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
}
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
return
audioMediaItem
;
}
else
if
(
UBMimeType
::
Flash
==
itemMimeType
)
...
...
@@ -1061,6 +1160,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
widgetItem
->
setSourceUrl
(
sourceUrl
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
return
widgetItem
;
}
if
(
eduMediaFile
)
...
...
@@ -1182,6 +1283,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
widgetItem
->
setSourceUrl
(
sourceUrl
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
return
widgetItem
;
}
}
}
...
...
@@ -1193,6 +1296,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBApplication
::
showMessage
(
tr
(
"Unknown content type %1"
).
arg
(
pContentTypeHeader
));
qWarning
()
<<
"ignoring mime type"
<<
pContentTypeHeader
;
}
return
NULL
;
}
void
UBBoardController
::
setActiveDocumentScene
(
int
pSceneIndex
)
...
...
@@ -1902,7 +2007,7 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
}
return
0
;
return
w3cWidgetItem
;
}
void
UBBoardController
::
cut
()
...
...
@@ -1957,7 +2062,11 @@ void UBBoardController::copy()
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
gi
);
if
(
ubItem
&&
!
mActiveScene
->
tools
().
contains
(
gi
))
selected
<<
ubItem
->
deepCopy
();
{
UBItem
*
itemCopy
=
ubItem
->
deepCopy
();
if
(
itemCopy
)
selected
<<
itemCopy
;
}
}
if
(
selected
.
size
()
>
0
)
...
...
@@ -2014,13 +2123,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
{
foreach
(
UBItem
*
item
,
mimeData
->
items
())
{
QGraphicsItem
*
gi
=
dynamic_cast
<
QGraphicsItem
*>
(
item
->
deepCopy
());
if
(
gi
)
{
mActiveScene
->
addItem
(
gi
);
gi
->
setPos
(
gi
->
pos
()
+
QPointF
(
50
,
50
));
}
duplicateItem
(
item
);
}
return
;
...
...
src/board/UBBoardController.h
View file @
42d1fcb6
...
...
@@ -39,6 +39,7 @@ class UBGraphicsVideoItem;
class
UBGraphicsAudioItem
;
class
UBGraphicsWidgetItem
;
class
UBBoardPaletteManager
;
class
UBItem
;
class
UBBoardController
:
public
UBDocumentContainer
...
...
@@ -157,6 +158,7 @@ class UBBoardController : public UBDocumentContainer
void
moveSceneToIndex
(
int
source
,
int
target
);
void
duplicateScene
(
int
index
);
void
duplicateItem
(
UBItem
*
item
);
void
deleteScene
(
int
index
);
bool
cacheIsVisible
()
{
return
mCacheWidgetIsEnabled
;}
...
...
@@ -188,7 +190,7 @@ class UBBoardController : public UBDocumentContainer
void
lastScene
();
void
groupButtonClicked
();
void
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
=
QPointF
(
0
.
0
,
0
.
0
),
const
QSize
&
pSize
=
QSize
(),
bool
isBackground
=
false
);
void
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
=
false
);
UBItem
*
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
=
false
);
void
changeBackground
(
bool
isDark
,
bool
isCrossed
);
void
setToolCursor
(
int
tool
);
void
showMessage
(
const
QString
&
message
,
bool
showSpinningWheel
);
...
...
src/board/UBBoardPaletteManager.cpp
View file @
42d1fcb6
...
...
@@ -665,11 +665,8 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
mAddItemPalette
->
show
();
mAddItemPalette
->
adjustSizeAndPosition
();
QRect
controlGeo
=
UBApplication
::
applicationController
->
displayManager
()
->
controlGeometry
();
mAddItemPalette
->
move
(
controlGeo
.
x
()
+
((
controlGeo
.
width
()
-
mAddItemPalette
->
geometry
().
width
())
/
2
),
(
controlGeo
.
y
()
+
(
controlGeo
.
height
()
-
mAddItemPalette
->
geometry
().
height
())
/
5
));
mAddItemPalette
->
move
((
mContainer
->
width
()
-
mAddItemPalette
->
width
())
/
2
,
(
mContainer
->
height
()
-
mAddItemPalette
->
height
())
/
5
);
}
void
UBBoardPaletteManager
::
changeMode
(
eUBDockPaletteWidgetMode
newMode
,
bool
isInit
)
...
...
@@ -831,13 +828,11 @@ void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos,
mPos
=
pos
;
mScaleFactor
=
scaleFactor
;
QRect
controlGeo
=
UBApplication
::
applicationController
->
displayManager
()
->
controlGeometry
();
mAddItemPalette
->
show
();
mAddItemPalette
->
adjustSizeAndPosition
();
mAddItemPalette
->
move
(
controlGeo
.
x
()
+
((
controlGeo
.
width
()
-
mAddItemPalette
->
geometry
().
width
())
/
2
)
,
(
controlGeo
.
y
()
+
(
controlGeo
.
height
()
-
mAddItemPalette
->
geometry
().
height
())
/
5
)
);
mAddItemPalette
->
move
(
(
mContainer
->
width
()
-
mAddItemPalette
->
width
())
/
2
,
(
mContainer
->
height
()
-
mAddItemPalette
->
height
())
/
5
);
}
...
...
src/domain/UBGraphicsGroupContainerItem.cpp
View file @
42d1fcb6
...
...
@@ -157,18 +157,29 @@ UBGraphicsGroupContainerItem *UBGraphicsGroupContainerItem::deepCopy() const
UBGraphicsGroupContainerItem
*
copy
=
new
UBGraphicsGroupContainerItem
(
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copyItemParameters
(
copy
);
// copy->resize(this->size());
return
copy
;
}
void
UBGraphicsGroupContainerItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsGroupContainerItem
*
cp
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
}
}
void
UBGraphicsGroupContainerItem
::
remove
()
{
if
(
mDelegate
)
...
...
src/domain/UBGraphicsGroupContainerItem.h
View file @
42d1fcb6
...
...
@@ -24,6 +24,8 @@ public:
virtual
UBGraphicsScene
*
scene
();
virtual
UBGraphicsGroupContainerItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
remove
();
enum
{
Type
=
UBGraphicsItemType
::
groupContainerType
};
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
42d1fcb6
...
...
@@ -410,6 +410,7 @@ void UBGraphicsItemDelegate::duplicate()
UBApplication
::
boardController
->
copy
();
UBApplication
::
boardController
->
paste
();
UBApplication
::
boardController
->
duplicateItem
(
dynamic_cast
<
UBItem
*>
(
delegated
()));
}
void
UBGraphicsItemDelegate
::
increaseZLevelUp
()
...
...
@@ -989,8 +990,15 @@ void MediaTimer::addPoint(QPolygon &a, const QPoint &p)
}
void
MediaTimer
::
paint
(
QPainter
*
p
,
const
QStyleOptionGraphicsItem
*
,
QWidget
*
)
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
QFont
f
=
p
->
font
();
f
.
setPointSizeF
(
f
.
pointSizeF
());
p
->
setFont
(
f
);
if
(
smallPoint
)
drawString
(
digitStr
,
*
p
,
&
points
,
false
);
else
...
...
@@ -1173,6 +1181,8 @@ void DelegateMediaControl::positionHandles()
mLCDTimerArea
.
setHeight
(
parentItem
()
->
boundingRect
().
height
());
lcdTimer
->
setRect
(
mLCDTimerArea
);
lcdTimer
->
setPos
(
mSeecArea
.
width
()
-
mLCDTimerArea
.
width
(),
0
);
//lcdTimer->setRect(mLCDTimerArea);
//lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0);
mSeecArea
.
setWidth
(
rect
().
width
()
-
mLCDTimerArea
.
width
());
...
...
@@ -1181,6 +1191,7 @@ void DelegateMediaControl::positionHandles()
setRect
(
selfRect
);
lcdTimer
->
setPos
(
rect
().
width
()
-
mLCDTimerArea
.
width
(),
0
);
//lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0);
}
...
...
@@ -1189,6 +1200,7 @@ void DelegateMediaControl::update()
QTime
t
;
t
=
t
.
addMSecs
(
mCurrentTimeInMs
<
0
?
0
:
mCurrentTimeInMs
);
lcdTimer
->
display
(
t
.
toString
(
"m:ss"
));
//lcdTimer->display(t.toString("m:ss"));
QGraphicsRectItem
::
update
();
}
...
...
@@ -1241,6 +1253,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos)
minX
=
frameWidth
;
length
=
mSeecArea
.
width
()
-
lcdTimer
->
rect
().
width
();
length
=
mSeecArea
.
width
()
/*- lcdTimer->rect().width()*/
;
qreal
mouseX
=
mousePos
.
x
();
if
(
mouseX
>=
(
mSeecArea
.
width
()
-
mSeecArea
.
height
()
/
2
))
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
42d1fcb6
...
...
@@ -241,26 +241,34 @@ void UBGraphicsMediaItem::showOnDisplayChanged(bool shown)
UBItem
*
UBGraphicsMediaItem
::
deepCopy
()
const
{
QUrl
url
=
this
->
mediaFileUrl
();
UBGraphicsMediaItem
*
copy
;
copy
=
new
UBGraphicsMediaItem
(
url
,
parentItem
());
UBGraphicsMediaItem
*
copy
=
new
UBGraphicsMediaItem
(
url
,
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK as long as Videos are imutable
copy
->
setSourceUrl
(
this
->
sourceUrl
());
copy
->
resize
(
this
->
size
());
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
copy
,
SLOT
(
activeSceneChanged
()));
// TODO UB 4.7 complete all members
copyItemParameters
(
copy
);
return
copy
;
}
void
UBGraphicsMediaItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsMediaItem
*
cp
=
dynamic_cast
<
UBGraphicsMediaItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
cp
->
setSourceUrl
(
this
->
sourceUrl
());
cp
->
resize
(
this
->
size
());
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
cp
,
SLOT
(
activeSceneChanged
()));
// TODO UB 4.7 complete all members
}
}
void
UBGraphicsMediaItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
)
...
...
src/domain/UBGraphicsMediaItem.h
View file @
42d1fcb6
...
...
@@ -95,6 +95,8 @@ public:
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
setSourceUrl
(
const
QUrl
&
pSourceUrl
)
{
UBAudioPresentationWidget
*
pAudioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
mAudioWidget
);
...
...
src/domain/UBGraphicsPDFItem.cpp
View file @
42d1fcb6
...
...
@@ -89,17 +89,26 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
{
UBGraphicsPDFItem
*
copy
=
new
UBGraphicsPDFItem
(
mRenderer
,
mPageNumber
,
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as PDF are imutable
copy
->
setSourceUrl
(
this
->
sourceUrl
());
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copyItemParameters
(
copy
);
return
copy
;
}
void
UBGraphicsPDFItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsPDFItem
*
cp
=
dynamic_cast
<
UBGraphicsPDFItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setSourceUrl
(
this
->
sourceUrl
());
}
}
void
UBGraphicsPDFItem
::
setRenderingQuality
(
RenderingQuality
pRenderingQuality
)
{
...
...
src/domain/UBGraphicsPDFItem.h
View file @
42d1fcb6
...
...
@@ -41,6 +41,8 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
setRenderingQuality
(
RenderingQuality
pRenderingQuality
);
virtual
UBGraphicsScene
*
scene
();
...
...
src/domain/UBGraphicsPixmapItem.cpp
View file @
42d1fcb6
...
...
@@ -114,22 +114,30 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
{
UBGraphicsPixmapItem
*
copy
=
new
UBGraphicsPixmapItem
();
copy
->
setPixmap
(
this
->
pixmap
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copy
->
setUuid
(
this
->
uuid
());
// This is OK for now, as long as pixmaps are immutable -
copy
->
setSourceUrl
(
this
->
sourceUrl
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsPixmapItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsPixmapItem
*
cp
=
dynamic_cast
<
UBGraphicsPixmapItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setPixmap
(
this
->
pixmap
());
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
cp
->
setSourceUrl
(
this
->
sourceUrl
());
}
}
UBGraphicsScene
*
UBGraphicsPixmapItem
::
scene
()
{
...
...
src/domain/UBGraphicsPixmapItem.h
View file @
42d1fcb6
...
...
@@ -40,6 +40,8 @@ class UBGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
UBGraphicsScene
*
scene
();
virtual
void
remove
();
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
42d1fcb6
...
...
@@ -156,29 +156,37 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
{
UBGraphicsPolygonItem
*
copy
=
new
UBGraphicsPolygonItem
(
pol
);
copy
->
mOriginalLine
=
QLineF
();
copy
->
mOriginalWidth
=
-
1
;
copy
->
mIsNominalLine
=
false
;
copyItemParameters
(
copy
);
copy
->
setStroke
(
this
->
stroke
());
copy
->
setStrokesGroup
(
this
->
strokesGroup
());
copy
->
setBrush
(
this
->
brush
());
copy
->
setPen
(
this
->
pen
());
copy
->
mHasAlpha
=
this
->
mHasAlpha
;
// TODO UB 4.7 ... complete all members ?
return
copy
;
copy
->
setColorOnDarkBackground
(
this
->
colorOnDarkBackground
());
copy
->
setColorOnLightBackground
(
this
->
colorOnLightBackground
());
}
void
UBGraphicsPolygonItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsPolygonItem
*
cp
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
copy
);
if
(
cp
)
{
cp
->
mOriginalLine
=
QLineF
();
cp
->
mOriginalWidth
=
-
1
;
cp
->
mIsNominalLine
=
false
;
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setStroke
(
this
->
stroke
());
cp
->
setStrokesGroup
(
this
->
strokesGroup
());
cp
->
setBrush
(
this
->
brush
());
cp
->
setPen
(
this
->
pen
());
cp
->
mHasAlpha
=
this
->
mHasAlpha
;
// TODO UB 4.7 ... complete all members ?
return
copy
;
cp
->
setColorOnDarkBackground
(
this
->
colorOnDarkBackground
());
cp
->
setColorOnLightBackground
(
this
->
colorOnLightBackground
());
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
}
}
void
UBGraphicsPolygonItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
if
(
mHasAlpha
&&
scene
()
&&
scene
()
->
isLightBackground
())
...
...
src/domain/UBGraphicsPolygonItem.h
View file @
42d1fcb6
...
...
@@ -88,6 +88,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
// optimisation (eraser)
UBGraphicsPolygonItem
*
deepCopy
(
const
QPolygonF
&
pol
)
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
QLineF
originalLine
()
{
return
mOriginalLine
;}
qreal
originalWidth
()
{
return
mOriginalWidth
;}
...
...
src/domain/UBGraphicsScene.cpp
View file @
42d1fcb6
...
...
@@ -1539,11 +1539,15 @@ void UBGraphicsScene::addGroup(UBGraphicsGroupContainerItem *groupItem)
setDocumentUpdated
();
}
UBGraphicsSvgItem
*
UBGraphicsScene
::
addSvg
(
const
QUrl
&
pSvgFileUrl
,
const
QPointF
&
pPos
)
UBGraphicsSvgItem
*
UBGraphicsScene
::
addSvg
(
const
QUrl
&
pSvgFileUrl
,
const
QPointF
&
pPos
,
const
QByteArray
pData
)
{
QString
path
=
pSvgFileUrl
.
toLocalFile
();
UBGraphicsSvgItem
*
svgItem
=
new
UBGraphicsSvgItem
(
path
);
UBGraphicsSvgItem
*
svgItem
;
if
(
pData
.
isNull
())
svgItem
=
new
UBGraphicsSvgItem
(
path
);
else
svgItem
=
new
UBGraphicsSvgItem
(
pData
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsScene.h
View file @
42d1fcb6
...
...
@@ -109,6 +109,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
{
Q_UNUSED
(
copy
);}
UBGraphicsScene
*
sceneDeepCopy
()
const
;
void
clearItemsAndAnnotations
();
...
...
@@ -136,7 +138,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
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
));
UBGraphicsSvgItem
*
addSvg
(
const
QUrl
&
pSvgFileUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
));
UBGraphicsSvgItem
*
addSvg
(
const
QUrl
&
pSvgFileUrl
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
)
,
const
QByteArray
pData
=
QByteArray
()
);
UBGraphicsTextItem
*
addText
(
const
QString
&
pString
,
const
QPointF
&
pTopLeft
=
QPointF
(
0
,
0
));
UBGraphicsTextItem
*
textForObjectName
(
const
QString
&
pString
,
const
QString
&
objectName
=
"UBTGZeroPageSessionTitle"
);
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
42d1fcb6
...
...
@@ -63,16 +63,25 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
{
UBGraphicsStrokesGroup
*
copy
=
new
UBGraphicsStrokesGroup
();
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copyItemParameters
(
copy
);
return
copy
;
}
void
UBGraphicsStrokesGroup
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsStrokesGroup
*
cp
=
dynamic_cast
<
UBGraphicsStrokesGroup
*>
(
copy
);
{
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
}
}
void
UBGraphicsStrokesGroup
::
remove
()
{
if
(
mDelegate
)
...
...
src/domain/UBGraphicsStrokesGroup.h
View file @
42d1fcb6
...
...
@@ -14,6 +14,7 @@ public:
UBGraphicsStrokesGroup
(
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsStrokesGroup
();
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
remove
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
enum
{
Type
=
UBGraphicsItemType
::
StrokeItemType
};
...
...
src/domain/UBGraphicsSvgItem.cpp
View file @
42d1fcb6
...
...
@@ -135,14 +135,9 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
{
UBGraphicsSvgItem
*
copy
=
new
UBGraphicsSvgItem
(
this
->
fileData
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as SVG are imutable
copy
->
setSourceUrl
(
this
->
sourceUrl
());
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copyItemParameters
(
copy
);
// TODO UB 4.7... complete all members ?
...
...
@@ -150,6 +145,20 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
}
void
UBGraphicsSvgItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsSvgItem
*
cp
=
dynamic_cast
<
UBGraphicsSvgItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
cp
->
setSourceUrl
(
this
->
sourceUrl
());
}
}
void
UBGraphicsSvgItem
::
setRenderingQuality
(
RenderingQuality
pRenderingQuality
)
{
...
...
src/domain/UBGraphicsSvgItem.h
View file @
42d1fcb6
...
...
@@ -52,6 +52,8 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
setRenderingQuality
(
RenderingQuality
pRenderingQuality
);
virtual
UBGraphicsScene
*
scene
();
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
42d1fcb6
...
...
@@ -201,28 +201,36 @@ UBItem* UBGraphicsTextItem::deepCopy() const
{
UBGraphicsTextItem
*
copy
=
new
UBGraphicsTextItem
();
copy
->
setHtml
(
toHtml
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setData
(
UBGraphicsItemData
::
ItemEditable
,
data
(
UBGraphicsItemData
::
ItemEditable
).
toBool
());
// copy->setDefaultTextColor(this->defaultTextColor());
// copy->setFont(this->font());
// copy->setColorOnDarkBackground(this->colorOnDarkBackground());
// copy->setColorOnLightBackground(this->colorOnLightBackground());
copy
->
setTextWidth
(
this
->
textWidth
());
copy
->
setTextHeight
(
this
->
textHeight
());
copy
->
setSourceUrl
(
this
->
sourceUrl
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsTextItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsTextItem
*
cp
=
dynamic_cast
<
UBGraphicsTextItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setHtml
(
toHtml
());
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
cp
->
setData
(
UBGraphicsItemData
::
ItemEditable
,
data
(
UBGraphicsItemData
::
ItemEditable
).
toBool
());
// cp->setDefaultTextColor(this->defaultTextColor());
// cp->setFont(this->font());
// cp->setColorOnDarkBackground(this->colorOnDarkBackground());
// cp->setColorOnLightBackground(this->colorOnLightBackground());
cp
->
setTextWidth
(
this
->
textWidth
());
cp
->
setTextHeight
(
this
->
textHeight
());
cp
->
setSourceUrl
(
this
->
sourceUrl
());
}
}
QRectF
UBGraphicsTextItem
::
boundingRect
()
const
{
...
...
src/domain/UBGraphicsTextItem.h
View file @
42d1fcb6
...
...
@@ -40,6 +40,9 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
UBGraphicsScene
*
scene
();
virtual
QRectF
boundingRect
()
const
;
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
42d1fcb6
...
...
@@ -330,19 +330,29 @@ UBItem* UBGraphicsAppleWidgetItem::deepCopy() const
{
UBGraphicsAppleWidgetItem
*
appleWidget
=
new
UBGraphicsAppleWidgetItem
(
mWebKitWidget
->
widgetUrl
(),
parentItem
());
foreach
(
QString
key
,
mPreferences
.
keys
())
{
appleWidget
->
setPreference
(
key
,
mPreferences
.
value
(
key
));
}
copyItemParameters
(
appleWidget
);
return
appleWidget
;
foreach
(
QString
key
,
mDatastore
.
keys
())
}
void
UBGraphicsAppleWidgetItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsAppleWidgetItem
*
cp
=
dynamic_cast
<
UBGraphicsAppleWidgetItem
*>
(
copy
);
if
(
cp
)
{
appleWidget
->
setDatastoreEntry
(
key
,
mDatastore
.
value
(
key
));
}
foreach
(
QString
key
,
mPreferences
.
keys
())
{
cp
->
setPreference
(
key
,
mPreferences
.
value
(
key
));
}
appleWidget
->
setSourceUrl
(
this
->
sourceUrl
());
foreach
(
QString
key
,
mDatastore
.
keys
())
{
cp
->
setDatastoreEntry
(
key
,
mDatastore
.
value
(
key
));
}
return
appleWidget
;
cp
->
setSourceUrl
(
this
->
sourceUrl
());
}
}
void
UBGraphicsAppleWidgetItem
::
setUuid
(
const
QUuid
&
pUuid
)
...
...
@@ -431,27 +441,35 @@ UBW3CWidget* UBGraphicsW3CWidgetItem::w3cWidget() const
UBItem
*
UBGraphicsW3CWidgetItem
::
deepCopy
()
const
{
UBGraphicsW3CWidgetItem
*
copy
=
new
UBGraphicsW3CWidgetItem
(
mWebKitWidget
->
widgetUrl
(),
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copy
->
setSourceUrl
(
this
->
sourceUrl
()
);
copy
ItemParameters
(
copy
);
copy
->
resize
(
this
->
size
());
return
copy
;
}
foreach
(
QString
key
,
mPreferences
.
keys
())
void
UBGraphicsW3CWidgetItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsW3CWidgetItem
*
cp
=
dynamic_cast
<
UBGraphicsW3CWidgetItem
*>
(
copy
);
if
(
cp
)
{
copy
->
setPreference
(
key
,
mPreferences
.
value
(
key
));
}
cp
->
setPos
(
this
->
pos
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
cp
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
cp
->
setSourceUrl
(
this
->
sourceUrl
());
foreach
(
QString
key
,
mDatastore
.
keys
())
{
copy
->
setDatastoreEntry
(
key
,
mDatastore
.
value
(
key
));
}
cp
->
resize
(
this
->
size
());
return
copy
;
}
foreach
(
QString
key
,
mPreferences
.
keys
())
{
cp
->
setPreference
(
key
,
mPreferences
.
value
(
key
));
}
foreach
(
QString
key
,
mDatastore
.
keys
())
{
cp
->
setDatastoreEntry
(
key
,
mDatastore
.
value
(
key
));
}
}
}
\ No newline at end of file
src/domain/UBGraphicsWidgetItem.h
View file @
42d1fcb6
...
...
@@ -130,6 +130,9 @@ class UBGraphicsAppleWidgetItem : public UBGraphicsWidgetItem
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
};
...
...
@@ -152,6 +155,8 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
UBW3CWidget
::
Metadata
metadatas
()
const
;
UBW3CWidget
*
w3cWidget
()
const
;
...
...
src/domain/UBItem.h
View file @
42d1fcb6
...
...
@@ -20,6 +20,7 @@
#include "core/UB.h"
class
UBGraphicsScene
;
class
UBGraphicsItem
;
class
UBItem
{
...
...
@@ -58,6 +59,8 @@ class UBItem
virtual
UBItem
*
deepCopy
()
const
=
0
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
=
0
;
virtual
UBGraphicsScene
*
scene
()
// TODO UB 4.x should be pure virtual ...
{
return
0
;
...
...
src/gui/UBFeaturesWidget.cpp
View file @
42d1fcb6
...
...
@@ -616,8 +616,8 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
QLabel
*
mLabel
=
new
QLabel
(
labelText
,
this
);
mLineEdit
=
new
QLineEdit
(
this
);
mValidator
=
new
QRegExpValidator
(
QRegExp
(
"[\^\/\:\?\*\|\<\>
\"
]{2,
}"
),
this
);
mLineEdit
->
setValidator
(
mValidator
);
//mValidator = new QRegExpValidator(QRegExp("[A-Za-z][1-9][0-9]{0,2
}"), this);
//
mLineEdit->setValidator(mValidator);
labelLayout
->
addWidget
(
mLabel
);
labelLayout
->
addWidget
(
mLineEdit
);
...
...
src/tools/UBGraphicsCache.cpp
View file @
42d1fcb6
...
...
@@ -45,15 +45,24 @@ UBItem* UBGraphicsCache::deepCopy() const
{
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
();
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setTransform
(
this
->
transform
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsCache
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsCache
*
cp
=
dynamic_cast
<
UBGraphicsCache
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setRect
(
this
->
rect
());
cp
->
setTransform
(
this
->
transform
());
}
}
QColor
UBGraphicsCache
::
maskColor
()
{
return
mMaskColor
;
...
...
src/tools/UBGraphicsCache.h
View file @
42d1fcb6
...
...
@@ -39,6 +39,8 @@ public:
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
QColor
maskColor
();
void
setMaskColor
(
QColor
color
);
eMaskShape
maskshape
();
...
...
src/tools/UBGraphicsCompass.cpp
View file @
42d1fcb6
...
...
@@ -86,15 +86,24 @@ UBItem* UBGraphicsCompass::deepCopy() const
{
UBGraphicsCompass
*
copy
=
new
UBGraphicsCompass
();
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setTransform
(
this
->
transform
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsCompass
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsCompass
*
cp
=
dynamic_cast
<
UBGraphicsCompass
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setRect
(
this
->
rect
());
cp
->
setTransform
(
this
->
transform
());
}
}
void
UBGraphicsCompass
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
styleOption
,
QWidget
*
widget
)
{
Q_UNUSED
(
styleOption
);
...
...
src/tools/UBGraphicsCompass.h
View file @
42d1fcb6
...
...
@@ -41,6 +41,8 @@ class UBGraphicsCompass: public QObject, public QGraphicsRectItem, public UBItem
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
signals
:
void
hidden
();
...
...
src/tools/UBGraphicsCurtainItem.cpp
View file @
42d1fcb6
...
...
@@ -133,20 +133,28 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const
{
UBGraphicsCurtainItem
*
copy
=
new
UBGraphicsCurtainItem
();
copy
->
setRect
(
this
->
rect
());
copy
->
setPos
(
this
->
pos
());
copy
->
setBrush
(
this
->
brush
());
copy
->
setPen
(
this
->
pen
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsCurtainItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsCurtainItem
*
cp
=
dynamic_cast
<
UBGraphicsCurtainItem
*>
(
copy
);
if
(
cp
)
{
cp
->
setRect
(
this
->
rect
());
cp
->
setPos
(
this
->
pos
());
cp
->
setBrush
(
this
->
brush
());
cp
->
setPen
(
this
->
pen
());
cp
->
setTransform
(
this
->
transform
());
cp
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
cp
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
}
}
QColor
UBGraphicsCurtainItem
::
drawColor
()
const
{
...
...
src/tools/UBGraphicsCurtainItem.h
View file @
42d1fcb6
...
...
@@ -42,6 +42,7 @@ class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public U
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
remove
();
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
42d1fcb6
...
...
@@ -579,20 +579,27 @@ UBItem* UBGraphicsProtractor::deepCopy() const
{
UBGraphicsProtractor
*
copy
=
new
UBGraphicsProtractor
();
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setTransform
(
this
->
transform
());
copy
->
mCurrentAngle
=
this
->
mCurrentAngle
;
copy
->
mSpan
=
this
->
mSpan
;
copy
->
mStartAngle
=
this
->
mStartAngle
;
copy
->
mScaleFactor
=
this
->
mScaleFactor
;
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsProtractor
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsProtractor
*
cp
=
dynamic_cast
<
UBGraphicsProtractor
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setRect
(
this
->
rect
());
cp
->
setTransform
(
this
->
transform
());
cp
->
mCurrentAngle
=
this
->
mCurrentAngle
;
cp
->
mSpan
=
this
->
mSpan
;
cp
->
mStartAngle
=
this
->
mStartAngle
;
cp
->
mScaleFactor
=
this
->
mScaleFactor
;
}
}
void
UBGraphicsProtractor
::
rotateAroundCenter
(
qreal
angle
)
{
...
...
src/tools/UBGraphicsProtractor.h
View file @
42d1fcb6
...
...
@@ -40,6 +40,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
void
setMarkerAngle
(
qreal
angle
)
{
mCurrentAngle
=
angle
;
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
enum
{
Type
=
UBGraphicsItemType
::
ProtractorItemType
};
...
...
src/tools/UBGraphicsRuler.cpp
View file @
42d1fcb6
...
...
@@ -75,15 +75,24 @@ UBItem* UBGraphicsRuler::deepCopy() const
{
UBGraphicsRuler
*
copy
=
new
UBGraphicsRuler
();
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setTransform
(
this
->
transform
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
void
UBGraphicsRuler
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsRuler
*
cp
=
dynamic_cast
<
UBGraphicsRuler
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setRect
(
this
->
rect
());
cp
->
setTransform
(
this
->
transform
());
}
}
void
UBGraphicsRuler
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
styleOption
,
QWidget
*
widget
)
{
Q_UNUSED
(
styleOption
);
...
...
src/tools/UBGraphicsRuler.h
View file @
42d1fcb6
...
...
@@ -41,6 +41,7 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
}
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
StartLine
(
const
QPointF
&
position
,
qreal
width
);
virtual
void
DrawLine
(
const
QPointF
&
position
,
qreal
width
);
...
...
src/tools/UBGraphicsTriangle.cpp
View file @
42d1fcb6
...
...
@@ -94,9 +94,7 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
{
UBGraphicsTriangle
*
copy
=
new
UBGraphicsTriangle
();
copy
->
setPos
(
this
->
pos
());
copy
->
setPolygon
(
this
->
polygon
());
copy
->
setTransform
(
this
->
transform
());
copyItemParameters
(
copy
);
// TODO UB 4.7 ... complete all members ?
...
...
@@ -104,6 +102,17 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
}
void
UBGraphicsTriangle
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsTriangle
*
cp
=
dynamic_cast
<
UBGraphicsTriangle
*>
(
copy
);
if
(
cp
)
{
cp
->
setPos
(
this
->
pos
());
cp
->
setPolygon
(
this
->
polygon
());
cp
->
setTransform
(
this
->
transform
());
}
}
void
UBGraphicsTriangle
::
setRect
(
qreal
x
,
qreal
y
,
qreal
w
,
qreal
h
,
UBGraphicsTriangleOrientation
orientation
)
{
QPolygonF
polygon
;
...
...
src/tools/UBGraphicsTriangle.h
View file @
42d1fcb6
...
...
@@ -45,6 +45,7 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
virtual
UBItem
*
deepCopy
(
void
)
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
StartLine
(
const
QPointF
&
scenePos
,
qreal
width
);
virtual
void
DrawLine
(
const
QPointF
&
position
,
qreal
width
);
...
...
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