Update to 1.7.0-1.20221129git9de37af

i9ce
Arkady L. Shane 1 year ago
parent fbe36e330d
commit 4ed2c12bf8
Signed by: tigro
GPG Key ID: 9C7900103E1C4F8B

2
.gitignore vendored

@ -1 +1 @@
SOURCES/openboard-9de37af2df1a7c0d88f71c94ab2db1815d082862.tar.gz
SOURCES/openboard-92dbed8305240a412fe71ae65de55a607214df1b.tar.gz

@ -1 +1 @@
2e7fff009140daa634e44b895f4ceb5c8353eddb SOURCES/openboard-9de37af2df1a7c0d88f71c94ab2db1815d082862.tar.gz
b43c7a74bef3a00d22ba053d507c1d13411c421e SOURCES/openboard-92dbed8305240a412fe71ae65de55a607214df1b.tar.gz

@ -1,589 +0,0 @@
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 1/3] refactor: drawBackground mostly in scene
- move all drawing of background grid to UBGraphicsScene
- only add document border in UBBoardView
- avoid some compiler warnings
---
src/board/UBBoardView.cpp | 101 ++++-----------------------------
src/domain/UBGraphicsScene.cpp | 48 +++++++++++++---
2 files changed, 51 insertions(+), 98 deletions(-)
diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp
index 817d8c4e7..c968f17d7 100644
--- a/src/board/UBBoardView.cpp
+++ b/src/board/UBBoardView.cpp
@@ -29,6 +29,7 @@
#include "UBBoardView.h"
+#include <QtGlobal>
#include <QtGui>
#include <QtXml>
#include <QListView>
@@ -92,11 +93,11 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
, mIsCreatingTextZone (false)
, mIsCreatingSceneGrabZone (false)
, mOkOnWidget(false)
+ , _movingItem(nullptr)
, suspendedMousePressEvent(NULL)
, mLongPressInterval(1000)
, mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false)
- , _movingItem(nullptr)
, bIsControl(isControl)
, bIsDesktop(isDesktop)
{
@@ -117,11 +118,11 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent, bool isControl, bool isDesktop)
: QGraphicsView (pParent)
, mController (pController)
+ , _movingItem(nullptr)
, suspendedMousePressEvent(NULL)
, mLongPressInterval(1000)
, mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false)
- , _movingItem(nullptr)
, bIsControl(isControl)
, bIsDesktop(isDesktop)
{
@@ -685,6 +686,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
return false;
if(currentTool == UBStylusTool::Play)
return false;
+ Q_FALLTHROUGH();
case UBGraphicsSvgItem::Type:
case UBGraphicsPixmapItem::Type:
@@ -692,10 +694,13 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
return true;
if (item->isSelected())
return false;
+ Q_FALLTHROUGH();
+
case UBGraphicsMediaItem::Type:
case UBGraphicsVideoItem::Type:
case UBGraphicsAudioItem::Type:
return true;
+
case UBGraphicsStrokesGroup::Type:
case UBGraphicsTextItem::Type:
if (currentTool == UBStylusTool::Play)
@@ -1714,98 +1719,14 @@ void UBBoardView::paintEvent(QPaintEvent *event)
void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect)
{
+ // draw the background of the QGraphicsScene
+ QGraphicsView::drawBackground(painter, rect);
+
if (testAttribute (Qt::WA_TranslucentBackground))
{
- QGraphicsView::drawBackground (painter, rect);
return;
}
- bool darkBackground = scene () && scene ()->isDarkBackground ();
-
- if (darkBackground)
- {
- painter->fillRect (rect, QBrush (QColor (Qt::black)));
- }
- else
- {
- painter->fillRect (rect, QBrush (QColor (Qt::white)));
- }
-
- if (transform ().m11 () > 0.5)
- {
- QColor bgCrossColor;
-
- if (darkBackground)
- bgCrossColor = QColor(UBSettings::settings()->boardCrossColorDarkBackground->get().toString());
- else
- bgCrossColor = QColor(UBSettings::settings()->boardCrossColorLightBackground->get().toString());
-
- if (transform ().m11 () < 0.7)
- {
- int alpha = 255 * transform ().m11 () / 2;
- bgCrossColor.setAlpha (alpha); // fade the crossing on small zooms
- }
-
- qreal gridSize = scene()->backgroundGridSize();
- bool intermediateLines = scene()->intermediateLines();
-
- painter->setPen (bgCrossColor);
-
- if (scene () && scene ()->pageBackground() == UBPageBackground::crossed)
- {
- qreal firstY = ((int) (rect.y () / gridSize)) * gridSize;
-
- for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += gridSize)
- {
- painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
- }
-
- qreal firstX = ((int) (rect.x () / gridSize)) * gridSize;
-
- for (qreal xPos = firstX; xPos < rect.x () + rect.width (); xPos += gridSize)
- {
- painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ());
- }
-
- if (intermediateLines) {
- QColor intermediateColor = bgCrossColor;
- intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF());
- painter->setPen(intermediateColor);
-
- for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize)
- {
- painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
- }
-
- for (qreal xPos = firstX - gridSize/2; xPos < rect.x () + rect.width (); xPos += gridSize)
- {
- painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ());
- }
- }
- }
-
- if (scene() && scene()->pageBackground() == UBPageBackground::ruled)
- {
- qreal firstY = ((int) (rect.y () / gridSize)) * gridSize;
-
- for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += gridSize)
- {
- painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
- }
-
- if (intermediateLines) {
- QColor intermediateColor = bgCrossColor;
- intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF());
- painter->setPen(intermediateColor);
-
- for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize)
- {
- painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
- }
- }
- }
- }
-
if (!mFilterZIndex && scene ())
{
QSize pageNominalSize = scene ()->nominalSize ();
@@ -1821,7 +1742,7 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect)
QColor docSizeColor;
- if (darkBackground)
+ if (scene ()->isDarkBackground ())
docSizeColor = UBSettings::documentSizeMarkColorDarkBackground;
else
docSizeColor = UBSettings::documentSizeMarkColorLightBackground;
diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp
index aa6734dfe..48850d7e8 100644
--- a/src/domain/UBGraphicsScene.cpp
+++ b/src/domain/UBGraphicsScene.cpp
@@ -2690,15 +2690,16 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect)
QGraphicsScene::drawBackground (painter, rect);
return;
}
+
bool darkBackground = isDarkBackground ();
if (darkBackground)
{
- painter->fillRect (rect, QBrush (QColor (Qt::black)));
+ painter->fillRect (rect, QBrush (QColor (Qt::black)));
}
else
{
- painter->fillRect (rect, QBrush (QColor (Qt::white)));
+ painter->fillRect (rect, QBrush (QColor (Qt::white)));
}
if (mZoomFactor > 0.5)
@@ -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());
+
if (mZoomFactor < 0.7)
{
int alpha = 255 * mZoomFactor / 2;
bgCrossColor.setAlpha (alpha); // fade the crossing on small zooms
}
+ qreal gridSize = backgroundGridSize();
painter->setPen (bgCrossColor);
if (mPageBackground == UBPageBackground::crossed)
{
- qreal firstY = ((int) (rect.y () / backgroundGridSize())) * backgroundGridSize();
+ qreal firstY = ((int) (rect.y () / gridSize)) * gridSize;
- for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += backgroundGridSize())
+ for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += gridSize)
{
painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
}
- qreal firstX = ((int) (rect.x () / backgroundGridSize())) * backgroundGridSize();
+ qreal firstX = ((int) (rect.x () / gridSize)) * gridSize;
- for (qreal xPos = firstX; xPos < rect.x () + rect.width (); xPos += backgroundGridSize())
+ for (qreal xPos = firstX; xPos < rect.x () + rect.width (); xPos += gridSize)
{
painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ());
}
+
+ if (mIntermediateLines)
+ {
+ QColor intermediateColor = bgCrossColor;
+ intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF());
+ painter->setPen(intermediateColor);
+
+ for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize)
+ {
+ painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
+ }
+
+ for (qreal xPos = firstX - gridSize/2; xPos < rect.x () + rect.width (); xPos += gridSize)
+ {
+ painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ());
+ }
+ }
}
else if (mPageBackground == UBPageBackground::ruled)
{
- qreal firstY = ((int) (rect.y () / backgroundGridSize())) * backgroundGridSize();
+ qreal firstY = ((int) (rect.y () / gridSize)) * gridSize;
- for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += backgroundGridSize())
+ for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += gridSize)
{
painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
}
+
+ if (mIntermediateLines)
+ {
+ QColor intermediateColor = bgCrossColor;
+ intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF());
+ painter->setPen(intermediateColor);
+
+ for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize)
+ {
+ painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos);
+ }
+ }
}
}
}
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);
}
}

@ -1,41 +0,0 @@
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 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp
index db5b65116..ff9810862 100644
--- a/src/gui/UBScreenMirror.cpp
+++ b/src/gui/UBScreenMirror.cpp
@@ -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);
}

@ -1,274 +0,0 @@
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;

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
From 6830bd54d42446a4d09acc25da39113ecd808a61 Mon Sep 17 00:00:00 2001
From 3ec285829559396ccd06f72106ff1e39cfbd9fcc Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Wed, 10 Aug 2022 10:41:15 +0200
Subject: [PATCH 1/3] chore: add cmake build system
Subject: [PATCH 1/6] chore: add cmake build system
- add a cmake based build sytem which is
- easy to understand
@ -122,7 +122,7 @@ Subject: [PATCH 1/3] chore: add cmake build system
create mode 100644 src/web/CMakeLists.txt
diff --git a/.gitignore b/.gitignore
index 46f6fb9f5..3b1d44dc8 100644
index 5bd5bf9ad..d82a98268 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,7 @@ Thumbs.db
@ -899,7 +899,7 @@ index 000000000..ef91e1096
+ UBWidgetUpgradeAdaptor.h
+)
diff --git a/src/adaptors/UBWidgetUpgradeAdaptor.cpp b/src/adaptors/UBWidgetUpgradeAdaptor.cpp
index 503897c15..cb9c98f18 100644
index b3df61105..fe782975c 100644
--- a/src/adaptors/UBWidgetUpgradeAdaptor.cpp
+++ b/src/adaptors/UBWidgetUpgradeAdaptor.cpp
@@ -206,7 +206,7 @@ UBWidgetUpgradeAdaptor::Widget::Widget(const QString &dir) : m_path(dir), m_hasU
@ -988,10 +988,10 @@ index 000000000..eda1052a9
+ UBTextTools.h
+)
diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp
index c076241df..c1b0f6236 100644
index 45365f916..e164d0183 100644
--- a/src/core/UBApplication.cpp
+++ b/src/core/UBApplication.cpp
@@ -139,7 +139,7 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : Single
@@ -140,7 +140,7 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : Single
setStyle("fusion");
@ -1001,7 +1001,7 @@ index c076241df..c1b0f6236 100644
setStyleSheet(css);
diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp
index 9a7a6f691..c07c9b7a1 100644
index 74962bb41..bb7fe2ea0 100644
--- a/src/core/UBSettings.cpp
+++ b/src/core/UBSettings.cpp
@@ -158,7 +158,7 @@ QSettings* UBSettings::getAppSettings()
@ -1110,10 +1110,10 @@ index 000000000..15bcab6b5
+ UBWebEngineView.h
+)
diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp
index 2ecad9587..53c01e9c8 100644
index 73796cefd..f93ae5d3d 100644
--- a/src/domain/UBGraphicsWidgetItem.cpp
+++ b/src/domain/UBGraphicsWidgetItem.cpp
@@ -1279,14 +1279,14 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates()
@@ -1280,14 +1280,14 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates()
if (!sTemplateLoaded) {
sNPAPIWrapperTemplates.clear();
@ -1132,7 +1132,7 @@ index 2ecad9587..53c01e9c8 100644
if (htmlContent.length() > 0) {
QStringList tokens = fileName.split(".");
@@ -1303,7 +1303,7 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates()
@@ -1304,7 +1304,7 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates()
}
}
}
@ -1180,7 +1180,7 @@ index 000000000..3bb0d7766
+ )
+endif()
diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h
index da9fd1295..2c9515a5d 100644
index 3717f1e33..953af0cda 100644
--- a/src/frameworks/UBPlatformUtils.h
+++ b/src/frameworks/UBPlatformUtils.h
@@ -191,6 +191,7 @@ class UBPlatformUtils
@ -1192,18 +1192,18 @@ index da9fd1295..2c9515a5d 100644
static void setFileType(const QString &filePath, unsigned long fileType);
static void fadeDisplayOut();
diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp
index cff17b1d3..61a2d0aad 100644
index e80dff306..117c6b7bf 100644
--- a/src/frameworks/UBPlatformUtils_linux.cpp
+++ b/src/frameworks/UBPlatformUtils_linux.cpp
@@ -33,6 +33,7 @@
#include <QApplication>
@@ -34,6 +34,7 @@
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMetaType>
+#include <QProcessEnvironment>
#include <unistd.h>
#include <X11/keysym.h>
@@ -50,7 +51,20 @@ void UBPlatformUtils::init()
@@ -53,7 +54,20 @@ void UBPlatformUtils::init()
QString UBPlatformUtils::applicationResourcesDirectory()
{
@ -1225,7 +1225,7 @@ index cff17b1d3..61a2d0aad 100644
void UBPlatformUtils::hideFile(const QString &filePath)
diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm
index 4ecb705a6..14c6ed303 100644
index 0be545ca9..d7adbcbc8 100644
--- a/src/frameworks/UBPlatformUtils_mac.mm
+++ b/src/frameworks/UBPlatformUtils_mac.mm
@@ -123,6 +123,11 @@ OSStatus emptySetSystemUIMode (
@ -1241,10 +1241,10 @@ index 4ecb705a6..14c6ed303 100644
{
FSRef ref;
diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp
index c85dafa75..bb6f4c68f 100644
index 2931b56b1..f084ba012 100644
--- a/src/frameworks/UBPlatformUtils_win.cpp
+++ b/src/frameworks/UBPlatformUtils_win.cpp
@@ -51,6 +51,10 @@ QString UBPlatformUtils::applicationResourcesDirectory()
@@ -53,6 +53,10 @@ QString UBPlatformUtils::applicationResourcesDirectory()
return QApplication::applicationDirPath();
}
@ -1577,10 +1577,10 @@ index 000000000..45277ec12
+ simplebrowser/passworddialog.ui
+)
diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp
index df3bffba5..31e4e8616 100644
index c57a3c454..29738daff 100644
--- a/src/web/UBWebController.cpp
+++ b/src/web/UBWebController.cpp
@@ -415,7 +415,7 @@ void UBWebController::injectScripts(QWebEngineView *view)
@@ -428,7 +428,7 @@ void UBWebController::injectScripts(QWebEngineView *view)
qDebug() << "Injecting qwebchannel.js";
QString src = js.readAll();
@ -1590,10 +1590,10 @@ index df3bffba5..31e4e8616 100644
if (asyncwrapper.open(QIODevice::ReadOnly))
{
From 5ed9d68afc52d071135640e8da5c35308cd5d318 Mon Sep 17 00:00:00 2001
From ec95135c4aea791fd78cf78b9eb600618c7ae591 Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Sun, 30 Oct 2022 08:09:24 +0100
Subject: [PATCH 2/3] fix: compatibility with Qt 5.12 and Qt 6
Subject: [PATCH 2/6] fix: compatibility with Qt 5.12 and Qt 6
- use qt5_add_resources and qt5_add_translation for Qt 5.12
- add .ui and .ts files using target_sources
@ -1693,10 +1693,10 @@ index 45277ec12..590476e34 100644
simplebrowser/downloadmanagerwidget.ui
simplebrowser/downloadwidget.ui
From 6ff5d2c7f339e1612a8e6e836061f0d96b03d8fc Mon Sep 17 00:00:00 2001
From 86903f2fb91193fae1d2af9a5895734f137036d8 Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Sat, 5 Nov 2022 08:52:48 +0100
Subject: [PATCH 3/3] chore: add cpack packaging (by @sebojolais)
Subject: [PATCH 3/6] chore: add cpack packaging (by @sebojolais)
- add cpack packaging instructions
- configure for deb and rpm packages
@ -1760,3 +1760,123 @@ index f6900ac39..ebd94ffce 100644
+
+# create packager
+include(CPack)
From f18b9ccde44c3e014a247684a8966816df3b3e4f Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Sat, 3 Dec 2022 18:30:14 +0100
Subject: [PATCH 4/6] fixup: remove unused UBIdleTimer
---
src/core/CMakeLists.txt | 2 --
src/core/UBApplication.cpp | 1 -
2 files changed, 3 deletions(-)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index eda1052a9..2b362252e 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -15,8 +15,6 @@ target_sources(${PROJECT_NAME} PRIVATE
UBDownloadThread.h
UBForeignObjectsHandler.cpp
UBForeignObjectsHandler.h
- UBIdleTimer.cpp
- UBIdleTimer.h
UBMimeData.cpp
UBMimeData.h
UBOpenSankoreImporter.cpp
diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp
index e164d0183..d89c2009a 100644
--- a/src/core/UBApplication.cpp
+++ b/src/core/UBApplication.cpp
@@ -43,7 +43,6 @@
#include "UBPersistenceManager.h"
#include "UBDocumentManager.h"
#include "UBPreferencesController.h"
-#include "UBIdleTimer.h"
#include "UBApplicationController.h"
#include "board/UBBoardController.h"
From 34c09bc5d984398cd31cf25538701a871e9d5d25 Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Wed, 21 Dec 2022 11:47:59 +0100
Subject: [PATCH 5/6] chore: allow to set build version for build
- make VERSION_BUILD and VERSION_TYPE CACHE variables
- this allows to overwrite them using -D when invoking cmake
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebd94ffce..5d884045d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,8 +41,8 @@ project(openboard
LANGUAGES CXX
)
-set(VERSION_TYPE a) # a = alpha, b = beta, rc = release candidate, r = release, other => error
-set(VERSION_BUILD 1027)
+set(VERSION_TYPE r CACHE STRING "a = alpha, b = beta, rc = release candidate, r = release")
+set(VERSION_BUILD 1027 CACHE STRING "Build version for non-release builds")
include(cmake/Version.cmake)
include(cmake/Platform.cmake)
From a91f2cecb1f8bfcece4565c083875936a71034f1 Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Fri, 24 Mar 2023 14:15:12 +0100
Subject: [PATCH 6/6] feat: add startup hints to cmake build
- package startupHints directory
- use absolute paths to make webengine happy
---
CMakeLists.txt | 2 ++
src/frameworks/UBPlatformUtils_linux.cpp | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d884045d..6d4887722 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,7 @@ set(OPENBOARD_FONT_DIR resources/customizations resources/fonts)
set(OPENBOARD_ETC_DIR resources/etc)
set(OPENBOARD_LIBRARY_DIR resources/library)
set(OPENBOARD_TEMPLATE_DIR resources/template)
+set(OPENBOARD_STARTUP_HINTS resources/startupHints)
set(OPENBOARD_ICON_FILE resources/images/ch.openboard.OpenBoard.svg)
@@ -246,6 +247,7 @@ if(LINUX)
install(DIRECTORY ${OPENBOARD_ETC_DIR}/ DESTINATION ${OPENBOARD_INSTALL_SYSCONFDIR})
install(DIRECTORY ${OPENBOARD_LIBRARY_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR})
install(DIRECTORY ${OPENBOARD_TEMPLATE_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR})
+ install(DIRECTORY ${OPENBOARD_STARTUP_HINTS} DESTINATION ${OPENBOARD_INSTALL_DATADIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/i18n DESTINATION ${OPENBOARD_INSTALL_DATADIR})
install(FILES ${OPENBOARD_ICON_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps)
install(FILES ${OPENBOARD_DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp
index 117c6b7bf..1328539de 100644
--- a/src/frameworks/UBPlatformUtils_linux.cpp
+++ b/src/frameworks/UBPlatformUtils_linux.cpp
@@ -55,7 +55,8 @@ void UBPlatformUtils::init()
QString UBPlatformUtils::applicationResourcesDirectory()
{
#ifdef APP_PREFIX
- return QProcessEnvironment::systemEnvironment().value("APP_PREFIX", APP_PREFIX);
+ QString prefix = QProcessEnvironment::systemEnvironment().value("APP_PREFIX", APP_PREFIX);
+ return QFileInfo(prefix).absoluteFilePath();
#else
return QApplication::applicationDirPath();
#endif
@@ -64,7 +65,8 @@ QString UBPlatformUtils::applicationResourcesDirectory()
QString UBPlatformUtils::applicationEtcDirectory()
{
#ifdef ETC_PREFIX
- return QProcessEnvironment::systemEnvironment().value("ETC_PREFIX", ETC_PREFIX);
+ QString prefix = QProcessEnvironment::systemEnvironment().value("ETC_PREFIX", ETC_PREFIX);
+ return QFileInfo(prefix).absoluteFilePath();
#else
return applicationResourcesDirectory() + "/etc";
#endif

@ -1,4 +1,4 @@
From 8868eacdd913c1c5bd3040425c507fb8ef527e71 Mon Sep 17 00:00:00 2001
From 7d50e97af79d7393d7b893bf640b6bccbcf22dd6 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
@ -14,7 +14,7 @@ Subject: [PATCH] feat: disable software and document update check
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/resources/etc/OpenBoard.config b/resources/etc/OpenBoard.config
index 0120f922d..09c11a6dc 100644
index e7f2e075b..67f21a58e 100644
--- a/resources/etc/OpenBoard.config
+++ b/resources/etc/OpenBoard.config
@@ -1,15 +1,14 @@
@ -26,7 +26,7 @@ index 0120f922d..09c11a6dc 100644
-EnableAutomaticSoftwareUpdates=true
-EnableSoftwareUpdates=true
+EnableAutomaticSoftwareUpdates=false
EnableStartupHints=false
EnableStartupHints=true
FavoriteToolURIs=openboardtool://openboard/mask, openboardtool://ruler, openboardtool://compass, openboardtool://protractor, openboardtool://triangle, openboardtool://magnifier, openboardtool://cache
IsInSoftwareUpdateProcess=false
LastSessionDocumentUUID=
@ -37,11 +37,15 @@ index 0120f922d..09c11a6dc 100644
PreferredLanguage=fr_CH
ProductWebAddress=http://www.openboard.ch
diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp
index 4e7c5612a..a5bec7b9b 100644
index 9c7802be9..f4e85c3a6 100644
--- a/src/core/UBPreferencesController.cpp
+++ b/src/core/UBPreferencesController.cpp
@@ -92,2 +92,4 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
@@ -90,6 +90,8 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
mPreferencesWindow = new UBPreferencesDialog(this,parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in destructor
mPreferencesUI->setupUi(mPreferencesWindow);
+ mPreferencesUI->softwareUpdateGroupBox->hide(); // disable check for software update
+ mPreferencesUI->sankoreImporterGroupBox->hide(); // disable check for OpenSankore documents
adjustScreens();
adjustScreensPreferences();
connect(UBApplication::displayManager, &UBDisplayManager::availableScreenCountChanged, this, &UBPreferencesController::adjustScreensPreferences);

@ -1,6 +1,6 @@
%define githash 9de37af2df1a7c0d88f71c94ab2db1815d082862
%define gitshort 9de37af
%define gitdate 20221129
%define githash 92dbed8305240a412fe71ae65de55a607214df1b
%define gitshort 92dbed8
%define gitdate 20230911
Summary: Interactive whiteboard for schools and universities
Name: openboard
@ -10,14 +10,6 @@ License: GPLv3
URL: https://openboard.ch
Source0: https://github.com/OpenBoard-org/OpenBoard/archive/%{githash}.tar.gz#/openboard-%{githash}.tar.gz
# 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/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
@ -86,8 +78,8 @@ rm resources/library/applications/Calculator.wgt/.gitignore
%{_bindir}/%{name}
%changelog
* Mon Sep 11 2023 Arkady L. Shane <ashejn@msvsphere.ru> - 1.7.0-1.20221129git9de37af
- Rebuilt for MSVSphere 9.2
* Mon Sep 11 2023 Arkady L. Shane <ashejn@msvsphere.ru> - 1.7.0-1.20230911git92dbed8
- Update to last commit
* Mon Sep 11 2023 Arkady L. Shane <ashejn@msvsphere.ru> - 1.7.0-1.20221129git9de37af
- Rebuilt for MSVSphere 9.2

Loading…
Cancel
Save