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

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 316
Merged at revision: 328
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview
Merge into: lp:ubuntu-docviewer-app
Prerequisite: lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-theming-silo-50
Diff against target: 349 lines (+120/-126)
5 files modified
src/app/qml/pdfView/PdfContentsPage.qml (+65/-66)
src/app/qml/pdfView/PdfPresentation.qml (+3/-2)
src/app/qml/pdfView/PdfView.qml (+47/-56)
src/app/qml/pdfView/PdfViewGotoDialog.qml (+2/-2)
src/app/qml/ubuntu-docviewer-app.qml (+3/-0)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-pdfview
Reviewer Review Type Date Requested Status
Roman Shchekin Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+290172@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
316. By Stefano Verzegnassi

Updated copyright

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Roman Shchekin (mrqtros) wrote :

Ok, like it!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
--- src/app/qml/pdfView/PdfContentsPage.qml 2016-03-26 18:45:15 +0000
+++ src/app/qml/pdfView/PdfContentsPage.qml 2016-03-26 18:45:15 +0000
@@ -24,7 +24,7 @@
24 objectName: "pdfcontents"24 objectName: "pdfcontents"
2525
26 // this property will have to be removed when bug #1341671 will be fixed.26 // this property will have to be removed when bug #1341671 will be fixed.
27 property string testProperty: "for page name issue" 27 property string testProperty: "for page name issue"
2828
29 header: PageHeader {29 header: PageHeader {
30 // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.30 // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
@@ -50,74 +50,73 @@
50 view.positionViewAtIndex(i, ListView.Center);50 view.positionViewAtIndex(i, ListView.Center);
51 }51 }
5252
53 ListView {53 ScrollView {
54 id: view
55 objectName: "view"
56 anchors.fill: parent54 anchors.fill: parent
57 clip: true55
5856 ListView {
59 model: poppler.tocModel57 id: view
6058 objectName: "view"
61 delegate: ListItem {59 anchors.fill: parent
62 id: delegate60 clip: true
63 objectName: "delegate" + index61
6462 model: poppler.tocModel
65 onClicked: {63
66 pdfView.positionAtIndex(model.pageIndex);64 delegate: ListItem {
67 contentsBottomEdge.collapse();65 id: delegate
68 }66 objectName: "delegate" + index
6967
70 // Highlighted property of ListItem is read-only. In order to68 property bool __isCurrentIndex: view.currentIndex == model.index
71 // provide an highlight for the current page, we need to duplicate69
72 // the overlay.70 onClicked: {
73 Rectangle {71 pdfView.positionAtIndex(model.pageIndex);
74 anchors.fill: parent72 contentsBottomEdge.collapse();
75 color: Qt.rgba(0, 0, 0, 0.05)73 }
76 visible: view.currentIndex == model.index74
77 }75 // Highlighted property of ListItem is read-only. In order to
7876 // provide an highlight for the current page, we need to duplicate
79 /* UITK 1.3 spec: Three slot layout (A-B-C) */77 // the overlay.
80 // ________________________________________78 Rectangle {
81 // | | | |79 anchors.fill: parent
82 // | A | B | C |80 color: Qt.rgba(0, 0, 0, 0.05)
83 // |______________________________|__ __|___|81 visible: __isCurrentIndex
84 //82 }
85 ListItemLayout {83
86 id: listItemLayout84 /* UITK 1.3 spec: Three slot layout (A-B-C) */
87 objectName: "listItemLayout" + index85 // ________________________________________
88 anchors.fill: parent86 // | | | |
89 anchors.leftMargin: model.level * units.gu(4)87 // | A | B | C |
9088 // |______________________________|__ __|___|
91 /* UITK 1.3 specs: Slot A */89 //
92 title {90 ListItemLayout {
93 text: model.title91 id: listItemLayout
94 elide: Text.ElideRight92 objectName: "listItemLayout" + index
95// font.weight: model.level == 0 ? Font.DemiBold : Font.Normal93 anchors.fill: parent
96// color: (model.level == 0) ? UbuntuColors.midAubergine94 anchors.leftMargin: model.level * units.gu(4)
97// : theme.palette.normal.backgroundText95
98 }96 /* UITK 1.3 specs: Slot A */
9997 title.text: model.title
100 /* UITK 1.3 specs: Slot B */98 title.color: __isCurrentIndex ? theme.palette.selected.backgroundText
101 Icon {99 : theme.palette.normal.backgroundText
102 SlotsLayout.position: SlotsLayout.Trailing100
103 width: units.gu(2); height: width101 /* UITK 1.3 specs: Slot B */
104 name: "tick"102 Icon {
105 color: UbuntuColors.green103 SlotsLayout.position: SlotsLayout.Trailing
106 visible: view.currentIndex == model.index104 width: units.gu(2); height: width
107 }105 name: "tick"
108106 color: UbuntuColors.green
109 /* UITK 1.3 specs: Slot C */107 visible: view.currentIndex == model.index
110 Label {108 }
111 objectName: "pageindex"109
112 SlotsLayout.position: SlotsLayout.Last110 /* UITK 1.3 specs: Slot C */
113 text: model.pageIndex + 1111 Label {
114// font.weight: model.level == 0 ? Font.DemiBold : Font.Normal112 objectName: "pageindex"
115// color: (model.level == 0) ? UbuntuColors.midAubergine113 SlotsLayout.position: SlotsLayout.Last
116// : theme.palette.normal.backgroundText114 text: model.pageIndex + 1
115 color: __isCurrentIndex ? theme.palette.selected.backgroundText
116 : theme.palette.normal.backgroundText
117 }
117 }118 }
118 }119 }
119 }120 }
120 }121 }
121
122 Scrollbar { flickableItem: view }
123}122}
124123
=== 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:45:15 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2013-2015 Canonical, Ltd.2 * Copyright (C) 2013-2016 Canonical, Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by5 * it under the terms of the GNU General Public License as published by
@@ -54,8 +54,9 @@
54 }54 }
5555
56 StyleHints {56 StyleHints {
57 backgroundColor: "#BF000000"57 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
58 foregroundColor: "white"58 foregroundColor: "white"
59 dividerColor: "transparent"
59 }60 }
60 }61 }
6162
6263
=== 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:45:15 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2013-2015 Canonical, Ltd.2 * Copyright (C) 2013-2016 Canonical, Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by5 * it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
31 header: PageHeader {31 header: PageHeader {
32 flickable: pdfView32 flickable: pdfView
3333
34 trailingActionBar.actions: [ searchText, goToPage, startPresentation, nightModeToggle, fileDetails ]34 trailingActionBar.actions: [ goToPage, startPresentation, nightModeToggle, fileDetails ]
3535
36 contents: ListItemLayout {36 contents: ListItemLayout {
37 anchors.centerIn: parent37 anchors.centerIn: parent
@@ -72,55 +72,55 @@
72 color: "#f5f5f5"72 color: "#f5f5f5"
73 }73 }
7474
75 PDF.VerticalView {75 ScrollView {
76 id: pdfView
77 objectName: "pdfView"
78
79 anchors.fill: parent76 anchors.fill: parent
80 anchors.topMargin: pdfPage.header.height77
81 spacing: units.gu(2)78 PDF.VerticalView {
8279 id: pdfView
83 boundsBehavior: Flickable.StopAtBounds80 objectName: "pdfView"
84 flickDeceleration: 1500 * units.gridUnit / 881
85 maximumFlickVelocity: 2500 * units.gridUnit / 8
86
87 contentWidth: parent.width * _zoomHelper.scale
88 cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
89 interactive: !pinchy.pinch.active
90
91 model: poppler
92 delegate: PdfViewDelegate {
93 Component.onDestruction: window.releaseResources()
94 }
95
96 // FIXME: On zooming, keep the same content position.
97 PinchArea {
98 id: pinchy
99 anchors.fill: parent82 anchors.fill: parent
10083 anchors.topMargin: pdfPage.header.height
101 pinch {84 spacing: units.gu(2)
102 target: _zoomHelper85
103 minimumScale: 1.086 boundsBehavior: Flickable.StopAtBounds
104 maximumScale: 2.587 flickDeceleration: 1500 * units.gridUnit / 8
105 }88 maximumFlickVelocity: 2500 * units.gridUnit / 8
10689
107 onPinchFinished: {90 contentWidth: parent.width * _zoomHelper.scale
108 pdfView.returnToBounds();91 cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
10992 interactive: !pinchy.pinch.active
110 // This is a bit expensive, so it's safer to put it here.93
111 // It won't be called on desktop (where PinchArea is not used),94 model: poppler
112 // but it's not a problem at the moment (our target is phone).95 delegate: PdfViewDelegate {
113 window.releaseResources();96 Component.onDestruction: window.releaseResources()
114 }97 }
98
99 // FIXME: On zooming, keep the same content position.
100 PinchArea {
101 id: pinchy
102 anchors.fill: parent
103
104 pinch {
105 target: _zoomHelper
106 minimumScale: 1.0
107 maximumScale: 2.5
108 }
109
110 onPinchFinished: {
111 pdfView.returnToBounds();
112
113 // This is a bit expensive, so it's safer to put it here.
114 // It won't be called on desktop (where PinchArea is not used),
115 // but it's not a problem at the moment (our target is phone).
116 window.releaseResources();
117 }
118 }
119
120 Item { id: _zoomHelper }
115 }121 }
116
117 Item { id: _zoomHelper }
118 }122 }
119123
120
121 Scrollbar { flickableItem: pdfView }
122 Scrollbar { flickableItem: pdfView; align: Qt.AlignBottom }
123
124 PDF.Document {124 PDF.Document {
125 id: poppler125 id: poppler
126126
@@ -202,20 +202,11 @@
202 /*** ACTIONS ***/202 /*** ACTIONS ***/
203203
204 Action {204 Action {
205 id: searchText
206 iconName: "search"
207 text: i18n.tr("Search")
208 // onTriggered: pageMain.state = "search"
209 //Disable it until we provide search in Poppler plugin.
210 enabled: false
211 }
212
213 Action {
214 id: goToPage205 id: goToPage
215 objectName:"gotopage"206 objectName:"gotopage"
216 iconName: "browser-tabs"207 iconName: "browser-tabs"
217 text: i18n.tr("Go to page...")208 text: i18n.tr("Go to page...")
218 onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), targetPage)209 onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), pdfPage)
219 }210 }
220211
221 Action {212 Action {
222213
=== 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:45:15 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2014-2015 Canonical, Ltd.2 * Copyright (C) 2014-2016 Canonical, Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by5 * it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
36 inputMethodHints: Qt.ImhFormattedNumbersOnly36 inputMethodHints: Qt.ImhFormattedNumbersOnly
37 validator: IntValidator{ bottom: 1; top: pdfView.count }37 validator: IntValidator{ bottom: 1; top: pdfView.count }
3838
39 Keys.onReturnPressed: goToPage()39 onAccepted: goToPage()
40 Component.onCompleted: forceActiveFocus()40 Component.onCompleted: forceActiveFocus()
41 }41 }
4242
4343
=== 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:45:15 +0000
@@ -115,6 +115,9 @@
115 }115 }
116116
117 Component.onCompleted: {117 Component.onCompleted: {
118 // WORKAROUND: Mouse detection is not included in the SDK yet
119 QuickUtils.mouseAttached = true
120
118 pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));121 pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));
119122
120 // Open the document, if one has been specified.123 // Open the document, if one has been specified.

Subscribers

People subscribed via source and target branches