← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mhall119/ubuntu-docviewer-app/pdf-presentations into lp:ubuntu-docviewer-app

 

Michael Hall has proposed merging lp:~mhall119/ubuntu-docviewer-app/pdf-presentations into lp:ubuntu-docviewer-app.

Commit message:
Add a basic presentation mode to PDF docments.

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/~mhall119/ubuntu-docviewer-app/pdf-presentations/+merge/282512

Adds a basic presentation mode to PDF docments.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~mhall119/ubuntu-docviewer-app/pdf-presentations into lp:ubuntu-docviewer-app.
=== 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-13 21:55:19 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-12-27 13:06+0100\n"
+"POT-Creation-Date: 2016-01-13 16:52-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -42,7 +42,7 @@
 
 #: ../src/app/qml/common/DetailsPage.qml:26
 #: ../src/app/qml/loView/LOViewDefaultHeader.qml:107
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:83
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:90
 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:69
 msgid "Details"
 msgstr ""
@@ -189,33 +189,33 @@
 
 #. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
 #. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:100
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:103
 #, qt-format
 msgid "Today, %1"
 msgstr ""
 
 #. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
 #. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:105
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:108
 #, qt-format
 msgid "Yesterday, %1"
 msgstr ""
 
 #. TRANSLATORS: this is a datetime formatting string,
 #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:112
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:131
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:115
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:134
 msgid "yyyy/MM/dd hh:mm"
 msgstr ""
 
 #. TRANSLATORS: this is a datetime formatting string,
 #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:125
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:128
 msgid "dddd, hh:mm"
 msgstr ""
 
 #: ../src/app/qml/documentPage/DocumentPage.qml:23
-#: /tmp/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:3
+#: /home/mhall/projects/Ubuntu/coreapps/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:3
 msgid "Documents"
 msgstr ""
 
@@ -342,13 +342,13 @@
 msgstr ""
 
 #: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84
 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
 msgid "Disable night mode"
 msgstr ""
 
 #: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84
 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
 msgid "Enable night mode"
 msgstr ""
@@ -412,6 +412,10 @@
 msgid "Go to page..."
 msgstr ""
 
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:78
+msgid "Presentation"
+msgstr ""
+
 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:26
 msgid "Go to page"
 msgstr ""
@@ -439,10 +443,10 @@
 msgid "copy %1"
 msgstr ""
 
-#: /tmp/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /home/mhall/projects/Ubuntu/coreapps/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
 msgid "Document Viewer"
 msgstr ""
 
-#: /tmp/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/mhall/projects/Ubuntu/coreapps/ubuntu-docviewer-app-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
 msgid "documents;viewer;pdf;reader;"
 msgstr ""

=== added file 'src/app/qml/pdfView/PdfPresentation.qml'
--- src/app/qml/pdfView/PdfPresentation.qml	1970-01-01 00:00:00 +0000
+++ src/app/qml/pdfView/PdfPresentation.qml	2016-01-13 21:55:19 +0000
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013-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/>.
+ */
+
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import DocumentViewer 1.0
+import DocumentViewer.PDF 1.0 as PDF
+
+Page {
+    id: pdfPage
+    property var poppler
+    anchors.fill: parent
+    title: DocumentViewer.getFileBaseNameFromPath(poppler.path)
+    focus: true
+
+    head.locked: true
+    head.visible: false
+    clip: !head.visible
+
+    head.contents: Item {
+        anchors.fill: parent
+        anchors.left: pdfPage.left
+        Rectangle {
+            anchors.fill: parent
+            anchors.leftMargin: -units.gu(5)
+            color: "white"
+            opacity: 0.8
+        }
+        Label {
+            width: parent.width
+            anchors.verticalCenter: parent.verticalCenter
+            elide: Text.ElideMiddle
+
+            font.weight: Font.DemiBold
+            fontSize: "large"
+            text: pdfPage.title
+            opacity: 1
+        }
+
+    }
+
+    ListView {
+        id: pdfView
+        anchors.fill: parent
+        focus: true
+
+        orientation: Qt.Horizontal;
+        snapMode: ListView.SnapOneItem
+        highlightRangeMode: ListView.StrictlyEnforceRange
+        highlightFollowsCurrentItem: true
+        highlightMoveDuration: 0
+        boundsBehavior: Flickable.StopAtBounds
+        cacheBuffer: width
+
+        model: poppler
+        delegate: PdfViewDelegate {
+            width: pdfPage.width
+            height: pdfPage.height
+            Component.onDestruction: window.releaseResources()
+        }
+        Component.onCompleted: pdfPage.forceActiveFocus()
+
+        MouseArea {
+            anchors.fill: parent
+            onDoubleClicked: pdfPage.head.visible = !pdfPage.head.visible
+        }
+
+    }
+
+    Keys.onPressed: {
+        if (event.key == Qt.Key_Escape) { pageStack.pop(); return; }
+        if (event.key == Qt.Key_Home) { pdfView.positionViewAtBeginning(); return; }
+        if (event.key == Qt.Key_End) { pdfView.positionViewAtEnd(); return; }
+
+        if (event.key == Qt.Key_Right || event.key == Qt.Key_PageDown) {
+            pdfView.incrementCurrentIndex();
+            return;
+        }
+        if (event.key == Qt.Key_Left || event.key == Qt.Key_PageUp) {
+            pdfView.decrementCurrentIndex();
+            return;
+        }
+
+    }
+
+}
+

=== 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-13 21:55:19 +0000
@@ -42,6 +42,9 @@
     // Reset night mode shader settings when closing the page
     // Component.onDestruction: mainView.nightModeEnabled = false
 
+    Keys.onPressed: {
+        if (event.key == Qt.Key_F5) { pageStack.push(Qt.resolvedUrl("./PdfPresentation.qml"), {'poppler': poppler}); }
+    }
     Rectangle {
         // Since UITK 1.3, the MainView background is white.
         // We need to set a different color, otherwise pages

=== modified file 'src/app/qml/pdfView/PdfViewDefaultHeader.qml'
--- src/app/qml/pdfView/PdfViewDefaultHeader.qml	2015-11-13 21:19:46 +0000
+++ src/app/qml/pdfView/PdfViewDefaultHeader.qml	2016-01-13 21:55:19 +0000
@@ -73,6 +73,13 @@
         },
 
         Action {
+            objectName:"presentationmode"
+            iconName: "media-playback-start"
+            text: i18n.tr("Presentation")
+            onTriggered: pageStack.push(Qt.resolvedUrl("./PdfPresentation.qml"), {'poppler': poppler})
+        },
+
+        Action {
             iconName: "night-mode"
             text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")
             onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled

=== modified file 'src/app/qml/pdfView/PdfViewDelegate.qml'
--- src/app/qml/pdfView/PdfViewDelegate.qml	2015-10-19 13:00:11 +0000
+++ src/app/qml/pdfView/PdfViewDelegate.qml	2016-01-13 21:55:19 +0000
@@ -47,6 +47,7 @@
 
         source: "image://poppler" + (index % poppler.providersNumber) + "/page/" + index;
         sourceSize.width: pdfPage.width
+        fillMode: Image.PreserveAspectFit
 
         onStatusChanged: {
             // This is supposed to run the first time PdfViewDelegate gets the page rendering.


Follow ups