commit OpenBoard for openSUSE:Factory

Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package OpenBoard for openSUSE:Factory checked in at 2022-11-30 14:59:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/OpenBoard (Old) and /work/SRC/openSUSE:Factory/.OpenBoard.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "OpenBoard" Wed Nov 30 14:59:39 2022 rev:4 rq:1038947 version:1.7.0~git20221129.9de37af Changes: -------- --- /work/SRC/openSUSE:Factory/OpenBoard/OpenBoard.changes 2022-09-20 19:23:36.154477296 +0200 +++ /work/SRC/openSUSE:Factory/.OpenBoard.new.1597/OpenBoard.changes 2022-11-30 15:00:25.033525369 +0100 @@ -1,0 +2,28 @@ +Tue Nov 29 16:17:02 UTC 2022 - Martin Winter <me@letsfindaway.de> + +- update to version 1.7.0~git20221129.9de37af +- feat: user configurable shortcuts + * replace 0460-shortcut-configuration.patch by updated + 0686-shortcut-configuration.patch + * add 9686-cmake-add-shortcut-manager.patch + add new files to CMakeLists.txt +- fix: background drawing when switching page size + * update 0551-common-background-drawing.patch +- fix: mirror pixmap size + * update 0569-scale-mirror-pixmap.patch +- remove upstreamed patches + * remove upstreamed 0604-qt-5.12-compatibility.patch + * remove upstreamed 0629-bug-ruler.patch + * remove upstreamed 0633-improve-displaymanager.patch + * remove upstreamed 0637-fix-pdf-background-export.patch + * remove upstreamed 0641-fix-font-handling.patch + * remove upstreamed 0649-fix-pdf-export-scaling.patch +- chore: replace qmake by cmake build system + * remove 0651-chore-reorganize-linux-build.patch + * add 0698-add-cmake-build-system.patch +- fix: page size for PDF export + * add 0677-pdf-export-page-size.patch +- disable software update from openboard web page + * add 9117-disable-software-update.patch + +------------------------------------------------------------------- Old: ---- 0460-shortcut-configuration.patch 0604-qt-5.12-compatibility.patch 0629-bug-ruler.patch 0633-improve-displaymanager.patch 0637-fix-pdf-background-export.patch 0641-fix-font-handling.patch 0649-fix-pdf-export-scaling.patch 0651-chore-reorganize-linux-build.patch OpenBoard-47a96e1d6bbdc0250977d22f1b79f11fcc1cbeee.zip New: ---- 0677-pdf-export-page-size.patch 0686-shortcut-configuration.patch 0698-add-cmake-build-system.patch 9117-disable-software-update.patch 9686-cmake-add-shortcut-manager.patch OpenBoard-9de37af2df1a7c0d88f71c94ab2db1815d082862.zip ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ OpenBoard.spec ++++++ --- /var/tmp/diff_new_pack.nNsJeW/_old 2022-11-30 15:00:26.301532347 +0100 +++ /var/tmp/diff_new_pack.nNsJeW/_new 2022-11-30 15:00:26.305532369 +0100 @@ -19,10 +19,10 @@ %define dest_dir %{_libdir}/%{name} %define namelc openboard %define fqname ch.%{namelc}.%{name} -%define githash 47a96e1d6bbdc0250977d22f1b79f11fcc1cbeee -%define gitshort 47a96e1 -%define gitdate 20220914 -%define buildver 0914 +%define githash 9de37af2df1a7c0d88f71c94ab2db1815d082862 +%define gitshort 9de37af +%define gitdate 20221129 +%define buildver 1129 Name: OpenBoard Version: 1.7.0~git%{gitdate}.%{gitshort} Release: 0 @@ -31,26 +31,20 @@ Group: Amusements/Teaching/Other URL: https://openboard.ch Source0: https://github.com/OpenBoard-org/OpenBoard/archive/%{githash}.zip#/OpenBoard-%{githash}.zip -# https://github.com/OpenBoard-org/OpenBoard/pull/460 -Patch460: 0460-shortcut-configuration.patch # https://github.com/OpenBoard-org/OpenBoard/pull/551 Patch551: 0551-common-background-drawing.patch # https://github.com/OpenBoard-org/OpenBoard/pull/569 Patch569: 0569-scale-mirror-pixmap.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/604 -Patch604: 0604-qt-5.12-compatibility.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/629 -Patch629: 0629-bug-ruler.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/633 -Patch633: 0633-improve-displaymanager.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/637 -Patch637: 0637-fix-pdf-background-export.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/641 -Patch641: 0641-fix-font-handling.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/649 -Patch649: 0649-fix-pdf-export-scaling.patch -# https://github.com/OpenBoard-org/OpenBoard/pull/651 -Patch651: 0651-chore-reorganize-linux-build.patch +# https://github.com/OpenBoard-org/OpenBoard/pull/677 +Patch677: 0677-pdf-export-page-size.patch +# https://github.com/OpenBoard-org/OpenBoard/pull/686 +Patch686: 0686-shortcut-configuration.patch +# https://github.com/OpenBoard-org/OpenBoard/pull/698 +Patch698: 0698-add-cmake-build-system.patch +# https://github.com/letsfindaway/OpenBoard/pull/117 +Patch9117: 9117-disable-software-update.patch +# no github url available +Patch9686: 9686-cmake-add-shortcut-manager.patch BuildRequires: desktop-file-utils BuildRequires: fdupes BuildRequires: ffmpeg-devel @@ -86,10 +80,6 @@ %prep %autosetup -p1 -n %{name}-%{githash} -# insert version -sed -i 's/VERSION_BUILD = 0225/VERSION_BUILD = %{buildver}/g' OpenBoard.pro -sed -i 's/OpenBoard 1.6.2/OpenBoard %{version}/g' resources/forms/preferences.ui - # remove x flag from any resource files find resources -type f -print0 | xargs -0 chmod a-x @@ -97,16 +87,11 @@ rm resources/library/applications/Calculator.wgt/.gitignore %build -lrelease-qt5 %{name}.pro - -export QMAKE_CXX_FLAGS="$QMAKE_CXX_FLAGS -fpermissive" -%qmake5 %{name}.pro -%make_jobs +%cmake +%cmake_build %install -export INSTALL_ROOT=%{buildroot} -%make_install - +%cmake_install %fdupes -s %{buildroot} %files @@ -115,7 +100,8 @@ %{_datadir}/applications/%{fqname}.desktop %{_datadir}/icons/hicolor/scalable %{_datadir}/mime/packages/* -%{_datadir}/openboard +%{_datadir}/%{namelc} %{_bindir}/%{namelc} +%config %{_sysconfdir}/%{namelc} %changelog ++++++ 0551-common-background-drawing.patch ++++++ --- /var/tmp/diff_new_pack.nNsJeW/_old 2022-11-30 15:00:26.333532522 +0100 +++ /var/tmp/diff_new_pack.nNsJeW/_new 2022-11-30 15:00:26.337532545 +0100 @@ -1,7 +1,7 @@ -From 450b7592d69f39f0c74c347b752fabab0f85e354 Mon Sep 17 00:00:00 2001 +From 31456152d403e57cdd56f6b1dd54d94d930a3029 Mon Sep 17 00:00:00 2001 From: letsfindaway <me@letsfindaway.de> Date: Wed, 5 Jan 2022 11:15:54 +0100 -Subject: [PATCH] refactor: drawBackground mostly in scene +Subject: [PATCH 1/3] refactor: drawBackground mostly in scene - move all drawing of background grid to UBGraphicsScene - only add document border in UBBoardView @@ -12,7 +12,7 @@ 2 files changed, 51 insertions(+), 98 deletions(-) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp -index afb60c535..64df7e0d6 100644 +index 817d8c4e7..c968f17d7 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -29,6 +29,7 @@ @@ -49,7 +49,7 @@ , bIsControl(isControl) , bIsDesktop(isDesktop) { -@@ -681,6 +682,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) +@@ -685,6 +686,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) return false; if(currentTool == UBStylusTool::Play) return false; @@ -57,7 +57,7 @@ case UBGraphicsSvgItem::Type: case UBGraphicsPixmapItem::Type: -@@ -688,10 +690,13 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) +@@ -692,10 +694,13 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) return true; if (item->isSelected()) return false; @@ -71,7 +71,7 @@ case UBGraphicsStrokesGroup::Type: case UBGraphicsTextItem::Type: if (currentTool == UBStylusTool::Play) -@@ -1644,98 +1649,14 @@ void UBBoardView::resizeEvent (QResizeEvent * event) +@@ -1714,98 +1719,14 @@ void UBBoardView::paintEvent(QPaintEvent *event) void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) { @@ -173,7 +173,7 @@ if (!mFilterZIndex && scene ()) { QSize pageNominalSize = scene ()->nominalSize (); -@@ -1751,7 +1672,7 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) +@@ -1821,7 +1742,7 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) QColor docSizeColor; @@ -183,10 +183,10 @@ else docSizeColor = UBSettings::documentSizeMarkColorLightBackground; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp -index 948fb5bc3..b14a8e56b 100644 +index aa6734dfe..48850d7e8 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp -@@ -2673,15 +2673,16 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) +@@ -2690,15 +2690,16 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) QGraphicsScene::drawBackground (painter, rect); return; } @@ -205,7 +205,7 @@ } if (mZoomFactor > 0.5) -@@ -2692,39 +2693,70 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) +@@ -2709,39 +2710,70 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) bgCrossColor = QColor(UBSettings::settings()->boardCrossColorDarkBackground->get().toString()); else bgCrossColor = QColor(UBSettings::settings()->boardCrossColorLightBackground->get().toString()); @@ -283,3 +283,308 @@ } } +From 95021acc1dbb5ab7c65fb04b7ff543fd064f41a4 Mon Sep 17 00:00:00 2001 +From: letsfindaway <me@letsfindaway.de> +Date: Tue, 29 Nov 2022 08:49:36 +0100 +Subject: [PATCH 2/3] fix: set document modified when changing page size + +- make sure page size change is persisted +- refactor code to refresh background in common function +--- + src/domain/UBGraphicsScene.cpp | 29 +++++++++++++++-------------- + src/domain/UBGraphicsScene.h | 1 + + 2 files changed, 16 insertions(+), 14 deletions(-) + +diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp +index 48850d7e8..25760d0bd 100644 +--- a/src/domain/UBGraphicsScene.cpp ++++ b/src/domain/UBGraphicsScene.cpp +@@ -1136,22 +1136,17 @@ void UBGraphicsScene::setBackground(bool pIsDark, UBPageBackground pBackground) + recolorAllItems(); + + needRepaint = true; +- setModified(true); + } + + if (mPageBackground != pBackground) + { + mPageBackground = pBackground; + needRepaint = true; +- setModified(true); + } + + if (needRepaint) + { +- foreach(QGraphicsView* view, views()) +- { +- view->resetCachedContent(); +- } ++ updateBackground(); + } + } + +@@ -1165,20 +1160,14 @@ void UBGraphicsScene::setBackgroundGridSize(int pSize) + { + if (pSize > 0) { + mBackgroundGridSize = pSize; +- setModified(true); +- +- foreach(QGraphicsView* view, views()) +- view->resetCachedContent(); ++ updateBackground(); + } + } + + void UBGraphicsScene::setIntermediateLines(bool checked) + { + mIntermediateLines = checked; +- setModified(true); +- +- foreach(QGraphicsView* view, views()) +- view->resetCachedContent(); ++ updateBackground(); + } + + void UBGraphicsScene::setDrawingMode(bool bModeDesktop) +@@ -2570,6 +2559,7 @@ void UBGraphicsScene::setNominalSize(const QSize& pSize) + if (nominalSize() != pSize) + { + mNominalSize = pSize; ++ updateBackground(); + + if(mDocument) + mDocument->setDefaultDocumentSize(pSize); +@@ -2918,6 +2908,17 @@ void UBGraphicsScene::setDocumentUpdated() + } + } + ++void UBGraphicsScene::updateBackground() ++{ ++ setModified(true); ++ ++ foreach(QGraphicsView* view, views()) ++ { ++ view->resetCachedContent(); ++ } ++ ++} ++ + void UBGraphicsScene::createEraiser() + { + if (UBSettings::settings()->showEraserPreviewCircle->get().toBool()) { +diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h +index e824e555f..80bad3d89 100644 +--- a/src/domain/UBGraphicsScene.h ++++ b/src/domain/UBGraphicsScene.h +@@ -427,6 +427,7 @@ public slots: + + private: + void setDocumentUpdated(); ++ void updateBackground(); + void createEraiser(); + void createPointer(); + void createMarkerCircle(); + +From 1eafb49db2e03b0b878d7d90e621136a6bce1374 Mon Sep 17 00:00:00 2001 +From: letsfindaway <me@letsfindaway.de> +Date: Tue, 29 Nov 2022 09:12:05 +0100 +Subject: [PATCH 3/3] refactor: avoid clang warnings + +- unneeded temporary container allocations +- reference to temporary +- possible memory leak +- unused variable +- use QHash for pointers instead of QMap +- possible nullptr reference +- not normalized signal/slot signatures +- detached container +- call to virtual function during construction +--- + src/domain/UBGraphicsScene.cpp | 65 ++++++++++++++++++---------------- + 1 file changed, 34 insertions(+), 31 deletions(-) + +diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp +index 25760d0bd..f3fed4b6f 100644 +--- a/src/domain/UBGraphicsScene.cpp ++++ b/src/domain/UBGraphicsScene.cpp +@@ -164,7 +164,7 @@ qreal UBZLayerController::changeZLevelTo(QGraphicsItem *item, moveDestination de + } + + //If only one item itself - do nothing, return it's z-value +- if (sortedItems.count() == 1 && sortedItems.values().first() == item) { ++ if (sortedItems.count() == 1 && sortedItems.first() == item) { + qDebug() << "only one item exists in layer. Have nothing to change"; + return item->data(UBGraphicsItemData::ItemOwnZValue).toReal(); + } +@@ -385,8 +385,8 @@ UBGraphicsScene::~UBGraphicsScene() + void UBGraphicsScene::selectionChangedProcessing() + { + if (selectedItems().count()){ +- UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f') + "own z value is " +- + QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f')); ++ UBApplication::showMessage("ZValue is " + QString::number(selectedItems().constFirst()->zValue(), 'f') + "own z value is " ++ + QString::number(selectedItems().constFirst()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f')); + + } + } +@@ -749,10 +749,11 @@ bool UBGraphicsScene::inputDeviceRelease(int tool) + { + + if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented +- UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack +- +- if(UBApplication::undoStack) ++ if (UBApplication::undoStack) ++ { ++ UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack + UBApplication::undoStack->push(udcmd); ++ } + } + + mRemovedItems.clear(); +@@ -1177,7 +1178,7 @@ void UBGraphicsScene::setDrawingMode(bool bModeDesktop) + + void UBGraphicsScene::recolorAllItems() + { +- QMap<QGraphicsView*, QGraphicsView::ViewportUpdateMode> previousUpdateModes; ++ QHash<QGraphicsView*, QGraphicsView::ViewportUpdateMode> previousUpdateModes; + foreach(QGraphicsView* view, views()) + { + previousUpdateModes.insert(view, view->viewportUpdateMode()); +@@ -1383,7 +1384,7 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const + copy->setNominalSize(this->mNominalSize); + + QListIterator<QGraphicsItem*> itItems(this->mFastAccessItems); +- QMap<UBGraphicsStroke*, UBGraphicsStroke*> groupClone; ++ QHash<UBGraphicsStroke*, UBGraphicsStroke*> groupClone; + + while (itItems.hasNext()) + { +@@ -1507,8 +1508,8 @@ void UBGraphicsScene::clearContent(clearCase pCase) + + groupsMap.insert(itemGroup, UBGraphicsItem::getOwnUuid(item)); + if (itemGroup->childItems().count() == 1) { +- groupsMap.insert(itemGroup, UBGraphicsItem::getOwnUuid(itemGroup->childItems().first())); +- QGraphicsItem *lastItem = itemGroup->childItems().first(); ++ groupsMap.insert(itemGroup, UBGraphicsItem::getOwnUuid(itemGroup->childItems().constFirst())); ++ QGraphicsItem *lastItem = itemGroup->childItems().constFirst(); + bool isSelected = itemGroup->isSelected(); + itemGroup->destroy(false); + lastItem->setSelected(isSelected); +@@ -1626,25 +1627,27 @@ UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool s + + UBGraphicsMediaItem * mediaItem = UBGraphicsMediaItem::createMediaItem(pMediaFileUrl); + +- if(mediaItem) ++ if (mediaItem) ++ { + connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), mediaItem, SLOT(activeSceneChanged())); + +- mediaItem->setPos(pPos); ++ mediaItem->setPos(pPos); + +- mediaItem->setFlag(QGraphicsItem::ItemIsMovable, true); +- mediaItem->setFlag(QGraphicsItem::ItemIsSelectable, true); ++ mediaItem->setFlag(QGraphicsItem::ItemIsMovable, true); ++ mediaItem->setFlag(QGraphicsItem::ItemIsSelectable, true); + +- addItem(mediaItem); ++ addItem(mediaItem); + +- mediaItem->show(); ++ mediaItem->show(); + +- if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented +- UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, mediaItem); +- UBApplication::undoStack->push(uc); +- } ++ if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented ++ UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, mediaItem); ++ UBApplication::undoStack->push(uc); ++ } + +- if (shouldPlayAsap) +- mediaItem->play(); ++ if (shouldPlayAsap) ++ mediaItem->play(); ++ } + + setDocumentUpdated(); + +@@ -1904,7 +1907,7 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con + UBApplication::undoStack->push(uc); + } + +- connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); ++ connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem*)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem*))); + + textItem->setSelected(true); + textItem->setFocus(); +@@ -1931,7 +1934,7 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q + UBApplication::undoStack->push(uc); + } + +- connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); ++ connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem*)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem*))); + + textItem->setFocus(); + +@@ -2140,10 +2143,10 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio) + QGraphicsItem *UBGraphicsScene::itemForUuid(QUuid uuid) + { + QGraphicsItem *result = 0; +- QString ui = uuid.toString(); + + //simple search before implementing container for fast access +- foreach (QGraphicsItem *item, items()) { ++ foreach (QGraphicsItem *item, items()) ++ { + if (UBGraphicsScene::getPersonalUuid(item) == uuid && !uuid.isNull()) { + result = item; + } +@@ -2514,7 +2517,7 @@ QList<QUrl> UBGraphicsScene::relativeDependencies() const + UBGraphicsGroupContainerItem* groupItem = dynamic_cast<UBGraphicsGroupContainerItem*>(item); + if(groupItem) + { +- for (auto child : groupItem->childItems()) ++ foreach (QGraphicsItem* child, groupItem->childItems()) + { + relativePaths << relativeDependenciesOfItem(child); + } +@@ -2932,7 +2935,7 @@ void UBGraphicsScene::createEraiser() + mEraser->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); //Necessary to set if we want z value to be assigned correctly + + mTools << mEraser; +- addItem(mEraser); ++ UBGraphicsScene::addItem(mEraser); + } + } + +@@ -2949,7 +2952,7 @@ void UBGraphicsScene::createPointer() + mPointer->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Pointer)); //Necessary to set if we want z value to be assigned correctly + + mTools << mPointer; +- addItem(mPointer); ++ UBGraphicsScene::addItem(mPointer); + } + + void UBGraphicsScene::createMarkerCircle() +@@ -2967,7 +2970,7 @@ void UBGraphicsScene::createMarkerCircle() + mMarkerCircle->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); + + mTools << mMarkerCircle; +- addItem(mMarkerCircle); ++ UBGraphicsScene::addItem(mMarkerCircle); + } + } + +@@ -2986,7 +2989,7 @@ void UBGraphicsScene::createPenCircle() + mPenCircle->setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Eraiser)); + + mTools << mPenCircle; +- addItem(mPenCircle); ++ UBGraphicsScene::addItem(mPenCircle); + } + } + + ++++++ 0569-scale-mirror-pixmap.patch ++++++ --- /var/tmp/diff_new_pack.nNsJeW/_old 2022-11-30 15:00:26.353532633 +0100 +++ /var/tmp/diff_new_pack.nNsJeW/_new 2022-11-30 15:00:26.361532677 +0100 @@ -1,24 +1,42 @@ -From 53f3077e9506740e32c76a8f1bbdcb68697c2941 Mon Sep 17 00:00:00 2001 +From d835e5ef719356c3840c11aade9e671a26d5c6ce Mon Sep 17 00:00:00 2001 From: letsfindaway <me@letsfindaway.de> Date: Sun, 9 Jan 2022 10:40:12 +0100 Subject: [PATCH] fix: scaling of mirror pixmap +- when scaling the pixmap take the devicePixelRatio into account - do not scale the already scaled pixmap when drawing in UBScreenMirror +- use device independent coordinates when positioning the pixmap --- - src/gui/UBScreenMirror.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/gui/UBScreenMirror.cpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp -index db5b65116..628e23446 100644 +index db5b65116..ff9810862 100644 --- a/src/gui/UBScreenMirror.cpp +++ b/src/gui/UBScreenMirror.cpp -@@ -69,7 +69,7 @@ void UBScreenMirror::paintEvent(QPaintEvent *event) - int x = (width() - mLastPixmap.width()) / 2; - int y = (height() - mLastPixmap.height()) / 2; +@@ -66,10 +66,12 @@ void UBScreenMirror::paintEvent(QPaintEvent *event) + + if (!mLastPixmap.isNull()) + { +- int x = (width() - mLastPixmap.width()) / 2; +- int y = (height() - mLastPixmap.height()) / 2; ++ // compute size and offset in device independent coordinates ++ QSizeF pixmapSize = mLastPixmap.size() / mLastPixmap.devicePixelRatioF(); ++ int x = (width() - pixmapSize.width()) / 2; ++ int y = (height() - pixmapSize.height()) / 2; - painter.drawPixmap(x, y, width(), height(), mLastPixmap); + painter.drawPixmap(x, y, mLastPixmap); } } +@@ -95,7 +97,7 @@ void UBScreenMirror::grabPixmap() + } + + if (!mLastPixmap.isNull()) +- mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); ++ mLastPixmap = mLastPixmap.scaled(size() * mLastPixmap.devicePixelRatioF(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + } + + ++++++ 0677-pdf-export-page-size.patch ++++++ From 2f6394ce1f085285c5c0a44857bb6ea2c79b8769 Mon Sep 17 00:00:00 2001 From: letsfindaway <me@letsfindaway.de> Date: Wed, 28 Sep 2022 16:12:50 +0200 Subject: [PATCH] fix: size of exported PDF page - add functions to retrieve original PDF page size in Points - make output pages the same size - align page sizes between overlay and base PDF - use QSizeF where necessary to improve accuracy - compute sceneBoundingRect only once - catch exception by const reference (best practice) --- src/adaptors/UBExportFullPDF.cpp | 50 +++++++++++++++++--------------- src/domain/UBGraphicsScene.cpp | 19 ++++++++++++ src/domain/UBGraphicsScene.h | 1 + src/pdf/GraphicsPDFItem.h | 1 + src/pdf/PDFRenderer.h | 2 ++ src/pdf/XPDFRenderer.cpp | 32 +++++++++++--------- src/pdf/XPDFRenderer.h | 1 + 7 files changed, 68 insertions(+), 38 deletions(-) diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index 5aaa93b45..4b11517ae 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -122,7 +122,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr // pageSize is the output PDF page size; it is set to equal the scene's boundary size; if the contents // of the scene overflow from the boundaries, they will be scaled down. - QSize pageSize = scene->sceneSize(); + QSizeF pageSize = scene->sceneSizeF() * mScaleFactor; // points UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); @@ -130,13 +130,14 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr { mHasPDFBackgrounds = true; sceneHasPDFBackground = true; + pageSize = pdfItem->pageSize(); // original PDF document page size } else { sceneHasPDFBackground = false; } - QPageSize size(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPageSize::Point); + QPageSize size(pageSize, QPageSize::Point); pdfPrinter.setPageSize(size); if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter); @@ -222,47 +223,46 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); - QSize pageSize = scene->nominalSize(); - if (pdfItem) { + QRectF pdfSceneRect = pdfItem->sceneBoundingRect(); QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; QRectF annotationsRect = scene->annotationsBoundingRect(); - // Original datas - double xAnnotation = qRound(annotationsRect.x()); - double yAnnotation = qRound(annotationsRect.y()); - double xPdf = qRound(pdfItem->sceneBoundingRect().x()); - double yPdf = qRound(pdfItem->sceneBoundingRect().y()); - double hPdf = qRound(pdfItem->sceneBoundingRect().height()); + // Original data + double xAnnotation = annotationsRect.x(); + double yAnnotation = annotationsRect.y(); + double xPdf = pdfSceneRect.x(); + double yPdf = pdfSceneRect.y(); + double hPdf = pdfSceneRect.height(); - // Exportation-transformed datas - double hScaleFactor = pageSize.width()/annotationsRect.width(); - double vScaleFactor = pageSize.height()/annotationsRect.height(); + // Exportation-transformed data + double hScaleFactor = pdfSceneRect.width() / annotationsRect.width(); + double vScaleFactor = pdfSceneRect.height() / annotationsRect.height(); double scaleFactor = qMin(hScaleFactor, vScaleFactor); double xAnnotationsOffset = 0; double yAnnotationsOffset = 0; - double hPdfTransformed = qRound(hPdf * scaleFactor); + double hPdfTransformed = hPdf * scaleFactor; // Here, we force the PDF page to be on the topleft corner of the page double xPdfOffset = 0; - double yPdfOffset = (hPdf - hPdfTransformed) * mScaleFactor; + double yPdfOffset = (hPdf - hPdfTransformed); // Now we align the items - xPdfOffset += (xPdf - xAnnotation) * scaleFactor * mScaleFactor; - yPdfOffset -= (yPdf - yAnnotation) * scaleFactor * mScaleFactor; + xPdfOffset += (xPdf - xAnnotation) * scaleFactor; + yPdfOffset -= (yPdf - yAnnotation) * scaleFactor; // 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 pdfScale = pdfItem->sceneTransform().m11(); - TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor * pdfScale, 0); + TransformationDescription pdfTransform(xPdfOffset, yPdfOffset, scaleFactor, 0); TransformationDescription annotationTransform(xAnnotationsOffset, yAnnotationsOffset, 1, 0); - MergePageDescription pageDescription(pageSize.width() * mScaleFactor, - pageSize.height() * mScaleFactor, + QSizeF pageSize = pdfItem->pageSize(); + MergePageDescription pageDescription(pageSize.width(), + pageSize.height(), pdfItem->pageNumber(), QFile::encodeName(backgroundPath).constData(), pdfTransform, @@ -276,8 +276,10 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS } else { - MergePageDescription pageDescription(pageSize.width() * mScaleFactor, - pageSize.height() * mScaleFactor, + QSizeF pageSize = scene->nominalSize() * mScaleFactor; + + MergePageDescription pageDescription(pageSize.width(), + pageSize.height(), 0, "", TransformationDescription(), @@ -294,7 +296,7 @@ bool UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS merger.saveMergedDocumentsAs(QFile::encodeName(filename).constData()); } - catch(Exception e) + catch(const Exception& e) { qDebug() << "PdfMerger failed to merge documents to " << filename << " - Exception : " << e.what(); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 51995ade2..74cb3e9db 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -2565,6 +2565,25 @@ QSize UBGraphicsScene::sceneSize() return nominalSize(); } +QSizeF UBGraphicsScene::sceneSizeF() const +{ + UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(backgroundObject()); + + if (pdfItem) + { + QRectF targetRect = pdfItem->sceneBoundingRect(); + return targetRect.size(); + } + else if (mDocument && !mNominalSize.isValid()) + { + return mDocument->defaultDocumentSize(); + } + else + { + return mNominalSize; + } +} + void UBGraphicsScene::setNominalSize(const QSize& pSize) { if (nominalSize() != pSize) diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index e824e555f..7723880a8 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -308,6 +308,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem QSize nominalSize(); QSize sceneSize(); + QSizeF sceneSizeF() const; void setNominalSize(const QSize& pSize); diff --git a/src/pdf/GraphicsPDFItem.h b/src/pdf/GraphicsPDFItem.h index 44858e53c..0eb9ed5cd 100644 --- a/src/pdf/GraphicsPDFItem.h +++ b/src/pdf/GraphicsPDFItem.h @@ -52,6 +52,7 @@ class GraphicsPDFItem : public QObject, public QGraphicsItem QUuid fileUuid() const { return mRenderer->fileUuid(); } QByteArray fileData() const { return mRenderer->fileData(); } void setCacheAllowed(bool const value) { mIsCacheAllowed = value; } + QSizeF pageSize() const { return mRenderer->pointSizeF(mPageNumber); } virtual void updateChild() = 0; protected: PDFRenderer *mRenderer; diff --git a/src/pdf/PDFRenderer.h b/src/pdf/PDFRenderer.h index f3b0bf268..8f0cb93e0 100644 --- a/src/pdf/PDFRenderer.h +++ b/src/pdf/PDFRenderer.h @@ -56,6 +56,8 @@ class PDFRenderer : public QObject virtual int pageRotation(int pageNumber) const = 0; + virtual QSizeF pointSizeF(int pageNumber) const = 0; + virtual QString title() const = 0; void attach(); diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp index 27291dda9..97e258bfd 100644 --- a/src/pdf/XPDFRenderer.cpp +++ b/src/pdf/XPDFRenderer.cpp @@ -195,6 +195,20 @@ QString XPDFRenderer::title() const QSizeF XPDFRenderer::pageSizeF(int pageNumber) const +{ + return pointSizeF(pageNumber) * this->dpiForRendering / 72.0; +} + + +int XPDFRenderer::pageRotation(int pageNumber) const +{ + if (mDocument) + return mDocument->getPageRotate(pageNumber); + else + return 0; +} + +QSizeF XPDFRenderer::pointSizeF(int pageNumber) const { qreal cropWidth = 0; qreal cropHeight = 0; @@ -203,27 +217,17 @@ QSizeF XPDFRenderer::pageSizeF(int pageNumber) const { int rotate = mDocument->getPageRotate(pageNumber); - cropWidth = mDocument->getPageCropWidth(pageNumber) * this->dpiForRendering / 72.0; - cropHeight = mDocument->getPageCropHeight(pageNumber) * this->dpiForRendering / 72.0; + cropWidth = mDocument->getPageCropWidth(pageNumber); + cropHeight = mDocument->getPageCropHeight(pageNumber); if (rotate == 90 || rotate == 270) { //switching width and height - qreal tmpVar = cropWidth; - cropWidth = cropHeight; - cropHeight = tmpVar; + std::swap(cropWidth, cropHeight); } } - return QSizeF(cropWidth, cropHeight); -} - -int XPDFRenderer::pageRotation(int pageNumber) const -{ - if (mDocument) - return mDocument->getPageRotate(pageNumber); - else - return 0; + return QSizeF(cropWidth, cropHeight); } diff --git a/src/pdf/XPDFRenderer.h b/src/pdf/XPDFRenderer.h index 919c2ad1c..5ae48ff48 100644 --- a/src/pdf/XPDFRenderer.h +++ b/src/pdf/XPDFRenderer.h @@ -85,6 +85,7 @@ class XPDFRenderer : public PDFRenderer virtual int pageCount() const override; virtual QSizeF pageSizeF(int pageNumber) const override; virtual int pageRotation(int pageNumber) const override; + virtual QSizeF pointSizeF(int pageNumber) const override; virtual QString title() const override; virtual void render(QPainter *p, int pageNumber, const bool cacheAllowed, const QRectF &bounds = QRectF()) override; ++++++ 0460-shortcut-configuration.patch -> 0686-shortcut-configuration.patch ++++++ ++++ 5191 lines (skipped) ++++ between /work/SRC/openSUSE:Factory/OpenBoard/0460-shortcut-configuration.patch ++++ and /work/SRC/openSUSE:Factory/.OpenBoard.new.1597/0686-shortcut-configuration.patch ++++++ 0698-add-cmake-build-system.patch ++++++ ++++ 1763 lines (skipped) ++++++ 9117-disable-software-update.patch ++++++ From 8868eacdd913c1c5bd3040425c507fb8ef527e71 Mon Sep 17 00:00:00 2001 From: letsfindaway <me@letsfindaway.de> Date: Wed, 16 Nov 2022 08:31:29 +0100 Subject: [PATCH] feat: disable software and document update check - for packages maintained by a Linux distribution, a software update check is not relevant - also the import of ancient OpenSankore documents is not necessary - disable the checks in the settings - hide the associated checkboxes in the preferences --- resources/etc/OpenBoard.config | 7 +++---- src/core/UBPreferencesController.cpp | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/etc/OpenBoard.config b/resources/etc/OpenBoard.config index 0120f922d..09c11a6dc 100644 --- a/resources/etc/OpenBoard.config +++ b/resources/etc/OpenBoard.config @@ -1,15 +1,14 @@ [App] AngleTolerance=4 -HideCheckForSoftwareUpdate=false +HideCheckForSoftwareUpdate=true HideSwapDisplayScreens=true -EnableAutomaticSoftwareUpdates=true -EnableSoftwareUpdates=true +EnableAutomaticSoftwareUpdates=false EnableStartupHints=false FavoriteToolURIs=openboardtool://openboard/mask, openboardtool://ruler, openboardtool://compass, openboardtool://protractor, openboardtool://triangle, openboardtool://magnifier, openboardtool://cache IsInSoftwareUpdateProcess=false LastSessionDocumentUUID= LastSessionPageIndex=0 -LookForOpenSankoreInstall=true +LookForOpenSankoreInstall=false PageCacheSize=20 PreferredLanguage=fr_CH ProductWebAddress=http://www.openboard.ch diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp index 4e7c5612a..a5bec7b9b 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -92,2 +92,4 @@ UBPreferencesController::UBPreferencesController(QWidget *parent) mPreferencesUI->setupUi(mPreferencesWindow); + mPreferencesUI->softwareUpdateGroupBox->hide(); // disable check for software update + mPreferencesUI->sankoreImporterGroupBox->hide(); // disable check for OpenSankore documents adjustScreens(); ++++++ 9686-cmake-add-shortcut-manager.patch ++++++ diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index eda1052a..e76d7f92 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -33,6 +33,8 @@ target_sources(${PROJECT_NAME} PRIVATE UBSetting.h UBSettings.cpp UBSettings.h + UBShortcutManager.cpp + UBShortcutManager.h UBTextTools.cpp UBTextTools.h )
participants (1)
-
Source-Sync