← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge into lp:ubuntu-docviewer-app.

Commit message:
* Use UITK 1.3 BottomEdge instead of old PageWithBottomEdge component.
* Updated framework version to 15.04.3

Requested reviews:
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge/+merge/281860

* Use UITK 1.3 BottomEdge instead of old PageWithBottomEdge component.
* Updated framework version to 15.04.3

New BottomEdge component is already in the rc-proposed channel (which means it will surely available for OTA-9).
Framework target for new stuff (e.g. UITK-1.3 PageHeader) in OTA-8 was 15.04.2. Since the upcoming OTA should provide a new framework (15.04.3), I guess everything in this MP is "legal".

NOTE:
BottomEdgeHint doesn't work on desktop, unless "QuickUtils.mouseAttached" property is set to true.
This does not represent a big issue for now (we're focused on touch devices) and I suspect a proper mouse detection will come in the near future.
If not, I have already prepared a MP for adding mouse detection in DocViewer. :)
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge into lp:ubuntu-docviewer-app.
=== modified file 'click/docviewer.apparmor'
--- click/docviewer.apparmor	2015-12-26 17:30:14 +0000
+++ click/docviewer.apparmor	2016-01-07 13:48:39 +0000
@@ -14,4 +14,4 @@
         "/media/*/*/[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt][Ss]/"
     ],
     "policy_version": 1.3
-}
+}
\ No newline at end of file

=== modified file 'click/manifest.json.in'
--- click/manifest.json.in	2015-12-04 11:39:06 +0000
+++ click/manifest.json.in	2016-01-07 13:48:39 +0000
@@ -2,7 +2,7 @@
     "name": "com.ubuntu.docviewer",
     "title": "Document Viewer",
     "description": "Document Viewer application for Ubuntu devices",
-    "framework": "ubuntu-sdk-15.04.1",
+    "framework": "ubuntu-sdk-15.04.3",
     "architecture": "@CLICK_ARCH@",
     "icon": "@ICON@",
     "hooks": {

=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot	2015-12-27 12:10:06 +0000
+++ po/com.ubuntu.docviewer.pot	2016-01-07 13:48:39 +0000
@@ -8,7 +8,11 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
+<<<<<<< TREE
 "POT-Creation-Date: 2015-12-27 13:06+0100\n"
+=======
+"POT-Creation-Date: 2015-12-15 20:33+0100\n"
+>>>>>>> MERGE-SOURCE
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -393,17 +397,25 @@
 
 #. TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
 #: ../src/app/qml/pdfView/PdfContentsPage.qml:30
+<<<<<<< TREE
 #: ../src/app/qml/pdfView/PdfView.qml:38
+=======
+#: ../src/app/qml/pdfView/PdfView.qml:40
+>>>>>>> MERGE-SOURCE
 msgid "Contents"
 msgstr ""
 
-#: ../src/app/qml/pdfView/PdfContentsPage.qml:36
+#: ../src/app/qml/pdfView/PdfContentsPage.qml:33
 msgid "Hide table of contents"
 msgstr ""
 
 #. TRANSLATORS: the first argument (%1) refers to the page currently shown on the screen,
 #. while the second one (%2) refers to the total pages count.
+<<<<<<< TREE
 #: ../src/app/qml/pdfView/PdfView.qml:35
+=======
+#: ../src/app/qml/pdfView/PdfView.qml:32
+>>>>>>> MERGE-SOURCE
 #, qt-format
 msgid "Page %1 of %2"
 msgstr ""
@@ -421,7 +433,7 @@
 msgid "Choose a page between 1 and %1"
 msgstr ""
 
-#: ../src/app/qml/ubuntu-docviewer-app.qml:118
+#: ../src/app/qml/ubuntu-docviewer-app.qml:124
 msgid "File does not exist."
 msgstr ""
 

=== removed file 'src/app/qml/common/PageWithBottomEdge.qml'
--- src/app/qml/common/PageWithBottomEdge.qml	2015-11-02 00:41:29 +0000
+++ src/app/qml/common/PageWithBottomEdge.qml	1970-01-01 00:00:00 +0000
@@ -1,397 +0,0 @@
-/*
- * Copyright (C) 2014, 2015 Canonical, Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
-    Example:
-
-    MainView {
-        objectName: "mainView"
-
-        applicationName: "com.ubuntu.developer.boiko.bottomedge"
-
-        width: units.gu(100)
-        height: units.gu(75)
-
-        Component {
-            id: pageComponent
-
-            PageWithBottomEdge {
-                id: mainPage
-                title: i18n.tr("Main Page")
-
-                Rectangle {
-                    anchors.fill: parent
-                    color: "white"
-                }
-
-                bottomEdgePageComponent: Page {
-                    title: "Contents"
-                    anchors.fill: parent
-                    //anchors.topMargin: contentsPage.flickable.contentY
-
-                    ListView {
-                        anchors.fill: parent
-                        model: 50
-                        delegate: ListItems.Standard {
-                            text: "One Content Item: " + index
-                        }
-                    }
-                }
-                bottomEdgeTitle: i18n.tr("Bottom edge action")
-            }
-        }
-
-        PageStack {
-            id: stack
-            Component.onCompleted: stack.push(pageComponent)
-        }
-    }
-
-*/
-
-import QtQuick 2.4
-import Ubuntu.Components 1.3
-
-Page {
-    id: page
-
-    property alias bottomEdgePageComponent: edgeLoader.sourceComponent
-    property alias bottomEdgePageSource: edgeLoader.source
-    property alias bottomEdgeTitle: tip.text
-    property bool bottomEdgeEnabled: true
-    property int bottomEdgeExpandThreshold: page.height * 0.2
-    property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded
-    property bool reloadBottomEdgePage: true
-
-    readonly property alias bottomEdgePage: edgeLoader.item
-    readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active)
-    readonly property bool isCollapsed: (bottomEdge.y === page.height)
-    readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
-
-    property bool _showEdgePageWhenReady: false
-    property int _areaWhenExpanded: 0
-
-    signal bottomEdgeReleased()
-    signal bottomEdgeDismissed()
-
-
-    function showBottomEdgePage(source, properties)
-    {
-        edgeLoader.setSource(source, properties)
-        _showEdgePageWhenReady = true
-    }
-
-    function setBottomEdgePage(source, properties)
-    {
-        edgeLoader.setSource(source, properties)
-    }
-
-    function _pushPage()
-    {
-        if (edgeLoader.status === Loader.Ready) {
-            edgeLoader.item.active = true
-            page.pageStack.push(edgeLoader.item)
-            if (edgeLoader.item.flickable) {
-                edgeLoader.item.flickable.contentY = -page.header.height
-                edgeLoader.item.flickable.returnToBounds()
-            }
-            if (edgeLoader.item.ready)
-                edgeLoader.item.ready()
-        }
-    }
-
-
-    Component.onCompleted: {
-        // avoid a binding on the expanded height value
-        var expandedHeight = height;
-        _areaWhenExpanded = expandedHeight;
-    }
-
-    onActiveChanged: {
-        if (active) {
-            bottomEdge.state = "collapsed"
-        }
-    }
-
-    onBottomEdgePageLoadedChanged: {
-        if (_showEdgePageWhenReady && bottomEdgePageLoaded) {
-            bottomEdge.state = "expanded"
-            _showEdgePageWhenReady = false
-        }
-    }
-
-    Rectangle {
-        id: bgVisual
-
-        color: "black"
-        anchors.fill: page
-        opacity: 0.7 * ((page.height - bottomEdge.y) / page.height)
-        z: 1
-    }
-
-    BottomEdgeHint {
-        id: tip
-        objectName: "bottomEdgeTip"
-
-        enabled: mouseArea.enabled
-        visible: page.bottomEdgeEnabled
-        z: 1
-
-        onClicked: bottomEdge.state = "expanded"
-
-        Connections {
-            target: mouseArea
-            onClosedChanged: {
-                if (!mouseArea.closed) {
-                    tip.state = "Visible";
-                }
-            }
-        }
-
-        Connections {
-            target: page.flickable
-            onVerticalVelocityChanged: {
-                if (!mouseArea.closed) {
-                    return;
-                }
-
-                if (page.flickable.verticalVelocity > 0) {
-                    tip.state = "Hidden";
-                } else if (page.flickable.verticalVelocity < 0) {
-                    tip.state = "Visible";
-                }
-            }
-        }
-    }
-
-    Rectangle {
-        id: shadow
-
-        anchors {
-            left: parent.left
-            right: parent.right
-            bottom: parent.bottom
-        }
-        height: units.gu(1)
-        z: 1
-        opacity: 0.0
-        gradient: Gradient {
-            GradientStop { position: 0.0; color: "transparent" }
-            GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) }
-        }
-    }
-
-    MouseArea {
-        id: mouseArea
-
-        property real previousY: -1
-        property string dragDirection: "None"
-        property bool closed: drag.target.y == drag.maximumY && !mouseArea.pressed
-
-        preventStealing: true
-        drag {
-            axis: Drag.YAxis
-            target: bottomEdge
-            minimumY: bottomEdge.pageStartY
-            maximumY: page.height
-        }
-        enabled: edgeLoader.status == Loader.Ready
-        visible: page.bottomEdgeEnabled
-
-        anchors {
-            left: parent.left
-            right: parent.right
-            bottom: parent.bottom
-
-        }
-        height: bottomEdge.tipHeight
-        z: 10
-
-        onReleased: {
-            page.bottomEdgeReleased()
-            if ((dragDirection === "BottomToTop") &&
-                bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) {
-                bottomEdge.state = "expanded"
-            } else {
-                bottomEdge.state = "collapsed"
-            }
-            previousY = -1
-            dragDirection = "None"
-        }
-
-        onPressed: {
-            previousY = mouse.y
-            tip.forceActiveFocus()
-        }
-
-        // Propagate click event to the BottomEdgeHint
-        onClicked: tip.clicked()
-
-        onMouseYChanged: {
-            var yOffset = previousY - mouseY
-            // skip if was a small move
-            if (Math.abs(yOffset) <= units.gu(2)) {
-                return
-            }
-            previousY = mouseY
-            dragDirection = yOffset > 0 ? "BottomToTop" : "TopToBottom"
-        }
-    }
-
-    Rectangle {
-        id: bottomEdge
-        objectName: "bottomEdge"
-
-        readonly property int tipHeight: units.gu(3)
-        readonly property int pageStartY: 0
-
-        z: Number.MAX_VALUE
-        color: theme.palette.normal.background
-        clip: true
-        anchors {
-            left: parent.left
-            right: parent.right
-        }
-        height: page.height
-        y: height
-        visible: !page.isCollapsed
-        state: "collapsed"
-        states: [
-            State {
-                name: "collapsed"
-                PropertyChanges {
-                    target: bottomEdge
-                    y: bottomEdge.height
-                }
-            },
-            State {
-                name: "expanded"
-                PropertyChanges {
-                    target: bottomEdge
-                    y: bottomEdge.pageStartY
-                }
-            },
-            State {
-                name: "floating"
-                when: mouseArea.drag.active
-                PropertyChanges {
-                    target: shadow
-                    opacity: 1.0
-                }
-            }
-        ]
-
-        transitions: [
-            Transition {
-                to: "expanded"
-                SequentialAnimation {
-                    alwaysRunToEnd: true
-
-                    SmoothedAnimation {
-                        target: bottomEdge
-                        property: "y"
-                        duration: UbuntuAnimation.FastDuration
-                        easing.type: Easing.Linear
-                    }
-                    SmoothedAnimation {
-                        target: edgeLoader
-                        property: "anchors.topMargin"
-                        to: - units.gu(4)
-                        duration: UbuntuAnimation.FastDuration
-                        easing.type: Easing.Linear
-                    }
-                    SmoothedAnimation {
-                        target: edgeLoader
-                        property: "anchors.topMargin"
-                        to: 0
-                        duration: UbuntuAnimation.FastDuration
-                        easing: UbuntuAnimation.StandardEasing
-                    }
-                    ScriptAction {
-                        script: page._pushPage()
-                    }
-                }
-            },
-            Transition {
-                from: "expanded"
-                to: "collapsed"
-                SequentialAnimation {
-                    alwaysRunToEnd: true
-
-                    ScriptAction {
-                        script: {
-                            Qt.inputMethod.hide()
-                            edgeLoader.item.parent = edgeLoader
-                            edgeLoader.item.anchors.fill = edgeLoader
-                            edgeLoader.item.active = false
-                        }
-                    }
-                    SmoothedAnimation {
-                        target: bottomEdge
-                        property: "y"
-                        duration: UbuntuAnimation.SlowDuration
-                    }
-                    ScriptAction {
-                        script: {
-                            // destroy current bottom page
-                            if (page.reloadBottomEdgePage) {
-                                edgeLoader.active = false
-                                // tip will receive focus on page active true
-                            } else {
-                                tip.forceActiveFocus()
-                            }
-
-                            // notify
-                            page.bottomEdgeDismissed()
-
-                            edgeLoader.active = true
-                        }
-                    }
-                }
-            },
-            Transition {
-                from: "floating"
-                to: "collapsed"
-                SmoothedAnimation {
-                    target: bottomEdge
-                    property: "y"
-                    duration: UbuntuAnimation.FastDuration
-                }
-            }
-        ]
-
-        Loader {
-            id: edgeLoader
-
-            asynchronous: true
-            anchors.fill: parent
-            //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
-            Binding {
-                target: edgeLoader.status === Loader.Ready ? edgeLoader : null
-                property: "anchors.topMargin"
-                value:  edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
-                when: !page.isReady
-            }
-
-            onLoaded: {
-                tip.forceActiveFocus()
-                if (page.isReady && edgeLoader.item.active !== true) {
-                    page._pushPage()
-                }
-            }
-        }
-    }
-}

=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
--- src/app/qml/pdfView/PdfContentsPage.qml	2015-11-13 21:35:22 +0000
+++ src/app/qml/pdfView/PdfContentsPage.qml	2016-01-07 13:48:39 +0000
@@ -29,9 +29,6 @@
     // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
     title: i18n.tr("Contents")
 
-    // Avoid a binding loop when using ListView.positionViewAtIndex()
-    flickable: null
-
     head.backAction: Action {
         text: i18n.tr("Hide table of contents")
         iconName: "down"

=== modified file 'src/app/qml/pdfView/PdfView.qml'
--- src/app/qml/pdfView/PdfView.qml	2015-12-26 18:27:13 +0000
+++ src/app/qml/pdfView/PdfView.qml	2016-01-07 13:48:39 +0000
@@ -22,9 +22,7 @@
 import "../common"
 import "../common/utils.js" as Utils
 
-// TODO: Use UITK 1.3 BottomEdge component when available
-
-PageWithBottomEdge {
+Page {
     id: pdfPage
     title: DocumentViewer.getFileBaseNameFromPath(file.path)
 
@@ -34,10 +32,32 @@
     // while the second one (%2) refers to the total pages count.
     property string currentPage: i18n.tr("Page %1 of %2").arg(pdfView.currentPageIndex + 1).arg(pdfView.count)
 
-    // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
-    bottomEdgeTitle: i18n.tr("Contents")
-    bottomEdgePageComponent: PdfContentsPage { }
-    bottomEdgeEnabled: poppler.tocModel.count > 0
+    BottomEdge {
+        id: bottomEdge
+
+        hint {
+            action: Action {
+                // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
+                text: i18n.tr("Contents")
+                iconName: "view-list-symbolic"  // FIXME: Needs ToC icon.
+                onTriggered: bottomEdge.commit()
+            }
+            flickable: pdfPage.flickable
+        }
+
+        contentComponent: bottomEdgeContent
+        onCommitCompleted: {
+            pdfPage.pageStack.push(bottomEdgeContent)
+            collapse();
+        }
+        enabled: poppler.tocModel.count > 0
+
+        Component {
+            id: bottomEdgeContent
+            PdfContentsPage { width: bottomEdge.width; height: bottomEdge.height }
+        }
+    }
+
 
     // Reset night mode shader settings when closing the page
     // Component.onDestruction: mainView.nightModeEnabled = false


References