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
d57341fd
Commit
d57341fd
authored
May 24, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
e79ed885
54d392a7
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
37 deletions
+65
-37
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+40
-17
UBBoardController.cpp
src/board/UBBoardController.cpp
+1
-1
UBBoardView.cpp
src/board/UBBoardView.cpp
+1
-1
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+0
-1
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+2
-2
UBGraphicsGroupContainerItem.h
src/domain/UBGraphicsGroupContainerItem.h
+0
-0
UBGraphicsGroupContainerItemDelegate.cpp
src/domain/UBGraphicsGroupContainerItemDelegate.cpp
+2
-2
UBGraphicsGroupContainerItemDelegate.h
src/domain/UBGraphicsGroupContainerItemDelegate.h
+0
-0
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+1
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+16
-10
domain.pri
src/domain/domain.pri
+2
-2
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
d57341fd
...
...
@@ -29,7 +29,7 @@
#include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsStroke.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "domain/UBItem.h"
#include "tools/UBGraphicsRuler.h"
...
...
@@ -543,6 +543,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if
(
strokesGroup
){
polygonItem
->
setTransform
(
strokesGroup
->
transform
());
strokesGroup
->
addToGroup
(
polygonItem
);
polygonItem
->
setStrokesGroup
(
strokesGroup
);
}
}
else
{
scene
->
addItem
(
polygonItem
);
...
...
@@ -1004,8 +1005,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement()
bool
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
persistScene
(
int
pageIndex
)
{
if
(
mScene
->
isModified
())
{
static
int
i
=
0
;
...
...
@@ -1028,6 +1027,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
writeSvgElement
();
// Get the items from the scene
QList
<
QGraphicsItem
*>
items
=
mScene
->
items
();
qSort
(
items
.
begin
(),
items
.
end
(),
itemZIndexComp
);
...
...
@@ -1040,10 +1040,32 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
{
QGraphicsItem
*
item
=
items
.
takeFirst
();
UBGraphicsPolygonItem
*
polygonItem
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
item
);
// Is the item a strokes group?
UBGraphicsStrokesGroup
*
strokesGroupItem
=
qgraphicsitem_cast
<
UBGraphicsStrokesGroup
*>
(
item
);
if
(
strokesGroupItem
&&
strokesGroupItem
->
isVisible
()){
mXmlWriter
.
writeStartElement
(
"g"
);
QMatrix
matrix
=
item
->
sceneMatrix
();
if
(
!
matrix
.
isIdentity
()){
mXmlWriter
.
writeAttribute
(
"transform"
,
toSvgTransform
(
matrix
));
}
// Add the polygons
foreach
(
QGraphicsItem
*
item
,
strokesGroupItem
->
childItems
()){
UBGraphicsPolygonItem
*
poly
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
){
polygonItemToSvgPolygon
(
poly
,
true
);
items
.
removeOne
(
poly
);
}
}
mXmlWriter
.
writeEndElement
();
//g
}
// Is the item a polygon?
UBGraphicsPolygonItem
*
polygonItem
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
polygonItem
&&
polygonItem
->
isVisible
())
{
UBGraphicsStroke
*
currentStroke
=
polygonItem
->
stroke
();
if
(
openStroke
&&
(
currentStroke
!=
openStroke
))
...
...
@@ -1115,16 +1137,16 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
openStroke
=
0
;
}
// Is the item a picture?
UBGraphicsPixmapItem
*
pixmapItem
=
qgraphicsitem_cast
<
UBGraphicsPixmapItem
*>
(
item
);
if
(
pixmapItem
&&
pixmapItem
->
isVisible
())
{
pixmapItemToLinkedImage
(
pixmapItem
);
continue
;
}
// Is the item a shape?
UBGraphicsSvgItem
*
svgItem
=
qgraphicsitem_cast
<
UBGraphicsSvgItem
*>
(
item
);
if
(
svgItem
&&
svgItem
->
isVisible
())
{
svgItemToLinkedSvg
(
svgItem
);
...
...
@@ -1142,54 +1164,55 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
continue
;
}
// Is the item an app?
UBGraphicsAppleWidgetItem
*
appleWidgetItem
=
qgraphicsitem_cast
<
UBGraphicsAppleWidgetItem
*>
(
item
);
if
(
appleWidgetItem
&&
appleWidgetItem
->
isVisible
())
{
graphicsAppleWidgetToSvg
(
appleWidgetItem
);
continue
;
}
// Is the item a W3C?
UBGraphicsW3CWidgetItem
*
w3cWidgetItem
=
qgraphicsitem_cast
<
UBGraphicsW3CWidgetItem
*>
(
item
);
if
(
w3cWidgetItem
&&
w3cWidgetItem
->
isVisible
())
{
graphicsW3CWidgetToSvg
(
w3cWidgetItem
);
continue
;
}
// Is the item a PDF?
UBGraphicsPDFItem
*
pdfItem
=
qgraphicsitem_cast
<
UBGraphicsPDFItem
*>
(
item
);
if
(
pdfItem
&&
pdfItem
->
isVisible
())
{
pdfItemToLinkedPDF
(
pdfItem
);
continue
;
}
// Is the item a text?
UBGraphicsTextItem
*
textItem
=
qgraphicsitem_cast
<
UBGraphicsTextItem
*>
(
item
);
if
(
textItem
&&
textItem
->
isVisible
())
{
textItemToSvg
(
textItem
);
continue
;
}
// Is the item a curtain?
UBGraphicsCurtainItem
*
curtainItem
=
qgraphicsitem_cast
<
UBGraphicsCurtainItem
*>
(
item
);
if
(
curtainItem
&&
curtainItem
->
isVisible
())
{
curtainItemToSvg
(
curtainItem
);
continue
;
}
// Is the item a ruler?
UBGraphicsRuler
*
ruler
=
qgraphicsitem_cast
<
UBGraphicsRuler
*>
(
item
);
if
(
ruler
&&
ruler
->
isVisible
())
{
rulerToSvg
(
ruler
);
continue
;
}
// Is the item a cache?
UBGraphicsCache
*
cache
=
qgraphicsitem_cast
<
UBGraphicsCache
*>
(
item
);
if
(
cache
&&
cache
->
isVisible
())
{
...
...
@@ -1197,35 +1220,35 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
continue
;
}
// Is the item a compass
UBGraphicsCompass
*
compass
=
qgraphicsitem_cast
<
UBGraphicsCompass
*>
(
item
);
if
(
compass
&&
compass
->
isVisible
())
{
compassToSvg
(
compass
);
continue
;
}
// Is the item a protractor?
UBGraphicsProtractor
*
protractor
=
qgraphicsitem_cast
<
UBGraphicsProtractor
*>
(
item
);
if
(
protractor
&&
protractor
->
isVisible
())
{
protractorToSvg
(
protractor
);
continue
;
}
// Is the item a triangle?
UBGraphicsTriangle
*
triangle
=
qgraphicsitem_cast
<
UBGraphicsTriangle
*>
(
item
);
if
(
triangle
&&
triangle
->
isVisible
())
{
triangleToSvg
(
triangle
);
continue
;
}
// Is the item a group?
UBGraphicsGroupContainerItem
*
groupItem
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
if
(
groupItem
&&
groupItem
->
isVisible
())
{
qDebug
()
<<
"came across the group during the parsing
"
;
qDebug
()
<<
"came across the group during the parsing
, uuid is "
<<
groupItem
->
data
(
UBGraphicsItemData
::
ItemUuid
).
toString
()
;
continue
;
}
}
...
...
src/board/UBBoardController.cpp
View file @
d57341fd
...
...
@@ -49,7 +49,7 @@
#include "domain/UBW3CWidget.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBPageSizeUndoCommand.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "tools/UBToolsManager.h"
...
...
src/board/UBBoardView.cpp
View file @
d57341fd
...
...
@@ -49,7 +49,7 @@
#include "domain/UBItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsSvgItem.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "document/UBDocumentProxy.h"
...
...
src/core/UBPersistenceManager.cpp
View file @
d57341fd
...
...
@@ -582,7 +582,6 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy,
if
(
mSceneCache
.
contains
(
proxy
,
sceneIndex
))
return
mSceneCache
.
value
(
proxy
,
sceneIndex
);
else
{
qDebug
()
<<
"scene"
<<
sceneIndex
<<
"retrieved from file ..."
;
UBGraphicsScene
*
scene
=
UBSvgSubsetAdaptor
::
loadScene
(
proxy
,
sceneIndex
);
if
(
scene
)
...
...
src/domain/
ubgraphicsgroupcontaineri
tem.cpp
→
src/domain/
UBGraphicsGroupContainerI
tem.cpp
View file @
d57341fd
#include "
ubgraphicsgroupcontaineri
tem.h"
#include "
UBGraphicsGroupContainerI
tem.h"
#include <QtGui>
#include "UBGraphicsMediaItem.h"
#include "UBGraphicsTextItem.h"
#include "domain/UBGraphicsItemDelegate.h"
#include "domain/
ubgraphicsgroupcontaineritemd
elegate.h"
#include "domain/
UBGraphicsGroupContainerItemD
elegate.h"
#include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
...
...
src/domain/
ubgraphicsgroupcontaineri
tem.h
→
src/domain/
UBGraphicsGroupContainerI
tem.h
View file @
d57341fd
File moved
src/domain/
ubgraphicsgroupcontaineritemd
elegate.cpp
→
src/domain/
UBGraphicsGroupContainerItemD
elegate.cpp
View file @
d57341fd
#include "
ubgraphicsgroupcontaineritemd
elegate.h"
#include "
UBGraphicsGroupContainerItemD
elegate.h"
#include <QtGui>
...
...
@@ -6,7 +6,7 @@
#include "gui/UBResources.h"
#include "domain/UBGraphicsDelegateFrame.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "board/UBBoardController.h"
...
...
src/domain/
ubgraphicsgroupcontaineritemd
elegate.h
→
src/domain/
UBGraphicsGroupContainerItemD
elegate.h
View file @
d57341fd
File moved
src/domain/UBGraphicsItemDelegate.cpp
View file @
d57341fd
...
...
@@ -40,7 +40,7 @@
#include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "web/UBWebController.h"
...
...
src/domain/UBGraphicsScene.cpp
View file @
d57341fd
...
...
@@ -56,7 +56,7 @@
#include "UBGraphicsTextItem.h"
#include "UBGraphicsStrokesGroup.h"
#include "domain/
ubgraphicsgroupcontaineri
tem.h"
#include "domain/
UBGraphicsGroupContainerI
tem.h"
#include "UBAppleWidget.h"
#include "UBW3CWidget.h"
...
...
@@ -777,18 +777,17 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if
(
mShouldUseOMP
)
{
#pragma omp parallel for
//
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
{
UBGraphicsPolygonItem
*
collidingPolygonItem
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
if
(
NULL
!=
collidingPolygonItem
)
if
(
NULL
!=
collidingPolygonItem
)
{
UBGraphicsStrokesGroup
*
pGroup
=
collidingPolygonItem
->
strokesGroup
();
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
{
#pragma omp critical
//
#pragma omp critical
// Put the entire polygon into the remove list
toBeRemovedItems
<<
collidingPolygonItem
;
}
...
...
@@ -825,7 +824,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
else */
if
(
croppedPathSimplified
.
isEmpty
())
{
#pragma omp critical
//
#pragma omp critical
// Put the entire polygon into the remove list if the eraser removes all its visible content
toBeRemovedItems
<<
collidingPolygonItem
;
}
...
...
@@ -836,14 +835,15 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
foreach
(
const
QPolygonF
&
pol
,
croppedPathSimplified
.
toFillPolygons
())
{
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
#pragma omp critical
//
#pragma omp critical
if
(
NULL
!=
pGroup
){
croppedPolygonItem
->
setStrokesGroup
(
pGroup
);
//pGroup->addToGroup(croppedPolygonItem);
}
// Add this new polygon to the 'added' list
toBeAddedItems
<<
croppedPolygonItem
;
}
#pragma omp critical
//
#pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons
toBeRemovedItems
<<
collidingPolygonItem
;
}
...
...
@@ -904,8 +904,9 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
foreach
(
QGraphicsItem
*
item
,
toBeRemovedItems
){
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
){
if
(
NULL
!=
poly
->
strokesGroup
()){
poly
->
strokesGroup
()
->
removeFromGroup
(
poly
);
UBGraphicsStrokesGroup
*
group
=
poly
->
strokesGroup
();
if
(
NULL
!=
group
){
group
->
removeFromGroup
(
poly
);
removeItem
(
poly
);
}
else
{
qDebug
()
<<
"No group present"
;
...
...
@@ -1489,6 +1490,11 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *
groupItem
->
setVisible
(
true
);
groupItem
->
setFocus
();
qDebug
()
<<
groupItem
->
uuid
().
toString
();
if
(
groupItem
->
uuid
().
isNull
())
{
groupItem
->
setUuid
(
QUuid
::
createUuid
());
}
if
(
enableUndoRedoStack
)
{
//should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand
*
uc
=
new
UBGraphicsItemUndoCommand
(
this
,
0
,
groupItem
);
UBApplication
::
undoStack
->
push
(
uc
);
...
...
src/domain/domain.pri
View file @
d57341fd
...
...
@@ -21,8 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsMediaItem.h \
src/domain/UBAbstractUndoCommand.h\
src/domain/UBAngleWidget.h \
src/domain/
ubgraphicsgroupcontaineri
tem.h \
src/domain/
ubgraphicsgroupcontaineritemd
elegate.h \
src/domain/
UBGraphicsGroupContainerI
tem.h \
src/domain/
UBGraphicsGroupContainerItemD
elegate.h \
src/domain/UBGraphicsStrokesGroup.h
HEADERS += src/domain/UBGraphicsItemDelegate.h \
...
...
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