Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-qsg-impress-support into lp:ubuntu-docviewer-app
- reboot-qsg-impress-support
- Merge into lo-viewer
Status: | Merged |
---|---|
Approved by: | Stefano Verzegnassi |
Approved revision: | 182 |
Merged at revision: | 185 |
Proposed branch: | lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-qsg-impress-support |
Merge into: | lp:ubuntu-docviewer-app |
Prerequisite: | lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-qsg-zoom |
Diff against target: |
807 lines (+319/-118) 12 files modified
po/com.ubuntu.docviewer.pot (+11/-6) src/app/qml/loView/KeybHelper.js (+98/-11) src/app/qml/loView/LOViewPage.qml (+21/-15) src/app/qml/loView/PartsView.qml (+10/-1) src/app/qml/loView/SlideControllerPanel.qml (+31/-11) src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp (+64/-23) src/plugin/libreofficetoolkit-qml-plugin/lodocument.h (+2/-3) src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp (+17/-44) src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp (+2/-2) src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml (+41/-0) src/plugin/libreofficetoolkit-qml-plugin/renderengine.cpp (+5/-2) src/plugin/libreofficetoolkit-qml-plugin/renderengine.h (+17/-0) |
To merge this branch: | bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-qsg-impress-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Document Viewer Developers | Pending | ||
Review via email: mp+272146@code.launchpad.net |
Commit message
* [loviewer] Improved support for presentation document type
* [loviewer] Added keyboard shortcuts.
* [loviewer] Added an image provider for slides thumbnails, sync'd with RenderEngine
* [loviewer] Conditional layout for the presentation view: use a bottom edge or a sidebar to show the list of slides
* [loviewer] Moved zoom controls into a separate page head
* Updated translation template
Description of the change
* [loviewer] Improved support for presentation document type
* [loviewer] Added keyboard shortcuts.
(PgUp, PgDown, Ctrl+Home, Ctrl+End, Up, Down, Left, Right, Ctrl+Plus, Ctrl+Minus)
See src/app/
* [loviewer] Added an image provider for slides thumbnails, sync'd with RenderEngine
* [loviewer] Conditional layout for the presentation view: use a bottom edge or a sidebar to show the list of slides
* [loviewer] Moved zoom controls into a separate page head
* Updated translation template
Alan Pope 🍺🐧🐱 🦄 (popey) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:178
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Roman Shchekin (mrqtros) wrote : | # |
No automatic merge?
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
I've done some mess with prerequisite branches, which is required to be already merged...
I honestly need a moment for checking if I have proposed this with the proper prerequisite. I'm sorry for this.
Stefano Verzegnassi (verzegnassi-stefano) wrote : | # |
Ok. False allarm, everything is okay.
Please approve this MP too: https:/
We've already reviewed its code when you started to rewrite the RenderEngine with thumbnails support.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
- 182. By Stefano Verzegnassi
-
Updated translation template
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Preview Diff
1 | === modified file 'po/com.ubuntu.docviewer.pot' | |||
2 | --- po/com.ubuntu.docviewer.pot 2015-10-10 12:15:07 +0000 | |||
3 | +++ po/com.ubuntu.docviewer.pot 2015-10-10 12:33:09 +0000 | |||
4 | @@ -8,7 +8,7 @@ | |||
5 | 8 | msgstr "" | 8 | msgstr "" |
6 | 9 | "Project-Id-Version: \n" | 9 | "Project-Id-Version: \n" |
7 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
9 | 11 | "POT-Creation-Date: 2015-10-10 14:14+0200\n" | 11 | "POT-Creation-Date: 2015-10-10 14:32+0200\n" |
10 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
11 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
12 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
13 | @@ -19,7 +19,7 @@ | |||
14 | 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" |
15 | 20 | 20 | ||
16 | 21 | #: ../src/app/docviewer-application.cpp:162 | 21 | #: ../src/app/docviewer-application.cpp:162 |
18 | 22 | #: /tmp/build-reboot-lok-qsg-zoom-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1 | 22 | #: /tmp/build-reboot-qsg-impress-support-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1 |
19 | 23 | msgid "Document Viewer" | 23 | msgid "Document Viewer" |
20 | 24 | msgstr "" | 24 | msgstr "" |
21 | 25 | 25 | ||
22 | @@ -255,7 +255,7 @@ | |||
23 | 255 | 255 | ||
24 | 256 | #: ../src/app/qml/documentPage/DocumentPageSearchHeader.qml:27 | 256 | #: ../src/app/qml/documentPage/DocumentPageSearchHeader.qml:27 |
25 | 257 | #: ../src/app/qml/loView/LOViewDefaultHeader.qml:80 | 257 | #: ../src/app/qml/loView/LOViewDefaultHeader.qml:80 |
27 | 258 | #: ../src/app/qml/loView/LOViewPage.qml:186 | 258 | #: ../src/app/qml/loView/LOViewPage.qml:191 |
28 | 259 | #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:61 | 259 | #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:61 |
29 | 260 | #: ../src/app/qml/textView/TextViewDefaultHeader.qml:61 | 260 | #: ../src/app/qml/textView/TextViewDefaultHeader.qml:61 |
30 | 261 | msgid "Back" | 261 | msgid "Back" |
31 | @@ -368,8 +368,8 @@ | |||
32 | 368 | msgid "GO!" | 368 | msgid "GO!" |
33 | 369 | msgstr "" | 369 | msgstr "" |
34 | 370 | 370 | ||
37 | 371 | #: ../src/app/qml/loView/LOViewPage.qml:41 | 371 | #: ../src/app/qml/loView/LOViewPage.qml:34 |
38 | 372 | #: ../src/app/qml/loView/LOViewPage.qml:184 | 372 | #: ../src/app/qml/loView/LOViewPage.qml:189 |
39 | 373 | msgid "Slides" | 373 | msgid "Slides" |
40 | 374 | msgstr "" | 374 | msgstr "" |
41 | 375 | 375 | ||
42 | @@ -385,6 +385,11 @@ | |||
43 | 385 | msgid "Zoom out" | 385 | msgid "Zoom out" |
44 | 386 | msgstr "" | 386 | msgstr "" |
45 | 387 | 387 | ||
46 | 388 | #: ../src/app/qml/loView/SlideControllerPanel.qml:62 | ||
47 | 389 | #, qt-format | ||
48 | 390 | msgid "Slide %1 of %2" | ||
49 | 391 | msgstr "" | ||
50 | 392 | |||
51 | 388 | #: ../src/app/qml/loView/ZoomSelector.qml:29 | 393 | #: ../src/app/qml/loView/ZoomSelector.qml:29 |
52 | 389 | msgid "Automatic (Fit width)" | 394 | msgid "Automatic (Fit width)" |
53 | 390 | msgstr "" | 395 | msgstr "" |
54 | @@ -443,6 +448,6 @@ | |||
55 | 443 | msgid "copy %1" | 448 | msgid "copy %1" |
56 | 444 | msgstr "" | 449 | msgstr "" |
57 | 445 | 450 | ||
59 | 446 | #: /tmp/build-reboot-lok-qsg-zoom-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2 | 451 | #: /tmp/build-reboot-qsg-impress-support-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2 |
60 | 447 | msgid "documents;viewer;pdf;reader;" | 452 | msgid "documents;viewer;pdf;reader;" |
61 | 448 | msgstr "" | 453 | msgstr "" |
62 | 449 | 454 | ||
63 | === modified file 'src/app/qml/loView/KeybHelper.js' | |||
64 | --- src/app/qml/loView/KeybHelper.js 2015-09-15 18:20:00 +0000 | |||
65 | +++ src/app/qml/loView/KeybHelper.js 2015-10-10 12:33:09 +0000 | |||
66 | @@ -16,42 +16,129 @@ | |||
67 | 16 | 16 | ||
68 | 17 | function parseEvent(event) { | 17 | function parseEvent(event) { |
69 | 18 | var pixelDiff = 5; | 18 | var pixelDiff = 5; |
71 | 19 | 19 | ||
72 | 20 | var view = loPageContentLoader.item.loView | ||
73 | 21 | var isPresentation = view.document.documentType === LO.Document.PresentationDocument | ||
74 | 22 | |||
75 | 20 | if (event.key == Qt.Key_PageUp) { | 23 | if (event.key == Qt.Key_PageUp) { |
78 | 21 | if (loDocument.documentType == LO.Document.PresentationDocument) | 24 | if (isPresentation) |
79 | 22 | loDocument.currentPart -= 1 | 25 | view.document.currentPart -= 1 |
80 | 23 | else | 26 | else |
82 | 24 | loPage.moveView("vertical", -loView.height) | 27 | view.moveView("vertical", -view.height) |
83 | 25 | 28 | ||
84 | 26 | return; | 29 | return; |
85 | 27 | } | 30 | } |
86 | 28 | 31 | ||
87 | 29 | if (event.key == Qt.Key_PageDown) { | 32 | if (event.key == Qt.Key_PageDown) { |
90 | 30 | if (loDocument.documentType == LO.Document.PresentationDocument) | 33 | if (isPresentation) |
91 | 31 | loDocument.currentPart += 1 | 34 | view.document.currentPart += 1 |
92 | 32 | else | 35 | else |
94 | 33 | loPage.moveView("vertical", loView.height) | 36 | view.moveView("vertical", view.height) |
95 | 34 | 37 | ||
96 | 35 | return; | 38 | return; |
97 | 36 | } | 39 | } |
98 | 37 | 40 | ||
99 | 41 | if (event.key == Qt.Key_Home) { | ||
100 | 42 | if (event.modifiers & Qt.ControlModifier) { | ||
101 | 43 | view.contentX = 0 | ||
102 | 44 | view.contentY = 0 | ||
103 | 45 | view.document.currentPart = 0 | ||
104 | 46 | } else { | ||
105 | 47 | view.contentX = 0 | ||
106 | 48 | view.contentY = 0 | ||
107 | 49 | } | ||
108 | 50 | } | ||
109 | 51 | |||
110 | 52 | if (event.key == Qt.Key_End) { | ||
111 | 53 | if (event.modifiers & Qt.ControlModifier) { | ||
112 | 54 | view.contentX = view.contentWidth - view.width | ||
113 | 55 | view.contentY = view.contentHeight - view.height | ||
114 | 56 | console.log(view.document.currentPart, view.document.partsCount - 1) | ||
115 | 57 | view.document.currentPart = view.document.partsCount - 1 | ||
116 | 58 | } else { | ||
117 | 59 | view.contentX = view.contentWidth - view.width | ||
118 | 60 | view.contentY = view.contentHeight - view.height | ||
119 | 61 | } | ||
120 | 62 | } | ||
121 | 63 | |||
122 | 38 | if (event.key == Qt.Key_Up) { | 64 | if (event.key == Qt.Key_Up) { |
124 | 39 | loPage.moveView("vertical", -pixelDiff) | 65 | view.moveView("vertical", -pixelDiff) |
125 | 40 | return; | 66 | return; |
126 | 41 | } | 67 | } |
127 | 42 | 68 | ||
128 | 43 | if (event.key == Qt.Key_Down) { | 69 | if (event.key == Qt.Key_Down) { |
130 | 44 | loPage.moveView("vertical", pixelDiff) | 70 | view.moveView("vertical", pixelDiff) |
131 | 45 | return; | 71 | return; |
132 | 46 | } | 72 | } |
133 | 47 | 73 | ||
134 | 48 | if (event.key == Qt.Key_Left) { | 74 | if (event.key == Qt.Key_Left) { |
136 | 49 | loPage.moveView("horizontal", -pixelDiff) | 75 | view.moveView("horizontal", -pixelDiff) |
137 | 50 | return; | 76 | return; |
138 | 51 | } | 77 | } |
139 | 52 | 78 | ||
140 | 53 | if (event.key == Qt.Key_Right) { | 79 | if (event.key == Qt.Key_Right) { |
142 | 54 | loPage.moveView("horizontal", pixelDiff) | 80 | view.moveView("horizontal", pixelDiff) |
143 | 55 | return; | 81 | return; |
144 | 56 | } | 82 | } |
145 | 83 | |||
146 | 84 | if (event.key == Qt.Key_Plus) { | ||
147 | 85 | if (event.modifiers & Qt.ControlModifier) { | ||
148 | 86 | view.zoomFactor = Math.max(4.0, view.zoomFactor + 0.25) | ||
149 | 87 | } | ||
150 | 88 | } | ||
151 | 89 | |||
152 | 90 | if (event.key == Qt.Key_Minus) { | ||
153 | 91 | if (event.modifiers & Qt.ControlModifier) { | ||
154 | 92 | view.zoomFactor = Math.min(0.5, view.zoomFactor - 0.25) | ||
155 | 93 | } | ||
156 | 94 | } | ||
157 | 95 | |||
158 | 96 | |||
159 | 97 | /* | ||
160 | 98 | if (event.key == Qt.Key_C) { | ||
161 | 99 | if (event.modifiers & Qt.ControlModifier) { | ||
162 | 100 | |||
163 | 101 | } | ||
164 | 102 | } | ||
165 | 103 | */ | ||
166 | 104 | |||
167 | 105 | /* | ||
168 | 106 | if (event.key == Qt.Key_X) { | ||
169 | 107 | if (event.modifiers & Qt.ControlModifier) { | ||
170 | 108 | |||
171 | 109 | } | ||
172 | 110 | } | ||
173 | 111 | */ | ||
174 | 112 | |||
175 | 113 | /* | ||
176 | 114 | if (event.key == Qt.Key_V) { | ||
177 | 115 | if (event.modifiers & Qt.ControlModifier) { | ||
178 | 116 | |||
179 | 117 | } | ||
180 | 118 | } | ||
181 | 119 | */ | ||
182 | 120 | |||
183 | 121 | /* | ||
184 | 122 | if (event.key == Qt.Key_A) { | ||
185 | 123 | if (event.modifiers & Qt.ControlModifier) { | ||
186 | 124 | |||
187 | 125 | } | ||
188 | 126 | } | ||
189 | 127 | */ | ||
190 | 128 | |||
191 | 129 | /* | ||
192 | 130 | if (event.key == Qt.Key_L) { | ||
193 | 131 | if (event.modifiers & Qt.ControlModifier) { | ||
194 | 132 | // TODO: Go to page dialog | ||
195 | 133 | } | ||
196 | 134 | } | ||
197 | 135 | */ | ||
198 | 136 | |||
199 | 137 | /* | ||
200 | 138 | if (event.key == Qt.Key_Question) { | ||
201 | 139 | if (event.modifiers & (Qt.ControlModifier | Qt.ShiftModifier)) { | ||
202 | 140 | // TODO: Keyboard shortcuts | ||
203 | 141 | } | ||
204 | 142 | } | ||
205 | 143 | */ | ||
206 | 57 | } | 144 | } |
207 | 58 | 145 | ||
208 | === modified file 'src/app/qml/loView/LOViewPage.qml' | |||
209 | --- src/app/qml/loView/LOViewPage.qml 2015-09-22 19:02:46 +0000 | |||
210 | +++ src/app/qml/loView/LOViewPage.qml 2015-10-10 12:33:09 +0000 | |||
211 | @@ -31,6 +31,7 @@ | |||
212 | 31 | 31 | ||
213 | 32 | readonly property bool wideWindow: width > units.gu(120) | 32 | readonly property bool wideWindow: width > units.gu(120) |
214 | 33 | 33 | ||
215 | 34 | bottomEdgeTitle: i18n.tr("Slides") | ||
216 | 34 | bottomEdgeEnabled: { | 35 | bottomEdgeEnabled: { |
217 | 35 | if (!loPageContentLoader.loaded) | 36 | if (!loPageContentLoader.loaded) |
218 | 36 | return false | 37 | return false |
219 | @@ -38,7 +39,6 @@ | |||
220 | 38 | // else | 39 | // else |
221 | 39 | return loPageContentLoader.item.loDocument.documentType == LO.Document.PresentationDocument && !wideWindow | 40 | return loPageContentLoader.item.loDocument.documentType == LO.Document.PresentationDocument && !wideWindow |
222 | 40 | } | 41 | } |
223 | 41 | bottomEdgeTitle: i18n.tr("Slides") | ||
224 | 42 | 42 | ||
225 | 43 | Loader { | 43 | Loader { |
226 | 44 | id: loPageContentLoader | 44 | id: loPageContentLoader |
227 | @@ -70,23 +70,14 @@ | |||
228 | 70 | Component { | 70 | Component { |
229 | 71 | id: loPageContentComponent | 71 | id: loPageContentComponent |
230 | 72 | 72 | ||
232 | 73 | Item { | 73 | FocusScope { |
233 | 74 | id: loPageContent | 74 | id: loPageContent |
234 | 75 | anchors.fill: parent | 75 | anchors.fill: parent |
235 | 76 | |||
236 | 76 | property alias loDocument: loView.document | 77 | property alias loDocument: loView.document |
237 | 77 | property alias loView: loView | 78 | property alias loView: loView |
238 | 78 | property alias bottomEdgePartsPage: bottomEdgePartsPage | 79 | property alias bottomEdgePartsPage: bottomEdgePartsPage |
239 | 79 | 80 | ||
240 | 80 | function moveView(axis, diff) { | ||
241 | 81 | if (axis == "vertical") { | ||
242 | 82 | var maxContentY = Math.max(0, loView.contentHeight - loView.height) | ||
243 | 83 | loView.contentY = Math.max(0, Math.min(loView.contentY + diff, maxContentY )) | ||
244 | 84 | } else { | ||
245 | 85 | var maxContentX = Math.max(0, loView.contentWidth - loView.width) | ||
246 | 86 | loView.contentX = Math.max(0, Math.min(loView.contentX + diff, maxContentX )) | ||
247 | 87 | } | ||
248 | 88 | } | ||
249 | 89 | |||
250 | 90 | Layouts { | 81 | Layouts { |
251 | 91 | id: layouts | 82 | id: layouts |
252 | 92 | anchors.fill: parent | 83 | anchors.fill: parent |
253 | @@ -108,8 +99,8 @@ | |||
254 | 108 | left: parent.left | 99 | left: parent.left |
255 | 109 | } | 100 | } |
256 | 110 | 101 | ||
259 | 111 | model: partsModel | 102 | model: LO.PartsModel { document: loPageContent.loDocument } |
260 | 112 | visible: model | 103 | visible: model && loDocument.documentType == LO.Document.PresentationDocument |
261 | 113 | width: visible ? units.gu(40) : 0 | 104 | width: visible ? units.gu(40) : 0 |
262 | 114 | } | 105 | } |
263 | 115 | 106 | ||
264 | @@ -120,7 +111,16 @@ | |||
265 | 120 | top: parent.top | 111 | top: parent.top |
266 | 121 | bottom: bottomBarLayoutItem.top | 112 | bottom: bottomBarLayoutItem.top |
267 | 122 | } | 113 | } |
269 | 123 | ItemLayout { item: "loView"; anchors.fill: parent } | 114 | |
270 | 115 | ItemLayout { | ||
271 | 116 | item: "loView" | ||
272 | 117 | anchors.fill: parent | ||
273 | 118 | |||
274 | 119 | // Keyboard events | ||
275 | 120 | focus: true | ||
276 | 121 | Keys.onPressed: KeybHelper.parseEvent(event) | ||
277 | 122 | Component.onCompleted: loPageContent.forceActiveFocus() | ||
278 | 123 | } | ||
279 | 124 | } | 124 | } |
280 | 125 | 125 | ||
281 | 126 | Item { | 126 | Item { |
282 | @@ -153,10 +153,15 @@ | |||
283 | 153 | clip: true | 153 | clip: true |
284 | 154 | documentPath: file.path | 154 | documentPath: file.path |
285 | 155 | 155 | ||
286 | 156 | // Keyboard events | ||
287 | 157 | focus: true | ||
288 | 158 | Keys.onPressed: KeybHelper.parseEvent(event) | ||
289 | 159 | |||
290 | 156 | Component.onCompleted: { | 160 | Component.onCompleted: { |
291 | 157 | // WORKAROUND: Fix for wrong grid unit size | 161 | // WORKAROUND: Fix for wrong grid unit size |
292 | 158 | flickDeceleration = 1500 * units.gridUnit / 8 | 162 | flickDeceleration = 1500 * units.gridUnit / 8 |
293 | 159 | maximumFlickVelocity = 2500 * units.gridUnit / 8 | 163 | maximumFlickVelocity = 2500 * units.gridUnit / 8 |
294 | 164 | loPageContent.forceActiveFocus() | ||
295 | 160 | } | 165 | } |
296 | 161 | 166 | ||
297 | 162 | Scrollbar { flickableItem: loView; parent: loView.parent } | 167 | Scrollbar { flickableItem: loView; parent: loView.parent } |
298 | @@ -191,6 +196,7 @@ | |||
299 | 191 | flickable: null | 196 | flickable: null |
300 | 192 | 197 | ||
301 | 193 | PartsView { | 198 | PartsView { |
302 | 199 | property bool belongsToNestedPage: true | ||
303 | 194 | anchors.fill: parent | 200 | anchors.fill: parent |
304 | 195 | model: LO.PartsModel { document: loPageContent.loDocument } | 201 | model: LO.PartsModel { document: loPageContent.loDocument } |
305 | 196 | } | 202 | } |
306 | 197 | 203 | ||
307 | === modified file 'src/app/qml/loView/PartsView.qml' | |||
308 | --- src/app/qml/loView/PartsView.qml 2015-09-15 18:20:00 +0000 | |||
309 | +++ src/app/qml/loView/PartsView.qml 2015-10-10 12:33:09 +0000 | |||
310 | @@ -29,6 +29,7 @@ | |||
311 | 29 | property bool expanded: true | 29 | property bool expanded: true |
312 | 30 | 30 | ||
313 | 31 | currentIndex: view.model ? view.model.document.currentPart : -1 | 31 | currentIndex: view.model ? view.model.document.currentPart : -1 |
314 | 32 | highlightMoveDuration: UbuntuAnimation.SnapDuration | ||
315 | 32 | 33 | ||
316 | 33 | delegate: ListItemWithActions { | 34 | delegate: ListItemWithActions { |
317 | 34 | id: delegate | 35 | id: delegate |
318 | @@ -45,7 +46,12 @@ | |||
319 | 45 | 46 | ||
320 | 46 | onClicked: { | 47 | onClicked: { |
321 | 47 | view.model.document.currentPart = model.index | 48 | view.model.document.currentPart = model.index |
323 | 48 | pageStack.pop(); | 49 | |
324 | 50 | // Check if the view has been included in a nested page (e.g. | ||
325 | 51 | // bottomEdge). If so, close that page and return to the | ||
326 | 52 | // main viewer. | ||
327 | 53 | if (view.hasOwnProperty("belongsToNestedPage")) | ||
328 | 54 | pageStack.pop(); | ||
329 | 49 | } | 55 | } |
330 | 50 | } | 56 | } |
331 | 51 | 57 | ||
332 | @@ -57,6 +63,9 @@ | |||
333 | 57 | Layout.fillHeight: true | 63 | Layout.fillHeight: true |
334 | 58 | Layout.preferredWidth: height | 64 | Layout.preferredWidth: height |
335 | 59 | fillMode: Image.PreserveAspectFit | 65 | fillMode: Image.PreserveAspectFit |
336 | 66 | // Do not store a cache of the thumbnail, so that we don't show | ||
337 | 67 | // thumbnails of a previously loaded document. | ||
338 | 68 | cache: false | ||
339 | 60 | 69 | ||
340 | 61 | source: "image://lok/part/" + model.index | 70 | source: "image://lok/part/" + model.index |
341 | 62 | } | 71 | } |
342 | 63 | 72 | ||
343 | === modified file 'src/app/qml/loView/SlideControllerPanel.qml' | |||
344 | --- src/app/qml/loView/SlideControllerPanel.qml 2015-09-22 19:02:46 +0000 | |||
345 | +++ src/app/qml/loView/SlideControllerPanel.qml 2015-10-10 12:33:09 +0000 | |||
346 | @@ -34,14 +34,24 @@ | |||
347 | 34 | 34 | ||
348 | 35 | Row { | 35 | Row { |
349 | 36 | anchors.centerIn: parent | 36 | anchors.centerIn: parent |
358 | 37 | spacing: units.gu(2) | 37 | //spacing: units.gu(2) |
359 | 38 | 38 | ||
360 | 39 | AbstractButton { | 39 | AbstractButton { |
361 | 40 | width: units.gu(4); height: parent.height | 40 | width: units.gu(4); height: parent.height |
362 | 41 | onClicked: loPageContentLoader.item.loDocument.currentPart -= 1 | 41 | onClicked: loPageContentLoader.item.loView.goFirstPart() |
363 | 42 | 42 | ||
364 | 43 | Icon { | 43 | Icon { |
365 | 44 | id: icon | 44 | anchors.centerIn: parent |
366 | 45 | width: units.gu(2.5); height: width | ||
367 | 46 | name: "go-first" | ||
368 | 47 | } | ||
369 | 48 | } | ||
370 | 49 | |||
371 | 50 | AbstractButton { | ||
372 | 51 | width: units.gu(4); height: parent.height | ||
373 | 52 | onClicked: loPageContentLoader.item.loView.goPreviousPart() | ||
374 | 53 | |||
375 | 54 | Icon { | ||
376 | 45 | anchors.centerIn: parent | 55 | anchors.centerIn: parent |
377 | 46 | width: units.gu(2.5); height: width | 56 | width: units.gu(2.5); height: width |
378 | 47 | name: "go-previous" | 57 | name: "go-previous" |
379 | @@ -49,13 +59,12 @@ | |||
380 | 49 | } | 59 | } |
381 | 50 | 60 | ||
382 | 51 | Label { | 61 | Label { |
385 | 52 | text: "%1 of %2".arg(loPageContentLoader.item.loDocument.currentPart + 1) | 62 | text: i18n.tr("Slide %1 of %2").arg(loPageContentLoader.item.loDocument.currentPart + 1).arg(loPageContentLoader.item.loDocument.partsCount) |
384 | 53 | .arg(loPageContentLoader.item.loDocument.partsCount) | ||
386 | 54 | } | 63 | } |
387 | 55 | 64 | ||
388 | 56 | AbstractButton { | 65 | AbstractButton { |
389 | 57 | width: units.gu(4); height: parent.height | 66 | width: units.gu(4); height: parent.height |
391 | 58 | onClicked: loPageContentLoader.item.loDocument.currentPart += 1 | 67 | onClicked: loPageContentLoader.item.loView.goNextPart() |
392 | 59 | 68 | ||
393 | 60 | Icon { | 69 | Icon { |
394 | 61 | anchors.centerIn: parent | 70 | anchors.centerIn: parent |
395 | @@ -63,5 +72,16 @@ | |||
396 | 63 | name: "go-next" | 72 | name: "go-next" |
397 | 64 | } | 73 | } |
398 | 65 | } | 74 | } |
399 | 75 | |||
400 | 76 | AbstractButton { | ||
401 | 77 | width: units.gu(4); height: parent.height | ||
402 | 78 | onClicked: loPageContentLoader.item.loView.goLastPart() | ||
403 | 79 | |||
404 | 80 | Icon { | ||
405 | 81 | anchors.centerIn: parent | ||
406 | 82 | width: units.gu(2.5); height: width | ||
407 | 83 | name: "go-last" | ||
408 | 84 | } | ||
409 | 85 | } | ||
410 | 66 | } | 86 | } |
411 | 67 | } | 87 | } |
412 | 68 | 88 | ||
413 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp' | |||
414 | --- src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-09-22 19:02:46 +0000 | |||
415 | +++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-10-10 12:33:09 +0000 | |||
416 | @@ -36,6 +36,7 @@ | |||
417 | 36 | 36 | ||
418 | 37 | LODocument::LODocument() | 37 | LODocument::LODocument() |
419 | 38 | : m_path("") | 38 | : m_path("") |
420 | 39 | , m_currentPart(-1) | ||
421 | 39 | , m_document(nullptr) | 40 | , m_document(nullptr) |
422 | 40 | { | 41 | { |
423 | 41 | // This space is intentionally empty. | 42 | // This space is intentionally empty. |
424 | @@ -61,21 +62,18 @@ | |||
425 | 61 | } | 62 | } |
426 | 62 | 63 | ||
427 | 63 | int LODocument::currentPart() { | 64 | int LODocument::currentPart() { |
432 | 64 | if (!m_document) | 65 | return m_currentPart; |
429 | 65 | return int(-1); | ||
430 | 66 | |||
431 | 67 | return m_document->getPart(); | ||
433 | 68 | } | 66 | } |
435 | 69 | 67 | ||
436 | 70 | void LODocument::setCurrentPart(int index) | 68 | void LODocument::setCurrentPart(int index) |
437 | 71 | { | 69 | { |
438 | 72 | if (!m_document) | 70 | if (!m_document) |
439 | 73 | return; | 71 | return; |
442 | 74 | 72 | ||
443 | 75 | if (this->currentPart() == index || index < 0 || index > partsCount() - 1) | 73 | if (m_currentPart == index || index < 0 || index > partsCount() - 1) |
444 | 76 | return; | 74 | return; |
447 | 77 | 75 | ||
448 | 78 | m_document->setPart(index); | 76 | m_currentPart = index; |
449 | 79 | Q_EMIT currentPartChanged(); | 77 | Q_EMIT currentPartChanged(); |
450 | 80 | } | 78 | } |
451 | 81 | 79 | ||
452 | @@ -97,6 +95,8 @@ | |||
453 | 97 | m_docType = DocumentType(m_document->getDocumentType()); | 95 | m_docType = DocumentType(m_document->getDocumentType()); |
454 | 98 | Q_EMIT documentTypeChanged(); | 96 | Q_EMIT documentTypeChanged(); |
455 | 99 | 97 | ||
456 | 98 | setCurrentPart(m_document->getPart()); | ||
457 | 99 | |||
458 | 100 | m_document->initializeForRendering(); | 100 | m_document->initializeForRendering(); |
459 | 101 | qDebug() << "Document loaded successfully !"; | 101 | qDebug() << "Document loaded successfully !"; |
460 | 102 | 102 | ||
461 | @@ -127,6 +127,12 @@ | |||
462 | 127 | // the rect tileSize. | 127 | // the rect tileSize. |
463 | 128 | QImage LODocument::paintTile(const QSize& canvasSize, const QRect& tileSize, const qreal &zoom) | 128 | QImage LODocument::paintTile(const QSize& canvasSize, const QRect& tileSize, const qreal &zoom) |
464 | 129 | { | 129 | { |
465 | 130 | if (!m_document) | ||
466 | 131 | return QImage(); | ||
467 | 132 | |||
468 | 133 | if (m_currentPart != m_document->getPart()) | ||
469 | 134 | m_document->setPart(m_currentPart); | ||
470 | 135 | |||
471 | 130 | QImage result = QImage(canvasSize.width(), canvasSize.height(), QImage::Format_RGB32); | 136 | QImage result = QImage(canvasSize.width(), canvasSize.height(), QImage::Format_RGB32); |
472 | 131 | 137 | ||
473 | 132 | #ifdef DEBUG_TILE_BENCHMARK | 138 | #ifdef DEBUG_TILE_BENCHMARK |
474 | @@ -148,6 +154,52 @@ | |||
475 | 148 | return result.rgbSwapped(); | 154 | return result.rgbSwapped(); |
476 | 149 | } | 155 | } |
477 | 150 | 156 | ||
478 | 157 | QImage LODocument::paintThumbnail(int part, qreal size) | ||
479 | 158 | { | ||
480 | 159 | if (!m_document) | ||
481 | 160 | return QImage(); | ||
482 | 161 | |||
483 | 162 | #ifdef DEBUG_TILE_BENCHMARK | ||
484 | 163 | QElapsedTimer renderTimer; | ||
485 | 164 | renderTimer.start(); | ||
486 | 165 | #endif | ||
487 | 166 | |||
488 | 167 | // This is used by LOPartsImageProvider to temporarily change the current part, | ||
489 | 168 | // in order to generate thumbnails. | ||
490 | 169 | |||
491 | 170 | // FIXME: Sometimes docviewer crashes at m_document->getPart() when a | ||
492 | 171 | // document is being loaded. | ||
493 | 172 | if (m_document->getPart() != part) | ||
494 | 173 | m_document->setPart(part); | ||
495 | 174 | |||
496 | 175 | qreal tWidth = this->documentSize().width(); | ||
497 | 176 | qreal tHeight = this->documentSize().height(); | ||
498 | 177 | |||
499 | 178 | QSize resultSize; | ||
500 | 179 | |||
501 | 180 | if (tWidth > tHeight) { | ||
502 | 181 | resultSize.setWidth(size); | ||
503 | 182 | resultSize.setHeight(size * tHeight / tWidth); | ||
504 | 183 | } else { | ||
505 | 184 | resultSize.setHeight(size); | ||
506 | 185 | resultSize.setWidth(size * tWidth / tHeight); | ||
507 | 186 | } | ||
508 | 187 | |||
509 | 188 | QImage result = QImage(resultSize.width(), resultSize.height(), QImage::Format_RGB32); | ||
510 | 189 | m_document->paintTile(result.bits(), resultSize.width(), resultSize.height(), | ||
511 | 190 | 0, 0, tWidth, tHeight); | ||
512 | 191 | |||
513 | 192 | // Restore the active part used for tile rendering. | ||
514 | 193 | if (m_currentPart != part) | ||
515 | 194 | m_document->setPart(m_currentPart); | ||
516 | 195 | |||
517 | 196 | #ifdef DEBUG_TILE_BENCHMARK | ||
518 | 197 | qDebug() << "Time to render the thumbnail:" << renderTimer.elapsed() << "ms"; | ||
519 | 198 | #endif | ||
520 | 199 | |||
521 | 200 | return result.rgbSwapped(); | ||
522 | 201 | } | ||
523 | 202 | |||
524 | 151 | int LODocument::partsCount() | 203 | int LODocument::partsCount() |
525 | 152 | { | 204 | { |
526 | 153 | if (!m_document) | 205 | if (!m_document) |
527 | @@ -161,20 +213,9 @@ | |||
528 | 161 | if (!m_document) | 213 | if (!m_document) |
529 | 162 | return QString(); | 214 | return QString(); |
530 | 163 | 215 | ||
545 | 164 | return QString::fromLatin1(m_document->getPartName(index)); | 216 | return QString::fromUtf8(m_document->getPartName(index)); |
546 | 165 | } | 217 | } |
547 | 166 | 218 | ||
534 | 167 | // This is used by LOPartsImageProvider to temporarily change the current part, | ||
535 | 168 | // in order to generate thumbnails. | ||
536 | 169 | // FIXME: We need to disable tiled rendering when we're generating the thumbnail. | ||
537 | 170 | int LODocument::swapCurrentPart(int newPartIndex) | ||
538 | 171 | { | ||
539 | 172 | int oldIndex = this->currentPart(); | ||
540 | 173 | |||
541 | 174 | m_document->setPart(newPartIndex); | ||
542 | 175 | return oldIndex; | ||
543 | 176 | } | ||
544 | 177 | |||
548 | 178 | /* Export the file in a given format: | 219 | /* Export the file in a given format: |
549 | 179 | * - url is a mandatory argument. | 220 | * - url is a mandatory argument. |
550 | 180 | * - format is optional. If not specified, lok will try to get it from the file | 221 | * - format is optional. If not specified, lok will try to get it from the file |
551 | 181 | 222 | ||
552 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.h' | |||
553 | --- src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-09-22 19:02:46 +0000 | |||
554 | +++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-10-10 12:33:09 +0000 | |||
555 | @@ -60,12 +60,10 @@ | |||
556 | 60 | QSize documentSize() const; | 60 | QSize documentSize() const; |
557 | 61 | 61 | ||
558 | 62 | QImage paintTile(const QSize& canvasSize, const QRect& tileSize, const qreal& zoom = 1.0); | 62 | QImage paintTile(const QSize& canvasSize, const QRect& tileSize, const qreal& zoom = 1.0); |
559 | 63 | QImage paintThumbnail(int part, qreal size); | ||
560 | 63 | 64 | ||
561 | 64 | int partsCount(); | 65 | int partsCount(); |
562 | 65 | |||
563 | 66 | QString getPartName(int index) const; | 66 | QString getPartName(int index) const; |
564 | 67 | int swapCurrentPart(int newPartIndex); | ||
565 | 68 | |||
566 | 69 | void setPart(int index); | 67 | void setPart(int index); |
567 | 70 | 68 | ||
568 | 71 | Q_INVOKABLE bool saveAs(QString url, QString format, QString filterOptions); | 69 | Q_INVOKABLE bool saveAs(QString url, QString format, QString filterOptions); |
569 | @@ -77,6 +75,7 @@ | |||
570 | 77 | 75 | ||
571 | 78 | private: | 76 | private: |
572 | 79 | QString m_path; | 77 | QString m_path; |
573 | 78 | int m_currentPart; | ||
574 | 80 | DocumentType m_docType; | 79 | DocumentType m_docType; |
575 | 81 | 80 | ||
576 | 82 | bool loadDocument(const QString &pathNAme); | 81 | bool loadDocument(const QString &pathNAme); |
577 | 83 | 82 | ||
578 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp' | |||
579 | --- src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp 2015-09-22 19:02:46 +0000 | |||
580 | +++ src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp 2015-10-10 12:33:09 +0000 | |||
581 | @@ -16,62 +16,35 @@ | |||
582 | 16 | 16 | ||
583 | 17 | #include "lopartsimageprovider.h" | 17 | #include "lopartsimageprovider.h" |
584 | 18 | #include "lodocument.h" | 18 | #include "lodocument.h" |
589 | 19 | #include "config.h" | 19 | #include "renderengine.h" |
586 | 20 | #include "twips.h" | ||
587 | 21 | |||
588 | 22 | #include <QDebug> | ||
590 | 23 | 20 | ||
591 | 24 | LOPartsImageProvider::LOPartsImageProvider(LODocument *document) | 21 | LOPartsImageProvider::LOPartsImageProvider(LODocument *document) |
592 | 25 | : QQuickImageProvider(QQuickImageProvider::Image, QQuickImageProvider::ForceAsynchronousImageLoading) | 22 | : QQuickImageProvider(QQuickImageProvider::Image, QQuickImageProvider::ForceAsynchronousImageLoading) |
596 | 26 | { | 23 | , m_document(document) |
597 | 27 | m_document = document; | 24 | { } |
595 | 28 | } | ||
598 | 29 | 25 | ||
599 | 30 | QImage LOPartsImageProvider::requestImage(const QString & id, QSize * size, const QSize & requestedSize) | 26 | QImage LOPartsImageProvider::requestImage(const QString & id, QSize * size, const QSize & requestedSize) |
600 | 31 | { | 27 | { |
601 | 32 | Q_UNUSED(size) | 28 | Q_UNUSED(size) |
611 | 33 | Q_UNUSED(requestedSize) | 29 | |
603 | 34 | |||
604 | 35 | if (m_document->documentType() != LODocument::PresentationDocument) | ||
605 | 36 | return QImage(); | ||
606 | 37 | |||
607 | 38 | // Here's the tricky magic. For getting a thumbnail of a document part | ||
608 | 39 | // (e.g. a specific slide in a Impress document), we need to change the | ||
609 | 40 | // current active part in LODocument, render the thumbnail, then re-set | ||
610 | 41 | // the previous value through lok::Document::setPath(index). | ||
612 | 42 | QString type = id.section("/", 0, 0); | 30 | QString type = id.section("/", 0, 0); |
613 | 43 | 31 | ||
615 | 44 | if (type != "part") | 32 | if (requestedSize.isNull() || type != "part" || |
616 | 33 | m_document->documentType() != LODocument::PresentationDocument) | ||
617 | 45 | return QImage(); | 34 | return QImage(); |
618 | 46 | 35 | ||
619 | 36 | // Wait for any in-progress rendering to be completed | ||
620 | 37 | while (RenderEngine::instance()->activeTaskCount() != 0) { } | ||
621 | 38 | |||
622 | 39 | // Lock the render engine | ||
623 | 40 | RenderEngine::instance()->setEnabled(false); | ||
624 | 41 | |||
625 | 42 | // Render the part to QImage | ||
626 | 47 | int partNumber = id.section("/", 1, 1).toInt(); | 43 | int partNumber = id.section("/", 1, 1).toInt(); |
653 | 48 | QImage result; | 44 | QImage result = m_document->paintThumbnail(partNumber, 256.0); |
654 | 49 | QSize partSize; | 45 | |
655 | 50 | QSize resultSize; | 46 | // Unlock the render engine |
656 | 51 | 47 | RenderEngine::instance()->setEnabled(true); | |
631 | 52 | // Get the current part index and set the index of the part to be rendered. | ||
632 | 53 | int currentPart = m_document->swapCurrentPart(partNumber); | ||
633 | 54 | |||
634 | 55 | // Get the size of the part | ||
635 | 56 | partSize = m_document->documentSize(); | ||
636 | 57 | partSize.setHeight(Twips::convertTwipsToPixels(partSize.height())); | ||
637 | 58 | partSize.setWidth(Twips::convertTwipsToPixels(partSize.width())); | ||
638 | 59 | |||
639 | 60 | // Set the size of the rendered thumbnail | ||
640 | 61 | if (partSize.width() > partSize.height()) { | ||
641 | 62 | resultSize.setWidth(TILE_SIZE); | ||
642 | 63 | resultSize.setHeight(TILE_SIZE * partSize.height() / partSize.width()); | ||
643 | 64 | } else { | ||
644 | 65 | resultSize.setHeight(TILE_SIZE); | ||
645 | 66 | resultSize.setWidth(TILE_SIZE * partSize.width() / partSize.height()); | ||
646 | 67 | } | ||
647 | 68 | |||
648 | 69 | // Render the part to QImage | ||
649 | 70 | result = m_document->paintTile(resultSize, QRect(QPoint(0, 0), partSize)); | ||
650 | 71 | |||
651 | 72 | // Re-set the earlier current part | ||
652 | 73 | m_document->swapCurrentPart(currentPart); | ||
657 | 74 | 48 | ||
658 | 75 | return result; | 49 | return result; |
659 | 76 | |||
660 | 77 | } | 50 | } |
661 | 78 | 51 | ||
662 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp' | |||
663 | --- src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp 2015-09-15 18:20:00 +0000 | |||
664 | +++ src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp 2015-10-10 12:33:09 +0000 | |||
665 | @@ -111,9 +111,9 @@ | |||
666 | 111 | part.index = i; | 111 | part.index = i; |
667 | 112 | part.name = m_document->getPartName(i); | 112 | part.name = m_document->getPartName(i); |
668 | 113 | 113 | ||
670 | 114 | beginRemoveRows(QModelIndex(), rowCount(), rowCount()); | 114 | beginInsertRows(QModelIndex(), rowCount(), rowCount()); |
671 | 115 | m_entries.append(part); | 115 | m_entries.append(part); |
673 | 116 | endRemoveRows(); | 116 | endInsertRows(); |
674 | 117 | } | 117 | } |
675 | 118 | 118 | ||
676 | 119 | Q_EMIT countChanged(); | 119 | Q_EMIT countChanged(); |
677 | 120 | 120 | ||
678 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml' | |||
679 | --- src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml 2015-09-22 00:01:22 +0000 | |||
680 | +++ src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml 2015-10-10 12:33:09 +0000 | |||
681 | @@ -32,6 +32,37 @@ | |||
682 | 32 | view.adjustZoomToWidth(); | 32 | view.adjustZoomToWidth(); |
683 | 33 | } | 33 | } |
684 | 34 | 34 | ||
685 | 35 | function moveView(axis, diff) | ||
686 | 36 | { | ||
687 | 37 | if (axis == "vertical") { | ||
688 | 38 | var maxContentY = Math.max(0, rootFlickable.contentHeight - rootFlickable.height) | ||
689 | 39 | rootFlickable.contentY = Math.max(0, Math.min(rootFlickable.contentY + diff, maxContentY )) | ||
690 | 40 | } else { | ||
691 | 41 | var maxContentX = Math.max(0, rootFlickable.contentWidth - rootFlickable.width) | ||
692 | 42 | rootFlickable.contentX = Math.max(0, Math.min(rootFlickable.contentX + diff, maxContentX )) | ||
693 | 43 | } | ||
694 | 44 | } | ||
695 | 45 | |||
696 | 46 | function goNextPart() | ||
697 | 47 | { | ||
698 | 48 | document.currentPart = Math.min(document.currentPart + 1, document.partsCount - 1) | ||
699 | 49 | } | ||
700 | 50 | |||
701 | 51 | function goPreviousPart() | ||
702 | 52 | { | ||
703 | 53 | document.currentPart = Math.max(0, document.currentPart - 1) | ||
704 | 54 | } | ||
705 | 55 | |||
706 | 56 | function goFirstPart() | ||
707 | 57 | { | ||
708 | 58 | document.currentPart = 0 | ||
709 | 59 | } | ||
710 | 60 | |||
711 | 61 | function goLastPart() | ||
712 | 62 | { | ||
713 | 63 | document.currentPart = document.partsCount - 1 | ||
714 | 64 | } | ||
715 | 65 | |||
716 | 35 | onDocumentPathChanged: { | 66 | onDocumentPathChanged: { |
717 | 36 | if (documentPath) | 67 | if (documentPath) |
718 | 37 | view.initializeDocument(documentPath) | 68 | view.initializeDocument(documentPath) |
719 | @@ -51,4 +82,14 @@ | |||
720 | 51 | 82 | ||
721 | 52 | parentFlickable: rootFlickable | 83 | parentFlickable: rootFlickable |
722 | 53 | } | 84 | } |
723 | 85 | |||
724 | 86 | Connections { | ||
725 | 87 | target: view.document | ||
726 | 88 | |||
727 | 89 | onCurrentPartChanged: { | ||
728 | 90 | // Position view at top-left corner | ||
729 | 91 | rootFlickable.contentX = 0 | ||
730 | 92 | rootFlickable.contentY = 0 | ||
731 | 93 | } | ||
732 | 94 | } | ||
733 | 54 | } | 95 | } |
734 | 55 | 96 | ||
735 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/renderengine.cpp' | |||
736 | --- src/plugin/libreofficetoolkit-qml-plugin/renderengine.cpp 2015-09-22 00:01:22 +0000 | |||
737 | +++ src/plugin/libreofficetoolkit-qml-plugin/renderengine.cpp 2015-10-10 12:33:09 +0000 | |||
738 | @@ -6,10 +6,13 @@ | |||
739 | 6 | 6 | ||
740 | 7 | RenderEngine::RenderEngine(): | 7 | RenderEngine::RenderEngine(): |
741 | 8 | QObject(nullptr), | 8 | QObject(nullptr), |
743 | 9 | m_activeTaskCount(0) | 9 | m_activeTaskCount(0), |
744 | 10 | m_enabled(true) | ||
745 | 10 | { | 11 | { |
746 | 11 | int itc = QThread::idealThreadCount(); | 12 | int itc = QThread::idealThreadCount(); |
747 | 12 | m_idealThreadCount = itc == -1 ? DefaultIdealThreadCount : itc; | 13 | m_idealThreadCount = itc == -1 ? DefaultIdealThreadCount : itc; |
748 | 14 | |||
749 | 15 | connect(this, SIGNAL(enabledChanged()), this, SLOT(doNextTask())); | ||
750 | 13 | } | 16 | } |
751 | 14 | 17 | ||
752 | 15 | void RenderEngine::enqueueTask(const QSharedPointer<LODocument>& doc, const QRect& area, const qreal &zoom, int id) | 18 | void RenderEngine::enqueueTask(const QSharedPointer<LODocument>& doc, const QRect& area, const qreal &zoom, int id) |
753 | @@ -43,7 +46,7 @@ | |||
754 | 43 | qDebug() << " ---- doNextTask" << m_activeTaskCount << m_queue.count(); | 46 | qDebug() << " ---- doNextTask" << m_activeTaskCount << m_queue.count(); |
755 | 44 | #endif | 47 | #endif |
756 | 45 | 48 | ||
758 | 46 | if (m_activeTaskCount >= m_idealThreadCount || !m_queue.count()) | 49 | if (m_activeTaskCount >= m_idealThreadCount || !m_queue.count() || !m_enabled) |
759 | 47 | return; | 50 | return; |
760 | 48 | 51 | ||
761 | 49 | m_activeTaskCount++; | 52 | m_activeTaskCount++; |
762 | 50 | 53 | ||
763 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/renderengine.h' | |||
764 | --- src/plugin/libreofficetoolkit-qml-plugin/renderengine.h 2015-09-22 00:01:22 +0000 | |||
765 | +++ src/plugin/libreofficetoolkit-qml-plugin/renderengine.h 2015-10-10 12:33:09 +0000 | |||
766 | @@ -6,6 +6,7 @@ | |||
767 | 6 | #include <QSharedPointer> | 6 | #include <QSharedPointer> |
768 | 7 | #include <QHash> | 7 | #include <QHash> |
769 | 8 | #include <QQueue> | 8 | #include <QQueue> |
770 | 9 | #include <QAtomicInt> | ||
771 | 9 | 10 | ||
772 | 10 | #include "lodocument.h" | 11 | #include "lodocument.h" |
773 | 11 | 12 | ||
774 | @@ -45,17 +46,33 @@ | |||
775 | 45 | return s_instance; | 46 | return s_instance; |
776 | 46 | } | 47 | } |
777 | 47 | 48 | ||
778 | 49 | int activeTaskCount() { return m_activeTaskCount; } | ||
779 | 50 | |||
780 | 51 | bool enabled() { return m_enabled.loadAcquire(); } | ||
781 | 52 | void setEnabled(bool enabled) { | ||
782 | 53 | if (m_enabled.loadAcquire() == enabled) | ||
783 | 54 | return; | ||
784 | 55 | |||
785 | 56 | m_enabled.storeRelease(enabled); | ||
786 | 57 | Q_EMIT enabledChanged(); | ||
787 | 58 | } | ||
788 | 59 | |||
789 | 48 | Q_SIGNALS: | 60 | Q_SIGNALS: |
790 | 49 | void renderFinished(int id, QImage img); | 61 | void renderFinished(int id, QImage img); |
791 | 62 | void enabledChanged(); | ||
792 | 50 | 63 | ||
793 | 51 | private: | 64 | private: |
794 | 52 | Q_INVOKABLE void internalRenderCallback(int id, QImage img); | 65 | Q_INVOKABLE void internalRenderCallback(int id, QImage img); |
795 | 66 | |||
796 | 67 | private slots: | ||
797 | 53 | void doNextTask(); | 68 | void doNextTask(); |
798 | 54 | 69 | ||
799 | 55 | private: | 70 | private: |
800 | 56 | QQueue<EngineTask> m_queue; | 71 | QQueue<EngineTask> m_queue; |
801 | 57 | int m_activeTaskCount; | 72 | int m_activeTaskCount; |
802 | 58 | int m_idealThreadCount; | 73 | int m_idealThreadCount; |
803 | 74 | |||
804 | 75 | QAtomicInt m_enabled; | ||
805 | 59 | }; | 76 | }; |
806 | 60 | 77 | ||
807 | 61 | #endif // RENDERENGINE_H | 78 | #endif // RENDERENGINE_H |
Seems the cmake isn't putting the following files into the build directory:-
com.ubuntu. docviewer. url-dispatcher content. json
docviewer.apparmor
docviewer-
I had to manually put them in the build to make a click.