← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview into lp:ubuntu-docviewer-app with lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-theming-silo-50 as a prerequisite.

Commit message:
Pdf viewer:
* Removed 'search' action (unused)
* Fixed keyboard hooks in the 'GoTo' dialog
* Fixed presentation mode color palette
* Use ScrollView component


Requested reviews:
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview/+merge/290172

Pdf viewer:
* Removed 'search' action (unused)
* Fixed keyboard hooks in the 'GoTo' dialog
* Fixed presentation mode color palette
* Use ScrollView component

-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
--- src/app/qml/pdfView/PdfContentsPage.qml	2016-03-26 18:44:11 +0000
+++ src/app/qml/pdfView/PdfContentsPage.qml	2016-03-26 18:44:11 +0000
@@ -24,7 +24,7 @@
     objectName: "pdfcontents"
 
     // this property will have to be removed when bug #1341671 will be fixed.
-    property string testProperty: "for page name issue"  
+    property string testProperty: "for page name issue"
 
     header: PageHeader {
         // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
@@ -50,74 +50,73 @@
         view.positionViewAtIndex(i, ListView.Center);
     }
 
-    ListView {
-        id: view
-        objectName: "view"
+    ScrollView {
         anchors.fill: parent
-        clip: true
-
-        model: poppler.tocModel
-
-        delegate: ListItem {
-            id: delegate
-            objectName: "delegate" + index
-
-            onClicked: {
-                pdfView.positionAtIndex(model.pageIndex);
-                contentsBottomEdge.collapse();
-            }
-
-            // Highlighted property of ListItem is read-only. In order to
-            // provide an highlight for the current page, we need to duplicate
-            // the overlay.
-            Rectangle {
-                anchors.fill: parent
-                color: Qt.rgba(0, 0, 0, 0.05)
-                visible: view.currentIndex == model.index
-            }
-
-            /* UITK 1.3 spec: Three slot layout (A-B-C)   */
-            //  ________________________________________
-            // |                              |     |   |
-            // |               A              |  B  | C |
-            // |______________________________|__ __|___|
-            //
-            ListItemLayout {
-                id: listItemLayout
-                objectName: "listItemLayout" + index
-                anchors.fill: parent
-                anchors.leftMargin: model.level * units.gu(4)
-
-                /* UITK 1.3 specs: Slot A */
-                title {
-                    text: model.title
-                    elide: Text.ElideRight
-//                    font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
-//                    color: (model.level == 0) ? UbuntuColors.midAubergine
-//                                              : theme.palette.normal.backgroundText
-                }
-
-                /* UITK 1.3 specs: Slot B */
-                Icon {
-                    SlotsLayout.position: SlotsLayout.Trailing
-                    width: units.gu(2); height: width
-                    name: "tick"
-                    color: UbuntuColors.green
-                    visible: view.currentIndex == model.index
-                }
-
-                /* UITK 1.3 specs: Slot C */
-                Label {
-                    objectName: "pageindex"
-                    SlotsLayout.position: SlotsLayout.Last
-                    text: model.pageIndex + 1
-//                    font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
-//                    color: (model.level == 0) ? UbuntuColors.midAubergine
-//                                              : theme.palette.normal.backgroundText
+
+        ListView {
+            id: view
+            objectName: "view"
+            anchors.fill: parent
+            clip: true
+
+            model: poppler.tocModel
+
+            delegate: ListItem {
+                id: delegate
+                objectName: "delegate" + index
+
+                property bool __isCurrentIndex: view.currentIndex == model.index
+
+                onClicked: {
+                    pdfView.positionAtIndex(model.pageIndex);
+                    contentsBottomEdge.collapse();
+                }
+
+                // Highlighted property of ListItem is read-only. In order to
+                // provide an highlight for the current page, we need to duplicate
+                // the overlay.
+                Rectangle {
+                    anchors.fill: parent
+                    color: Qt.rgba(0, 0, 0, 0.05)
+                    visible: __isCurrentIndex
+                }
+
+                /* UITK 1.3 spec: Three slot layout (A-B-C)   */
+                //  ________________________________________
+                // |                              |     |   |
+                // |               A              |  B  | C |
+                // |______________________________|__ __|___|
+                //
+                ListItemLayout {
+                    id: listItemLayout
+                    objectName: "listItemLayout" + index
+                    anchors.fill: parent
+                    anchors.leftMargin: model.level * units.gu(4)
+
+                    /* UITK 1.3 specs: Slot A */
+                    title.text: model.title
+                    title.color: __isCurrentIndex ? theme.palette.selected.backgroundText
+                                                  : theme.palette.normal.backgroundText
+
+                    /* UITK 1.3 specs: Slot B */
+                    Icon {
+                        SlotsLayout.position: SlotsLayout.Trailing
+                        width: units.gu(2); height: width
+                        name: "tick"
+                        color: UbuntuColors.green
+                        visible: view.currentIndex == model.index
+                    }
+
+                    /* UITK 1.3 specs: Slot C */
+                    Label {
+                        objectName: "pageindex"
+                        SlotsLayout.position: SlotsLayout.Last
+                        text: model.pageIndex + 1
+                        color: __isCurrentIndex ? theme.palette.selected.backgroundText
+                                                : theme.palette.normal.backgroundText
+                    }
                 }
             }
         }
     }
-
-    Scrollbar { flickableItem: view }
 }

=== modified file 'src/app/qml/pdfView/PdfPresentation.qml'
--- src/app/qml/pdfView/PdfPresentation.qml	2016-02-07 23:01:57 +0000
+++ src/app/qml/pdfView/PdfPresentation.qml	2016-03-26 18:44:11 +0000
@@ -54,8 +54,9 @@
         }
 
         StyleHints {
-            backgroundColor: "#BF000000"
+            backgroundColor: Qt.rgba(0, 0, 0, 0.75)
             foregroundColor: "white"
+            dividerColor: "transparent"
         }
     }
 

=== modified file 'src/app/qml/pdfView/PdfView.qml'
--- src/app/qml/pdfView/PdfView.qml	2016-02-16 15:56:26 +0000
+++ src/app/qml/pdfView/PdfView.qml	2016-03-26 18:44:11 +0000
@@ -31,7 +31,7 @@
     header: PageHeader {
         flickable: pdfView
 
-        trailingActionBar.actions: [ searchText, goToPage, startPresentation, nightModeToggle, fileDetails ]
+        trailingActionBar.actions: [ goToPage, startPresentation, nightModeToggle, fileDetails ]
 
         contents: ListItemLayout {
             anchors.centerIn: parent
@@ -72,55 +72,55 @@
         color: "#f5f5f5"
     }
 
-    PDF.VerticalView {
-        id: pdfView
-        objectName: "pdfView"
-
+    ScrollView {
         anchors.fill: parent
-        anchors.topMargin: pdfPage.header.height
-        spacing: units.gu(2)
-
-        boundsBehavior: Flickable.StopAtBounds
-        flickDeceleration: 1500 * units.gridUnit / 8
-        maximumFlickVelocity: 2500 * units.gridUnit / 8
-
-        contentWidth: parent.width * _zoomHelper.scale
-        cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
-        interactive: !pinchy.pinch.active
-
-        model: poppler
-        delegate: PdfViewDelegate {
-            Component.onDestruction: window.releaseResources()
-        }
-
-        // FIXME: On zooming, keep the same content position.
-        PinchArea {
-            id: pinchy
+
+        PDF.VerticalView {
+            id: pdfView
+            objectName: "pdfView"
+
             anchors.fill: parent
-
-            pinch {
-                target: _zoomHelper
-                minimumScale: 1.0
-                maximumScale: 2.5
-            }
-
-            onPinchFinished: {
-                pdfView.returnToBounds();
-
-                // This is a bit expensive, so it's safer to put it here.
-                // It won't be called on desktop (where PinchArea is not used),
-                // but it's not a problem at the moment (our target is phone).
-                window.releaseResources();
-            }
+            anchors.topMargin: pdfPage.header.height
+            spacing: units.gu(2)
+
+            boundsBehavior: Flickable.StopAtBounds
+            flickDeceleration: 1500 * units.gridUnit / 8
+            maximumFlickVelocity: 2500 * units.gridUnit / 8
+
+            contentWidth: parent.width * _zoomHelper.scale
+            cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
+            interactive: !pinchy.pinch.active
+
+            model: poppler
+            delegate: PdfViewDelegate {
+                Component.onDestruction: window.releaseResources()
+            }
+
+            // FIXME: On zooming, keep the same content position.
+            PinchArea {
+                id: pinchy
+                anchors.fill: parent
+
+                pinch {
+                    target: _zoomHelper
+                    minimumScale: 1.0
+                    maximumScale: 2.5
+                }
+
+                onPinchFinished: {
+                    pdfView.returnToBounds();
+
+                    // This is a bit expensive, so it's safer to put it here.
+                    // It won't be called on desktop (where PinchArea is not used),
+                    // but it's not a problem at the moment (our target is phone).
+                    window.releaseResources();
+                }
+            }
+
+            Item { id: _zoomHelper }
         }
-
-        Item { id: _zoomHelper }
     }
 
-
-    Scrollbar { flickableItem: pdfView }
-    Scrollbar { flickableItem: pdfView; align: Qt.AlignBottom }
-
     PDF.Document {
         id: poppler
 
@@ -202,20 +202,11 @@
     /*** ACTIONS ***/
 
     Action {
-        id: searchText
-        iconName: "search"
-        text: i18n.tr("Search")
-        // onTriggered: pageMain.state = "search"
-        //Disable it until we provide search in Poppler plugin.
-        enabled: false
-    }
-
-    Action {
         id: goToPage
         objectName:"gotopage"
         iconName: "browser-tabs"
         text: i18n.tr("Go to page...")
-        onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), targetPage)
+        onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), pdfPage)
     }
 
     Action {

=== modified file 'src/app/qml/pdfView/PdfViewGotoDialog.qml'
--- src/app/qml/pdfView/PdfViewGotoDialog.qml	2015-10-23 11:19:19 +0000
+++ src/app/qml/pdfView/PdfViewGotoDialog.qml	2016-03-26 18:44:11 +0000
@@ -36,7 +36,7 @@
         inputMethodHints: Qt.ImhFormattedNumbersOnly
         validator: IntValidator{ bottom: 1; top: pdfView.count }
 
-        Keys.onReturnPressed: goToPage()
+        onAccepted: goToPage()
         Component.onCompleted: forceActiveFocus()
     }
 

=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
--- src/app/qml/ubuntu-docviewer-app.qml	2016-03-03 13:08:20 +0000
+++ src/app/qml/ubuntu-docviewer-app.qml	2016-03-26 18:44:11 +0000
@@ -115,6 +115,9 @@
     }
 
     Component.onCompleted: {
+        // WORKAROUND: Mouse detection is not included in the SDK yet
+        QuickUtils.mouseAttached = true
+
         pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));
 
         // Open the document, if one has been specified.


Follow ups