|
|
@ -984,22 +984,36 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const |
|
|
|
|| contentType.startsWith("application/widget") |
|
|
|
|| contentType.startsWith("application/widget") |
|
|
|
|| contentType.startsWith("application/vnd.apple-widget"); |
|
|
|
|| contentType.startsWith("application/vnd.apple-widget"); |
|
|
|
|
|
|
|
|
|
|
|
QFile file(fileName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shouldLoadFileData) |
|
|
|
if (shouldLoadFileData) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QFile file(fileName); |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
|
|
|
|
|
|
|
|
downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); |
|
|
|
|
|
|
|
|
|
|
|
if (shouldLoadFileData) |
|
|
|
|
|
|
|
file.close(); |
|
|
|
file.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// media items should be copyed in separate thread
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sDownloadFileDesc desc; |
|
|
|
|
|
|
|
desc.modal = false; |
|
|
|
|
|
|
|
desc.srcUrl = sUrl; |
|
|
|
|
|
|
|
desc.currentSize = 0; |
|
|
|
|
|
|
|
desc.name = QFileInfo(url.toString()).fileName(); |
|
|
|
|
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
|
|
|
|
|
desc.pos = pPos; |
|
|
|
|
|
|
|
desc.size = pSize; |
|
|
|
|
|
|
|
desc.isBackground = isBackground; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBDownloadManager::downloadManager()->addFileToDownload(desc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// When we fall there, it means that we are dropping something from the web to the board
|
|
|
|
// When we fall there, it means that we are dropping something from the web to the board
|
|
|
|
sDownloadFileDesc desc; |
|
|
|
sDownloadFileDesc desc; |
|
|
|
desc.modal = true; |
|
|
|
desc.modal = true; |
|
|
|
desc.url = url.toString(); |
|
|
|
desc.srcUrl = url.toString(); |
|
|
|
desc.currentSize = 0; |
|
|
|
desc.currentSize = 0; |
|
|
|
desc.name = QFileInfo(url.toString()).fileName(); |
|
|
|
desc.name = QFileInfo(url.toString()).fileName(); |
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
@ -1157,11 +1171,9 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
qDebug() << "accepting mime type" << mimeType << "as video"; |
|
|
|
qDebug() << "accepting mime type" << mimeType << "as video"; |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem *mediaVideoItem = 0; |
|
|
|
UBGraphicsMediaItem *mediaVideoItem = 0; |
|
|
|
|
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
if (pData.length() > 0) |
|
|
|
if (pData.length() > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
sourceUrl.toString(), |
|
|
|
sourceUrl.toString(), |
|
|
@ -1178,16 +1190,16 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
QUrl url = QUrl::fromLocalFile(destFile); |
|
|
|
QUrl url = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
|
|
|
|
mediaVideoItem = mActiveScene->addMedia(url, false, pPos); |
|
|
|
mediaVideoItem = mActiveScene->addMedia(url, false, pPos); |
|
|
|
|
|
|
|
|
|
|
|
mediaVideoItem->setSourceUrl(sourceUrl); |
|
|
|
|
|
|
|
mediaVideoItem->setUuid(uuid); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
mediaVideoItem = addVideo(sourceUrl, false, pPos); |
|
|
|
qDebug() << sourceUrl.toString(); |
|
|
|
|
|
|
|
mediaVideoItem = addVideo(sourceUrl, false, pPos, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(mediaVideoItem){ |
|
|
|
if(mediaVideoItem){ |
|
|
|
|
|
|
|
mediaVideoItem->setSourceUrl(sourceUrl); |
|
|
|
|
|
|
|
mediaVideoItem->setUuid(uuid); |
|
|
|
connect(this, SIGNAL(activeSceneChanged()), mediaVideoItem, SLOT(activeSceneChanged())); |
|
|
|
connect(this, SIGNAL(activeSceneChanged()), mediaVideoItem, SLOT(activeSceneChanged())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1201,10 +1213,9 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem *audioMediaItem = 0; |
|
|
|
UBGraphicsMediaItem *audioMediaItem = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
if (pData.length() > 0) |
|
|
|
if (pData.length() > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
sourceUrl.toString(), |
|
|
|
sourceUrl.toString(), |
|
|
@ -1221,16 +1232,15 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri |
|
|
|
QUrl url = QUrl::fromLocalFile(destFile); |
|
|
|
QUrl url = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
|
|
|
|
audioMediaItem = mActiveScene->addMedia(url, false, pPos); |
|
|
|
audioMediaItem = mActiveScene->addMedia(url, false, pPos); |
|
|
|
|
|
|
|
|
|
|
|
audioMediaItem->setSourceUrl(sourceUrl); |
|
|
|
|
|
|
|
audioMediaItem->setUuid(uuid); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
audioMediaItem = addAudio(sourceUrl, false, pPos); |
|
|
|
audioMediaItem = addAudio(sourceUrl, false, pPos, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(audioMediaItem){ |
|
|
|
if(audioMediaItem){ |
|
|
|
|
|
|
|
audioMediaItem->setSourceUrl(sourceUrl); |
|
|
|
|
|
|
|
audioMediaItem->setUuid(uuid); |
|
|
|
connect(this, SIGNAL(activeSceneChanged()), audioMediaItem, SLOT(activeSceneChanged())); |
|
|
|
connect(this, SIGNAL(activeSceneChanged()), audioMediaItem, SLOT(activeSceneChanged())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2023,11 +2033,14 @@ void UBBoardController::grabScene(const QRectF& pSceneRect) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos) |
|
|
|
UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos, bool bUseSource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QUrl concreteUrl = pSourceUrl; |
|
|
|
QUrl concreteUrl = pSourceUrl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// media file is not in document folder yet
|
|
|
|
|
|
|
|
if (!bUseSource) |
|
|
|
|
|
|
|
{ |
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
pSourceUrl.toLocalFile(), |
|
|
|
pSourceUrl.toLocalFile(), |
|
|
@ -2040,6 +2053,8 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
}// else we just use source Url.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem* vi = mActiveScene->addMedia(concreteUrl, startPlay, pos); |
|
|
|
UBGraphicsMediaItem* vi = mActiveScene->addMedia(concreteUrl, startPlay, pos); |
|
|
|
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
@ -2053,11 +2068,14 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos) |
|
|
|
UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool startPlay, const QPointF& pos, bool bUseSource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QUrl concreteUrl = pSourceUrl; |
|
|
|
QUrl concreteUrl = pSourceUrl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// media file is not in document folder yet
|
|
|
|
|
|
|
|
if (!bUseSource) |
|
|
|
|
|
|
|
{ |
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
|
|
|
|
pSourceUrl.toLocalFile(), |
|
|
|
pSourceUrl.toLocalFile(), |
|
|
@ -2070,6 +2088,7 @@ UBGraphicsMediaItem* UBBoardController::addAudio(const QUrl& pSourceUrl, bool st |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
}// else we just use source Url.
|
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem* ai = mActiveScene->addMedia(concreteUrl, startPlay, pos); |
|
|
|
UBGraphicsMediaItem* ai = mActiveScene->addMedia(concreteUrl, startPlay, pos); |
|
|
|
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
selectedDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|