|
|
|
@ -131,7 +131,7 @@ void UBBoardController::init() |
|
|
|
|
, this, SLOT(lastWindowClosed())); |
|
|
|
|
|
|
|
|
|
connect(UBDownloadManager::downloadManager(), SIGNAL(downloadModalFinished()), this, SLOT(onDownloadModalFinished())); |
|
|
|
|
connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToBoard(bool,QUrl,QString,QByteArray,QPointF,QSize,bool)), this, SLOT(downloadFinished(bool,QUrl,QString,QByteArray,QPointF,QSize,bool))); |
|
|
|
|
connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToBoard(bool,QUrl,QUrl,QString,QByteArray,QPointF,QSize,bool)), this, SLOT(downloadFinished(bool,QUrl,QUrl,QString,QByteArray,QPointF,QSize,bool))); |
|
|
|
|
|
|
|
|
|
UBDocumentProxy* doc = UBPersistenceManager::persistenceManager()->createDocument(); |
|
|
|
|
|
|
|
|
@ -562,7 +562,12 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UBMimeType::Enum itemMimeType; |
|
|
|
|
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(item->sourceUrl().toLocalFile()); |
|
|
|
|
|
|
|
|
|
QString srcFile = item->sourceUrl().toLocalFile(); |
|
|
|
|
if (srcFile.isEmpty()) |
|
|
|
|
srcFile = item->sourceUrl().toString(); |
|
|
|
|
|
|
|
|
|
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(srcFile); |
|
|
|
|
if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem)) |
|
|
|
|
itemMimeType = UBMimeType::Group; |
|
|
|
|
else
|
|
|
|
@ -587,6 +592,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item) |
|
|
|
|
if (mitem) |
|
|
|
|
{ |
|
|
|
|
sourceUrl = mitem->mediaFileUrl(); |
|
|
|
|
downloadURL(sourceUrl, srcFile, itemPos, QSize(itemSize.width(), itemSize.height()), false, false);
|
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
|
|
|
|
@ -661,7 +667,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item) |
|
|
|
|
if (retItem) |
|
|
|
|
return retItem; |
|
|
|
|
|
|
|
|
|
UBItem *createdItem = downloadFinished(true, sourceUrl, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false); |
|
|
|
|
UBItem *createdItem = downloadFinished(true, sourceUrl, sourceUrl, contentTypeHeader, pData, itemPos, QSize(itemSize.width(), itemSize.height()), false); |
|
|
|
|
if (createdItem) |
|
|
|
|
{ |
|
|
|
|
createdItem->setSourceUrl(item->sourceUrl()); |
|
|
|
@ -675,6 +681,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item) |
|
|
|
|
|
|
|
|
|
retItem = dynamic_cast<UBGraphicsItem *>(createdItem); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return retItem; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -960,7 +967,7 @@ void UBBoardController::groupButtonClicked() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const QSize& pSize, bool isBackground, bool internalData) |
|
|
|
|
void UBBoardController::downloadURL(const QUrl& url, QString contentSourceUrl, const QPointF& pPos, const QSize& pSize, bool isBackground, bool internalData) |
|
|
|
|
{ |
|
|
|
|
qDebug() << "something has been dropped on the board! Url is: " << url.toString(); |
|
|
|
|
QString sUrl = url.toString(); |
|
|
|
@ -971,7 +978,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
|
|
|
|
|
|
if(sUrl.startsWith("uniboardTool://")) |
|
|
|
|
{ |
|
|
|
|
downloadFinished(true, url, "application/vnd.mnemis-uniboard-tool", QByteArray(), pPos, pSize, isBackground); |
|
|
|
|
downloadFinished(true, url, QUrl(), "application/vnd.mnemis-uniboard-tool", QByteArray(), pPos, pSize, isBackground); |
|
|
|
|
} |
|
|
|
|
else if (sUrl.startsWith("file://") || sUrl.startsWith("/")) |
|
|
|
|
{ |
|
|
|
@ -988,7 +995,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
|
{ |
|
|
|
|
QFile file(fileName); |
|
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
|
downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
|
downloadFinished(true, formedUrl, QUrl(), contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
|
file.close(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -998,6 +1005,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
|
sDownloadFileDesc desc; |
|
|
|
|
desc.modal = false; |
|
|
|
|
desc.srcUrl = sUrl; |
|
|
|
|
desc.originalSrcUrl = contentSourceUrl; |
|
|
|
|
desc.currentSize = 0; |
|
|
|
|
desc.name = QFileInfo(url.toString()).fileName(); |
|
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
|
@ -1036,7 +1044,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, |
|
|
|
|
UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pContentTypeHeader, |
|
|
|
|
QByteArray pData, QPointF pPos, QSize pSize, |
|
|
|
|
bool isBackground, bool internalData) |
|
|
|
|
{ |
|
|
|
@ -1198,7 +1206,10 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(mediaVideoItem){ |
|
|
|
|
if (contentUrl.isEmpty()) |
|
|
|
|
mediaVideoItem->setSourceUrl(sourceUrl); |
|
|
|
|
else
|
|
|
|
|
mediaVideoItem->setSourceUrl(contentUrl); |
|
|
|
|
mediaVideoItem->setUuid(uuid); |
|
|
|
|
connect(this, SIGNAL(activeSceneChanged()), mediaVideoItem, SLOT(activeSceneChanged())); |
|
|
|
|
} |
|
|
|
@ -1239,7 +1250,10 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(audioMediaItem){ |
|
|
|
|
if (contentUrl.isEmpty()) |
|
|
|
|
audioMediaItem->setSourceUrl(sourceUrl); |
|
|
|
|
else
|
|
|
|
|
audioMediaItem->setSourceUrl(contentUrl); |
|
|
|
|
audioMediaItem->setUuid(uuid); |
|
|
|
|
connect(this, SIGNAL(activeSceneChanged()), audioMediaItem, SLOT(activeSceneChanged())); |
|
|
|
|
} |
|
|
|
@ -2262,7 +2276,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint |
|
|
|
|
|
|
|
|
|
if("" != url) |
|
|
|
|
{ |
|
|
|
|
downloadURL(url, pPos); |
|
|
|
|
downloadURL(url, QString(), pPos); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2282,7 +2296,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint |
|
|
|
|
foreach(const QUrl url, urls){ |
|
|
|
|
QPointF pos(pPos + QPointF(index * 15, index * 15)); |
|
|
|
|
|
|
|
|
|
downloadURL(url, pos, QSize(), false, internalData); |
|
|
|
|
downloadURL(url, QString(), pos, QSize(), false, internalData); |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2308,7 +2322,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint |
|
|
|
|
// Sometimes, it is possible to have an URL as text. we check here if it is the case
|
|
|
|
|
QString qsTmp = pMimeData->text().remove(QRegExp("[\\0]")); |
|
|
|
|
if(qsTmp.startsWith("http")){ |
|
|
|
|
downloadURL(QUrl(qsTmp), pPos); |
|
|
|
|
downloadURL(QUrl(qsTmp), QString(), pPos); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
mActiveScene->addTextHtml(pMimeData->html(), pPos); |
|
|
|
|