Third step to fix the bug 27

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent ea9ddcff3f
commit fdc9e7ca6f
  1. 24
      src/adaptors/UBImportAdaptor.cpp
  2. 6
      src/core/UBPersistenceManager.cpp
  3. 36
      src/domain/UBGraphicsScene.cpp
  4. 2
      src/domain/UBGraphicsWidgetItem.h

@ -53,27 +53,3 @@ UBDocumentBasedImportAdaptor::UBDocumentBasedImportAdaptor(QObject *parent)
{
// NOOP
}
/*
UBDocumentProxy* UBImportAdaptor::importFile(const QFile& pFile, const QString& pGroup)
{
QString documentName = QFileInfo(pFile.fileName()).completeBaseName();
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocument(pGroup, documentName);
bool result = addFileToDocument(newDocument, pFile);
if (result)
{
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(newDocument);
}
else
{
UBPersistenceManager::persistenceManager()->deleteDocument(newDocument);
newDocument = 0;
}
return newDocument;
}
*/

@ -255,7 +255,7 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
}
doc->setMetaData(UBSettings::documentVersion, UBSettings::currentFileVersion);
QString currentDate = UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime());
QString currentDate = UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime());
doc->setMetaData(UBSettings::documentUpdatedAt,currentDate);
doc->setMetaData(UBSettings::documentDate,currentDate);
@ -396,12 +396,14 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
foreach(int index, compactedIndexes)
{
// trig the reload of the thumbnails
emit documentSceneWillBeDeleted(proxy, index);
}
QString sourceGroupName = proxy->metaData(UBSettings::documentGroupName).toString();
QString sourceName = proxy->metaData(UBSettings::documentName).toString();
UBDocumentProxy *trashDocProxy = createDocument(UBSettings::trashedDocumentGroupNamePrefix + sourceGroupName, sourceName, false);
generatePathIfNeeded(trashDocProxy);
foreach(int index, compactedIndexes)
{
@ -418,7 +420,7 @@ void UBPersistenceManager::deleteDocumentScenes(UBDocumentProxy* proxy, const QL
QDir d = fi.dir();
d.mkpath(d.absolutePath());
QFile::copy(source, target);
Q_ASSERT(QFile::rename(source, target));
}
insertDocumentSceneAt(trashDocProxy, scene, trashDocProxy->pageCount());

@ -2088,11 +2088,39 @@ QList<QUrl> UBGraphicsScene::relativeDependencies() const
while (itItems.hasNext())
{
UBGraphicsMediaItem *videoItem = qgraphicsitem_cast<UBGraphicsMediaItem*> (itItems.next());
QGraphicsItem* item = itItems.next();
UBGraphicsMediaItem *mediaItem = qgraphicsitem_cast<UBGraphicsMediaItem*> (item);
if (videoItem && videoItem->mediaFileUrl().isRelative())
{
relativePathes << videoItem->mediaFileUrl();
if (mediaItem){
QString completeFileName = QFileInfo(mediaItem->mediaFileUrl().toLocalFile()).fileName();
QString path;
if(mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
path = UBPersistenceManager::videoDirectory + "/";
else
path = UBPersistenceManager::audioDirectory + "/";
relativePathes << QUrl(path + completeFileName);
continue;
}
UBGraphicsWidgetItem* widget = qgraphicsitem_cast<UBGraphicsWidgetItem*>(item);
if(widget){
QString widgetPath = UBPersistenceManager::widgetDirectory + "/" + widget->uuid().toString() + ".wgt";
QString screenshotPath = UBPersistenceManager::widgetDirectory + "/" + widget->uuid().toString().remove("{").remove("}") + ".png";
relativePathes << QUrl(widgetPath);
relativePathes << QUrl(screenshotPath);
continue;
}
UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item);
if(pixmapItem){
relativePathes << QUrl(UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png");
continue;
}
UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item);
if(svgItem){
relativePathes << QUrl(UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg");
continue;
}
}

@ -130,7 +130,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
type_WIN = 1, // 0001
type_MAC = 2, // 0010
type_UNIX = 4, // 0100
type_ALL = 7, // 0111
type_ALL = 7 // 0111
};
bool mFirstReleaseAfterMove;

Loading…
Cancel
Save