From 0d517aadfef2367ea186a722cd33d18e239c4ccb Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 26 Apr 2012 11:06:45 +0200 Subject: [PATCH 1/7] 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 831765ccfe214a78d2d95d61f9033f3d9505331b Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 26 Apr 2012 12:40:48 +0300 Subject: [PATCH 2/7] Fix to SANKORE-626. Display widget displaying correctly now. --- src/core/UBDisplayManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/UBDisplayManager.cpp b/src/core/UBDisplayManager.cpp index 1d441adb..140dc875 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -146,6 +146,11 @@ void UBDisplayManager::setDisplayWidget(QWidget* pDisplayWidget) { if(pDisplayWidget && (pDisplayWidget != mDisplayWidget)) { + if (mDisplayWidget) + { + pDisplayWidget->setGeometry(mDisplayWidget->geometry()); + pDisplayWidget->setWindowFlags(mDisplayWidget->windowFlags()); + } mDisplayWidget = pDisplayWidget; // !!!! Should be included into Windows after QT recompilation #ifdef Q_WS_MAC From bc941dd41ace91ee6ae387acb57f0de47e17ad8f Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 26 Apr 2012 13:11:32 +0200 Subject: [PATCH 3/7] fixed teacher guide licence index out of boundaries --- src/gui/UBTeacherGuideWidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index d6ca56f2..54d9e847 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -767,8 +767,10 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) mpLicenceValueLabel->setText(mpLicenceBox->currentText()); QStringList licenceIconList; licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; - if(mpLicenceBox->currentIndex() < 6){ - mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex())); + int licenceBoxCurrentIndex = mpLicenceBox->currentIndex(); + // -1 is return if there is no values on the box + if(licenceBoxCurrentIndex > 0 && licenceBoxCurrentIndex < licenceIconList.count()){ + mpLicenceIcon->setPixmap(licenceIconList.at(licenceBoxCurrentIndex)); mpLicenceIcon->show(); } mpLicenceValueLabel->show(); From 2a1ff6ad51df871528d02021e7ed3e1e85c26a0c Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 26 Apr 2012 15:33:59 +0300 Subject: [PATCH 4/7] Fix to SANKORE-629. D'n'D in widgets works fine now. --- src/domain/UBGraphicsItemDelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 311ff93f..594dc813 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -227,7 +227,7 @@ bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event) return true; } else - return true; + return false; } bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) From a77036d6fb9a02d0a14d54ecde951b327bb7838f Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 26 Apr 2012 15:57:02 +0200 Subject: [PATCH 5/7] 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 6/7] 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)); } } From d6de8439455857aeba99a66e6bd1f06386261cd0 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 26 Apr 2012 18:00:48 +0300 Subject: [PATCH 7/7] Correction to dragging items. --- src/domain/UBGraphicsItemDelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 594dc813..cadbf191 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -207,7 +207,7 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData) bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if((NULL != mMimeData) && ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance())) + if(NULL != mMimeData) { QDrag* mDrag = new QDrag(event->widget()); mDrag->setMimeData(mMimeData);