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
232730e3
Commit
232730e3
authored
Apr 12, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
e36c0c8e
33d2bfab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
16 deletions
+60
-16
UBImportDocument.cpp
src/adaptors/UBImportDocument.cpp
+1
-1
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+12
-2
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+1
-1
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+46
-12
No files found.
src/adaptors/UBImportDocument.cpp
View file @
232730e3
...
@@ -191,7 +191,7 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
...
@@ -191,7 +191,7 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
return
0
;
return
0
;
}
}
else
{
else
{
UBDocumentProxy
*
newDocument
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentFromDir
(
documentRootFolder
);
UBDocumentProxy
*
newDocument
=
UBPersistenceManager
::
persistenceManager
()
->
createDocumentFromDir
(
documentRootFolder
,
pGroup
);
UBApplication
::
showMessage
(
tr
(
"Import successful."
));
UBApplication
::
showMessage
(
tr
(
"Import successful."
));
return
newDocument
;
return
newDocument
;
}
}
...
...
src/core/UBPersistenceManager.cpp
View file @
232730e3
...
@@ -254,13 +254,23 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
...
@@ -254,13 +254,23 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
return
doc
;
return
doc
;
}
}
UBDocumentProxy
*
UBPersistenceManager
::
createDocumentFromDir
(
const
QString
&
pDocumentDirectory
,
const
QString
&
pGroupName
,
const
QString
&
pName
,
bool
withEmptyPage
)
UBDocumentProxy
*
UBPersistenceManager
::
createDocumentFromDir
(
const
QString
&
pDocumentDirectory
)
{
{
checkIfDocumentRepositoryExists
();
checkIfDocumentRepositoryExists
();
UBDocumentProxy
*
doc
=
new
UBDocumentProxy
(
pDocumentDirectory
);
// deleted in UBPersistenceManager::destructor
UBDocumentProxy
*
doc
=
new
UBDocumentProxy
(
pDocumentDirectory
);
// deleted in UBPersistenceManager::destructor
if
(
pGroupName
.
length
()
>
0
)
{
doc
->
setMetaData
(
UBSettings
::
documentGroupName
,
pGroupName
);
}
if
(
pName
.
length
()
>
0
)
{
doc
->
setMetaData
(
UBSettings
::
documentName
,
pName
);
}
if
(
withEmptyPage
)
createDocumentSceneAt
(
doc
,
0
);
QMap
<
QString
,
QVariant
>
metadatas
=
UBMetadataDcSubsetAdaptor
::
load
(
pDocumentDirectory
);
QMap
<
QString
,
QVariant
>
metadatas
=
UBMetadataDcSubsetAdaptor
::
load
(
pDocumentDirectory
);
foreach
(
QString
key
,
metadatas
.
keys
())
foreach
(
QString
key
,
metadatas
.
keys
())
...
...
src/core/UBPersistenceManager.h
View file @
232730e3
...
@@ -46,7 +46,7 @@ class UBPersistenceManager : public QObject
...
@@ -46,7 +46,7 @@ class UBPersistenceManager : public QObject
static
void
destroy
();
static
void
destroy
();
virtual
UBDocumentProxy
*
createDocument
(
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
true
);
virtual
UBDocumentProxy
*
createDocument
(
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
true
);
virtual
UBDocumentProxy
*
createDocumentFromDir
(
const
QString
&
pDocumentDirectory
);
virtual
UBDocumentProxy
*
createDocumentFromDir
(
const
QString
&
pDocumentDirectory
,
const
QString
&
pGroupName
=
""
,
const
QString
&
pName
=
""
,
bool
withEmptyPage
=
false
);
virtual
UBDocumentProxy
*
persistDocumentMetadata
(
UBDocumentProxy
*
pDocumentProxy
);
virtual
UBDocumentProxy
*
persistDocumentMetadata
(
UBDocumentProxy
*
pDocumentProxy
);
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
232730e3
...
@@ -254,10 +254,10 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -254,10 +254,10 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
qreal
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
width
=
delegated
()
->
boundingRect
().
width
()
*
mTotalScaleX
;
qreal
width
=
delegated
()
->
boundingRect
().
width
()
*
mTotalScaleX
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
mTranslateX
=
moveX
;
if
(
mOperationMode
==
Scaling
)
if
(
mOperationMode
==
Scaling
)
{
{
mTranslateX
=
moveX
;
// Perform the resize
// Perform the resize
if
(
resizingBottomRight
())
if
(
resizingBottomRight
())
{
{
...
@@ -353,6 +353,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -353,6 +353,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
else
if
(
mOperationMode
==
Resizing
)
else
if
(
mOperationMode
==
Resizing
)
{
{
mTranslateX
=
moveX
;
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
delegated
());
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
delegated
());
if
(
resizableItem
)
if
(
resizableItem
)
...
@@ -390,12 +391,14 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -390,12 +391,14 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if
(
rotating
())
if
(
rotating
())
{
{
mTranslateX
=
0
;
mTranslateY
=
0
;
QLineF
startLine
(
sceneBoundingRect
().
center
(),
event
->
lastScenePos
());
QLineF
startLine
(
sceneBoundingRect
().
center
(),
event
->
lastScenePos
());
QLineF
currentLine
(
sceneBoundingRect
().
center
(),
event
->
scenePos
());
QLineF
currentLine
(
sceneBoundingRect
().
center
(),
event
->
scenePos
());
mAngle
+=
startLine
.
angleTo
(
currentLine
);
mAngle
+=
startLine
.
angleTo
(
currentLine
);
if
((
int
)
mAngle
%
45
>=
45
-
mAngleTolerance
if
((
int
)
mAngle
%
45
>=
45
-
mAngleTolerance
||
(
int
)
mAngle
%
45
<=
mAngleTolerance
)
||
(
int
)
mAngle
%
45
<=
mAngleTolerance
)
{
{
mAngle
=
qRound
(
mAngle
/
45
)
*
45
;
mAngle
=
qRound
(
mAngle
/
45
)
*
45
;
mAngleOffset
+=
startLine
.
angleTo
(
currentLine
);
mAngleOffset
+=
startLine
.
angleTo
(
currentLine
);
...
@@ -405,8 +408,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -405,8 +408,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
mAngleOffset
=
0
;
mAngleOffset
=
0
;
}
}
}
}
else
if
((
int
)
mAngle
%
30
>=
30
-
mAngleTolerance
else
if
((
int
)
mAngle
%
30
>=
30
-
mAngleTolerance
||
(
int
)
mAngle
%
30
<=
mAngleTolerance
)
||
(
int
)
mAngle
%
30
<=
mAngleTolerance
)
{
{
mAngle
=
qRound
(
mAngle
/
30
)
*
30
;
mAngle
=
qRound
(
mAngle
/
30
)
*
30
;
mAngleOffset
+=
startLine
.
angleTo
(
currentLine
);
mAngleOffset
+=
startLine
.
angleTo
(
currentLine
);
...
@@ -498,10 +500,16 @@ QTransform UBGraphicsDelegateFrame::buildTransform()
...
@@ -498,10 +500,16 @@ QTransform UBGraphicsDelegateFrame::buildTransform()
{
{
QTransform
tr
;
QTransform
tr
;
QPointF
center
=
delegated
()
->
boundingRect
().
center
();
QPointF
center
=
delegated
()
->
boundingRect
().
center
();
// Translate
tr
.
translate
(
mTotalTranslateX
+
mTranslateX
,
mTotalTranslateY
+
mTranslateY
);
tr
.
translate
(
mTotalTranslateX
+
mTranslateX
,
mTotalTranslateY
+
mTranslateY
);
// Set angle
tr
.
translate
(
center
.
x
()
*
mTotalScaleX
*
mScaleX
,
center
.
y
()
*
mTotalScaleY
*
mScaleY
);
tr
.
translate
(
center
.
x
()
*
mTotalScaleX
*
mScaleX
,
center
.
y
()
*
mTotalScaleY
*
mScaleY
);
tr
.
rotate
(
-
mAngle
);
tr
.
rotate
(
-
mAngle
);
tr
.
translate
(
-
center
.
x
()
*
mTotalScaleX
*
mScaleX
,
-
center
.
y
()
*
mTotalScaleY
*
mScaleY
);
tr
.
translate
(
-
center
.
x
()
*
mTotalScaleX
*
mScaleX
,
-
center
.
y
()
*
mTotalScaleY
*
mScaleY
);
// Scale
tr
.
scale
(
mTotalScaleX
*
mScaleX
,
mTotalScaleY
*
mScaleY
);
tr
.
scale
(
mTotalScaleX
*
mScaleX
,
mTotalScaleY
*
mScaleY
);
return
tr
;
return
tr
;
}
}
...
@@ -565,35 +573,53 @@ void UBGraphicsDelegateFrame::setVisible(bool visible)
...
@@ -565,35 +573,53 @@ void UBGraphicsDelegateFrame::setVisible(bool visible)
void
UBGraphicsDelegateFrame
::
positionHandles
()
void
UBGraphicsDelegateFrame
::
positionHandles
()
{
{
// TODO: Check why the height is modified if the user rotates the item more than 90°
QRectF
itemRect
=
delegated
()
->
boundingRect
();
QRectF
itemRect
=
delegated
()
->
boundingRect
();
QTransform
itemTransform
=
delegated
()
->
sceneTransform
();
QTransform
itemTransform
=
delegated
()
->
sceneTransform
();
QPointF
topLeft
=
itemTransform
.
map
(
itemRect
.
topLeft
());
QPointF
topLeft
=
itemTransform
.
map
(
itemRect
.
topLeft
());
QPointF
topRight
=
itemTransform
.
map
(
itemRect
.
topRight
());
QPointF
topRight
=
itemTransform
.
map
(
itemRect
.
topRight
());
QPointF
bottomLeft
=
itemTransform
.
map
(
itemRect
.
bottomLeft
());
QPointF
bottomLeft
=
itemTransform
.
map
(
itemRect
.
bottomLeft
());
QPointF
bottomRight
=
itemTransform
.
map
(
itemRect
.
bottomRight
());
QPointF
center
=
itemTransform
.
map
(
itemRect
.
center
());
QPointF
center
=
itemTransform
.
map
(
itemRect
.
center
());
int
rotateHeight
=
QLineF
(
topLeft
,
bottomLeft
).
length
();
// Handle the mirroring
// Handle the mirroring
if
(
topLeft
.
x
()
>
topRight
.
x
()){
if
(
topLeft
.
x
()
>
topRight
.
x
()){
QPointF
tmp
=
topRight
;
QPointF
topTmp
=
topRight
;
QPointF
bottomTmp
=
bottomRight
;
topRight
=
topLeft
;
topRight
=
topLeft
;
topLeft
=
tmp
;
topLeft
=
topTmp
;
bottomLeft
.
setX
(
topLeft
.
x
());
bottomRight
=
bottomLeft
;
bottomLeft
=
bottomTmp
;
}
if
(
bottomLeft
.
y
()
>
topLeft
.
y
()){
QPointF
leftTmp
=
bottomLeft
;
QPointF
rightTmp
=
bottomRight
;
bottomLeft
=
topLeft
;
topLeft
=
leftTmp
;
bottomRight
=
topRight
;
topRight
=
rightTmp
;
}
}
QLineF
topLine
(
topLeft
,
topRight
);
QLineF
topLine
(
topLeft
,
topRight
);
qreal
angle
=
topLine
.
angle
();
qreal
angle
=
topLine
.
angle
();
qreal
width
=
topLine
.
length
();
qreal
width
=
topLine
.
length
();
QLineF
leftLine
(
topLeft
,
bottomLeft
);
QLineF
leftLine
(
topLeft
,
bottomLeft
);
qreal
height
=
leftLine
.
length
();
qreal
height
=
leftLine
.
length
();
int
h
=
rotating
()
?
rotateHeight
:
height
;
if
(
mVisible
)
if
(
mVisible
)
{
{
setRect
(
center
.
x
()
-
mFrameWidth
-
width
/
2
,
center
.
y
()
-
mFrameWidth
-
height
/
2
,
qDebug
()
<<
center
.
y
();
width
+
2
*
mFrameWidth
,
height
+
2
*
mFrameWidth
);
setRect
(
center
.
x
()
-
mFrameWidth
-
width
/
2
,
center
.
y
()
-
mFrameWidth
-
h
/
2
,
width
+
2
*
mFrameWidth
,
h
+
2
*
mFrameWidth
);
}
}
else
else
{
{
setRect
(
center
.
x
()
-
width
/
2
,
center
.
y
()
-
h
eight
/
2
,
width
,
height
);
setRect
(
center
.
x
()
-
width
/
2
,
center
.
y
()
-
h
/
2
,
width
,
h
);
}
}
resetTransform
();
resetTransform
();
...
@@ -680,30 +706,38 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
...
@@ -680,30 +706,38 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
return
ResizeBottomRight
;
return
ResizeBottomRight
;
else
if
(
bottomResizeGripRect
().
contains
(
pos
)){
else
if
(
bottomResizeGripRect
().
contains
(
pos
)){
if
(
mMirrorY
){
if
(
mMirrorY
){
qDebug
()
<<
"Top"
;
return
ResizeTop
;
return
ResizeTop
;
}
else
{
}
else
{
qDebug
()
<<
"Bottom"
;
return
ResizeBottom
;
return
ResizeBottom
;
}
}
}
}
else
if
(
leftResizeGripRect
().
contains
(
pos
)){
else
if
(
leftResizeGripRect
().
contains
(
pos
)){
if
(
mMirrorX
){
if
(
mMirrorX
){
qDebug
()
<<
"Right"
;
return
ResizeRight
;
return
ResizeRight
;
}
else
{
}
else
{
qDebug
()
<<
"Left"
;
return
ResizeLeft
;
return
ResizeLeft
;
}
}
return
ResizeLeft
;
return
ResizeLeft
;
}
}
else
if
(
rightResizeGripRect
().
contains
(
pos
)){
else
if
(
rightResizeGripRect
().
contains
(
pos
)){
if
(
mMirrorX
){
if
(
mMirrorX
){
qDebug
()
<<
"Left"
;
return
ResizeLeft
;
return
ResizeLeft
;
}
else
{
}
else
{
qDebug
()
<<
"Right"
;
return
ResizeRight
;
return
ResizeRight
;
}
}
}
}
else
if
(
topResizeGripRect
().
contains
(
pos
)){
else
if
(
topResizeGripRect
().
contains
(
pos
)){
if
(
mMirrorY
){
if
(
mMirrorY
){
qDebug
()
<<
"Bottom"
;
return
ResizeBottom
;
return
ResizeBottom
;
}
else
{
}
else
{
qDebug
()
<<
"Top"
;
return
ResizeTop
;
return
ResizeTop
;
}
}
}
}
...
...
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