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
feb346f6
Commit
feb346f6
authored
May 15, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some refactoring
parent
33c6e117
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
121 deletions
+11
-121
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+11
-118
UBSvgSubsetAdaptor.h
src/adaptors/UBSvgSubsetAdaptor.h
+0
-3
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
feb346f6
...
@@ -399,10 +399,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -399,10 +399,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mXmlReader
.
readNext
();
mXmlReader
.
readNext
();
if
(
mXmlReader
.
isStartElement
())
if
(
mXmlReader
.
isStartElement
())
{
{
qreal
zFromSvg
=
getZValueFromSvg
();
QUuid
uuidFromSvg
=
getUuidFromSvg
();
if
(
mXmlReader
.
name
()
==
"svg"
)
if
(
mXmlReader
.
name
()
==
"svg"
)
{
{
if
(
!
mScene
)
if
(
!
mScene
)
...
@@ -556,8 +552,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -556,8 +552,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if
(
polygonItem
)
if
(
polygonItem
)
{
{
polygonItem
->
setUuid
(
uuidFromSvg
);
polygonItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Graphic
));
polygonItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Graphic
));
UBGraphicsStrokesGroup
*
group
;
UBGraphicsStrokesGroup
*
group
;
...
@@ -566,7 +560,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -566,7 +560,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mStrokesList
.
insert
(
parentId
,
group
);
mStrokesList
.
insert
(
parentId
,
group
);
currentStroke
=
new
UBGraphicsStroke
();
currentStroke
=
new
UBGraphicsStroke
();
group
->
setTransform
(
polygonItem
->
transform
());
group
->
setTransform
(
polygonItem
->
transform
());
UBGraphicsItem
::
assignZValue
(
group
,
zFromSvg
);
UBGraphicsItem
::
assignZValue
(
group
,
polygonItem
->
zValue
()
);
}
}
else
else
group
=
mStrokesList
.
value
(
parentId
);
group
=
mStrokesList
.
value
(
parentId
);
...
@@ -598,7 +592,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -598,7 +592,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mStrokesList
.
insert
(
parentId
,
group
);
mStrokesList
.
insert
(
parentId
,
group
);
currentStroke
=
new
UBGraphicsStroke
();
currentStroke
=
new
UBGraphicsStroke
();
group
->
setTransform
(
polygonItem
->
transform
());
group
->
setTransform
(
polygonItem
->
transform
());
UBGraphicsItem
::
assignZValue
(
group
,
zFromSvg
);
UBGraphicsItem
::
assignZValue
(
group
,
polygonItem
->
zValue
()
);
}
}
else
else
group
=
mStrokesList
.
value
(
parentId
);
group
=
mStrokesList
.
value
(
parentId
);
...
@@ -633,8 +627,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -633,8 +627,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsPixmapItem
*
pixmapItem
=
pixmapItemFromSvg
();
UBGraphicsPixmapItem
*
pixmapItem
=
pixmapItemFromSvg
();
if
(
pixmapItem
)
if
(
pixmapItem
)
{
{
UBGraphicsItem
::
assignZValue
(
pixmapItem
,
zFromSvg
);
pixmapItem
->
setUuid
(
uuidFromSvg
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -651,8 +643,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -651,8 +643,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsSvgItem
*
svgItem
=
svgItemFromSvg
();
UBGraphicsSvgItem
*
svgItem
=
svgItemFromSvg
();
if
(
svgItem
)
if
(
svgItem
)
{
{
UBGraphicsItem
::
assignZValue
(
svgItem
,
zFromSvg
);
svgItem
->
setUuid
(
uuidFromSvg
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
svgItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -675,8 +665,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -675,8 +665,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsMediaItem
*
audioItem
=
audioItemFromSvg
();
UBGraphicsMediaItem
*
audioItem
=
audioItemFromSvg
();
if
(
audioItem
)
if
(
audioItem
)
{
{
UBGraphicsItem
::
assignZValue
(
audioItem
,
zFromSvg
);
audioItem
->
setUuid
(
uuidFromSvg
);
audioItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
audioItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
audioItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
audioItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -694,8 +682,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -694,8 +682,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsMediaItem
*
videoItem
=
videoItemFromSvg
();
UBGraphicsMediaItem
*
videoItem
=
videoItemFromSvg
();
if
(
videoItem
)
if
(
videoItem
)
{
{
UBGraphicsItem
::
assignZValue
(
videoItem
,
zFromSvg
);
videoItem
->
setUuid
(
uuidFromSvg
);
videoItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
videoItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
videoItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
videoItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -713,8 +700,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -713,8 +700,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsTextItem
*
textItem
=
textItemFromSvg
();
UBGraphicsTextItem
*
textItem
=
textItemFromSvg
();
if
(
textItem
)
if
(
textItem
)
{
{
UBGraphicsItem
::
assignZValue
(
textItem
,
zFromSvg
);
textItem
->
setUuid
(
uuidFromSvg
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -728,8 +713,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -728,8 +713,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsCurtainItem
*
mask
=
curtainItemFromSvg
();
UBGraphicsCurtainItem
*
mask
=
curtainItemFromSvg
();
if
(
mask
)
if
(
mask
)
{
{
UBGraphicsItem
::
assignZValue
(
mask
,
zFromSvg
);
mask
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
mask
);
mScene
->
addItem
(
mask
);
mScene
->
registerTool
(
mask
);
mScene
->
registerTool
(
mask
);
}
}
...
@@ -740,8 +723,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -740,8 +723,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsRuler
*
ruler
=
rulerFromSvg
();
UBGraphicsRuler
*
ruler
=
rulerFromSvg
();
if
(
ruler
)
if
(
ruler
)
{
{
UBGraphicsItem
::
assignZValue
(
ruler
,
zFromSvg
);
ruler
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
ruler
);
mScene
->
addItem
(
ruler
);
mScene
->
registerTool
(
ruler
);
mScene
->
registerTool
(
ruler
);
}
}
...
@@ -752,8 +733,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -752,8 +733,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsCompass
*
compass
=
compassFromSvg
();
UBGraphicsCompass
*
compass
=
compassFromSvg
();
if
(
compass
)
if
(
compass
)
{
{
UBGraphicsItem
::
assignZValue
(
compass
,
zFromSvg
);
compass
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
compass
);
mScene
->
addItem
(
compass
);
mScene
->
registerTool
(
compass
);
mScene
->
registerTool
(
compass
);
}
}
...
@@ -763,8 +742,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -763,8 +742,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsProtractor
*
protractor
=
protractorFromSvg
();
UBGraphicsProtractor
*
protractor
=
protractorFromSvg
();
if
(
protractor
)
if
(
protractor
)
{
{
UBGraphicsItem
::
assignZValue
(
protractor
,
zFromSvg
);
protractor
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
protractor
);
mScene
->
addItem
(
protractor
);
mScene
->
registerTool
(
protractor
);
mScene
->
registerTool
(
protractor
);
}
}
...
@@ -774,8 +751,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -774,8 +751,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsTriangle
*
triangle
=
triangleFromSvg
();
UBGraphicsTriangle
*
triangle
=
triangleFromSvg
();
if
(
triangle
)
if
(
triangle
)
{
{
UBGraphicsItem
::
assignZValue
(
triangle
,
zFromSvg
);
triangle
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
triangle
);
mScene
->
addItem
(
triangle
);
mScene
->
registerTool
(
triangle
);
mScene
->
registerTool
(
triangle
);
}
}
...
@@ -785,8 +760,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -785,8 +760,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsCache
*
cache
=
cacheFromSvg
();
UBGraphicsCache
*
cache
=
cacheFromSvg
();
if
(
cache
)
if
(
cache
)
{
{
UBGraphicsItem
::
assignZValue
(
cache
,
zFromSvg
);
cache
->
setUuid
(
uuidFromSvg
);
mScene
->
addItem
(
cache
);
mScene
->
addItem
(
cache
);
mScene
->
registerTool
(
cache
);
mScene
->
registerTool
(
cache
);
UBApplication
::
boardController
->
notifyCache
(
true
);
UBApplication
::
boardController
->
notifyCache
(
true
);
...
@@ -807,8 +780,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -807,8 +780,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsPDFItem
*
pdfItem
=
pdfItemFromPDF
();
UBGraphicsPDFItem
*
pdfItem
=
pdfItemFromPDF
();
if
(
pdfItem
)
if
(
pdfItem
)
{
{
UBGraphicsItem
::
assignZValue
(
pdfItem
,
zFromSvg
);
pdfItem
->
setUuid
(
uuidFromSvg
);
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
qreal
currentDpi
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
qreal
currentDpi
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
qreal
pdfScale
=
UBSettings
::
settings
()
->
pageDpi
->
get
().
toReal
()
/
currentDpi
;
qreal
pdfScale
=
UBSettings
::
settings
()
->
pageDpi
->
get
().
toReal
()
/
currentDpi
;
...
@@ -831,9 +802,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -831,9 +802,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsAppleWidgetItem
*
appleWidgetItem
=
graphicsAppleWidgetFromSvg
();
UBGraphicsAppleWidgetItem
*
appleWidgetItem
=
graphicsAppleWidgetFromSvg
();
if
(
appleWidgetItem
)
if
(
appleWidgetItem
)
{
{
UBGraphicsItem
::
assignZValue
(
appleWidgetItem
,
zFromSvg
);
appleWidgetItem
->
setUuid
(
uuidFromSvg
);
appleWidgetItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
appleWidgetItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
appleWidgetItem
->
resize
(
foreignObjectWidth
,
foreignObjectHeight
);
appleWidgetItem
->
resize
(
foreignObjectWidth
,
foreignObjectHeight
);
...
@@ -850,8 +818,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -850,8 +818,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsW3CWidgetItem
*
w3cWidgetItem
=
graphicsW3CWidgetFromSvg
();
UBGraphicsW3CWidgetItem
*
w3cWidgetItem
=
graphicsW3CWidgetFromSvg
();
if
(
w3cWidgetItem
)
if
(
w3cWidgetItem
)
{
{
UBGraphicsItem
::
assignZValue
(
w3cWidgetItem
,
zFromSvg
);
w3cWidgetItem
->
setUuid
(
uuidFromSvg
);
w3cWidgetItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
w3cWidgetItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
w3cWidgetItem
->
resize
(
foreignObjectWidth
,
foreignObjectHeight
);
w3cWidgetItem
->
resize
(
foreignObjectWidth
,
foreignObjectHeight
);
...
@@ -881,8 +847,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
...
@@ -881,8 +847,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if
(
textItem
)
if
(
textItem
)
{
{
UBGraphicsItem
::
assignZValue
(
textItem
,
zFromSvg
);
textItem
->
setUuid
(
uuidFromSvg
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
textItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -1642,6 +1606,8 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
...
@@ -1642,6 +1606,8 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
{
{
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
();
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
();
graphicsItemFromSvg
(
polygonItem
);
QStringRef
svgPoints
=
mXmlReader
.
attributes
().
value
(
"points"
);
QStringRef
svgPoints
=
mXmlReader
.
attributes
().
value
(
"points"
);
QPolygonF
polygon
;
QPolygonF
polygon
;
...
@@ -1683,26 +1649,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
...
@@ -1683,26 +1649,13 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
polygonItem
->
setPolygon
(
polygon
);
polygonItem
->
setPolygon
(
polygon
);
QStringRef
svgTransform
=
mXmlReader
.
attributes
().
value
(
"transform"
);
QMatrix
itemMatrix
;
if
(
!
svgTransform
.
isNull
())
{
itemMatrix
=
fromSvgTransform
(
svgTransform
.
toString
());
polygonItem
->
setMatrix
(
itemMatrix
);
}
QStringRef
svgFill
=
mXmlReader
.
attributes
().
value
(
"fill"
);
QStringRef
svgFill
=
mXmlReader
.
attributes
().
value
(
"fill"
);
QColor
brushColor
=
pDefaultColor
;
QColor
brushColor
=
pDefaultColor
;
if
(
!
svgFill
.
isNull
())
if
(
!
svgFill
.
isNull
())
{
brushColor
.
setNamedColor
(
svgFill
.
toString
());
brushColor
.
setNamedColor
(
svgFill
.
toString
());
}
QStringRef
svgFillOpacity
=
mXmlReader
.
attributes
().
value
(
"fill-opacity"
);
QStringRef
svgFillOpacity
=
mXmlReader
.
attributes
().
value
(
"fill-opacity"
);
qreal
opacity
=
1.0
;
qreal
opacity
=
1.0
;
...
@@ -1714,17 +1667,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
...
@@ -1714,17 +1667,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
polygonItem
->
setColor
(
brushColor
);
polygonItem
->
setColor
(
brushColor
);
QStringRef
ubZValue
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"z-value"
);
if
(
!
ubZValue
.
isNull
())
{
UBGraphicsItem
::
assignZValue
(
polygonItem
,
ubZValue
.
toString
().
toFloat
());
}
else
{
UBGraphicsItem
::
assignZValue
(
polygonItem
,
mGroupZIndex
);
}
QStringRef
ubFillOnDarkBackground
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"fill-on-dark-background"
);
QStringRef
ubFillOnDarkBackground
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"fill-on-dark-background"
);
if
(
!
ubFillOnDarkBackground
.
isNull
())
if
(
!
ubFillOnDarkBackground
.
isNull
())
...
@@ -1799,6 +1741,7 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
...
@@ -1799,6 +1741,7 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
}
}
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
(
line
,
lineWidth
);
UBGraphicsPolygonItem
*
polygonItem
=
new
UBGraphicsPolygonItem
(
line
,
lineWidth
);
graphicsItemFromSvg
(
polygonItem
);
QStringRef
svgStroke
=
mXmlReader
.
attributes
().
value
(
"stroke"
);
QStringRef
svgStroke
=
mXmlReader
.
attributes
().
value
(
"stroke"
);
...
@@ -1821,18 +1764,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
...
@@ -1821,18 +1764,6 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
polygonItem
->
setColor
(
brushColor
);
polygonItem
->
setColor
(
brushColor
);
QStringRef
ubZValue
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"z-value"
);
if
(
!
ubZValue
.
isNull
())
{
UBGraphicsItem
::
assignZValue
(
polygonItem
,
ubZValue
.
toString
().
toFloat
());
}
else
{
UBGraphicsItem
::
assignZValue
(
polygonItem
,
mGroupZIndex
);
}
QStringRef
ubFillOnDarkBackground
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"fill-on-dark-background"
);
QStringRef
ubFillOnDarkBackground
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"fill-on-dark-background"
);
if
(
!
ubFillOnDarkBackground
.
isNull
())
if
(
!
ubFillOnDarkBackground
.
isNull
())
...
@@ -2223,24 +2154,21 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::audioItemFromSvg()
...
@@ -2223,24 +2154,21 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::audioItemFromSvg()
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//The absoult path doesn't work when you want to share Sankore documents.
//The absoult path doesn't work when you want to share Sankore documents.
if
(
!
h
ref
.
startsWith
(
"audios/"
)){
if
(
!
audioH
ref
.
startsWith
(
"audios/"
)){
int
indexOfAudioDirectory
=
href
.
lastIndexOf
(
"audios"
);
int
indexOfAudioDirectory
=
href
.
lastIndexOf
(
"audios"
);
href
=
mDocumentPath
+
"/"
+
href
.
right
(
href
.
length
()
-
indexOfAudioDirectory
);
href
=
mDocumentPath
+
"/"
+
href
.
right
(
href
.
length
()
-
indexOfAudioDirectory
);
}
}
UBGraphicsMediaItem
*
audioItem
=
new
UBGraphicsMediaItem
(
QUrl
::
fromLocalFile
(
href
));
UBGraphicsMediaItem
*
audioItem
=
new
UBGraphicsMediaItem
(
QUrl
::
fromLocalFile
(
href
));
if
(
audioItem
)
{
if
(
audioItem
)
audioItem
->
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
audioItem
,
SLOT
(
activeSceneChanged
()));
audioItem
->
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
audioItem
,
SLOT
(
activeSceneChanged
()));
}
graphicsItemFromSvg
(
audioItem
);
graphicsItemFromSvg
(
audioItem
);
QStringRef
ubPos
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"position"
);
QStringRef
ubPos
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"position"
);
qint64
p
=
0
;
qint64
p
=
0
;
if
(
!
ubPos
.
isNull
())
if
(
!
ubPos
.
isNull
())
{
p
=
ubPos
.
toString
().
toLongLong
();
p
=
ubPos
.
toString
().
toLongLong
();
}
audioItem
->
setInitialPos
(
p
);
audioItem
->
setInitialPos
(
p
);
return
audioItem
;
return
audioItem
;
...
@@ -2261,7 +2189,7 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::videoItemFromSvg()
...
@@ -2261,7 +2189,7 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::videoItemFromSvg()
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//Claudio this is necessary to fix the absolute path added on Sankore 3.1 1.00.00
//The absoult path doesn't work when you want to share Sankore documents.
//The absoult path doesn't work when you want to share Sankore documents.
if
(
!
h
ref
.
startsWith
(
"videos/"
)){
if
(
!
videoH
ref
.
startsWith
(
"videos/"
)){
int
indexOfAudioDirectory
=
href
.
lastIndexOf
(
"videos"
);
int
indexOfAudioDirectory
=
href
.
lastIndexOf
(
"videos"
);
href
=
mDocumentPath
+
"/"
+
href
.
right
(
href
.
length
()
-
indexOfAudioDirectory
);
href
=
mDocumentPath
+
"/"
+
href
.
right
(
href
.
length
()
-
indexOfAudioDirectory
);
}
}
...
@@ -2337,9 +2265,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
...
@@ -2337,9 +2265,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
QStringRef
ubZValue
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"z-value"
);
QStringRef
ubZValue
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"z-value"
);
if
(
!
ubZValue
.
isNull
())
if
(
!
ubZValue
.
isNull
())
{
UBGraphicsItem
::
assignZValue
(
gItem
,
ubZValue
.
toString
().
toFloat
());
UBGraphicsItem
::
assignZValue
(
gItem
,
ubZValue
.
toString
().
toFloat
());
}
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
gItem
);
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
gItem
);
...
@@ -2348,16 +2274,14 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
...
@@ -2348,16 +2274,14 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
QStringRef
ubUuid
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"uuid"
);
QStringRef
ubUuid
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"uuid"
);
if
(
!
ubUuid
.
isNull
())
if
(
!
ubUuid
.
isNull
())
{
ubItem
->
setUuid
(
QUuid
(
ubUuid
.
toString
()));
ubItem
->
setUuid
(
QUuid
(
ubUuid
.
toString
()));
}
else
ubItem
->
setUuid
(
QUuid
::
createUuid
());
QStringRef
ubSource
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"source"
);
QStringRef
ubSource
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"source"
);
if
(
!
ubSource
.
isNull
())
if
(
!
ubSource
.
isNull
())
{
ubItem
->
setSourceUrl
(
QUrl
(
ubSource
.
toString
()));
ubItem
->
setSourceUrl
(
QUrl
(
ubSource
.
toString
()));
}
}
}
QStringRef
ubLocked
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"locked"
);
QStringRef
ubLocked
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"locked"
);
...
@@ -2384,35 +2308,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
...
@@ -2384,35 +2308,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
int
layerAsInt
=
ubLayer
.
toString
().
toInt
(
&
ok
);
int
layerAsInt
=
ubLayer
.
toString
().
toInt
(
&
ok
);
if
(
ok
)
if
(
ok
)
{
gItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
layerAsInt
));
gItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
layerAsInt
));
}
}
}
qreal
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
getZValueFromSvg
()
{
qreal
result
=
UBZLayerController
::
errorNum
();
QStringRef
ubZValue
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"z-value"
);
if
(
!
ubZValue
.
isNull
())
{
result
=
ubZValue
.
toString
().
toFloat
();
}
}
return
result
;
}
}
QUuid
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
getUuidFromSvg
()
{
QString
strUuid
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"uuid"
).
toString
();
QUuid
uuid
=
QUuid
(
strUuid
);
if
(
!
uuid
.
isNull
())
return
uuid
;
return
QUuid
::
createUuid
();
}
void
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
graphicsItemToSvg
(
QGraphicsItem
*
item
)
void
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
graphicsItemToSvg
(
QGraphicsItem
*
item
)
{
{
mXmlWriter
.
writeAttribute
(
"x"
,
"0"
);
mXmlWriter
.
writeAttribute
(
"x"
,
"0"
);
...
@@ -3235,9 +3134,3 @@ void UBSvgSubsetAdaptor::convertSvgImagesToImages(UBDocumentProxy* proxy)
...
@@ -3235,9 +3134,3 @@ void UBSvgSubsetAdaptor::convertSvgImagesToImages(UBDocumentProxy* proxy)
}
}
}
}
}
}
src/adaptors/UBSvgSubsetAdaptor.h
View file @
feb346f6
...
@@ -158,9 +158,6 @@ class UBSvgSubsetAdaptor
...
@@ -158,9 +158,6 @@ class UBSvgSubsetAdaptor
void
graphicsItemFromSvg
(
QGraphicsItem
*
gItem
);
void
graphicsItemFromSvg
(
QGraphicsItem
*
gItem
);
qreal
getZValueFromSvg
();
QUuid
getUuidFromSvg
();
QXmlStreamReader
mXmlReader
;
QXmlStreamReader
mXmlReader
;
int
mFileVersion
;
int
mFileVersion
;
UBDocumentProxy
*
mProxy
;
UBDocumentProxy
*
mProxy
;
...
...
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