From 0d517aadfef2367ea186a722cd33d18e239c4ccb Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 26 Apr 2012 11:06:45 +0200 Subject: [PATCH 1/3] Backup --- src/adaptors/UBSvgSubsetAdaptor.cpp | 1 + src/core/UBPersistenceManager.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 33a5a091..285fe6c5 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -29,6 +29,7 @@ #include "domain/UBGraphicsTextItem.h" #include "domain/UBAbstractWidget.h" #include "domain/UBGraphicsStroke.h" +#include "domain/UBGraphicsStrokesGroup.h" #include "domain/UBItem.h" #include "tools/UBGraphicsRuler.h" diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 8d0e1952..0d3da2d4 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -619,7 +619,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene); emit documentCommitted(pDocumentProxy); - } From a77036d6fb9a02d0a14d54ecde951b327bb7838f Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 26 Apr 2012 15:57:02 +0200 Subject: [PATCH 2/3] Backup of the lines as object --- src/adaptors/UBSvgSubsetAdaptor.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 285fe6c5..c616ae66 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -43,6 +43,7 @@ #include "board/UBBoardView.h" #include "board/UBBoardController.h" +#include "board/UBDrawingController.h" #include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBStringUtils.h" @@ -312,6 +313,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() mFileVersion = 40100; // default to 4.1.0 UBGraphicsStroke* annotationGroup = 0; + UBGraphicsStrokesGroup* strokesGroup = 0; + UBDrawingController* dc = UBDrawingController::drawingController(); while (!mXmlReader.atEnd()) { @@ -434,6 +437,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() else annotationGroup = new UBGraphicsStroke(); + if(eDrawingMode_Vector == dc->drawingMode()){ + strokesGroup = new UBGraphicsStrokesGroup(); + } + QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value"); if (!ubZValue.isNull()) @@ -476,7 +483,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() polygonItem->setStroke(annotationGroup); } - scene->addItem(polygonItem); + if(eDrawingMode_Vector == dc->drawingMode()){ + if(strokesGroup){ + strokesGroup->addToGroup(polygonItem); + } + }else{ + scene->addItem(polygonItem); + } polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); @@ -495,7 +508,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() polygonItem->setStroke(annotationGroup); } - scene->addItem(polygonItem); + if(eDrawingMode_Vector == dc->drawingMode()){ + if(strokesGroup){ + strokesGroup->addToGroup(polygonItem); + } + }else{ + scene->addItem(polygonItem); + } polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->show(); @@ -817,6 +836,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() { if (mXmlReader.name() == "g") { + if(strokesGroup && scene){ + scene->addItem(strokesGroup); + } + if (annotationGroup) { if (!annotationGroup->polygons().empty()) @@ -932,7 +955,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene() { QGraphicsItem *item = items.takeFirst(); - UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast (item); if (polygonItem && polygonItem->isVisible()) From c62c84fbfbb4541dd0dbd8c505ddec5f61286a71 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 26 Apr 2012 16:11:01 +0200 Subject: [PATCH 3/3] fixed crash due to the document metadata --- src/document/UBDocumentProxy.cpp | 2 ++ src/gui/UBTeacherGuideWidget.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index 67f11b0f..c37f9b28 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -297,6 +297,8 @@ QString UBDocumentProxy::sessionAuthors() QDateTime UBDocumentProxy::documentDate() { + qDebug()<< UBSettings::documentDate; + qDebug()<getCurrentDocument() : 0; if(UBApplication::documentController && UBApplication::boardController->activeSceneIndex() == 0){ - QDateTime creationDate = documentProxy->documentDate(); - mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); - QDateTime updatedDate = documentProxy->lastUpdate(); - mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); +// QDateTime creationDate = documentProxy->documentDate(); +// mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate)); +// QDateTime updatedDate = documentProxy->lastUpdate(); +// mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate)); } }