Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge into lp:ubuntu-docviewer-app
- uitk-bottom-edge
- Merge into lo-viewer
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Stefano Verzegnassi | ||||
Approved revision: | 239 | ||||
Merged at revision: | 281 | ||||
Proposed branch: | lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge | ||||
Merge into: | lp:ubuntu-docviewer-app | ||||
Diff against target: |
871 lines (+151/-556) 8 files modified
click/docviewer.apparmor (+1/-1) click/manifest.json.in (+1/-1) po/com.ubuntu.docviewer.pot (+16/-19) src/app/qml/common/PageWithBottomEdge.qml (+0/-397) src/app/qml/pdfView/PdfContentsPage.qml (+7/-13) src/app/qml/pdfView/PdfView.qml (+125/-30) src/app/qml/pdfView/PdfViewDefaultHeader.qml (+0/-95) src/app/qml/pdfView/PdfViewDelegate.qml (+1/-0) |
||||
To merge this branch: | bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk-bottom-edge | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jenkins Bot | continuous-integration | Approve | |
Alan Pope πΊπ§π± π¦ (community) | Approve | ||
Review via email: mp+281860@code.launchpad.net |
Commit message
* Use UITK 1.3 BottomEdge instead of old PageWithBottomEdge component.
* Updated framework version to 15.04.3
Description of the change
* Use UITK 1.3 BottomEdge instead of old PageWithBottomEdge component.
* Updated framework version to 15.04.3
New BottomEdge component is already in the rc-proposed channel (which means it will surely available for OTA-9).
Framework target for new stuff (e.g. UITK-1.3 PageHeader) in OTA-8 was 15.04.2. Since the upcoming OTA should provide a new framework (15.04.3), I guess everything in this MP is "legal".
NOTE:
BottomEdgeHint doesn't work on desktop, unless "QuickUtils.
This does not represent a big issue for now (we're focused on touch devices) and I suspect a proper mouse detection will come in the near future.
If not, I have already prepared a MP for adding mouse detection in DocViewer. :)
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
Alan Pope πΊπ§π± π¦ (popey) wrote : | # |
Works well, but I noticed a strange flickering of the content appearing on screen. I made a video showing it which should be available shortly. Not sure if this is a toolkit bug (likely)?
Roman Shchekin (mrqtros) wrote : | # |
Hi, Alan, I've seen video - yes, I can see flickering, we should find out is it SDK bug or ours!
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
On it!
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
It doesn't seem to be related to something we've done in DocViewer.
I wrote a minimal code which reproduces the issue, and there's nothing strange with the ListView usage (the rest of the code comes from the official examples).
A first workaround I found is making the ListView not visible as long as the page is not active.
ListView {
...
visible: bePage.active
}
Still having a deeper look.
================
import QtQuick 2.4
import Ubuntu.Components 1.3
MainView {
// Note! applicationName needs to match the "name" field of the click manifest
application
width: units.gu(100)
height: units.gu(75)
Page {
id: page
title: i18n.tr("Main")
BottomEdge {
height: parent.height
id: bottomEdgeContent
}
}
}
}
}
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
Replaced ListView with Column+Repeater, in order to delay things a bit.
New example:
http://
That's the result:
https:/
It seems that the issue lives in the UCPageTreeNode component (used by UITK Page) - just my speculation.
Replacing the Page with a Rectangle makes the issue not reproducible anymore.
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:238
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:238
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Alan Pope πΊπ§π± π¦ (popey) wrote : | # |
Much better!
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
- 239. By Stefano Verzegnassi
-
Merged trunk, fixed conflicts.
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
It seems that Jenkins has run a build on revision 239, but it didn't update the review. Top-approving...
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:239
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) : | # |
Preview Diff
1 | === modified file 'click/docviewer.apparmor' |
2 | --- click/docviewer.apparmor 2015-12-26 17:30:14 +0000 |
3 | +++ click/docviewer.apparmor 2016-01-29 12:23:50 +0000 |
4 | @@ -14,4 +14,4 @@ |
5 | "/media/*/*/[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt][Ss]/" |
6 | ], |
7 | "policy_version": 1.3 |
8 | -} |
9 | +} |
10 | \ No newline at end of file |
11 | |
12 | === modified file 'click/manifest.json.in' |
13 | --- click/manifest.json.in 2015-12-04 11:39:06 +0000 |
14 | +++ click/manifest.json.in 2016-01-29 12:23:50 +0000 |
15 | @@ -2,7 +2,7 @@ |
16 | "name": "com.ubuntu.docviewer", |
17 | "title": "Document Viewer", |
18 | "description": "Document Viewer application for Ubuntu devices", |
19 | - "framework": "ubuntu-sdk-15.04.1", |
20 | + "framework": "ubuntu-sdk-15.04.3", |
21 | "architecture": "@CLICK_ARCH@", |
22 | "icon": "@ICON@", |
23 | "hooks": { |
24 | |
25 | === modified file 'po/com.ubuntu.docviewer.pot' |
26 | --- po/com.ubuntu.docviewer.pot 2016-01-18 00:02:05 +0000 |
27 | +++ po/com.ubuntu.docviewer.pot 2016-01-29 12:23:50 +0000 |
28 | @@ -8,7 +8,7 @@ |
29 | msgstr "" |
30 | "Project-Id-Version: \n" |
31 | "Report-Msgid-Bugs-To: \n" |
32 | -"POT-Creation-Date: 2016-01-18 00:54+0100\n" |
33 | +"POT-Creation-Date: 2016-01-29 13:22+0100\n" |
34 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
35 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
36 | "Language-Team: LANGUAGE <LL@li.org>\n" |
37 | @@ -42,7 +42,7 @@ |
38 | |
39 | #: ../src/app/qml/common/DetailsPage.qml:26 |
40 | #: ../src/app/qml/loView/LOViewDefaultHeader.qml:107 |
41 | -#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:90 |
42 | +#: ../src/app/qml/pdfView/PdfView.qml:227 |
43 | #: ../src/app/qml/textView/TextViewDefaultHeader.qml:69 |
44 | msgid "Details" |
45 | msgstr "" |
46 | @@ -117,6 +117,7 @@ |
47 | #: ../src/app/qml/documentPage/DeleteFileDialog.qml:55 |
48 | #: ../src/app/qml/documentPage/DocumentPagePickModeHeader.qml:28 |
49 | #: ../src/app/qml/loView/LOViewGotoDialog.qml:55 |
50 | +#: ../src/app/qml/pdfView/PdfView.qml:180 |
51 | #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:51 |
52 | msgid "Cancel" |
53 | msgstr "" |
54 | @@ -215,7 +216,7 @@ |
55 | msgstr "" |
56 | |
57 | #: ../src/app/qml/documentPage/DocumentPage.qml:23 |
58 | -#: /tmp/build-lok-new-zoom-modes+spreadsheet-zoom-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid_8e2ec5-Default/po/com.ubuntu.docviewer.desktop.in.in.h:3 |
59 | +#: /tmp/uitk-bottom-edge-build/po/com.ubuntu.docviewer.desktop.in.in.h:3 |
60 | msgid "Documents" |
61 | msgstr "" |
62 | |
63 | @@ -342,13 +343,13 @@ |
64 | msgstr "" |
65 | |
66 | #: ../src/app/qml/loView/LOViewDefaultHeader.qml:100 |
67 | -#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84 |
68 | +#: ../src/app/qml/pdfView/PdfView.qml:220 |
69 | #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63 |
70 | msgid "Disable night mode" |
71 | msgstr "" |
72 | |
73 | #: ../src/app/qml/loView/LOViewDefaultHeader.qml:100 |
74 | -#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84 |
75 | +#: ../src/app/qml/pdfView/PdfView.qml:220 |
76 | #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63 |
77 | msgid "Enable night mode" |
78 | msgstr "" |
79 | @@ -400,31 +401,27 @@ |
80 | msgstr "" |
81 | |
82 | #. TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document. |
83 | -#: ../src/app/qml/pdfView/PdfContentsPage.qml:30 |
84 | -#: ../src/app/qml/pdfView/PdfView.qml:38 |
85 | +#: ../src/app/qml/pdfView/PdfContentsPage.qml:31 |
86 | +#: ../src/app/qml/pdfView/PdfView.qml:153 |
87 | msgid "Contents" |
88 | msgstr "" |
89 | |
90 | -#: ../src/app/qml/pdfView/PdfContentsPage.qml:36 |
91 | -msgid "Hide table of contents" |
92 | -msgstr "" |
93 | - |
94 | #. TRANSLATORS: the first argument (%1) refers to the page currently shown on the screen, |
95 | #. while the second one (%2) refers to the total pages count. |
96 | #: ../src/app/qml/pdfView/PdfPresentation.qml:51 |
97 | -#: ../src/app/qml/pdfView/PdfView.qml:35 |
98 | +#: ../src/app/qml/pdfView/PdfView.qml:56 |
99 | #, qt-format |
100 | msgid "Page %1 of %2" |
101 | msgstr "" |
102 | |
103 | -#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:71 |
104 | +#: ../src/app/qml/pdfView/PdfView.qml:203 |
105 | +msgid "Search" |
106 | +msgstr "" |
107 | + |
108 | +#: ../src/app/qml/pdfView/PdfView.qml:213 |
109 | msgid "Go to page..." |
110 | msgstr "" |
111 | |
112 | -#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:78 |
113 | -msgid "Presentation" |
114 | -msgstr "" |
115 | - |
116 | #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:26 |
117 | msgid "Go to page" |
118 | msgstr "" |
119 | @@ -452,10 +449,10 @@ |
120 | msgid "copy %1" |
121 | msgstr "" |
122 | |
123 | -#: /tmp/build-lok-new-zoom-modes+spreadsheet-zoom-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid_8e2ec5-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1 |
124 | +#: /tmp/uitk-bottom-edge-build/po/com.ubuntu.docviewer.desktop.in.in.h:1 |
125 | msgid "Document Viewer" |
126 | msgstr "" |
127 | |
128 | -#: /tmp/build-lok-new-zoom-modes+spreadsheet-zoom-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid_8e2ec5-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2 |
129 | +#: /tmp/uitk-bottom-edge-build/po/com.ubuntu.docviewer.desktop.in.in.h:2 |
130 | msgid "documents;viewer;pdf;reader;" |
131 | msgstr "" |
132 | |
133 | === removed file 'src/app/qml/common/PageWithBottomEdge.qml' |
134 | --- src/app/qml/common/PageWithBottomEdge.qml 2015-11-02 00:41:29 +0000 |
135 | +++ src/app/qml/common/PageWithBottomEdge.qml 1970-01-01 00:00:00 +0000 |
136 | @@ -1,397 +0,0 @@ |
137 | -/* |
138 | - * Copyright (C) 2014, 2015 Canonical, Ltd. |
139 | - * |
140 | - * This program is free software; you can redistribute it and/or modify |
141 | - * it under the terms of the GNU General Public License as published by |
142 | - * the Free Software Foundation; version 3. |
143 | - * |
144 | - * This program is distributed in the hope that it will be useful, |
145 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
146 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
147 | - * GNU General Public License for more details. |
148 | - * |
149 | - * You should have received a copy of the GNU General Public License |
150 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
151 | - */ |
152 | - |
153 | -/* |
154 | - Example: |
155 | - |
156 | - MainView { |
157 | - objectName: "mainView" |
158 | - |
159 | - applicationName: "com.ubuntu.developer.boiko.bottomedge" |
160 | - |
161 | - width: units.gu(100) |
162 | - height: units.gu(75) |
163 | - |
164 | - Component { |
165 | - id: pageComponent |
166 | - |
167 | - PageWithBottomEdge { |
168 | - id: mainPage |
169 | - title: i18n.tr("Main Page") |
170 | - |
171 | - Rectangle { |
172 | - anchors.fill: parent |
173 | - color: "white" |
174 | - } |
175 | - |
176 | - bottomEdgePageComponent: Page { |
177 | - title: "Contents" |
178 | - anchors.fill: parent |
179 | - //anchors.topMargin: contentsPage.flickable.contentY |
180 | - |
181 | - ListView { |
182 | - anchors.fill: parent |
183 | - model: 50 |
184 | - delegate: ListItems.Standard { |
185 | - text: "One Content Item: " + index |
186 | - } |
187 | - } |
188 | - } |
189 | - bottomEdgeTitle: i18n.tr("Bottom edge action") |
190 | - } |
191 | - } |
192 | - |
193 | - PageStack { |
194 | - id: stack |
195 | - Component.onCompleted: stack.push(pageComponent) |
196 | - } |
197 | - } |
198 | - |
199 | -*/ |
200 | - |
201 | -import QtQuick 2.4 |
202 | -import Ubuntu.Components 1.3 |
203 | - |
204 | -Page { |
205 | - id: page |
206 | - |
207 | - property alias bottomEdgePageComponent: edgeLoader.sourceComponent |
208 | - property alias bottomEdgePageSource: edgeLoader.source |
209 | - property alias bottomEdgeTitle: tip.text |
210 | - property bool bottomEdgeEnabled: true |
211 | - property int bottomEdgeExpandThreshold: page.height * 0.2 |
212 | - property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded |
213 | - property bool reloadBottomEdgePage: true |
214 | - |
215 | - readonly property alias bottomEdgePage: edgeLoader.item |
216 | - readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active) |
217 | - readonly property bool isCollapsed: (bottomEdge.y === page.height) |
218 | - readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready) |
219 | - |
220 | - property bool _showEdgePageWhenReady: false |
221 | - property int _areaWhenExpanded: 0 |
222 | - |
223 | - signal bottomEdgeReleased() |
224 | - signal bottomEdgeDismissed() |
225 | - |
226 | - |
227 | - function showBottomEdgePage(source, properties) |
228 | - { |
229 | - edgeLoader.setSource(source, properties) |
230 | - _showEdgePageWhenReady = true |
231 | - } |
232 | - |
233 | - function setBottomEdgePage(source, properties) |
234 | - { |
235 | - edgeLoader.setSource(source, properties) |
236 | - } |
237 | - |
238 | - function _pushPage() |
239 | - { |
240 | - if (edgeLoader.status === Loader.Ready) { |
241 | - edgeLoader.item.active = true |
242 | - page.pageStack.push(edgeLoader.item) |
243 | - if (edgeLoader.item.flickable) { |
244 | - edgeLoader.item.flickable.contentY = -page.header.height |
245 | - edgeLoader.item.flickable.returnToBounds() |
246 | - } |
247 | - if (edgeLoader.item.ready) |
248 | - edgeLoader.item.ready() |
249 | - } |
250 | - } |
251 | - |
252 | - |
253 | - Component.onCompleted: { |
254 | - // avoid a binding on the expanded height value |
255 | - var expandedHeight = height; |
256 | - _areaWhenExpanded = expandedHeight; |
257 | - } |
258 | - |
259 | - onActiveChanged: { |
260 | - if (active) { |
261 | - bottomEdge.state = "collapsed" |
262 | - } |
263 | - } |
264 | - |
265 | - onBottomEdgePageLoadedChanged: { |
266 | - if (_showEdgePageWhenReady && bottomEdgePageLoaded) { |
267 | - bottomEdge.state = "expanded" |
268 | - _showEdgePageWhenReady = false |
269 | - } |
270 | - } |
271 | - |
272 | - Rectangle { |
273 | - id: bgVisual |
274 | - |
275 | - color: "black" |
276 | - anchors.fill: page |
277 | - opacity: 0.7 * ((page.height - bottomEdge.y) / page.height) |
278 | - z: 1 |
279 | - } |
280 | - |
281 | - BottomEdgeHint { |
282 | - id: tip |
283 | - objectName: "bottomEdgeTip" |
284 | - |
285 | - enabled: mouseArea.enabled |
286 | - visible: page.bottomEdgeEnabled |
287 | - z: 1 |
288 | - |
289 | - onClicked: bottomEdge.state = "expanded" |
290 | - |
291 | - Connections { |
292 | - target: mouseArea |
293 | - onClosedChanged: { |
294 | - if (!mouseArea.closed) { |
295 | - tip.state = "Visible"; |
296 | - } |
297 | - } |
298 | - } |
299 | - |
300 | - Connections { |
301 | - target: page.flickable |
302 | - onVerticalVelocityChanged: { |
303 | - if (!mouseArea.closed) { |
304 | - return; |
305 | - } |
306 | - |
307 | - if (page.flickable.verticalVelocity > 0) { |
308 | - tip.state = "Hidden"; |
309 | - } else if (page.flickable.verticalVelocity < 0) { |
310 | - tip.state = "Visible"; |
311 | - } |
312 | - } |
313 | - } |
314 | - } |
315 | - |
316 | - Rectangle { |
317 | - id: shadow |
318 | - |
319 | - anchors { |
320 | - left: parent.left |
321 | - right: parent.right |
322 | - bottom: parent.bottom |
323 | - } |
324 | - height: units.gu(1) |
325 | - z: 1 |
326 | - opacity: 0.0 |
327 | - gradient: Gradient { |
328 | - GradientStop { position: 0.0; color: "transparent" } |
329 | - GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) } |
330 | - } |
331 | - } |
332 | - |
333 | - MouseArea { |
334 | - id: mouseArea |
335 | - |
336 | - property real previousY: -1 |
337 | - property string dragDirection: "None" |
338 | - property bool closed: drag.target.y == drag.maximumY && !mouseArea.pressed |
339 | - |
340 | - preventStealing: true |
341 | - drag { |
342 | - axis: Drag.YAxis |
343 | - target: bottomEdge |
344 | - minimumY: bottomEdge.pageStartY |
345 | - maximumY: page.height |
346 | - } |
347 | - enabled: edgeLoader.status == Loader.Ready |
348 | - visible: page.bottomEdgeEnabled |
349 | - |
350 | - anchors { |
351 | - left: parent.left |
352 | - right: parent.right |
353 | - bottom: parent.bottom |
354 | - |
355 | - } |
356 | - height: bottomEdge.tipHeight |
357 | - z: 10 |
358 | - |
359 | - onReleased: { |
360 | - page.bottomEdgeReleased() |
361 | - if ((dragDirection === "BottomToTop") && |
362 | - bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) { |
363 | - bottomEdge.state = "expanded" |
364 | - } else { |
365 | - bottomEdge.state = "collapsed" |
366 | - } |
367 | - previousY = -1 |
368 | - dragDirection = "None" |
369 | - } |
370 | - |
371 | - onPressed: { |
372 | - previousY = mouse.y |
373 | - tip.forceActiveFocus() |
374 | - } |
375 | - |
376 | - // Propagate click event to the BottomEdgeHint |
377 | - onClicked: tip.clicked() |
378 | - |
379 | - onMouseYChanged: { |
380 | - var yOffset = previousY - mouseY |
381 | - // skip if was a small move |
382 | - if (Math.abs(yOffset) <= units.gu(2)) { |
383 | - return |
384 | - } |
385 | - previousY = mouseY |
386 | - dragDirection = yOffset > 0 ? "BottomToTop" : "TopToBottom" |
387 | - } |
388 | - } |
389 | - |
390 | - Rectangle { |
391 | - id: bottomEdge |
392 | - objectName: "bottomEdge" |
393 | - |
394 | - readonly property int tipHeight: units.gu(3) |
395 | - readonly property int pageStartY: 0 |
396 | - |
397 | - z: Number.MAX_VALUE |
398 | - color: theme.palette.normal.background |
399 | - clip: true |
400 | - anchors { |
401 | - left: parent.left |
402 | - right: parent.right |
403 | - } |
404 | - height: page.height |
405 | - y: height |
406 | - visible: !page.isCollapsed |
407 | - state: "collapsed" |
408 | - states: [ |
409 | - State { |
410 | - name: "collapsed" |
411 | - PropertyChanges { |
412 | - target: bottomEdge |
413 | - y: bottomEdge.height |
414 | - } |
415 | - }, |
416 | - State { |
417 | - name: "expanded" |
418 | - PropertyChanges { |
419 | - target: bottomEdge |
420 | - y: bottomEdge.pageStartY |
421 | - } |
422 | - }, |
423 | - State { |
424 | - name: "floating" |
425 | - when: mouseArea.drag.active |
426 | - PropertyChanges { |
427 | - target: shadow |
428 | - opacity: 1.0 |
429 | - } |
430 | - } |
431 | - ] |
432 | - |
433 | - transitions: [ |
434 | - Transition { |
435 | - to: "expanded" |
436 | - SequentialAnimation { |
437 | - alwaysRunToEnd: true |
438 | - |
439 | - SmoothedAnimation { |
440 | - target: bottomEdge |
441 | - property: "y" |
442 | - duration: UbuntuAnimation.FastDuration |
443 | - easing.type: Easing.Linear |
444 | - } |
445 | - SmoothedAnimation { |
446 | - target: edgeLoader |
447 | - property: "anchors.topMargin" |
448 | - to: - units.gu(4) |
449 | - duration: UbuntuAnimation.FastDuration |
450 | - easing.type: Easing.Linear |
451 | - } |
452 | - SmoothedAnimation { |
453 | - target: edgeLoader |
454 | - property: "anchors.topMargin" |
455 | - to: 0 |
456 | - duration: UbuntuAnimation.FastDuration |
457 | - easing: UbuntuAnimation.StandardEasing |
458 | - } |
459 | - ScriptAction { |
460 | - script: page._pushPage() |
461 | - } |
462 | - } |
463 | - }, |
464 | - Transition { |
465 | - from: "expanded" |
466 | - to: "collapsed" |
467 | - SequentialAnimation { |
468 | - alwaysRunToEnd: true |
469 | - |
470 | - ScriptAction { |
471 | - script: { |
472 | - Qt.inputMethod.hide() |
473 | - edgeLoader.item.parent = edgeLoader |
474 | - edgeLoader.item.anchors.fill = edgeLoader |
475 | - edgeLoader.item.active = false |
476 | - } |
477 | - } |
478 | - SmoothedAnimation { |
479 | - target: bottomEdge |
480 | - property: "y" |
481 | - duration: UbuntuAnimation.SlowDuration |
482 | - } |
483 | - ScriptAction { |
484 | - script: { |
485 | - // destroy current bottom page |
486 | - if (page.reloadBottomEdgePage) { |
487 | - edgeLoader.active = false |
488 | - // tip will receive focus on page active true |
489 | - } else { |
490 | - tip.forceActiveFocus() |
491 | - } |
492 | - |
493 | - // notify |
494 | - page.bottomEdgeDismissed() |
495 | - |
496 | - edgeLoader.active = true |
497 | - } |
498 | - } |
499 | - } |
500 | - }, |
501 | - Transition { |
502 | - from: "floating" |
503 | - to: "collapsed" |
504 | - SmoothedAnimation { |
505 | - target: bottomEdge |
506 | - property: "y" |
507 | - duration: UbuntuAnimation.FastDuration |
508 | - } |
509 | - } |
510 | - ] |
511 | - |
512 | - Loader { |
513 | - id: edgeLoader |
514 | - |
515 | - asynchronous: true |
516 | - anchors.fill: parent |
517 | - //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging |
518 | - Binding { |
519 | - target: edgeLoader.status === Loader.Ready ? edgeLoader : null |
520 | - property: "anchors.topMargin" |
521 | - value: edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0 |
522 | - when: !page.isReady |
523 | - } |
524 | - |
525 | - onLoaded: { |
526 | - tip.forceActiveFocus() |
527 | - if (page.isReady && edgeLoader.item.active !== true) { |
528 | - page._pushPage() |
529 | - } |
530 | - } |
531 | - } |
532 | - } |
533 | -} |
534 | |
535 | === modified file 'src/app/qml/pdfView/PdfContentsPage.qml' |
536 | --- src/app/qml/pdfView/PdfContentsPage.qml 2015-11-13 21:35:22 +0000 |
537 | +++ src/app/qml/pdfView/PdfContentsPage.qml 2016-01-29 12:23:50 +0000 |
538 | @@ -24,18 +24,12 @@ |
539 | objectName: "pdfcontents" |
540 | |
541 | // this property will have to be removed when bug #1341671 will be fixed. |
542 | - property string testProperty: "for page name issue" |
543 | - |
544 | - // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document. |
545 | - title: i18n.tr("Contents") |
546 | - |
547 | - // Avoid a binding loop when using ListView.positionViewAtIndex() |
548 | - flickable: null |
549 | - |
550 | - head.backAction: Action { |
551 | - text: i18n.tr("Hide table of contents") |
552 | - iconName: "down" |
553 | - onTriggered: pageStack.pop() |
554 | + property string testProperty: "for page name issue" |
555 | + |
556 | + header: PageHeader { |
557 | + // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document. |
558 | + title: i18n.tr("Contents") |
559 | + flickable: view |
560 | } |
561 | |
562 | onActiveChanged: { |
563 | @@ -76,7 +70,7 @@ |
564 | |
565 | onClicked: { |
566 | pdfView.positionAtIndex(model.pageIndex); |
567 | - pageStack.pop(); |
568 | + contentsBottomEdge.collapse(); |
569 | } |
570 | |
571 | // Highlighted property of ListItem is read-only. In order to |
572 | |
573 | === modified file 'src/app/qml/pdfView/PdfView.qml' |
574 | --- src/app/qml/pdfView/PdfView.qml 2016-01-13 21:03:40 +0000 |
575 | +++ src/app/qml/pdfView/PdfView.qml 2016-01-29 12:23:50 +0000 |
576 | @@ -16,28 +16,47 @@ |
577 | |
578 | import QtQuick 2.4 |
579 | import Ubuntu.Components 1.3 |
580 | +import Ubuntu.Components.Popups 1.3 |
581 | +import QtQuick.Layouts 1.1 |
582 | import DocumentViewer 1.0 |
583 | import DocumentViewer.PDF 1.0 as PDF |
584 | |
585 | import "../common" |
586 | import "../common/utils.js" as Utils |
587 | |
588 | -// TODO: Use UITK 1.3 BottomEdge component when available |
589 | - |
590 | -PageWithBottomEdge { |
591 | +Page { |
592 | id: pdfPage |
593 | title: DocumentViewer.getFileBaseNameFromPath(file.path) |
594 | |
595 | - flickable: pdfView |
596 | - |
597 | - // TRANSLATORS: the first argument (%1) refers to the page currently shown on the screen, |
598 | - // while the second one (%2) refers to the total pages count. |
599 | - property string currentPage: i18n.tr("Page %1 of %2").arg(pdfView.currentPageIndex + 1).arg(pdfView.count) |
600 | - |
601 | - // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document. |
602 | - bottomEdgeTitle: i18n.tr("Contents") |
603 | - bottomEdgePageComponent: PdfContentsPage { } |
604 | - bottomEdgeEnabled: poppler.tocModel.count > 0 |
605 | + header: PageHeader { |
606 | + flickable: pdfView |
607 | + |
608 | + trailingActionBar.actions: [ searchText, goToPage, nightModeToggle, fileDetails ] |
609 | + |
610 | + contents: ListItemLayout { |
611 | + anchors.centerIn: parent |
612 | + |
613 | + ActivityIndicator { |
614 | + SlotsLayout.position: SlotsLayout.Leading |
615 | + SlotsLayout.overrideVerticalPositioning: true |
616 | + y: (parent.height - height) * 0.5 |
617 | + running: pdfView.currentPageItem.status == Image.Loading || poppler.isLoading |
618 | + visible: running |
619 | + } |
620 | + |
621 | + title { |
622 | + font.weight: Font.DemiBold |
623 | + text: pdfPage.title |
624 | + } |
625 | + |
626 | + subtitle { |
627 | + textSize: Label.Small |
628 | + // TRANSLATORS: the first argument (%1) refers to the page currently shown on the screen, |
629 | + // while the second one (%2) refers to the total pages count. |
630 | + text: i18n.tr("Page %1 of %2").arg(pdfView.currentPageIndex + 1).arg(pdfView.count) |
631 | + } |
632 | + } |
633 | + } |
634 | |
635 | // Reset night mode shader settings when closing the page |
636 | // Component.onDestruction: mainView.nightModeEnabled = false |
637 | @@ -57,17 +76,8 @@ |
638 | id: pdfView |
639 | objectName: "pdfView" |
640 | |
641 | - anchors { |
642 | - fill: parent |
643 | - |
644 | - // WORKAROUND: If we set 'pdfPage.flickable' property, 'pdfView' is not |
645 | - // longer aligned to the bottom of the header, but to the top instead. |
646 | - // This is deprecated code though, and it's not worth to spend more time |
647 | - // for a proper fix here. |
648 | - // (This is likely a bug in the VerticalView class.) |
649 | - topMargin: units.gu(6) |
650 | - } |
651 | - |
652 | + anchors.fill: parent |
653 | + anchors.topMargin: pdfPage.header.height |
654 | spacing: units.gu(2) |
655 | |
656 | boundsBehavior: Flickable.StopAtBounds |
657 | @@ -126,11 +136,96 @@ |
658 | } |
659 | } |
660 | |
661 | - // *** HEADER *** |
662 | - state: "default" |
663 | - states: PdfViewDefaultHeader { |
664 | - name: "default" |
665 | - targetPage: pdfPage |
666 | - activityRunning: pdfView.currentPageItem.status == Image.Loading || poppler.isLoading |
667 | + |
668 | + BottomEdge { |
669 | + id: contentsBottomEdge |
670 | + |
671 | + // WORKAROUND: BottomEdge component loads the page async while draging it |
672 | + // this cause a very bad visual. |
673 | + // To avoid that we create it as soon as the component is ready and keep |
674 | + // it invisible until the user start to drag it. |
675 | + // Fix from: http://bazaar.launchpad.net/~phablet-team/address-book-app/trunk/revision/528 |
676 | + property var _realPage: null |
677 | + |
678 | + hint { |
679 | + action: Action { |
680 | + // TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document. |
681 | + text: i18n.tr("Contents") |
682 | + iconName: "view-list-symbolic" // FIXME: Needs ToC icon. |
683 | + onTriggered: contentsBottomEdge.commit() |
684 | + } |
685 | + flickable: pdfPage.flickable |
686 | + } |
687 | + |
688 | + contentComponent: Item { |
689 | + implicitWidth: contentsBottomEdge.width |
690 | + implicitHeight: contentsBottomEdge.height |
691 | + children: contentsBottomEdge._realPage |
692 | + } |
693 | + |
694 | + enabled: poppler.tocModel.count > 0 |
695 | + |
696 | + onCollapseCompleted: { |
697 | + _realPage = contentsPage.createObject(null) |
698 | + _realPage.header.leadingActionBar.actions = collapseAction |
699 | + } |
700 | + |
701 | + Component.onCompleted: { |
702 | + _realPage = contentsPage.createObject(null) |
703 | + _realPage.header.leadingActionBar.actions = collapseAction |
704 | + } |
705 | + |
706 | + Action { |
707 | + id: collapseAction |
708 | + text: i18n.tr("Cancel") |
709 | + iconName: "down" |
710 | + onTriggered: contentsBottomEdge.collapse() |
711 | + } |
712 | + |
713 | + Component { |
714 | + id: contentsPage |
715 | + |
716 | + PdfContentsPage { |
717 | + width: contentsBottomEdge.width |
718 | + height: contentsBottomEdge.height |
719 | + enabled: contentsBottomEdge.status === BottomEdge.Committed |
720 | + active: contentsBottomEdge.status === BottomEdge.Committed |
721 | + visible: contentsBottomEdge.status !== BottomEdge.Hidden |
722 | + } |
723 | + } |
724 | + } |
725 | + |
726 | + /*** ACTIONS ***/ |
727 | + |
728 | + Action { |
729 | + id: searchText |
730 | + iconName: "search" |
731 | + text: i18n.tr("Search") |
732 | + // onTriggered: pageMain.state = "search" |
733 | + //Disable it until we provide search in Poppler plugin. |
734 | + enabled: false |
735 | + } |
736 | + |
737 | + Action { |
738 | + id: goToPage |
739 | + objectName:"gotopage" |
740 | + iconName: "browser-tabs" |
741 | + text: i18n.tr("Go to page...") |
742 | + onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), targetPage) |
743 | + } |
744 | + |
745 | + Action { |
746 | + id: nightModeToggle |
747 | + iconName: "night-mode" |
748 | + text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode") |
749 | + onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled |
750 | + } |
751 | + |
752 | + Action { |
753 | + id: fileDetails |
754 | + objectName: "detailsAction" |
755 | + text: i18n.tr("Details") |
756 | + iconName: "info" |
757 | + onTriggered: pageStack.push(Qt.resolvedUrl("../common/DetailsPage.qml")) |
758 | } |
759 | } |
760 | |
761 | === removed file 'src/app/qml/pdfView/PdfViewDefaultHeader.qml' |
762 | --- src/app/qml/pdfView/PdfViewDefaultHeader.qml 2016-01-14 13:07:09 +0000 |
763 | +++ src/app/qml/pdfView/PdfViewDefaultHeader.qml 1970-01-01 00:00:00 +0000 |
764 | @@ -1,95 +0,0 @@ |
765 | -/* |
766 | - * Copyright (C) 2014-2015 Canonical, Ltd. |
767 | - * |
768 | - * This program is free software; you can redistribute it and/or modify |
769 | - * it under the terms of the GNU General Public License as published by |
770 | - * the Free Software Foundation; version 3. |
771 | - * |
772 | - * This program is distributed in the hope that it will be useful, |
773 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
774 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
775 | - * GNU General Public License for more details. |
776 | - * |
777 | - * You should have received a copy of the GNU General Public License |
778 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
779 | - */ |
780 | - |
781 | -import QtQuick 2.4 |
782 | -import Ubuntu.Components 1.3 |
783 | -import QtQuick.Layouts 1.1 |
784 | -import Ubuntu.Components.Popups 1.3 |
785 | -import DocumentViewer 1.0 |
786 | - |
787 | -PageHeadState { |
788 | - id: rootItem |
789 | - |
790 | - property Page targetPage |
791 | - property alias activityRunning: activity.running |
792 | - |
793 | - head: targetPage.head |
794 | - |
795 | - contents: RowLayout { |
796 | - anchors.fill: parent |
797 | - spacing: units.gu(1) |
798 | - |
799 | - ActivityIndicator { id: activity; visible: running } |
800 | - |
801 | - Column { |
802 | - id: layout |
803 | - Layout.fillWidth: true |
804 | - |
805 | - Label { |
806 | - width: parent.width |
807 | - //horizontalAlignment: Text.AlignHCenter |
808 | - elide: Text.ElideMiddle |
809 | - |
810 | - font.weight: Font.DemiBold |
811 | - text: targetPage.title |
812 | - } |
813 | - Label { |
814 | - width: parent.width |
815 | - //horizontalAlignment: Text.AlignHCenter |
816 | - elide: Text.ElideMiddle |
817 | - |
818 | - textSize: Label.Small |
819 | - text: targetPage.currentPage |
820 | - } |
821 | - } |
822 | - } |
823 | - |
824 | - actions: [ |
825 | - Action { |
826 | - iconName: "search" |
827 | - // onTriggered: pageMain.state = "search" |
828 | - //Disable it until we provide search in Poppler plugin. |
829 | - enabled: false |
830 | - }, |
831 | - |
832 | - Action { |
833 | - objectName:"gotopage" |
834 | - iconName: "browser-tabs" |
835 | - text: i18n.tr("Go to page...") |
836 | - onTriggered: PopupUtils.open(Qt.resolvedUrl("PdfViewGotoDialog.qml"), targetPage) |
837 | - }, |
838 | - |
839 | - Action { |
840 | - objectName:"presentationmode" |
841 | - iconName: "slideshow" |
842 | - text: i18n.tr("Presentation") |
843 | - onTriggered: pageStack.push(Qt.resolvedUrl("./PdfPresentation.qml"), {'poppler': poppler}) |
844 | - }, |
845 | - |
846 | - Action { |
847 | - iconName: "night-mode" |
848 | - text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode") |
849 | - onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled |
850 | - }, |
851 | - |
852 | - Action { |
853 | - objectName: "detailsAction" |
854 | - text: i18n.tr("Details") |
855 | - iconName: "info" |
856 | - onTriggered: pageStack.push(Qt.resolvedUrl("../common/DetailsPage.qml")) |
857 | - } |
858 | - ] |
859 | -} |
860 | |
861 | === modified file 'src/app/qml/pdfView/PdfViewDelegate.qml' |
862 | --- src/app/qml/pdfView/PdfViewDelegate.qml 2016-01-14 13:07:09 +0000 |
863 | +++ src/app/qml/pdfView/PdfViewDelegate.qml 2016-01-29 12:23:50 +0000 |
864 | @@ -46,6 +46,7 @@ |
865 | id: pageImg |
866 | anchors.fill: parent |
867 | |
868 | + cache: false |
869 | source: "image://poppler" + (index % poppler.providersNumber) + "/page/" + index; |
870 | sourceSize.width: pdfPage.width |
871 | fillMode: Image.PreserveAspectFit |
FAILED: Continuous integration, rev:235 /core-apps- jenkins. ubuntu. com/job/ docviewer- app-ci/ 61/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/323/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ docviewer- app-ci/ 61/rebuild
https:/