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
f941091f
Commit
f941091f
authored
Apr 12, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some changes
parent
2b81a9ee
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
126 deletions
+40
-126
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+14
-72
UBSvgSubsetAdaptor.h
src/adaptors/UBSvgSubsetAdaptor.h
+1
-1
UBThumbnailAdaptor.cpp
src/adaptors/UBThumbnailAdaptor.cpp
+3
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+2
-14
UBBoardController.h
src/board/UBBoardController.h
+0
-1
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+18
-35
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+1
-1
UBCachePropertiesWidget.cpp
src/gui/UBCachePropertiesWidget.cpp
+1
-1
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
f941091f
...
...
@@ -383,6 +383,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy
UBGraphicsScene
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
loadScene
()
{
qDebug
()
<<
"loadScene() : starting reading..."
;
mScene
=
0
;
UBGraphicsWidgetItem
*
currentWidget
=
0
;
...
...
@@ -984,10 +985,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
if
(
mXmlReader
.
name
()
==
"g"
)
{
// if(strokesGroup && mScene){
// mScene->addItem(strokesGroup);
// }
if
(
annotationGroup
)
{
if
(
!
annotationGroup
->
polygons
().
empty
())
...
...
@@ -1007,7 +1004,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
}
qDebug
()
<<
"Number of detected strokes: "
<<
mStrokesList
.
count
();
Q
Map
Iterator
<
QString
,
UBGraphicsStrokesGroup
*>
iterator
(
mStrokesList
);
Q
Hash
Iterator
<
QString
,
UBGraphicsStrokesGroup
*>
iterator
(
mStrokesList
);
while
(
iterator
.
hasNext
())
{
iterator
.
next
();
mScene
->
addItem
(
iterator
.
value
());
...
...
@@ -1024,6 +1021,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
}
mScene
->
enableUndoRedoStack
();
qDebug
()
<<
"loadScene() : created scene and read file"
;
return
mScene
;
}
...
...
@@ -1031,9 +1029,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsGroupContainerItem
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
readGroup
()
{
UBGraphicsGroupContainerItem
*
group
=
new
UBGraphicsGroupContainerItem
();
// QMultiMap<QString, UBGraphicsPolygonItem *> strokesGroupsContainer;
QList
<
QGraphicsItem
*>
groupContainer
;
QString
id
=
mXmlReader
.
attributes
().
value
(
aId
).
toString
();
id
=
id
.
mid
(
1
,
id
.
length
()
-
2
);
qDebug
()
<<
id
;
bool
shouldSkipSubElements
=
false
;
if
(
mStrokesList
.
contains
(
id
))
shouldSkipSubElements
=
true
;
mXmlReader
.
readNext
();
while
(
!
mXmlReader
.
atEnd
())
{
...
...
@@ -1043,34 +1047,18 @@ UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
}
else
if
(
mXmlReader
.
isStartElement
())
{
if
(
mXmlReader
.
name
()
==
tGroup
)
{
qDebug
()
<<
"came across the group id is"
<<
mXmlReader
.
attributes
().
value
(
aId
);
UBGraphicsGroupContainerItem
*
curGroup
=
readGroup
();
if
(
curGroup
)
groupContainer
.
append
(
curGroup
);
else
qDebug
()
<<
"this is an error"
;
}
else
if
(
mXmlReader
.
name
()
==
tElement
)
{
else
if
(
mXmlReader
.
name
()
==
tElement
&&
!
shouldSkipSubElements
)
{
QString
id
=
mXmlReader
.
attributes
().
value
(
aId
).
toString
();
// QString itemId = id.right(QUuid().toString().size());
// QString groupId = id.left(QUuid().toString().size());
QGraphicsItem
*
curItem
=
readElementFromGroup
();
// UBGraphicsPolygonItem *curPolygon = qgraphicsitem_cast<UBGraphicsPolygonItem *>(curItem);
//
// if (curPolygon && !groupId.isEmpty() && !itemId.isEmpty() && itemId != groupId) {
// strokesGroupsContainer.insert(groupId, curPolygon);
// }
// else {// item
// Explanation: the second condition discriminate the old storage version that should
// not be interpreted anymore
if
(
curItem
&&
id
.
count
(
"{"
)
<
2
)
groupContainer
.
append
(
curItem
);
else
qDebug
()
<<
"this is an error"
;
// }
}
else
{
mXmlReader
.
skipCurrentElement
();
...
...
@@ -1081,39 +1069,6 @@ UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
}
}
// foreach (QString key, strokesGroupsContainer.keys().toSet())
// {
// UBGraphicsStrokesGroup* pStrokesGroup = new UBGraphicsStrokesGroup();
// UBGraphicsStroke *currentStroke = new UBGraphicsStroke();
// foreach(UBGraphicsPolygonItem* poly, strokesGroupsContainer.values(key))
// {
// if (poly)
// {
// mScene->removeItem(poly);
// mScene->removeItemFromDeletion(poly);
// poly->setStrokesGroup(pStrokesGroup);
// poly->setStroke(currentStroke);
// pStrokesGroup->addToGroup(poly);
// }
// }
// if (currentStroke->polygons().empty())
// delete currentStroke;
// if (pStrokesGroup->childItems().count())
// mScene->addItem(pStrokesGroup);
// else
// delete pStrokesGroup;
// if (pStrokesGroup)
// {
// QGraphicsItem *strokeGroup = qgraphicsitem_cast<QGraphicsItem *>(pStrokesGroup);
// if(strokeGroup)
// groupContainer.append(strokeGroup);
// else
// qDebug() << "this is an error";
// }
// }
foreach
(
QGraphicsItem
*
item
,
groupContainer
)
group
->
addToGroup
(
item
);
...
...
@@ -1164,8 +1119,6 @@ QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup()
if
(
!
result
)
result
=
mStrokesList
.
take
(
uuid
.
replace
(
"}"
,
""
).
replace
(
"{"
,
""
));
//Q_ASSERT(result);
mXmlReader
.
skipCurrentElement
();
mXmlReader
.
readNext
();
...
...
@@ -1561,14 +1514,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
if
(
item
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
&&
item
->
childItems
().
count
())
{
persistGroupToDom
(
item
,
curParent
,
groupDomDocument
);
}
// else if (item->type() == UBGraphicsStrokesGroup::Type) {
// foreach (QGraphicsItem *polygonItem, item->childItems()) {
// QDomElement curPolygonElement = groupDomDocument->createElement(tElement);
// curPolygonElement.setAttribute(aId, tmpUuid.toString()
// + UBGraphicsItem::getOwnUuid(polygonItem).toString());
// curGroupElement.appendChild(curPolygonElement);
// }
// }
else
{
QDomElement
curSubElement
=
groupDomDocument
->
createElement
(
tElement
);
...
...
@@ -2509,15 +2454,12 @@ qreal UBSvgSubsetAdaptor::UBSvgSubsetReader::getZValueFromSvg()
QUuid
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
getUuidFromSvg
()
{
QUuid
result
;
QString
strUuid
=
mXmlReader
.
attributes
().
value
(
mNamespaceUri
,
"uuid"
).
toString
();
QUuid
uuid
=
QUuid
(
strUuid
);
if
(
!
uuid
.
isNull
())
{
result
=
uuid
;
}
if
(
!
uuid
.
isNull
())
return
uuid
;
return
result
;
return
QUuid
::
createUuid
()
;
}
...
...
src/adaptors/UBSvgSubsetAdaptor.h
View file @
f941091f
...
...
@@ -174,7 +174,7 @@ class UBSvgSubsetAdaptor
QString
mNamespaceUri
;
UBGraphicsScene
*
mScene
;
Q
Map
<
QString
,
UBGraphicsStrokesGroup
*>
mStrokesList
;
Q
Hash
<
QString
,
UBGraphicsStrokesGroup
*>
mStrokesList
;
};
class
UBSvgSubsetWriter
...
...
src/adaptors/UBThumbnailAdaptor.cpp
View file @
f941091f
...
...
@@ -120,8 +120,10 @@ void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& lis
updateDocumentToHandleZeroPage
(
proxy
);
generateMissingThumbnails
(
proxy
);
foreach
(
const
QPixmap
*
pm
,
list
)
foreach
(
const
QPixmap
*
pm
,
list
)
{
delete
pm
;
pm
=
NULL
;
}
list
.
clear
();
for
(
int
i
=
0
;
i
<
proxy
->
pageCount
();
i
++
)
list
.
append
(
get
(
proxy
,
i
));
...
...
src/board/UBBoardController.cpp
View file @
f941091f
...
...
@@ -541,8 +541,6 @@ void UBBoardController::duplicateScene(int nIndex)
setActiveDocumentScene
(
nIndex
+
1
);
QApplication
::
restoreOverrideCursor
();
emit
pageChanged
();
}
void
UBBoardController
::
duplicateScene
()
...
...
@@ -648,7 +646,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync)
QList
<
QGraphicsItem
*>
duplicatedItems
;
QList
<
QGraphicsItem
*>
children
=
groupItem
->
childItems
();
mActiveScene
->
setURStackEnable
(
false
);
foreach
(
QGraphicsItem
*
pIt
,
children
){
UBItem
*
pItem
=
dynamic_cast
<
UBItem
*>
(
pIt
);
...
...
@@ -920,7 +918,6 @@ void UBBoardController::previousScene()
}
updateActionStates
();
emit
pageChanged
();
}
...
...
@@ -935,7 +932,6 @@ void UBBoardController::nextScene()
}
updateActionStates
();
emit
pageChanged
();
}
...
...
@@ -950,7 +946,6 @@ void UBBoardController::firstScene()
}
updateActionStates
();
emit
pageChanged
();
}
...
...
@@ -965,7 +960,6 @@ void UBBoardController::lastScene()
}
updateActionStates
();
emit
pageChanged
();
}
void
UBBoardController
::
groupButtonClicked
()
...
...
@@ -1539,16 +1533,10 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
updateBackgroundState
();
if
(
documentChange
)
{
UBGraphicsTextItem
::
lastUsedTextColor
=
QColor
();
}
if
(
sceneChange
)
{
emit
activeSceneChanged
();
emit
pageChanged
();
}
}
...
...
@@ -2476,7 +2464,7 @@ void UBBoardController::importPage()
void
UBBoardController
::
notifyPageChanged
()
{
emit
pag
eChanged
();
emit
activeScen
eChanged
();
}
void
UBBoardController
::
onDownloadModalFinished
()
...
...
src/board/UBBoardController.h
View file @
f941091f
...
...
@@ -245,7 +245,6 @@ class UBBoardController : public UBDocumentContainer
void
backgroundChanged
();
void
cacheEnabled
();
void
cacheDisabled
();
void
pageChanged
();
void
documentReorganized
(
int
index
);
void
displayMetadata
(
QMap
<
QString
,
QString
>
metadata
);
void
pageSelectionChanged
(
int
index
);
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
f941091f
...
...
@@ -359,17 +359,13 @@ bool UBGraphicsItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsItemDelegate
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
// if (!mDelegated->isSelected()) {
// setZOrderButtonsVisible(true);
// }
}
void
UBGraphicsItemDelegate
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
// if (!mDelegated->isSelected()) {
// setZOrderButtonsVisible(false);
// }
}
QGraphicsItem
*
UBGraphicsItemDelegate
::
delegated
()
...
...
@@ -440,22 +436,9 @@ void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible)
void
UBGraphicsItemDelegate
::
remove
(
bool
canUndo
)
{
/*UBGraphicsScene* scene = dynamic_cast<UBGraphicsScene*>(mDelegated->scene());
if (scene && canUndo)
{
UBGraphicsItemUndoCommand *uc = new UBGraphicsItemUndoCommand(scene, mDelegated, 0);
UBApplication::undoStack->push(uc);
}
mDelegated->hide(); */
UBGraphicsScene
*
scene
=
dynamic_cast
<
UBGraphicsScene
*>
(
mDelegated
->
scene
());
if
(
scene
)
{
// bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control;
// showHide(shownOnDisplay);
// updateFrame();
// updateButtons();
if
(
mFrame
&&
!
mFrame
->
scene
()
&&
mDelegated
->
scene
())
{
mDelegated
->
scene
()
->
addItem
(
mFrame
);
...
...
@@ -773,7 +756,7 @@ void UBGraphicsItemDelegate::setButtonsVisible(bool visible)
}
UBGraphicsToolBarItem
::
UBGraphicsToolBarItem
(
QGraphicsItem
*
parent
)
:
UBGraphicsToolBarItem
::
UBGraphicsToolBarItem
(
QGraphicsItem
*
parent
)
:
QGraphicsRectItem
(
parent
),
mShifting
(
true
),
mVisible
(
false
),
...
...
@@ -786,7 +769,7 @@ UBGraphicsToolBarItem::UBGraphicsToolBarItem(QGraphicsItem * parent) :
rect
.
setWidth
(
parent
->
boundingRect
().
width
());
this
->
setRect
(
rect
);
// setBrush(QColor(UBSettings::paletteColor));
// setBrush(QColor(UBSettings::paletteColor));
setPen
(
Qt
::
NoPen
);
hide
();
...
...
@@ -816,14 +799,14 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI
Q_UNUSED
(
widget
);
QPainterPath
path
;
path
.
addRoundedRect
(
rect
(),
10
,
10
);
path
.
addRoundedRect
(
rect
(),
10
,
10
);
setBrush
(
QBrush
(
UBSettings
::
paletteColor
));
painter
->
fillPath
(
path
,
brush
());
}
MediaTimer
::
MediaTimer
(
QGraphicsItem
*
parent
)
:
QGraphicsRectItem
(
parent
)
MediaTimer
::
MediaTimer
(
QGraphicsItem
*
parent
)
:
QGraphicsRectItem
(
parent
)
{
val
=
0
;
smallPoint
=
false
;
...
...
@@ -879,11 +862,11 @@ void MediaTimer::drawDigit(const QPoint &pos, QPainter &p, int segLen,
int
nUpdates
;
const
char
*
segs
;
int
i
,
j
;
const
char
erase
=
0
;
const
char
draw
=
1
;
const
char
leaveAlone
=
2
;
segs
=
getSegments
(
oldCh
);
for
(
nErases
=
0
;
segs
[
nErases
]
!=
99
;
nErases
++
)
{
updates
[
nErases
][
0
]
=
erase
;
// get segments to erase to
...
...
@@ -911,8 +894,8 @@ void MediaTimer::drawDigit(const QPoint &pos, QPainter &p, int segLen,
}
}
char
MediaTimer
::
segments
[][
8
]
=
{
char
MediaTimer
::
segments
[][
8
]
=
{
{
0
,
1
,
2
,
4
,
5
,
6
,
99
,
0
},
// 0 0
{
2
,
5
,
99
,
0
,
0
,
0
,
0
,
0
},
// 1 1
{
0
,
2
,
3
,
4
,
6
,
99
,
0
,
0
},
// 2 2
...
...
@@ -935,7 +918,7 @@ const char* MediaTimer::getSegments(char ch) // gets list of segme
return
segments
[
10
];
if
(
ch
==
' '
)
return
segments
[
11
];
return
NULL
;
}
...
...
@@ -947,7 +930,7 @@ void MediaTimer::drawSegment(const QPoint &pos, char segmentNo, QPainter &p,
QPoint
ppt
;
QPoint
pt
=
pos
;
int
width
=
segLen
/
5
;
#define LINETO(X,Y) addPoint(a, QPoint(pt.x() + (X),pt.y() + (Y)))
#define LIGHT
#define DARK
...
...
@@ -1236,7 +1219,7 @@ void DelegateMediaControl::paint(QPainter *painter,
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
QPainterPath
path
;
mLCDTimerArea
.
setHeight
(
rect
().
height
());
...
...
@@ -1289,7 +1272,7 @@ void DelegateMediaControl::positionHandles()
selfRect
.
setHeight
(
parentItem
()
->
boundingRect
().
height
());
setRect
(
selfRect
);
lcdTimer
->
setPos
(
rect
().
width
()
-
mLCDTimerArea
.
width
(),
0
);
lcdTimer
->
setPos
(
rect
().
width
()
-
mLCDTimerArea
.
width
(),
0
);
}
void
DelegateMediaControl
::
update
()
...
...
@@ -1318,9 +1301,9 @@ void DelegateMediaControl::totalTimeChanged(qint64 newTotalTime)
void
DelegateMediaControl
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
qreal
frameWidth
=
mSeecArea
.
height
()
/
2
;
if
(
boundingRect
().
contains
(
event
->
pos
()
-
QPointF
(
frameWidth
,
0
))
if
(
boundingRect
().
contains
(
event
->
pos
()
-
QPointF
(
frameWidth
,
0
))
&&
boundingRect
().
contains
(
event
->
pos
()
+
QPointF
(
frameWidth
,
0
)))
{
{
mDisplayCurrentTime
=
true
;
seekToMousePos
(
event
->
pos
());
this
->
update
();
...
...
@@ -1332,9 +1315,9 @@ void DelegateMediaControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
void
DelegateMediaControl
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
qreal
frameWidth
=
mSeecArea
.
height
()
/
2
;
if
(
boundingRect
().
contains
(
event
->
pos
()
-
QPointF
(
frameWidth
,
0
))
if
(
boundingRect
().
contains
(
event
->
pos
()
-
QPointF
(
frameWidth
,
0
))
&&
boundingRect
().
contains
(
event
->
pos
()
+
QPointF
(
frameWidth
,
0
)))
{
{
seekToMousePos
(
event
->
pos
());
this
->
update
();
event
->
accept
();
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
f941091f
...
...
@@ -206,7 +206,7 @@ QPainterPath UBGraphicsStrokesGroup::shape () const
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
path
.
addPath
(
item
->
shape
());
}
}
}
return
path
;
...
...
src/gui/UBCachePropertiesWidget.cpp
View file @
f941091f
...
...
@@ -142,7 +142,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
connect
(
mpCircleButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
updateShapeButtons
()));
connect
(
mpSquareButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
updateShapeButtons
()));
connect
(
mpSizeSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
onSizeChanged
(
int
)));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
pag
eChanged
()),
this
,
SLOT
(
updateCurrentCache
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeScen
eChanged
()),
this
,
SLOT
(
updateCurrentCache
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
cacheEnabled
()),
this
,
SLOT
(
onCacheEnabled
()));
}
...
...
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