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
8ee8b59b
Commit
8ee8b59b
authored
Oct 02, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed duplication of groups.
parent
ef262fdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
34 deletions
+33
-34
UBBoardController.cpp
src/board/UBBoardController.cpp
+32
-33
UBBoardController.h
src/board/UBBoardController.h
+1
-1
No files found.
src/board/UBBoardController.cpp
View file @
8ee8b59b
...
@@ -537,7 +537,7 @@ void UBBoardController::duplicateScene()
...
@@ -537,7 +537,7 @@ void UBBoardController::duplicateScene()
duplicateScene
(
mActiveSceneIndex
);
duplicateScene
(
mActiveSceneIndex
);
}
}
UBGraphicsItem
*
UBBoardController
::
duplicateItem
(
UBItem
*
item
)
UBGraphicsItem
*
UBBoardController
::
duplicateItem
(
UBItem
*
item
,
bool
bAsync
)
{
{
if
(
!
item
)
if
(
!
item
)
return
NULL
;
return
NULL
;
...
@@ -593,9 +593,13 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
...
@@ -593,9 +593,13 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
if
(
mitem
)
if
(
mitem
)
{
{
sourceUrl
=
mitem
->
mediaFileUrl
();
sourceUrl
=
mitem
->
mediaFileUrl
();
downloadURL
(
sourceUrl
,
srcFile
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
,
false
);
if
(
bAsync
)
{
downloadURL
(
sourceUrl
,
srcFile
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
,
false
);
return
NULL
;
// async operation
}
}
}
}
return
NULL
;
// async operation
}
break
;
case
UBMimeType
:
:
VectorImage
:
case
UBMimeType
:
:
VectorImage
:
{
{
...
@@ -621,35 +625,22 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
...
@@ -621,35 +625,22 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
case
UBMimeType
:
:
Group
:
case
UBMimeType
:
:
Group
:
{
{
UBGraphicsGroupContainerItem
*
groupItem
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
UBGraphicsGroupContainerItem
*
groupItem
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
UBGraphicsGroupContainerItem
*
duplicatedGroup
=
NULL
;
UBGraphicsGroupContainerItem
*
duplicatedGroup
=
new
UBGraphicsGroupContainerItem
();
if
(
groupItem
){
QTransform
groupTransform
=
groupItem
->
transform
();
QList
<
QGraphicsItem
*>
children
=
groupItem
->
childItems
();
groupItem
->
resetTransform
();
foreach
(
QGraphicsItem
*
pIt
,
children
){
UBItem
*
pItem
=
dynamic_cast
<
UBItem
*>
(
pIt
);
QList
<
QGraphicsItem
*>
children
=
groupItem
->
childItems
();
if
(
pItem
)
// we diong sync duplication of all childs.
foreach
(
QGraphicsItem
*
pIt
,
children
){
duplicatedGroup
->
addToGroup
(
dynamic_cast
<
QGraphicsItem
*>
(
duplicateItem
(
pItem
,
false
)));
UBItem
*
pItem
=
dynamic_cast
<
UBItem
*>
(
pIt
);
}
if
(
NULL
!=
pItem
){
duplicateItem
(
pItem
);
duplicatedGroup
->
setTransform
(
groupItem
->
transform
());
}
groupItem
->
setSelected
(
false
);
}
groupItem
->
setTransform
(
groupTransform
);
retItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
duplicatedGroup
);
groupItem
->
setSelected
(
false
);
UBApplication
::
mainWindow
->
actionGroupItems
->
trigger
();
}
break
;
QList
<
QGraphicsItem
*>
selItems
=
mActiveScene
->
selectedItems
();
if
(
!
selItems
.
empty
()){
// I don't like this solution but for now this is the only way I found.
// Normally, at this state, only the duplicated group should be selected
duplicatedGroup
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
selItems
.
at
(
0
));
if
(
NULL
!=
duplicatedGroup
){
duplicatedGroup
->
setTransform
(
groupTransform
);
}
}
}
retItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
duplicatedGroup
);
break
;
}
case
UBMimeType
:
:
UNKNOWN
:
case
UBMimeType
:
:
UNKNOWN
:
{
{
...
@@ -666,9 +657,17 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
...
@@ -666,9 +657,17 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
}
}
if
(
retItem
)
if
(
retItem
)
{
QGraphicsItem
*
itemToAdd
=
dynamic_cast
<
QGraphicsItem
*>
(
retItem
);
if
(
itemToAdd
)
{
mActiveScene
->
addItem
(
itemToAdd
);
itemToAdd
->
setSelected
(
true
);
}
return
retItem
;
return
retItem
;
}
UBItem
*
createdItem
=
downloadFinished
(
true
,
sourceUrl
,
s
ourceUrl
,
contentTypeHeader
,
pData
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
);
UBItem
*
createdItem
=
downloadFinished
(
true
,
sourceUrl
,
s
rcFile
,
contentTypeHeader
,
pData
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
);
if
(
createdItem
)
if
(
createdItem
)
{
{
createdItem
->
setSourceUrl
(
item
->
sourceUrl
());
createdItem
->
setSourceUrl
(
item
->
sourceUrl
());
...
...
src/board/UBBoardController.h
View file @
8ee8b59b
...
@@ -159,7 +159,7 @@ class UBBoardController : public UBDocumentContainer
...
@@ -159,7 +159,7 @@ class UBBoardController : public UBDocumentContainer
void
moveSceneToIndex
(
int
source
,
int
target
);
void
moveSceneToIndex
(
int
source
,
int
target
);
void
duplicateScene
(
int
index
);
void
duplicateScene
(
int
index
);
UBGraphicsItem
*
duplicateItem
(
UBItem
*
item
);
UBGraphicsItem
*
duplicateItem
(
UBItem
*
item
,
bool
bAsync
=
true
);
void
deleteScene
(
int
index
);
void
deleteScene
(
int
index
);
bool
cacheIsVisible
()
{
return
mCacheWidgetIsEnabled
;}
bool
cacheIsVisible
()
{
return
mCacheWidgetIsEnabled
;}
...
...
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