From 468373292caace17286184252c69d1e233bcefc6 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Mon, 13 Jun 2016 05:10:15 +0200 Subject: [PATCH 1/6] When using the system OSK, don't show/hide the inbuilt OSK when switching modes --- src/board/UBBoardPaletteManager.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 89cf5067..bb7324d1 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -664,11 +664,11 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mRightPalette->assignParent(mContainer); mRightPalette->stackUnder(mStylusPalette); mLeftPalette->stackUnder(mStylusPalette); - if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) + if (UBPlatformUtils::hasVirtualKeyboard() + && mKeyboardPalette != NULL + && UBSettings::settings()->useSystemOnScreenKeyboard->get().toBool() == false) { - - if(mKeyboardPalette->m_isVisible) - { + if(mKeyboardPalette->m_isVisible) { mKeyboardPalette->hide(); mKeyboardPalette->setParent(UBApplication::boardController->controlContainer()); mKeyboardPalette->show(); @@ -698,7 +698,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mStylusPalette->raise(); - if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) + if (UBPlatformUtils::hasVirtualKeyboard() + && mKeyboardPalette != NULL + && UBSettings::settings()->useSystemOnScreenKeyboard->get().toBool() == false) { if(mKeyboardPalette->m_isVisible) @@ -745,7 +747,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is case eUBDockPaletteWidget_WEB: { mAddItemPalette->setParent(UBApplication::mainWindow); - if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) + if (UBPlatformUtils::hasVirtualKeyboard() + && mKeyboardPalette != NULL + && UBSettings::settings()->useSystemOnScreenKeyboard->get().toBool() == false) { // tmp variable? // WBBrowserWindow* brWnd = UBApplication::webController->GetCurrentWebBrowser(); @@ -769,7 +773,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mRightPalette->setVisible(rightPaletteVisible); mLeftPalette->assignParent(UBApplication::documentController->controlView()); mRightPalette->assignParent(UBApplication::documentController->controlView()); - if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) + if (UBPlatformUtils::hasVirtualKeyboard() + && mKeyboardPalette != NULL + && UBSettings::settings()->useSystemOnScreenKeyboard->get().toBool() == false) { if(mKeyboardPalette->m_isVisible) @@ -792,7 +798,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mRightPalette->setVisible(rightPaletteVisible); mLeftPalette->assignParent(0); mRightPalette->assignParent(0); - if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) + if (UBPlatformUtils::hasVirtualKeyboard() + && mKeyboardPalette != NULL + && UBSettings::settings()->useSystemOnScreenKeyboard->get().toBool() == false) { if(mKeyboardPalette->m_isVisible) From 9ed35d1d0d24f1a58efa17e9ea272c7646e84400 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 22 Jun 2016 15:43:17 +0200 Subject: [PATCH 2/6] Version bumped to 1.3.2 (hotfix release) --- OpenBoard.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBoard.pro b/OpenBoard.pro index 5a64ea8d..6bca6050 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -10,7 +10,7 @@ CONFIG += debug_and_release \ VERSION_MAJ = 1 VERSION_MIN = 3 -VERSION_PATCH = 1 +VERSION_PATCH = 2 VERSION_TYPE = r # a = alpha, b = beta, rc = release candidate, r = release, other => error VERSION_BUILD = 0 From 3995d007a3ca5370a48252f20610c68ca8c2f94f Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 22 Jun 2016 16:16:13 +0200 Subject: [PATCH 3/6] Document's pageDpi is now stored in UBDocumentProxy rather than in UBSettings This fixes an issue where if one document was imported with a different DPI than the current one, any document created thereafter would have this same value (which could then cause problems if a PDF was added to that new document). Saving this value to UBDocumentProxy not only makes more sense, it also fixes this issue. --- src/adaptors/UBExportFullPDF.cpp | 3 ++- src/adaptors/UBSvgSubsetAdaptor.cpp | 27 ++++++++++++++------------- src/adaptors/UBSvgSubsetAdaptor.h | 6 +++--- src/core/UBSettings.cpp | 4 ---- src/core/UBSettings.h | 2 -- src/document/UBDocumentProxy.cpp | 11 +++++++++++ src/document/UBDocumentProxy.h | 5 +++++ 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index 823c21d0..2f426a46 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -211,7 +211,8 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS // If the PDF was scaled when added to the scene (e.g if it was loaded from a document with a different DPI // than the current one), it should also be scaled here. qreal currentDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY()) / 2; - qreal pdfScale = qreal(UBSettings::pageDpi)/currentDpi; + qreal documentDpi = pDocumentProxy->pageDpi(); + qreal pdfScale = documentDpi != 0 ? documentDpi/currentDpi : 1; TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor * pdfScale, 0); TransformationDescription annotationTransform(xAnnotationsOffset, yAnnotationsOffset, 1, 0); diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 733a9e49..9e0cbd92 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -334,7 +334,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray) { UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toUtf8()); - return reader.loadScene(); + return reader.loadScene(proxy); } UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy, const QByteArray& pXmlData) @@ -347,7 +347,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy } -UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() +UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProxy* proxy) { qDebug() << "loadScene() : starting reading..."; QTime time; @@ -435,9 +435,9 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() QStringRef pageDpi = mXmlReader.attributes().value("pageDpi"); if (!pageDpi.isNull()) - UBSettings::pageDpi = pageDpi.toInt(); + proxy->setPageDpi(pageDpi.toInt()); else - UBSettings::pageDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/2; + proxy->setPageDpi((UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/2); bool darkBackground = false; bool crossedBackground = false; @@ -769,7 +769,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() QDesktopWidget* desktop = UBApplication::desktop(); qreal currentDpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; qDebug() << "currentDpi (" << desktop->physicalDpiX() << " + " << desktop->physicalDpiY() << ")/2 = " << currentDpi; - qreal pdfScale = qreal(UBSettings::pageDpi)/currentDpi; + qreal pdfScale = qreal(proxy->pageDpi())/currentDpi; qDebug() << "pdfScale " << pdfScale; pdfItem->setScale(pdfScale); pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true); @@ -829,7 +829,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() { QDesktopWidget* desktop = UBApplication::desktop(); qreal currentDpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; - qreal textSizeMultiplier = qreal(UBSettings::pageDpi)/currentDpi; + qreal textSizeMultiplier = qreal(proxy->pageDpi())/currentDpi; //textDelegate->scaleTextSize(textSizeMultiplier); } @@ -1013,7 +1013,7 @@ QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup() void UBSvgSubsetAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex) { UBSvgSubsetWriter writer(proxy, pScene, pageIndex); - writer.persistScene(pageIndex); + writer.persistScene(proxy, pageIndex); } @@ -1027,7 +1027,7 @@ UBSvgSubsetAdaptor::UBSvgSubsetWriter::UBSvgSubsetWriter(UBDocumentProxy* proxy, } -void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement() +void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement(UBDocumentProxy* proxy) { mXmlWriter.writeStartElement("svg"); @@ -1053,10 +1053,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement() QDesktopWidget* desktop = UBApplication::desktop(); - if (UBSettings::pageDpi == 0) - UBSettings::pageDpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + if (proxy->pageDpi() == 0) + proxy->setPageDpi((desktop->physicalDpiX() + desktop->physicalDpiY()) / 2); + + mXmlWriter.writeAttribute("pageDpi", QString::number(proxy->pageDpi())); - mXmlWriter.writeAttribute("pageDpi", QString::number(UBSettings::pageDpi)); mXmlWriter.writeStartElement("rect"); mXmlWriter.writeAttribute("fill", mScene->isDarkBackground() ? "black" : "white"); @@ -1068,7 +1069,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement() mXmlWriter.writeEndElement(); } -bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) +bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy, int pageIndex) { Q_UNUSED(pageIndex); @@ -1089,7 +1090,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) mXmlWriter.writeNamespace(UBSettings::uniboardDocumentNamespaceUri, "ub"); mXmlWriter.writeNamespace(nsXHtml, "xhtml"); - writeSvgElement(); + writeSvgElement(proxy); // Get the items from the scene QList items = mScene->items(); diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index e081e6a4..48e3b1d7 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -114,7 +114,7 @@ class UBSvgSubsetAdaptor virtual ~UBSvgSubsetReader(){} - UBGraphicsScene* loadScene(); + UBGraphicsScene* loadScene(UBDocumentProxy *proxy); private: @@ -180,7 +180,7 @@ class UBSvgSubsetAdaptor UBSvgSubsetWriter(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex); - bool persistScene(int pageIndex); + bool persistScene(UBDocumentProxy *proxy, int pageIndex); virtual ~UBSvgSubsetWriter(){} @@ -249,7 +249,7 @@ class UBSvgSubsetAdaptor void protractorToSvg(UBGraphicsProtractor *item); void cacheToSvg(UBGraphicsCache* item); void triangleToSvg(UBGraphicsTriangle *item); - void writeSvgElement(); + void writeSvgElement(UBDocumentProxy *proxy); private: diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 7943066f..c344908a 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -112,8 +112,6 @@ const int UBSettings::longClickInterval = 1200; const qreal UBSettings::minScreenRatio = 1.33; // 800/600 or 1024/768 -int UBSettings::pageDpi = 0; - QStringList UBSettings::bitmapFileExtensions; QStringList UBSettings::vectoFileExtensions; QStringList UBSettings::imageFileExtensions; @@ -274,8 +272,6 @@ void UBSettings::init() pageSize = new UBSetting(this, "Board", "DefaultPageSize", documentSizes.value(DocumentSizeRatio::Ratio4_3)); - pageDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/ 2; - QStringList penLightBackgroundColors; penLightBackgroundColors << "#000000" << "#FF0000" <<"#004080" << "#008000" << "#FFDD00" << "#C87400" << "#800040" << "#008080" << "#5F2D0A" << "#FFFFFF"; boardPenLightBackgroundColors = new UBColorListSetting(this, "Board", "PenLightBackgroundColors", penLightBackgroundColors, 1.0); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 7b676e96..9d04f0dc 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -232,8 +232,6 @@ class UBSettings : public QObject static QString appPingMessage; - static int pageDpi; - UBSetting* productWebUrl; QString softwareHomeUrl; diff --git a/src/document/UBDocumentProxy.cpp b/src/document/UBDocumentProxy.cpp index cd5847d3..f90e6286 100644 --- a/src/document/UBDocumentProxy.cpp +++ b/src/document/UBDocumentProxy.cpp @@ -41,6 +41,7 @@ UBDocumentProxy::UBDocumentProxy() : mPageCount(0) + , mPageDpi(0) { init(); } @@ -48,6 +49,7 @@ UBDocumentProxy::UBDocumentProxy() UBDocumentProxy::UBDocumentProxy(const QString& pPersistancePath) : mPageCount(0) + , mPageDpi(0) { init(); setPersistencePath(pPersistancePath); @@ -98,6 +100,15 @@ void UBDocumentProxy::setPageCount(int pPageCount) mPageCount = pPageCount; } +int UBDocumentProxy::pageDpi() +{ + return mPageDpi; +} + +void UBDocumentProxy::setPageDpi(int dpi) +{ + mPageDpi = dpi; +} int UBDocumentProxy::incPageCount() { diff --git a/src/document/UBDocumentProxy.h b/src/document/UBDocumentProxy.h index bb9d7794..3012b6a3 100644 --- a/src/document/UBDocumentProxy.h +++ b/src/document/UBDocumentProxy.h @@ -79,6 +79,9 @@ class UBDocumentProxy : public QObject int pageCount(); + int pageDpi(); + void setPageDpi(int dpi); + protected: void setPageCount(int pPageCount); int incPageCount(); @@ -96,6 +99,8 @@ class UBDocumentProxy : public QObject int mPageCount; + int mPageDpi; + }; inline bool operator==(const UBDocumentProxy &proxy1, const UBDocumentProxy &proxy2) From b323f2f9bbf6d9bc23bceb0999d5fd918ad55912 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 22 Jun 2016 16:34:23 +0200 Subject: [PATCH 4/6] Fix PDF export of documents containing both PDFs and tools In some cases, the PDF background of a document could be scaled badly when tools such as the ruler, compass etc. were present on the page. This happened with PDFs of version <= 1.4, and when the tools were outside of / larger than the page. --- src/adaptors/UBExportFullPDF.cpp | 6 +++--- src/domain/UBGraphicsScene.cpp | 15 +++++++++++++++ src/domain/UBGraphicsScene.h | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index 2f426a46..6d69aef2 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -182,7 +182,7 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS { QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; - QRectF annotationsRect = scene->itemsBoundingRect(); + QRectF annotationsRect = scene->annotationsBoundingRect(); // Original datas double xAnnotation = qRound(annotationsRect.x()); @@ -192,8 +192,8 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS double hPdf = qRound(pdfItem->sceneBoundingRect().height()); // Exportation-transformed datas - double hScaleFactor = pageSize.width()/scene->itemsBoundingRect().width(); - double vScaleFactor = pageSize.height()/scene->itemsBoundingRect().height(); + double hScaleFactor = pageSize.width()/annotationsRect.width(); + double vScaleFactor = pageSize.height()/annotationsRect.height(); double scaleFactor = qMin(hScaleFactor, vScaleFactor); double xAnnotationsOffset = 0; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index b38c8936..5181af4a 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1811,6 +1811,21 @@ void UBGraphicsScene::deselectAllItemsExcept(QGraphicsItem* item) } } +/** + * Return the bounding rectangle of all items on the page except for tools (ruler, compass,...) + */ +QRectF UBGraphicsScene::annotationsBoundingRect() const +{ + QRectF boundingRect; + + foreach (QGraphicsItem *item, items()) { + if (!mTools.contains(rootItem(item))) + boundingRect |= item->sceneBoundingRect(); + } + + return boundingRect; +} + bool UBGraphicsScene::isEmpty() const { return mItemCount == 0; diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index f445beef..29966f6d 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -321,6 +321,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem void notifyZChanged(QGraphicsItem *item, qreal zValue); void deselectAllItemsExcept(QGraphicsItem* graphicsItem); + QRectF annotationsBoundingRect() const; + public slots: void updateSelectionFrame(); void updateSelectionFrameWrapper(int); From 3abf154dfd6c48d553ebe501e23179946452ff03 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Mon, 27 Jun 2016 14:28:54 +0200 Subject: [PATCH 5/6] Fixes to import and export of files containing PDFs The scale of PDF items was sometimes badly calculated when opening a document made with a previous version of OpenBoard or made on another computer. Specifically, this solves the following issues: - PDF scale calculation in documents that did not specify the pageDPI used to render the PDF (happened with documents created with some old versions of OpenBoard) - PDF scale calculation in multi-page documents (it was set correctly for the first page, but not the following ones) --- src/adaptors/UBExportFullPDF.cpp | 4 +--- src/adaptors/UBSvgSubsetAdaptor.cpp | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index 6d69aef2..64b989a0 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -210,9 +210,7 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS // If the PDF was scaled when added to the scene (e.g if it was loaded from a document with a different DPI // than the current one), it should also be scaled here. - qreal currentDpi = (UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY()) / 2; - qreal documentDpi = pDocumentProxy->pageDpi(); - qreal pdfScale = documentDpi != 0 ? documentDpi/currentDpi : 1; + qreal pdfScale = pdfItem->scale(); TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor * pdfScale, 0); TransformationDescription annotationTransform(xAnnotationsOffset, yAnnotationsOffset, 1, 0); diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 9e0cbd92..e44eba15 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -354,6 +354,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx time.start(); mScene = 0; UBGraphicsWidgetItem *currentWidget = 0; + bool pageDpiSpecified = true; mFileVersion = 40100; // default to 4.1.0 @@ -436,8 +437,11 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx if (!pageDpi.isNull()) proxy->setPageDpi(pageDpi.toInt()); - else + + else if (proxy->pageDpi() == 0) { proxy->setPageDpi((UBApplication::desktop()->physicalDpiX() + UBApplication::desktop()->physicalDpiY())/2); + pageDpiSpecified = false; + } bool darkBackground = false; bool crossedBackground = false; @@ -768,9 +772,22 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx { QDesktopWidget* desktop = UBApplication::desktop(); qreal currentDpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; - qDebug() << "currentDpi (" << desktop->physicalDpiX() << " + " << desktop->physicalDpiY() << ")/2 = " << currentDpi; + // qDebug() << "currentDpi (" << desktop->physicalDpiX() << " + " << desktop->physicalDpiY() << ")/2 = " << currentDpi; qreal pdfScale = qreal(proxy->pageDpi())/currentDpi; - qDebug() << "pdfScale " << pdfScale; + // qDebug() << "pdfScale " << pdfScale; + + // If the PDF is in the background, it occupies the whole page; so we can simply + // use that information to calculate its scale. + if (isBackground) { + qreal pageWidth = mScene->nominalSize().width(); + qreal pageHeight = mScene->nominalSize().height(); + + qreal scaleX = pageWidth / pdfItem->sceneBoundingRect().width(); + qreal scaleY = pageHeight / pdfItem->sceneBoundingRect().height(); + + pdfScale = (scaleX+scaleY)/2.; + } + pdfItem->setScale(pdfScale); pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true); pdfItem->setFlag(QGraphicsItem::ItemIsSelectable, true); From 3a7c2945c3bc9ff10c11bdc942fbf9b62fbc02ef Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Mon, 27 Jun 2016 15:43:57 +0200 Subject: [PATCH 6/6] Bumped version to 1.3.3 --- OpenBoard.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBoard.pro b/OpenBoard.pro index 6bca6050..a164d483 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -10,7 +10,7 @@ CONFIG += debug_and_release \ VERSION_MAJ = 1 VERSION_MIN = 3 -VERSION_PATCH = 2 +VERSION_PATCH = 3 VERSION_TYPE = r # a = alpha, b = beta, rc = release candidate, r = release, other => error VERSION_BUILD = 0