From 254d090baebbd2aec9226596aafcdb5fc8c70d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Wed, 13 Jan 2021 10:41:18 +0100 Subject: [PATCH] added an option in the preferences to enable/disable the new pdf optimizations during zoom (just in case some issues may remain, to remove later) --- resources/etc/OpenBoard.config | 1 + resources/forms/preferences.ui | 530 +++++++++++++++------------ src/core/UBPreferencesController.cpp | 20 + src/core/UBPreferencesController.h | 1 + src/core/UBSettings.cpp | 2 + src/core/UBSettings.h | 2 + src/pdf/XPDFRenderer.cpp | 2 +- 7 files changed, 313 insertions(+), 245 deletions(-) diff --git a/resources/etc/OpenBoard.config b/resources/etc/OpenBoard.config index b0665b82..f6a0a3a9 100644 --- a/resources/etc/OpenBoard.config +++ b/resources/etc/OpenBoard.config @@ -124,6 +124,7 @@ Margin=20 PageFormat=A4 Resolution=300 ZoomBehavior=4 +enableQualityLossToIncreaseZoomPerfs=true [Podcast] AudioRecordingDevice=Default diff --git a/resources/forms/preferences.ui b/resources/forms/preferences.ui index f9eef050..d570f56c 100644 --- a/resources/forms/preferences.ui +++ b/resources/forms/preferences.ui @@ -7,7 +7,7 @@ 0 0 825 - 810 + 830 @@ -82,86 +82,14 @@ - 7 + 0 Display - - - - Multi display - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - Swap control display and view display - - - - - - - Show internal web page content on secondary screen or projector - - - - - - - Swap first and second view displays - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + @@ -230,6 +158,204 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + PDF Rendering + + + + + + + + Enable quality loss to increase zoom performances + + + true + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + Toolbar + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + Display Text Under Button + + + + + + + + + Positioned at the Bottom (recommended for white boards) + + + + + + + Positioned at the Top (recommended for tablets) + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -332,8 +458,8 @@ - - + + 0 @@ -341,37 +467,50 @@ - Virtual Keyboard + Documents Mode - - - - - + + + + + + + + 0 + 0 + + + + Display date column on alphabetical sort + + - - + + - Built-in virtual keyboard button size: + Empty trash for documents older than - - + + + + + - Use system keyboard (recommended) + days - - + + Qt::Horizontal - QSizePolicy::Preferred + QSizePolicy::Fixed @@ -381,8 +520,8 @@ - - + + Qt::Horizontal @@ -397,73 +536,17 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - + + - Toolbar + Multi display - - - - - - - Positioned at the Top (recommended for tablets) - - - - - - - Positioned at the Bottom (recommended for white boards) - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - + + + Qt::Horizontal - - QSizePolicy::Preferred - 40 @@ -472,13 +555,13 @@ - - + + Qt::Horizontal - QSizePolicy::Expanding + QSizePolicy::Preferred @@ -488,60 +571,32 @@ - - + + - Display Text Under Button + Swap control display and view display + + + + + + + Show internal web page content on secondary screen or projector + + + + + + + Swap first and second view displays - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + 0 @@ -549,50 +604,37 @@ - Documents Mode + Virtual Keyboard - + - - - - - - 0 - 0 - - - - Display date column on alphabetical sort - - - + - + + + + - Empty trash for documents older than + Built-in virtual keyboard button size: - - - - - + + - days + Use system keyboard (recommended) - - + + Qt::Horizontal - QSizePolicy::Fixed + QSizePolicy::Preferred @@ -603,7 +645,7 @@ - + Qt::Horizontal @@ -1064,7 +1106,7 @@ - 1 + 4 @@ -3065,7 +3107,7 @@ Public License instead of this License. But first, please read <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:12pt; font-weight:600;">Translations</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;"><br /></span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">A special thanks to:</span></p> @@ -3093,7 +3135,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;"><br /></span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;"><br /></span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:12pt; font-weight:600;">Resources added in OpenBoard</span></p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">AndBasR.ttf </span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">Sil Open Font License</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://scripts.sil.org/OFL"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">http://scripts.sil.org/OFL</span></a></p> @@ -3122,10 +3164,10 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.ge.ch/sem/cc/by-nc-nd/"><span style=" font-family:'Lucida Grande'; font-size:10pt; text-decoration: underline; color:#0000ff;">http://www.ge.ch/sem/cc/by-nc-nd/</span></a></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">© 2005-2015, Vista Multimedia SA, Droit de diffusion Etat de Genève - DIP</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://edu.ge.ch/sem/node/1294"><span style=" font-family:'Lucida Grande'; font-size:10pt; text-decoration: underline; color:#0000ff;">http://edu.ge.ch/sem/node/1294</span></a></p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">GraphMe Widget 2.1</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Yannick Vessaz</span></p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">QR-Code Widget</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Basilstotz</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">Licence: CCO</span></p> @@ -3148,7 +3190,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">David Eccles (gringer)</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://creativecommons.org/licenses/by-sa/3.0/deed.en"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">Creative Commons Attribution-Share Alike 3.0 Unported</span></a></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://commons.wikimedia.org/wiki/File:Worldmap_wdb_combined.svg"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">http://commons.wikimedia.org/wiki/File:Worldmap_wdb_combined.svg</span></a></p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p></body></html> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html> true @@ -3171,7 +3213,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> <tr> <td style="border: none;"> @@ -3190,9 +3232,9 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">Case Postale 241</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">1211 Genève 8</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">Switzerland</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.openboard.ch"><span style=" font-family:'.Helvetica Neue DeskInterface'; text-decoration: underline; color:#0000ff;">openboard.ch</span></a></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.Helvetica Neue DeskInterface'; text-decoration: underline; color:#0000ff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">emails: </span><a href="mailto:sem.logistique@edu.ge.ch"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">sem.logistique@edu.ge.ch</span></a><span style=" font-family:'Ubuntu';">, </span><a href="mailto:sem.logistique@edu.ge.ch"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">support@openboard.ch</span></a></p></td></tr></table></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.openboard.ch"><span style=" font-family:'.Helvetica Neue DeskInterface'; font-size:11pt; text-decoration: underline; color:#0000ff;">openboard.ch</span></a></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.Helvetica Neue DeskInterface'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">emails: </span><a href="mailto:sem.logistique@edu.ge.ch"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">sem.logistique@edu.ge.ch</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">, </span><a href="mailto:sem.logistique@edu.ge.ch"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">support@openboard.ch</span></a></p></td></tr></table></body></html> true diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp index 9ecceeec..2cbe8e06 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -138,6 +138,10 @@ void UBPreferencesController::wire() connect(mPreferencesUI->useSystemOSKCheckBox, SIGNAL(clicked(bool)), settings->useSystemOnScreenKeyboard, SLOT(setBool(bool))); connect(mPreferencesUI->useSystemOSKCheckBox, SIGNAL(clicked(bool)), this, SLOT(systemOSKCheckBoxToggled(bool))); + //Zoom Behavior preferences + connect(mPreferencesUI->enableQualityLossToIncreaseZoomPerfs, SIGNAL(clicked(bool)), settings->enableQualityLossToIncreaseZoomPerfs, SLOT(setBool(bool))); + connect(mPreferencesUI->enableQualityLossToIncreaseZoomPerfs, SIGNAL(clicked(bool)), this, SLOT(setPdfZoomBehavior(bool))); + // Documents Mode preferences connect(mPreferencesUI->showDateColumnOnAlphabeticalSort, SIGNAL(clicked(bool)), settings->showDateColumnOnAlphabeticalSort, SLOT(setBool(bool))); connect(mPreferencesUI->showDateColumnOnAlphabeticalSort, SIGNAL(clicked(bool)), UBApplication::documentController, SLOT(refreshDateColumns())); @@ -282,6 +286,8 @@ void UBPreferencesController::init() mPreferencesUI->useSystemOSKCheckBox->setChecked(settings->useSystemOnScreenKeyboard->get().toBool()); this->systemOSKCheckBoxToggled(mPreferencesUI->useSystemOSKCheckBox->isChecked()); + mPreferencesUI->enableQualityLossToIncreaseZoomPerfs->setChecked(settings->enableQualityLossToIncreaseZoomPerfs->get().toBool()); + mPreferencesUI->showDateColumnOnAlphabeticalSort->setChecked(settings->showDateColumnOnAlphabeticalSort->get().toBool()); mPreferencesUI->emptyTrashForOlderDocuments->setChecked(settings->emptyTrashForOlderDocuments->get().toBool()); mPreferencesUI->emptyTrashDaysValue->setValue(settings->emptyTrashDaysValue->get().toInt()); @@ -354,6 +360,8 @@ void UBPreferencesController::defaultSettings() mPreferencesUI->showDateColumnOnAlphabeticalSort->setChecked(settings->showDateColumnOnAlphabeticalSort->reset().toBool()); UBApplication::documentController->refreshDateColumns(); + mPreferencesUI->enableQualityLossToIncreaseZoomPerfs->setChecked(settings->enableQualityLossToIncreaseZoomPerfs->reset().toBool()); + mPreferencesUI->emptyTrashForOlderDocuments->setChecked(settings->emptyTrashForOlderDocuments->reset().toBool()); mPreferencesUI->emptyTrashDaysValue->setValue(settings->emptyTrashDaysValue->reset().toInt()); @@ -655,6 +663,18 @@ void UBPreferencesController::systemOSKCheckBoxToggled(bool checked) mPreferencesUI->keyboardPaletteKeyButtonSize_Label->setVisible(!checked); } +void UBPreferencesController::setPdfZoomBehavior(bool checked) +{ + if (checked) + { + UBSettings::settings()->pdfZoomBehavior->setInt(4);// Multithreaded, several steps, downsampled. + } + else + { + UBSettings::settings()->pdfZoomBehavior->setInt(0);//Old behavior. To remove if no issues found with the other mode + } +} + UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList& lightBackgroundColors, const QList& darkBackgroundColors, const QList& lightBackgroundSelectedColors, const QList& darkBackgroundSelectedColors, UBPreferencesController* controller) diff --git a/src/core/UBPreferencesController.h b/src/core/UBPreferencesController.h index d94f4403..2a6b21b3 100644 --- a/src/core/UBPreferencesController.h +++ b/src/core/UBPreferencesController.h @@ -102,6 +102,7 @@ class UBPreferencesController : public QObject void toolbarOrientationVertical(bool checked); void toolbarOrientationHorizontal(bool checked); void systemOSKCheckBoxToggled(bool checked); + void setPdfZoomBehavior(bool checked); private slots: void adjustScreens(int screen); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 78be3c15..1920d90b 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -408,7 +408,9 @@ void UBSettings::init() pdfMargin = new UBSetting(this, "PDF", "Margin", "20"); pdfPageFormat = new UBSetting(this, "PDF", "PageFormat", "A4"); pdfResolution = new UBSetting(this, "PDF", "Resolution", "300"); + pdfZoomBehavior = new UBSetting(this, "PDF", "ZoomBehavior", "4"); + enableQualityLossToIncreaseZoomPerfs = new UBSetting(this, "PDF", "enableQualityLossToIncreaseZoomPerfs", true); podcastFramesPerSecond = new UBSetting(this, "Podcast", "FramesPerSecond", 10); podcastVideoSize = new UBSetting(this, "Podcast", "VideoSize", "Medium"); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 5b287354..a7353108 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -359,7 +359,9 @@ class UBSettings : public QObject UBSetting* pdfMargin; UBSetting* pdfPageFormat; UBSetting* pdfResolution; + UBSetting* pdfZoomBehavior; + UBSetting* enableQualityLossToIncreaseZoomPerfs; UBSetting* podcastFramesPerSecond; UBSetting* podcastVideoSize; diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp index 045156e8..a81616b8 100644 --- a/src/pdf/XPDFRenderer.cpp +++ b/src/pdf/XPDFRenderer.cpp @@ -54,9 +54,9 @@ XPDFRenderer::XPDFRenderer(const QString &filename, bool importingFile) { switch (m_pdfZoomMode) { case 0: // Render each time (historical initial implementation). + default: break; case 1: // Render a single image, degradated quality when zoomed big. - default: m_pdfZoomCache.push_back(XPDFRendererZoomFactor::mode1_zoomFactor); break; case 2: // Render three images, use downsampling, optimal quality all the time, slower.