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
1=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
2--- src/app/qml/pdfView/PdfContentsPage.qml 2016-03-26 18:45:15 +0000
3+++ src/app/qml/pdfView/PdfContentsPage.qml 2016-03-26 18:45:15 +0000
4@@ -24,7 +24,7 @@
5 objectName: "pdfcontents"
6
7 // this property will have to be removed when bug #1341671 will be fixed.
8- property string testProperty: "for page name issue"
9+ property string testProperty: "for page name issue"
10
11 header: PageHeader {
12 // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
13@@ -50,74 +50,73 @@
14 view.positionViewAtIndex(i, ListView.Center);
15 }
16
17- ListView {
18- id: view
19- objectName: "view"
20+ ScrollView {
21 anchors.fill: parent
22- clip: true
23-
24- model: poppler.tocModel
25-
26- delegate: ListItem {
27- id: delegate
28- objectName: "delegate" + index
29-
30- onClicked: {
31- pdfView.positionAtIndex(model.pageIndex);
32- contentsBottomEdge.collapse();
33- }
34-
35- // Highlighted property of ListItem is read-only. In order to
36- // provide an highlight for the current page, we need to duplicate
37- // the overlay.
38- Rectangle {
39- anchors.fill: parent
40- color: Qt.rgba(0, 0, 0, 0.05)
41- visible: view.currentIndex == model.index
42- }
43-
44- /* UITK 1.3 spec: Three slot layout (A-B-C) */
45- // ________________________________________
46- // | | | |
47- // | A | B | C |
48- // |______________________________|__ __|___|
49- //
50- ListItemLayout {
51- id: listItemLayout
52- objectName: "listItemLayout" + index
53- anchors.fill: parent
54- anchors.leftMargin: model.level * units.gu(4)
55-
56- /* UITK 1.3 specs: Slot A */
57- title {
58- text: model.title
59- elide: Text.ElideRight
60-// font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
61-// color: (model.level == 0) ? UbuntuColors.midAubergine
62-// : theme.palette.normal.backgroundText
63- }
64-
65- /* UITK 1.3 specs: Slot B */
66- Icon {
67- SlotsLayout.position: SlotsLayout.Trailing
68- width: units.gu(2); height: width
69- name: "tick"
70- color: UbuntuColors.green
71- visible: view.currentIndex == model.index
72- }
73-
74- /* UITK 1.3 specs: Slot C */
75- Label {
76- objectName: "pageindex"
77- SlotsLayout.position: SlotsLayout.Last
78- text: model.pageIndex + 1
79-// font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
80-// color: (model.level == 0) ? UbuntuColors.midAubergine
81-// : theme.palette.normal.backgroundText
82+
83+ ListView {
84+ id: view
85+ objectName: "view"
86+ anchors.fill: parent
87+ clip: true
88+
89+ model: poppler.tocModel
90+
91+ delegate: ListItem {
92+ id: delegate
93+ objectName: "delegate" + index
94+
95+ property bool __isCurrentIndex: view.currentIndex == model.index
96+
97+ onClicked: {
98+ pdfView.positionAtIndex(model.pageIndex);
99+ contentsBottomEdge.collapse();
100+ }
101+
102+ // Highlighted property of ListItem is read-only. In order to
103+ // provide an highlight for the current page, we need to duplicate
104+ // the overlay.
105+ Rectangle {
106+ anchors.fill: parent
107+ color: Qt.rgba(0, 0, 0, 0.05)
108+ visible: __isCurrentIndex
109+ }
110+
111+ /* UITK 1.3 spec: Three slot layout (A-B-C) */
112+ // ________________________________________
113+ // | | | |
114+ // | A | B | C |
115+ // |______________________________|__ __|___|
116+ //
117+ ListItemLayout {
118+ id: listItemLayout
119+ objectName: "listItemLayout" + index
120+ anchors.fill: parent
121+ anchors.leftMargin: model.level * units.gu(4)
122+
123+ /* UITK 1.3 specs: Slot A */
124+ title.text: model.title
125+ title.color: __isCurrentIndex ? theme.palette.selected.backgroundText
126+ : theme.palette.normal.backgroundText
127+
128+ /* UITK 1.3 specs: Slot B */
129+ Icon {
130+ SlotsLayout.position: SlotsLayout.Trailing
131+ width: units.gu(2); height: width
132+ name: "tick"
133+ color: UbuntuColors.green
134+ visible: view.currentIndex == model.index
135+ }
136+
137+ /* UITK 1.3 specs: Slot C */
138+ Label {
139+ objectName: "pageindex"
140+ SlotsLayout.position: SlotsLayout.Last
141+ text: model.pageIndex + 1
142+ color: __isCurrentIndex ? theme.palette.selected.backgroundText
143+ : theme.palette.normal.backgroundText
144+ }
145 }
146 }
147 }
148 }
149-
150- Scrollbar { flickableItem: view }
151 }
152
153=== modified file 'src/app/qml/pdfView/PdfPresentation.qml'
154--- src/app/qml/pdfView/PdfPresentation.qml 2016-02-07 23:01:57 +0000
155+++ src/app/qml/pdfView/PdfPresentation.qml 2016-03-26 18:45:15 +0000
156@@ -1,5 +1,5 @@
157 /*
158- * Copyright (C) 2013-2015 Canonical, Ltd.
159+ * Copyright (C) 2013-2016 Canonical, Ltd.
160 *
161 * This program is free software; you can redistribute it and/or modify
162 * it under the terms of the GNU General Public License as published by
163@@ -54,8 +54,9 @@
164 }
165
166 StyleHints {
167- backgroundColor: "#BF000000"
168+ backgroundColor: Qt.rgba(0, 0, 0, 0.75)
169 foregroundColor: "white"
170+ dividerColor: "transparent"
171 }
172 }
173
174
175=== modified file 'src/app/qml/pdfView/PdfView.qml'
176--- src/app/qml/pdfView/PdfView.qml 2016-02-16 15:56:26 +0000
177+++ src/app/qml/pdfView/PdfView.qml 2016-03-26 18:45:15 +0000
178@@ -1,5 +1,5 @@
179 /*
180- * Copyright (C) 2013-2015 Canonical, Ltd.
181+ * Copyright (C) 2013-2016 Canonical, Ltd.
182 *
183 * This program is free software; you can redistribute it and/or modify
184 * it under the terms of the GNU General Public License as published by
185@@ -31,7 +31,7 @@
186 header: PageHeader {
187 flickable: pdfView
188
189- trailingActionBar.actions: [ searchText, goToPage, startPresentation, nightModeToggle, fileDetails ]
190+ trailingActionBar.actions: [ goToPage, startPresentation, nightModeToggle, fileDetails ]
191
192 contents: ListItemLayout {
193 anchors.centerIn: parent
194@@ -72,55 +72,55 @@
195 color: "#f5f5f5"
196 }
197
198- PDF.VerticalView {
199- id: pdfView
200- objectName: "pdfView"
201-
202+ ScrollView {
203 anchors.fill: parent
204- anchors.topMargin: pdfPage.header.height
205- spacing: units.gu(2)
206-
207- boundsBehavior: Flickable.StopAtBounds
208- flickDeceleration: 1500 * units.gridUnit / 8
209- maximumFlickVelocity: 2500 * units.gridUnit / 8
210-
211- contentWidth: parent.width * _zoomHelper.scale
212- cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
213- interactive: !pinchy.pinch.active
214-
215- model: poppler
216- delegate: PdfViewDelegate {
217- Component.onDestruction: window.releaseResources()
218- }
219-
220- // FIXME: On zooming, keep the same content position.
221- PinchArea {
222- id: pinchy
223+
224+ PDF.VerticalView {
225+ id: pdfView
226+ objectName: "pdfView"
227+
228 anchors.fill: parent
229-
230- pinch {
231- target: _zoomHelper
232- minimumScale: 1.0
233- maximumScale: 2.5
234- }
235-
236- onPinchFinished: {
237- pdfView.returnToBounds();
238-
239- // This is a bit expensive, so it's safer to put it here.
240- // It won't be called on desktop (where PinchArea is not used),
241- // but it's not a problem at the moment (our target is phone).
242- window.releaseResources();
243- }
244+ anchors.topMargin: pdfPage.header.height
245+ spacing: units.gu(2)
246+
247+ boundsBehavior: Flickable.StopAtBounds
248+ flickDeceleration: 1500 * units.gridUnit / 8
249+ maximumFlickVelocity: 2500 * units.gridUnit / 8
250+
251+ contentWidth: parent.width * _zoomHelper.scale
252+ cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
253+ interactive: !pinchy.pinch.active
254+
255+ model: poppler
256+ delegate: PdfViewDelegate {
257+ Component.onDestruction: window.releaseResources()
258+ }
259+
260+ // FIXME: On zooming, keep the same content position.
261+ PinchArea {
262+ id: pinchy
263+ anchors.fill: parent
264+
265+ pinch {
266+ target: _zoomHelper
267+ minimumScale: 1.0
268+ maximumScale: 2.5
269+ }
270+
271+ onPinchFinished: {
272+ pdfView.returnToBounds();
273+
274+ // This is a bit expensive, so it's safer to put it here.
275+ // It won't be called on desktop (where PinchArea is not used),
276+ // but it's not a problem at the moment (our target is phone).
277+ window.releaseResources();
278+ }
279+ }
280+
281+ Item { id: _zoomHelper }
282 }
283-
284- Item { id: _zoomHelper }
285 }
286
287-
288- Scrollbar { flickableItem: pdfView }
289- Scrollbar { flickableItem: pdfView; align: Qt.AlignBottom }
290-
291 PDF.Document {
292 id: poppler
293
294@@ -202,20 +202,11 @@
295 /*** ACTIONS ***/
296
297 Action {
298- id: searchText
299- iconName: "search"
300- text: i18n.tr("Search")
301- // onTriggered: pageMain.state = "search"
302- //Disable it until we provide search in Poppler plugin.
303- enabled: false
304- }
305-
306- Action {
307 id: goToPage
308 objectName:"gotopage"
309 iconName: "browser-tabs"
310 text: i18n.tr("Go to page...")
311- onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), targetPage)
312+ onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), pdfPage)
313 }
314
315 Action {
316
317=== modified file 'src/app/qml/pdfView/PdfViewGotoDialog.qml'
318--- src/app/qml/pdfView/PdfViewGotoDialog.qml 2015-10-23 11:19:19 +0000
319+++ src/app/qml/pdfView/PdfViewGotoDialog.qml 2016-03-26 18:45:15 +0000
320@@ -1,5 +1,5 @@
321 /*
322- * Copyright (C) 2014-2015 Canonical, Ltd.
323+ * Copyright (C) 2014-2016 Canonical, Ltd.
324 *
325 * This program is free software; you can redistribute it and/or modify
326 * it under the terms of the GNU General Public License as published by
327@@ -36,7 +36,7 @@
328 inputMethodHints: Qt.ImhFormattedNumbersOnly
329 validator: IntValidator{ bottom: 1; top: pdfView.count }
330
331- Keys.onReturnPressed: goToPage()
332+ onAccepted: goToPage()
333 Component.onCompleted: forceActiveFocus()
334 }
335
336
337=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
338--- src/app/qml/ubuntu-docviewer-app.qml 2016-03-03 13:08:20 +0000
339+++ src/app/qml/ubuntu-docviewer-app.qml 2016-03-26 18:45:15 +0000
340@@ -115,6 +115,9 @@
341 }
342
343 Component.onCompleted: {
344+ // WORKAROUND: Mouse detection is not included in the SDK yet
345+ QuickUtils.mouseAttached = true
346+
347 pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));
348
349 // Open the document, if one has been specified.

Subscribers

People subscribed via source and target branches