|
|
@ -568,7 +568,10 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync) |
|
|
|
if (srcFile.isEmpty()) |
|
|
|
if (srcFile.isEmpty()) |
|
|
|
srcFile = item->sourceUrl().toString(); |
|
|
|
srcFile = item->sourceUrl().toString(); |
|
|
|
|
|
|
|
|
|
|
|
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(srcFile); |
|
|
|
QString contentTypeHeader; |
|
|
|
|
|
|
|
if (!srcFile.isEmpty()) |
|
|
|
|
|
|
|
contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(srcFile); |
|
|
|
|
|
|
|
|
|
|
|
if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem)) |
|
|
|
if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem)) |
|
|
|
itemMimeType = UBMimeType::Group; |
|
|
|
itemMimeType = UBMimeType::Group; |
|
|
|
else
|
|
|
|
else
|
|
|
@ -626,20 +629,30 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync) |
|
|
|
case UBMimeType::Group: |
|
|
|
case UBMimeType::Group: |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsGroupContainerItem* groupItem = dynamic_cast<UBGraphicsGroupContainerItem*>(item); |
|
|
|
UBGraphicsGroupContainerItem* groupItem = dynamic_cast<UBGraphicsGroupContainerItem*>(item); |
|
|
|
UBGraphicsGroupContainerItem* duplicatedGroup = new UBGraphicsGroupContainerItem(); |
|
|
|
UBGraphicsGroupContainerItem* duplicatedGroup = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QList<QGraphicsItem*> duplicatedItems; |
|
|
|
QList<QGraphicsItem*> children = groupItem->childItems(); |
|
|
|
QList<QGraphicsItem*> children = groupItem->childItems(); |
|
|
|
foreach(QGraphicsItem* pIt, children){ |
|
|
|
foreach(QGraphicsItem* pIt, children){ |
|
|
|
UBItem* pItem = dynamic_cast<UBItem*>(pIt); |
|
|
|
UBItem* pItem = dynamic_cast<UBItem*>(pIt); |
|
|
|
if(pItem) // we diong sync duplication of all childs.
|
|
|
|
if(pItem){ // we diong sync duplication of all childs.
|
|
|
|
duplicatedGroup->addToGroup(dynamic_cast<QGraphicsItem *>(duplicateItem(pItem, false))); |
|
|
|
QGraphicsItem * itemToGroup = dynamic_cast<QGraphicsItem *>(duplicateItem(pItem, false)); |
|
|
|
|
|
|
|
if (itemToGroup) |
|
|
|
|
|
|
|
duplicatedItems.append(itemToGroup); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
duplicatedGroup = mActiveScene->createGroup(duplicatedItems); |
|
|
|
duplicatedGroup->setTransform(groupItem->transform()); |
|
|
|
duplicatedGroup->setTransform(groupItem->transform()); |
|
|
|
groupItem->setSelected(false); |
|
|
|
groupItem->setSelected(false); |
|
|
|
|
|
|
|
|
|
|
|
retItem = dynamic_cast<UBGraphicsItem *>(duplicatedGroup); |
|
|
|
retItem = dynamic_cast<UBGraphicsItem *>(duplicatedGroup); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGraphicsItem * itemToAdd = dynamic_cast<QGraphicsItem *>(retItem); |
|
|
|
|
|
|
|
if (itemToAdd) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mActiveScene->addItem(itemToAdd); |
|
|
|
|
|
|
|
itemToAdd->setSelected(true); |
|
|
|
|
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
|
|
|
|
|
|
|
|
case UBMimeType::UNKNOWN: |
|
|
|
case UBMimeType::UNKNOWN: |
|
|
@ -657,15 +670,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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, srcFile, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false); |
|
|
|
UBItem *createdItem = downloadFinished(true, sourceUrl, srcFile, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false); |
|
|
|
if (createdItem) |
|
|
|
if (createdItem) |
|
|
|