ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01578
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/landscape-support into lp:ubuntu-docviewer-app
Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/landscape-support into lp:ubuntu-docviewer-app.
Commit message:
Enabled landscape support
Requested reviews:
Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)
Related bugs:
Bug #1428721 in Ubuntu Document Viewer App: "support orientation rotation"
https://bugs.launchpad.net/ubuntu-docviewer-app/+bug/1428721
For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/landscape-support/+merge/256146
Enabled landscape support
Tested on N5, vivid-proposed channel (r169), since automatic orientation doesn't work properly on utopic-based RTM/stable channel.
Just some notes:
We actually force hiding of Unity 8 indicators panel when the following two conditions are true:
- Screen.orientation == Qt.LandscapeOrientation (or inverted landscape)
- Screen.width < units.gu(51)
This means that it only happens on smartphones (N5 screen width is units.gu(47), so it should work on both krillin and mx4 - needs testing through).
I took this behavior from https://bugs.launchpad.net/webbrowser-app/+bug/1426347
I assume that if the Ubuntu UX team wants the indicators to be hidden in the webbrowser-app, which has an app header smaller than the docviewer-app one, we want the same thing to happen in docviewer-app too.
This also workaround an issue that can not be solved until full rotation support is landed in Unity 8.
ATM the indicators panel does not rotate, so it's shown on the left side of the screen when in landscape.
Since we render PDF pages on the base of mainView's width, a new rendering of the page is requested any time we show/hide Unity 8 panel, because mainView's width changes.
It actually fixes this wrong behaviour on smartphones without the need of adding some temporary code.
On tablet this issue still happens: since there's no Ubuntu tablet on the market yet, this is not a real issue.
CONTENT POSITION ON ROTATION:
When we rotate the screen, the size of the pages changes, so we'd need to re-set the x/y position of the content in the flickable.
I just say this gives the same same issues that we have with zooming...
--
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/landscape-support into lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot 2015-04-13 15:56:00 +0000
+++ po/com.ubuntu.docviewer.pot 2015-04-14 14:16:25 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-04-13 17:55+0200\n"
+"POT-Creation-Date: 2015-04-14 16:14+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -215,7 +215,7 @@
msgstr ""
#: ../src/app/qml/documentPage/DocumentPage.qml:25
-#: /home/stefano/Progetti/doc-viewer/build-adv-import-handler-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /home/stefano/Progetti/doc-viewer/build-landscape-support-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
msgid "Document Viewer"
msgstr ""
@@ -294,16 +294,16 @@
msgid "Loading..."
msgstr ""
-#: ../src/app/qml/ubuntu-docviewer-app.qml:167
+#: ../src/app/qml/ubuntu-docviewer-app.qml:183
msgid "Document successfully imported!"
msgid_plural "Documents successfully imported!"
msgstr[0] ""
msgstr[1] ""
-#: ../src/app/qml/ubuntu-docviewer-app.qml:170
+#: ../src/app/qml/ubuntu-docviewer-app.qml:186
msgid "Open"
msgstr ""
-#: /home/stefano/Progetti/doc-viewer/build-adv-import-handler-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/stefano/Progetti/doc-viewer/build-landscape-support-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
msgid "documents;viewer;pdf;reader;"
msgstr ""
=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
--- src/app/qml/ubuntu-docviewer-app.qml 2015-04-13 15:56:00 +0000
+++ src/app/qml/ubuntu-docviewer-app.qml 2015-04-14 14:16:25 +0000
@@ -19,6 +19,7 @@
import Ubuntu.Components.Popups 1.0
import com.ubuntu.fileqmlplugin 1.0
import DocumentViewer 1.0
+import QtQuick.Window 2.0
import "common"
import "common/loadComponent.js" as LoadComponent
@@ -27,10 +28,13 @@
id: mainView
objectName: "mainView"
+ property bool pickMode: DOC_VIEWER.pickModeEnabled
+ readonly property bool isLandscape: Screen.orientation == Qt.LandscapeOrientation ||
+ Screen.orientation == Qt.InvertedLandscapeOrientation
+
applicationName: "com.ubuntu.docviewer"
- useDeprecatedToolbar: false
-
- property bool pickMode: DOC_VIEWER.pickModeEnabled
+ useDeprecatedToolbar: false
+ automaticOrientation: true
width: units.gu(50)
height: units.gu(75)
@@ -80,6 +84,15 @@
function setHeaderVisibility(visible, toggleFullscreen) {
toggleFullscreen = typeof toggleFullscreen !== 'undefined' ? toggleFullscreen : true
header.visible = visible;
+
+ // If device orientation is landscape and screen width is limited,
+ // force hiding Unity 8 indicators panel.
+ if (!DOC_VIEWER.desktopMode && mainView.isLandscape &&
+ mainView.width < units.gu(51)) {
+ setFullScreen(true);
+ return;
+ }
+
if (!DOC_VIEWER.desktopMode && toggleFullscreen)
setFullScreen(!visible);
}
@@ -88,6 +101,9 @@
setHeaderVisibility(!header.visible);
}
+ // On screen rotation, force updating of header/U8 indicators panel visibility
+ onIsLandscapeChanged: setHeaderVisibility(true);
+
Component.onCompleted: {
pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));
=== modified file 'src/plugin/poppler-qml-plugin/verticalview.cpp'
--- src/plugin/poppler-qml-plugin/verticalview.cpp 2015-02-04 19:19:21 +0000
+++ src/plugin/poppler-qml-plugin/verticalview.cpp 2015-04-14 14:16:25 +0000
@@ -592,7 +592,7 @@
if (nextItem) {
listItem->setY(nextItem->y() - listItem->height() - m_spacing);
} else if (modelIndex == 0) {
- listItem->setY(560);
+ listItem->setY(0);
} else if (!m_visibleItems.isEmpty()) {
lostItem = true;
}
Follow ups