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
ec85baff
Commit
ec85baff
authored
Dec 11, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:OpenEducationFoundation/OpenBoard into develop
parents
280789c9
c8145a6e
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
393 additions
and
45 deletions
+393
-45
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+17
-0
UBBoardController.cpp
src/board/UBBoardController.cpp
+4
-4
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+1
-1
UBSettings.cpp
src/core/UBSettings.cpp
+1
-1
UBSettings.h
src/core/UBSettings.h
+1
-1
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+13
-2
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+9
-0
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+1
-0
UBGraphicsItemZLevelUndoCommand.cpp
src/domain/UBGraphicsItemZLevelUndoCommand.cpp
+1
-1
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+249
-20
UBGraphicsTextItemDelegate.h
src/domain/UBGraphicsTextItemDelegate.h
+84
-6
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+3
-6
UBItem.cpp
src/domain/UBItem.cpp
+5
-0
UBItem.h
src/domain/UBItem.h
+1
-0
UBDocumentTreeWidget.cpp
src/gui/UBDocumentTreeWidget.cpp
+3
-3
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
ec85baff
...
...
@@ -42,6 +42,7 @@
#include "domain/UBGraphicsStroke.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsGroupContainerItemDelegate.h"
#include "domain/UBItem.h"
#include "tools/UBGraphicsRuler.h"
...
...
@@ -924,7 +925,13 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot()
}
else
if
(
mXmlReader
.
isStartElement
())
{
if
(
mXmlReader
.
name
()
==
tGroup
)
{
QString
ubLocked
=
mXmlReader
.
attributes
().
value
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"locked"
).
toString
();
UBGraphicsGroupContainerItem
*
curGroup
=
readGroup
();
if
(
!
ubLocked
.
isEmpty
())
{
bool
isLocked
=
ubLocked
.
contains
(
xmlTrue
);
curGroup
->
Delegate
()
->
setLocked
(
isLocked
);
}
if
(
curGroup
)
{
mScene
->
addGroup
(
curGroup
);
}
...
...
@@ -1276,6 +1283,9 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
if
(
curElement
.
hasAttribute
(
aId
))
{
mXmlWriter
.
writeStartElement
(
curElement
.
tagName
());
mXmlWriter
.
writeAttribute
(
aId
,
curElement
.
attribute
(
aId
));
if
(
curElement
.
hasAttribute
(
"locked"
)){
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"locked"
,
curElement
.
attribute
(
"locked"
));
}
QDomElement
curSubElement
=
curElement
.
firstChildElement
();
while
(
!
curSubElement
.
isNull
())
{
if
(
curSubElement
.
hasAttribute
(
aId
))
{
...
...
@@ -1320,6 +1330,13 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
if
(
!
uuid
.
isNull
())
{
QDomElement
curGroupElement
=
groupDomDocument
->
createElement
(
tGroup
);
curGroupElement
.
setAttribute
(
aId
,
uuid
);
UBGraphicsGroupContainerItem
*
group
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
groupItem
);
if
(
group
&&
group
->
Delegate
()){
if
(
group
->
Delegate
()
->
isLocked
())
curGroupElement
.
setAttribute
(
"locked"
,
xmlTrue
);
else
curGroupElement
.
setAttribute
(
"locked"
,
xmlFalse
);
}
curParent
->
appendChild
(
curGroupElement
);
foreach
(
QGraphicsItem
*
item
,
groupItem
->
childItems
())
{
QUuid
tmpUuid
=
UBGraphicsScene
::
getPersonalUuid
(
item
);
...
...
src/board/UBBoardController.cpp
View file @
ec85baff
...
...
@@ -1634,7 +1634,7 @@ void UBBoardController::adjustDisplayViews()
int
UBBoardController
::
autosaveTimeoutFromSettings
()
{
int
value
=
UBSettings
::
settings
()
->
timer
Interval
->
get
().
toInt
();
int
value
=
UBSettings
::
settings
()
->
autoSave
Interval
->
get
().
toInt
();
int
minute
=
60
*
1000
;
return
value
*
minute
;
...
...
@@ -1773,8 +1773,8 @@ void UBBoardController::autosaveTimeout()
void
UBBoardController
::
appMainModeChanged
(
UBApplicationController
::
MainMode
md
)
{
int
timer
Interval
=
autosaveTimeoutFromSettings
();
if
(
!
timer
Interval
)
{
int
autoSave
Interval
=
autosaveTimeoutFromSettings
();
if
(
!
autoSave
Interval
)
{
return
;
}
...
...
@@ -1784,7 +1784,7 @@ void UBBoardController::appMainModeChanged(UBApplicationController::MainMode md)
}
if
(
md
==
UBApplicationController
::
Board
)
{
mAutosaveTimer
->
start
(
timer
Interval
);
mAutosaveTimer
->
start
(
autoSave
Interval
);
}
else
if
(
mAutosaveTimer
->
isActive
())
{
mAutosaveTimer
->
stop
();
}
...
...
src/board/UBBoardPaletteManager.cpp
View file @
ec85baff
...
...
@@ -243,7 +243,7 @@ void UBBoardPaletteManager::setupPalettes()
mStylusPalette
->
stackUnder
(
mZoomPalette
);
mTipPalette
=
new
UBStartupHintsPalette
(
mContainer
);
//
mTipPalette = new UBStartupHintsPalette(mContainer);
QList
<
QAction
*>
backgroundsActions
;
backgroundsActions
<<
UBApplication
::
mainWindow
->
actionPlainLightBackground
;
...
...
src/core/UBSettings.cpp
View file @
ec85baff
...
...
@@ -353,7 +353,7 @@ void UBSettings::init()
boardShowToolsPalette
=
new
UBSetting
(
this
,
"Board"
,
"ShowToolsPalette"
,
"false"
);
magnifierDrawingMode
=
new
UBSetting
(
this
,
"Board"
,
"MagnifierDrawingMode"
,
"0"
);
timerInterval
=
new
UBSetting
(
this
,
"Board"
,
"Timer interval"
,
"5
"
);
autoSaveInterval
=
new
UBSetting
(
this
,
"Board"
,
"AutoSaveIntervalInMinutes"
,
"3
"
);
svgViewBoxMargin
=
new
UBSetting
(
this
,
"SVG"
,
"ViewBoxMargin"
,
"50"
);
...
...
src/core/UBSettings.h
View file @
ec85baff
...
...
@@ -373,7 +373,7 @@ class UBSettings : public QObject
UBSetting
*
libIconSize
;
UBSetting
*
magnifierDrawingMode
;
UBSetting
*
timer
Interval
;
UBSetting
*
autoSave
Interval
;
public
slots
:
...
...
src/domain/UBGraphicsGroupContainerItem.cpp
View file @
ec85baff
...
...
@@ -79,9 +79,14 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
if
(
UBGraphicsItem
::
isRotatable
(
this
)
&&
!
UBGraphicsItem
::
isRotatable
(
item
))
{
Delegate
()
->
setUBFlag
(
GF_REVOLVABLE
,
false
);
}
}
else
{
if
(
!
UBGraphicsItem
::
isLocked
(
this
)
&&
UBGraphicsItem
::
isLocked
(
item
))
{
Delegate
()
->
setLocked
(
true
);
}
}
else
{
Delegate
()
->
setUBFlag
(
GF_FLIPPABLE_ALL_AXIS
,
UBGraphicsItem
::
isFlippable
(
item
));
Delegate
()
->
setUBFlag
(
GF_REVOLVABLE
,
UBGraphicsItem
::
isRotatable
(
item
));
Delegate
()
->
setLocked
(
UBGraphicsItem
::
isLocked
(
item
));
}
// COMBINE
...
...
@@ -322,6 +327,7 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item)
if
(
!
UBGraphicsItem
::
isFlippable
(
item
)
||
!
UBGraphicsItem
::
isRotatable
(
item
))
{
bool
flippableNow
=
true
;
bool
rotatableNow
=
true
;
bool
lockedNow
=
false
;
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
if
(
!
UBGraphicsItem
::
isFlippable
(
item
))
{
...
...
@@ -330,12 +336,17 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item)
if
(
!
UBGraphicsItem
::
isRotatable
(
item
))
{
rotatableNow
=
false
;
}
if
(
!
rotatableNow
&&
!
flippableNow
)
{
if
(
UBGraphicsItem
::
isLocked
(
item
))
lockedNow
=
true
;
if
(
!
rotatableNow
&&
!
flippableNow
&&
lockedNow
)
{
break
;
}
}
Delegate
()
->
setUBFlag
(
GF_FLIPPABLE_ALL_AXIS
,
flippableNow
);
Delegate
()
->
setUBFlag
(
GF_REVOLVABLE
,
rotatableNow
);
Delegate
()
->
setLocked
(
lockedNow
);
}
}
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
ec85baff
...
...
@@ -715,6 +715,15 @@ void UBGraphicsItemDelegate::showMenu()
mMenu
->
exec
(
cv
->
mapToGlobal
(
pinPos
.
bottomRight
()));
}
void
UBGraphicsItemDelegate
::
setLocked
(
bool
pLocked
)
{
Q_ASSERT
(
mDelegated
);
if
(
mDelegated
)
{
mDelegated
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
QVariant
(
pLocked
));
}
}
void
UBGraphicsItemDelegate
::
updateFrame
()
{
if
(
mFrame
&&
!
mFrame
->
scene
()
&&
mDelegated
->
scene
())
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
ec85baff
...
...
@@ -279,6 +279,7 @@ class UBGraphicsItemDelegate : public QObject
void
setMimeData
(
QMimeData
*
mimeData
);
void
setDragPixmap
(
const
QPixmap
&
pix
)
{
mDragPixmap
=
pix
;}
void
setLocked
(
bool
pLocked
);
void
setButtonsVisible
(
bool
visible
);
UBGraphicsToolBarItem
*
getToolBarItem
()
const
{
return
mToolBarItem
;
}
...
...
src/domain/UBGraphicsItemZLevelUndoCommand.cpp
View file @
ec85baff
...
...
@@ -59,7 +59,7 @@ void UBGraphicsItemZLevelUndoCommand::undo(){
if
(
mDest
==
UBZLayerController
::
down
||
mDest
==
UBZLayerController
::
bottom
){
// Move up
QList
<
QGraphicsItem
*>::
iterator
downIt
=
mItems
.
end
();
for
(
downIt
;
downIt
>=
mItems
.
begin
();
downIt
--
){
for
(;
downIt
>=
mItems
.
begin
();
downIt
--
){
for
(
int
i
=
0
;
i
<
zDiff
;
i
++
)
mpScene
->
changeZLevelTo
(
*
downIt
,
UBZLayerController
::
up
);
}
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
ec85baff
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsTextItemDelegate.h
View file @
ec85baff
...
...
@@ -37,6 +37,64 @@
class
UBGraphicsTextItem
;
class
AlignTextButton
:
public
DelegateButton
{
Q_OBJECT
public
:
static
const
int
MAX_KIND
=
3
;
enum
kind_t
{
k_left
=
0
,
k_center
,
k_right
,
k_mixed
};
AlignTextButton
(
const
QString
&
fileName
,
QGraphicsItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
,
Qt
::
WindowFrameSection
section
=
Qt
::
TopLeftSection
);
virtual
~
AlignTextButton
();
void
setKind
(
int
pKind
);
int
kind
()
{
return
mKind
;}
void
setNextKind
();
int
nextKind
()
const
;
void
setMixedButtonVisible
(
bool
v
=
true
)
{
mHideMixed
=
!
v
;}
bool
isMixedButtonVisible
()
{
return
!
mHideMixed
;}
private
:
QSvgRenderer
*
rndFromKind
(
int
pknd
)
{
switch
(
pknd
)
{
case
k_left
:
return
lft
;
break
;
case
k_center
:
return
cntr
;
break
;
case
k_right
:
return
rght
;
break
;
case
k_mixed
:
return
mxd
;
break
;
}
return
0
;
}
QSvgRenderer
*
curRnd
()
{
return
rndFromKind
(
mKind
);}
QPointer
<
QSvgRenderer
>
lft
;
QPointer
<
QSvgRenderer
>
cntr
;
QPointer
<
QSvgRenderer
>
rght
;
QPointer
<
QSvgRenderer
>
mxd
;
int
mKind
;
bool
mHideMixed
;
};
class
UBGraphicsTextItemDelegate
:
public
UBGraphicsItemDelegate
{
Q_OBJECT
...
...
@@ -67,8 +125,11 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
virtual
void
positionHandles
();
private
:
virtual
bool
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
UBGraphicsTextItem
*
delegated
();
DelegateButton
*
mFontButton
;
...
...
@@ -76,10 +137,7 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
DelegateButton
*
mDecreaseSizeButton
;
DelegateButton
*
mIncreaseSizeButton
;
DelegateButton
*
mAlignLeftButton
;
DelegateButton
*
mAlignCenterButton
;
DelegateButton
*
mAlignRightButton
;
DelegateButton
*
mAlighMixed
;
DelegateButton
*
mAlignButton
;
int
mLastFontPixelSize
;
...
...
@@ -89,9 +147,26 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
private
:
void
customize
(
QFontDialog
&
fontDialog
);
void
ChangeTextSize
(
qreal
factor
,
textChangeMode
changeMode
);
void
updateAlighButtonState
();
bool
oneBlockSelection
();
void
saveTextCursorFormats
();
void
restoreTextCursorFormats
();
QFont
createDefaultFont
();
QAction
*
mEditableAction
;
struct
selectionData_t
{
selectionData_t
()
:
mButtonIsPressed
(
false
)
{}
bool
mButtonIsPressed
;
int
position
;
int
anchor
;
QString
html
;
QTextDocumentFragment
selection
;
QList
<
QTextBlockFormat
>
fmts
;
}
mSelectionData
;
private
slots
:
...
...
@@ -101,9 +176,12 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
void
decreaseSize
();
void
increaseSize
();
void
alignButtonProcess
();
void
onCursorPositionChanged
(
const
QTextCursor
&
cursor
);
void
onModificationChanged
(
bool
ch
);
private
:
const
int
delta
;
};
#endif
/* UBGRAPHICSTEXTITEMDELEGATE_H_ */
src/domain/UBGraphicsWidgetItem.cpp
View file @
ec85baff
...
...
@@ -565,12 +565,9 @@ void UBGraphicsWidgetItem::injectInlineJavaScript()
void
UBGraphicsWidgetItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
if
(
scene
()
&&
scene
()
->
renderingContext
()
!=
UBGraphicsScene
::
Screen
)
{
painter
->
drawPixmap
(
0
,
0
,
snapshot
());
}
else
{
QGraphicsWebView
::
paint
(
painter
,
option
,
widget
);
}
QGraphicsWebView
::
paint
(
painter
,
option
,
widget
);
if
(
!
mInitialLoadDone
)
{
QString
message
;
...
...
src/domain/UBItem.cpp
View file @
ec85baff
...
...
@@ -85,6 +85,11 @@ bool UBGraphicsItem::isRotatable(QGraphicsItem *item)
return
item
->
data
(
UBGraphicsItemData
::
ItemRotatable
).
toBool
();
}
bool
UBGraphicsItem
::
isLocked
(
QGraphicsItem
*
item
)
{
return
item
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
();
}
QUuid
UBGraphicsItem
::
getOwnUuid
(
QGraphicsItem
*
item
)
{
QString
idCandidate
=
item
->
data
(
UBGraphicsItemData
::
ItemUuid
).
toString
();
...
...
src/domain/UBItem.h
View file @
ec85baff
...
...
@@ -116,6 +116,7 @@ public:
static
void
assignZValue
(
QGraphicsItem
*
,
qreal
value
);
static
bool
isRotatable
(
QGraphicsItem
*
item
);
static
bool
isFlippable
(
QGraphicsItem
*
item
);
static
bool
isLocked
(
QGraphicsItem
*
item
);
static
QUuid
getOwnUuid
(
QGraphicsItem
*
item
);
static
UBGraphicsItemDelegate
*
Delegate
(
QGraphicsItem
*
pItem
);
...
...
src/gui/UBDocumentTreeWidget.cpp
View file @
ec85baff
...
...
@@ -261,7 +261,7 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
UBDocumentProxyTreeItem
*
pi
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
ti
);
if
(
pi
)
{
if
(
mSelectedProxyTi
->
proxy
()
->
metaData
(
UBSettings
::
document
UpdatedAt
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentUpdatedAt
).
toString
())
if
(
mSelectedProxyTi
->
proxy
()
->
metaData
(
UBSettings
::
document
Date
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentDate
).
toString
())
{
break
;
}
...
...
@@ -380,7 +380,7 @@ void UBDocumentTreeWidget::documentUpdated(UBDocumentProxy *pDocument)
UBDocumentProxyTreeItem
*
pi
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
ti
);
if
(
pi
)
{
if
(
pDocument
->
metaData
(
UBSettings
::
document
UpdatedAt
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentUpdatedAt
).
toString
())
if
(
pDocument
->
metaData
(
UBSettings
::
document
Date
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentDate
).
toString
())
{
bool
selected
=
treeItem
->
isSelected
();
parent
->
removeChild
(
treeItem
);
...
...
@@ -416,7 +416,7 @@ UBDocumentProxyTreeItem::UBDocumentProxyTreeItem(QTreeWidgetItem * parent, UBDoc
UBDocumentProxyTreeItem
*
pi
=
dynamic_cast
<
UBDocumentProxyTreeItem
*>
(
ti
);
if
(
pi
)
{
if
(
proxy
->
metaData
(
UBSettings
::
document
UpdatedAt
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentUpdatedAt
).
toString
())
if
(
proxy
->
metaData
(
UBSettings
::
document
Date
).
toString
()
>=
pi
->
proxy
()
->
metaData
(
UBSettings
::
documentDate
).
toString
())
{
break
;
}
...
...
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