← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-zoom-final into lp:ubuntu-docviewer-app

 

Roman Shchekin has proposed merging lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-zoom-final into lp:ubuntu-docviewer-app.

Commit message:
Zoom in LO.

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/~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-zoom-final/+merge/278248

Zoom in LO.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-zoom-final into lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot	2015-10-31 20:37:19 +0000
+++ po/com.ubuntu.docviewer.pot	2015-11-21 19:27:31 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-10-31 23:16+0300\n"
+"POT-Creation-Date: 2015-11-21 22:13+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -245,7 +245,7 @@
 
 #: ../src/app/qml/documentPage/DocumentPageSearchHeader.qml:27
 #: ../src/app/qml/loView/LOViewDefaultHeader.qml:70
-#: ../src/app/qml/loView/LOViewPage.qml:191
+#: ../src/app/qml/loView/LOViewPage.qml:208
 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:61
 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:61
 msgid "Back"
@@ -378,8 +378,8 @@
 msgid "GO!"
 msgstr ""
 
-#: ../src/app/qml/loView/LOViewPage.qml:34
-#: ../src/app/qml/loView/LOViewPage.qml:189
+#: ../src/app/qml/loView/LOViewPage.qml:35
+#: ../src/app/qml/loView/LOViewPage.qml:206
 msgid "Slides"
 msgstr ""
 
@@ -458,10 +458,10 @@
 msgid "copy %1"
 msgstr ""
 
-#: /home/qtros/dev/ubuntu-docviewer-app-render-engine-tuning-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /home/qtros/dev/build-ubuntu-docviewer-app-zoom-final-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
 msgid "Document Viewer"
 msgstr ""
 
-#: /home/qtros/dev/ubuntu-docviewer-app-render-engine-tuning-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/qtros/dev/build-ubuntu-docviewer-app-zoom-final-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
 msgid "documents;viewer;pdf;reader;"
 msgstr ""

=== added file 'src/app/qml/common/ScalingPinchArea.qml'
--- src/app/qml/common/ScalingPinchArea.qml	1970-01-01 00:00:00 +0000
+++ src/app/qml/common/ScalingPinchArea.qml	2015-11-21 19:27:31 +0000
@@ -0,0 +1,55 @@
+import QtQuick 2.4
+
+PinchArea {
+    id: pinchArea
+
+    property var targetFlickable: null
+    property real totalScale: 1
+
+    onPinchUpdated: {
+        pinchUpdatedHandler(pinch)
+    }
+    onPinchFinished: {
+        pinchFinishedHandler()
+    }
+
+    // ------------------------ Desktop DEBUG
+
+//    MouseArea {
+//        id: testMa
+//        anchors.fill: parent
+//        visible: Qt.platform.os == "linux"
+//        z: 19
+//        acceptedButtons: Qt.RightButton
+
+//        property int touchPointY
+//        property int touchPointX
+//        onPressed: {
+//            touchPointY = mouse.y
+//            touchPointX = mouse.x
+//        }
+//        onPositionChanged: {
+//            var sc = (1 + (mouse.y - touchPointY) / 200)
+//            pinchUpdatedHandler({"center" : { "x" : mouse.x, "y" : mouse.y }, "scale" : sc })
+//        }
+//        onReleased: {
+//            pinchFinishedHandler()
+//        }
+//    }
+
+    // ------------------------ Desktop DEBUG end
+
+    function pinchUpdatedHandler(pinch) {
+        targetFlickable.scale = pinch.scale
+    }
+
+    function pinchFinishedHandler() {
+        var pt = pinchArea.mapFromItem(targetFlickable, -targetFlickable.contentX , -targetFlickable.contentY )
+        // console.log("pinchFinishedHandler", -myItem.contentX, -myItem.contentY, Math.round(pt.x), Math.round(pt.y))
+        targetFlickable.contentX = -pt.x
+        targetFlickable.contentY = -pt.y
+
+        totalScale = targetFlickable.scale * totalScale
+        targetFlickable.scale = 1
+    }
+}

=== modified file 'src/app/qml/loView/LOViewPage.qml'
--- src/app/qml/loView/LOViewPage.qml	2015-11-13 17:31:09 +0000
+++ src/app/qml/loView/LOViewPage.qml	2015-11-21 19:27:31 +0000
@@ -22,6 +22,7 @@
 import "../upstreamComponents"
 
 import "../common/utils.js" as Utils
+import "../common"
 import "KeybHelper.js" as KeybHelper
 
 PageWithBottomEdge {
@@ -113,7 +114,7 @@
                                 }
 
                                 ItemLayout {
-                                    item: "loView"
+                                    item: "pinchArea"
                                     anchors.fill: parent
 
                                     // Keyboard events
@@ -139,30 +140,50 @@
                     }
                 ]
 
-                LibreOffice.Viewer {
-                    id: loView
-                    objectName: "loView"
-                    Layouts.item: "loView"
+                ScalingPinchArea {
+                    id: pinchArea
+                    objectName: "pinchArea"
+                    Layouts.item: "pinchArea"
+
+                    targetFlickable: loView
+                    onTotalScaleChanged: targetFlickable.updateContentSize(totalScale)
+
                     anchors {
-                        left: parent.left
-                        right: parent.right
                         top: parent.top
+                        left: parent.left
+                        right: parent.right
                         bottom: bottomBar.top
                     }
 
-                    clip: true
-                    documentPath: file.path
-
-                    // Keyboard events
-                    focus: true
-                    Keys.onPressed: KeybHelper.parseEvent(event)
-
-                    Component.onCompleted: {
-                        // WORKAROUND: Fix for wrong grid unit size
-                        flickDeceleration = 1500 * units.gridUnit / 8
-                        maximumFlickVelocity = 2500 * units.gridUnit / 8
-                        loPageContent.forceActiveFocus()
+                    LibreOffice.Viewer {
+                        id: loView
+                        objectName: "loView"
+                        Layouts.item: "loView"
+
+                        anchors.fill: parent
+
+                        clip: true
+                        documentPath: file.path
+
+                        // Keyboard events
+                        focus: true
+                        Keys.onPressed: KeybHelper.parseEvent(event)
+
+                        Component.onCompleted: {
+                            // WORKAROUND: Fix for wrong grid unit size
+                            flickDeceleration = 1500 * units.gridUnit / 8
+                            maximumFlickVelocity = 2500 * units.gridUnit / 8
+                            loPageContent.forceActiveFocus()
+                        }
+
+                        function updateContentSize(tgtScale) {
+                            zoomFactor = tgtScale
+                        }
+
+                        Scrollbar { flickableItem: loView; parent: loView.parent }
+                        Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom }
                     }
+<<<<<<< TREE
 
                     onErrorChanged: {
                         var errorString;
@@ -191,6 +212,8 @@
 
                     Scrollbar { flickableItem: loView; parent: loView.parent }
                     Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom }
+=======
+>>>>>>> MERGE-SOURCE
                 }
 
                 // TODO: When we'll have to merge this with the zooming branch, replace this