Merge lp://staging/~verzegnassi-stefano/ubuntu-docviewer-app/lok-new-zoom-modes+spreadsheet-zoom into lp://staging/ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 257
Merged at revision: 274
Proposed branch: lp://staging/~verzegnassi-stefano/ubuntu-docviewer-app/lok-new-zoom-modes+spreadsheet-zoom
Merge into: lp://staging/ubuntu-docviewer-app
Diff against target: 1001 lines (+647/-86)
9 files modified
po/com.ubuntu.docviewer.pot (+13/-5)
src/app/qml/loView/ZoomSelector.qml (+66/-28)
src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt (+1/-0)
src/plugin/libreofficetoolkit-qml-plugin/loview.cpp (+183/-32)
src/plugin/libreofficetoolkit-qml-plugin/loview.h (+24/-11)
src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml (+23/-1)
src/plugin/libreofficetoolkit-qml-plugin/twips.h (+36/-9)
src/plugin/libreofficetoolkit-qml-plugin/ucunits.cpp (+241/-0)
src/plugin/libreofficetoolkit-qml-plugin/ucunits.h (+60/-0)
To merge this branch: bzr merge lp://staging/~verzegnassi-stefano/ubuntu-docviewer-app/lok-new-zoom-modes+spreadsheet-zoom
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Needs Fixing
Review via email: mp+281385@code.staging.launchpad.net

Commit message

LibreOffice Viewer - LibreOfficeKit QML plugin:
- Open spreadsheet with manual zoom (1.0x factor)
- Added "Fit to height" and "Automatic" zoom behaviours
- Added a "zoomModesAvailable" which returns the zoom modes available for a given document.
- Use UCUnits when converting TWIPs in pixels (and vice versa)
- Minor changes

Description of the change

LibreOffice Viewer - LibreOfficeKit QML plugin:
- Open spreadsheet with manual zoom (1.0x factor)
- Added "Fit to height" and "Automatic" zoom behaviours
- Added a "zoomModesAvailable" which returns the zoom modes available for a given document.
- Use UCUnits when converting TWIPs in pixels (and vice versa)
- Minor changes

*** NOTE FOR REVIEWERS ***
Please let me know what do you think about the usage of manual zoom as default for spreadsheet documents.
It behaves properly on desktop, but on phones it looks overzoomed.
I believe it's anyway better than earlier, since the zoom value does not depend on the number of columns with content.
Ideally we want in future to set a different default zoom value when running on a mobile device (but it could be a bit complex to do)

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Tested on bq e4.5:-

http://people.canonical.com/~alan/screenshots/device-2016-01-12-133308.png

Tested on OnePlus One:-

http://people.canonical.com/~alan/screenshots/device-2016-01-12-133734.png

So it looks like we're detecting the screen size / resolution and automatic zoom on larger resolution (1080p) devices isn't working correctly. I don't have an MX4 handy to see what it is like on that.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

(I should add, I quite like the zoomed in level. While the text is very large, it loads fast, and is easy enough to scroll around / zoom in/out).

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Confirmed with a community member that the MX4 also has the "zoomed out" look. As that's a supported device, I think we should improve that.

review: Needs Fixing
Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

It seems to me an HIDPI issue.
The only math involved is a conversion from TWIPs to pixels, based on the value of the pixel density of the screen.

Except for some rounding issue, but DocViewer should return the same size (in cm or inches) for the same object, as in this picture:
   https://imgur.com/NOI1Rwm

I've seen that a number of issues about HIDPI screens has been reported for some core app recently[1]. May it be related somehow with the result of your tests?

[1] https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1532950

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Ok, I tried to use the GRID_UNIT used by the UITK, instead of assuming the size of the document on DPI.

Screenshot - BQ E5: https://imgur.com/FobrTSK
Screenshot - desktop: https://imgur.com/2ODW93W

It seems to provide the result we were expecting.

---

Basically, the idea is to make the size of the document depending on perceived size of the screen[1], instead of being the same size in inches on any screen/device.

This way the value of the 1.0x zoom factor *should* also depend on the distance between the device and the user (which is kinda important for a proper scaling of a phone GUI).

The logic behind this would be taken from the UITK and *should* work on any device, regardless is an Ubuntu device or not.

That's how it works:
    1) Read GRID_UNIT_PX variable (Ubuntu Touch/Personal specific)
    2) If GRID_UNIT_PX not found, read QT_DEVICE_PIXEL_RATIO variable (Qt specific, works on any platform)
    3) If the Qt variable is not found, just assume it's a desktop with the standard 96 DPI value.

This is done using qgetenv(), which is a Qt function and works even on MS Windows.

Further informations can be found here:
    http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/head:/src/Ubuntu/Components/plugin/ucunits.cpp

======

[1] i.e. physical quality of the screen + scope of the device - see "Screen Pixel Ratio" section at
    https://developer.ubuntu.com/en/start/ubuntu-for-devices/porting-new-device/

255. By Stefano Verzegnassi

Merged trunk

256. By Stefano Verzegnassi

Convert TWIPs to pixels (and vice versa) using UCUnits from Ubuntu UI Toolkit, instead of DPI

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
257. By Stefano Verzegnassi

Added UCUnits class from UITK. Forgot to 'bzr add' them in the previous commit

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

I got some time to reinstall Ubuntu Touch on my Nexus 5.
After some fight with LibreOffice dependencies, I've been able to test the UCUnits change on the device:

WITH DPIs - https://imgur.com/sc53rXF
WITH UCUNITS - https://imgur.com/i6DYb6e

The GRID_UNIT_PX env value on Nexus 5 is "23", and the result in the screenshot above is totally compatible with the test done on the BQ E5 (Nexus 5 has a wider screen in terms of units.gu() than mako and vegetahd).

I'm sure the same result is visible also on OPO and MX4.

@Alan: I really need this branch merged ASAP because it's a prerequisite for two other branches[1] in the queue.
I know you're busy with the UbuCon@LA but, since the other changes work well and the issue you've found has been fixed, I'm forced to by-pass your review and top-approve this. Sorry.

======
[1] 1st branch: Refactor of the zooming code, providing a single property called "zoomSettings", instead of individual ones (which are grouped in 'zoomSettings').
    2nd branch: Show content centered on the screen + fixes for PinchArea + double-tap-to-zoom gesture

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches