Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/spreadsheet-part-selector into lp:ubuntu-docviewer-app
- spreadsheet-part-selector
- Merge into lo-viewer
Status: | Merged |
---|---|
Approved by: | Stefano Verzegnassi |
Approved revision: | 245 |
Merged at revision: | 287 |
Proposed branch: | lp:~verzegnassi-stefano/ubuntu-docviewer-app/spreadsheet-part-selector |
Merge into: | lp:ubuntu-docviewer-app |
Prerequisite: | lp:~verzegnassi-stefano/ubuntu-docviewer-app/lok-qml-currentpart-moved |
Diff against target: |
415 lines (+162/-50) 7 files modified
po/com.ubuntu.docviewer.pot (+18/-7) src/app/qml/loView/LOViewPage.qml (+39/-13) src/app/qml/loView/SpreadsheetSelector.qml (+84/-0) src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp (+8/-16) src/plugin/libreofficetoolkit-qml-plugin/lodocument.h (+1/-6) src/plugin/libreofficetoolkit-qml-plugin/loview.cpp (+2/-4) src/plugin/libreofficetoolkit-qml-plugin/lozoom.cpp (+10/-4) |
To merge this branch: | bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/spreadsheet-part-selector |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jenkins Bot | continuous-integration | Approve | |
Nicholas Skaggs (community) | Needs Fixing | ||
Alan Pope πΊπ§π± π¦ (community) | Approve | ||
Review via email: mp+282845@code.launchpad.net |
Commit message
LibreOffice viewer:
* Added a sheet selector
* Show an empty state when the current sheet has no content
* Fixed "currentPart" usage, partially broken after a recent commit in trunk
Description of the change
LibreOffice viewer:
* Added a sheet selector
* Show an empty state when the current sheet has no content
* Fixed "currentPart" usage, partially broken after a recent commit in trunk
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
Alan Pope πΊπ§π± π¦ (popey) wrote : | # |
This is excellent. Works really well.
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
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:244
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) : | # |
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
Merging failed. More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
None: https:/
Nicholas Skaggs (nskaggs) wrote : | # |
Text conflict in po/com.
1 conflicts encountered.
- 245. By Stefano Verzegnassi
-
Merged trunk + updated .pot
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:245
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'po/com.ubuntu.docviewer.pot' | |||
2 | --- po/com.ubuntu.docviewer.pot 2016-02-02 11:34:27 +0000 | |||
3 | +++ po/com.ubuntu.docviewer.pot 2016-02-03 00:12:17 +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: 2016-02-02 12:33+0100\n" | 11 | "POT-Creation-Date: 2016-02-03 00:58+0100\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 | @@ -216,7 +216,7 @@ | |||
14 | 216 | msgstr "" | 216 | msgstr "" |
15 | 217 | 217 | ||
16 | 218 | #: ../src/app/qml/documentPage/DocumentPage.qml:23 | 218 | #: ../src/app/qml/documentPage/DocumentPage.qml:23 |
18 | 219 | #: /tmp/new-empty-state-build/po/com.ubuntu.docviewer.desktop.in.in.h:3 | 219 | #: /tmp/spreadsheet-part-selector-build/po/com.ubuntu.docviewer.desktop.in.in.h:3 |
19 | 220 | msgid "Documents" | 220 | msgid "Documents" |
20 | 221 | msgstr "" | 221 | msgstr "" |
21 | 222 | 222 | ||
22 | @@ -367,20 +367,24 @@ | |||
23 | 367 | msgid "GO!" | 367 | msgid "GO!" |
24 | 368 | msgstr "" | 368 | msgstr "" |
25 | 369 | 369 | ||
27 | 370 | #: ../src/app/qml/loView/LOViewPage.qml:129 | 370 | #: ../src/app/qml/loView/LOViewPage.qml:137 |
28 | 371 | msgid "LibreOffice binaries not found." | 371 | msgid "LibreOffice binaries not found." |
29 | 372 | msgstr "" | 372 | msgstr "" |
30 | 373 | 373 | ||
32 | 374 | #: ../src/app/qml/loView/LOViewPage.qml:132 | 374 | #: ../src/app/qml/loView/LOViewPage.qml:140 |
33 | 375 | msgid "Error while loading LibreOffice." | 375 | msgid "Error while loading LibreOffice." |
34 | 376 | msgstr "" | 376 | msgstr "" |
35 | 377 | 377 | ||
37 | 378 | #: ../src/app/qml/loView/LOViewPage.qml:135 | 378 | #: ../src/app/qml/loView/LOViewPage.qml:143 |
38 | 379 | msgid "" | 379 | msgid "" |
39 | 380 | "Document not loaded.\n" | 380 | "Document not loaded.\n" |
40 | 381 | "The requested document may be corrupt or protected by a password." | 381 | "The requested document may be corrupt or protected by a password." |
41 | 382 | msgstr "" | 382 | msgstr "" |
42 | 383 | 383 | ||
43 | 384 | #: ../src/app/qml/loView/LOViewPage.qml:164 | ||
44 | 385 | msgid "This sheet has no content." | ||
45 | 386 | msgstr "" | ||
46 | 387 | |||
47 | 384 | #. TRANSLATORS: 'LibreOfficeKit' is the name of the library used by | 388 | #. TRANSLATORS: 'LibreOfficeKit' is the name of the library used by |
48 | 385 | #. Document Viewer for rendering LibreOffice/MS-Office documents. | 389 | #. Document Viewer for rendering LibreOffice/MS-Office documents. |
49 | 386 | #. Ref. https://docs.libreoffice.org/libreofficekit.html | 390 | #. Ref. https://docs.libreoffice.org/libreofficekit.html |
50 | @@ -388,6 +392,13 @@ | |||
51 | 388 | msgid "Powered by LibreOfficeKit" | 392 | msgid "Powered by LibreOfficeKit" |
52 | 389 | msgstr "" | 393 | msgstr "" |
53 | 390 | 394 | ||
54 | 395 | #. TRANSLATORS: Please don't add any space between "Sheet" and "%1". | ||
55 | 396 | #. This is the default name for a sheet in LibreOffice. | ||
56 | 397 | #: ../src/app/qml/loView/SpreadsheetSelector.qml:64 | ||
57 | 398 | #, qt-format | ||
58 | 399 | msgid "Sheet%1" | ||
59 | 400 | msgstr "" | ||
60 | 401 | |||
61 | 391 | #: ../src/app/qml/loView/ZoomSelector.qml:122 | 402 | #: ../src/app/qml/loView/ZoomSelector.qml:122 |
62 | 392 | msgid "Fit width" | 403 | msgid "Fit width" |
63 | 393 | msgstr "" | 404 | msgstr "" |
64 | @@ -449,10 +460,10 @@ | |||
65 | 449 | msgid "copy %1" | 460 | msgid "copy %1" |
66 | 450 | msgstr "" | 461 | msgstr "" |
67 | 451 | 462 | ||
69 | 452 | #: /tmp/new-empty-state-build/po/com.ubuntu.docviewer.desktop.in.in.h:1 | 463 | #: /tmp/spreadsheet-part-selector-build/po/com.ubuntu.docviewer.desktop.in.in.h:1 |
70 | 453 | msgid "Document Viewer" | 464 | msgid "Document Viewer" |
71 | 454 | msgstr "" | 465 | msgstr "" |
72 | 455 | 466 | ||
74 | 456 | #: /tmp/new-empty-state-build/po/com.ubuntu.docviewer.desktop.in.in.h:2 | 467 | #: /tmp/spreadsheet-part-selector-build/po/com.ubuntu.docviewer.desktop.in.in.h:2 |
75 | 457 | msgid "documents;viewer;pdf;reader;" | 468 | msgid "documents;viewer;pdf;reader;" |
76 | 458 | msgstr "" | 469 | msgstr "" |
77 | 459 | 470 | ||
78 | === modified file 'src/app/qml/loView/LOViewPage.qml' | |||
79 | --- src/app/qml/loView/LOViewPage.qml 2016-01-20 21:48:21 +0000 | |||
80 | +++ src/app/qml/loView/LOViewPage.qml 2016-02-03 00:12:17 +0000 | |||
81 | @@ -30,6 +30,7 @@ | |||
82 | 30 | 30 | ||
83 | 31 | property bool isPresentation: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.PresentationDocument) | 31 | property bool isPresentation: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.PresentationDocument) |
84 | 32 | property bool isTextDocument: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.TextDocument) | 32 | property bool isTextDocument: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.TextDocument) |
85 | 33 | property bool isSpreadsheet: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.SpreadsheetDocument) | ||
86 | 33 | 34 | ||
87 | 34 | title: DocumentViewer.getFileBaseNameFromPath(file.path); | 35 | title: DocumentViewer.getFileBaseNameFromPath(file.path); |
88 | 35 | flickable: isTextDocument ? loPage.contentItem.loView : null | 36 | flickable: isTextDocument ? loPage.contentItem.loView : null |
89 | @@ -76,9 +77,16 @@ | |||
90 | 76 | left: leftSidebar.right | 77 | left: leftSidebar.right |
91 | 77 | right: parent.right | 78 | right: parent.right |
92 | 78 | top: parent.top | 79 | top: parent.top |
94 | 79 | bottom: parent.bottom | 80 | bottom: sSelector.top |
95 | 80 | } | 81 | } |
96 | 81 | } | 82 | } |
97 | 83 | |||
98 | 84 | SpreadsheetSelector { | ||
99 | 85 | id: sSelector | ||
100 | 86 | anchors.bottom: parent.bottom | ||
101 | 87 | visible: loPage.isSpreadsheet | ||
102 | 88 | view: loView | ||
103 | 89 | } | ||
104 | 82 | } | 90 | } |
105 | 83 | } | 91 | } |
106 | 84 | ] | 92 | ] |
107 | @@ -148,29 +156,47 @@ | |||
108 | 148 | 156 | ||
109 | 149 | Scrollbar { flickableItem: loView; parent: loView.parent } | 157 | Scrollbar { flickableItem: loView; parent: loView.parent } |
110 | 150 | Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom } | 158 | Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom } |
111 | 159 | |||
112 | 160 | Label { | ||
113 | 161 | anchors.centerIn: parent | ||
114 | 162 | parent: loPage | ||
115 | 163 | textSize: Label.Large | ||
116 | 164 | text: i18n.tr("This sheet has no content.") | ||
117 | 165 | visible: loPage.isSpreadsheet && loView.contentWidth <= 0 && loView.contentHeight <= 0 | ||
118 | 166 | } | ||
119 | 151 | } | 167 | } |
120 | 152 | } | 168 | } |
121 | 153 | 169 | ||
123 | 154 | PartsView { | 170 | Item { |
124 | 155 | id: bottomBar | 171 | id: bottomBar |
125 | 156 | anchors { | 172 | anchors { |
126 | 157 | left: parent.left | 173 | left: parent.left |
127 | 158 | right: parent.right | 174 | right: parent.right |
128 | 159 | bottom: parent.bottom | 175 | bottom: parent.bottom |
129 | 160 | } | 176 | } |
141 | 161 | height: visible ? units.gu(12) : 0 | 177 | height: childrenRect.height |
142 | 162 | visible: loPage.isPresentation | 178 | |
143 | 163 | 179 | PartsView { | |
144 | 164 | model: loView.partsModel | 180 | anchors { left: parent.left; right: parent.right } |
145 | 165 | orientation: ListView.Horizontal | 181 | height: visible ? units.gu(12) : 0 |
146 | 166 | 182 | visible: loPage.isPresentation | |
147 | 167 | HorizontalDivider { | 183 | |
148 | 168 | anchors { | 184 | model: loView.partsModel |
149 | 169 | left: parent.left | 185 | orientation: ListView.Horizontal |
150 | 170 | right: parent.right | 186 | |
151 | 171 | top: parent.top | 187 | HorizontalDivider { |
152 | 188 | anchors { | ||
153 | 189 | left: parent.left | ||
154 | 190 | right: parent.right | ||
155 | 191 | top: parent.top | ||
156 | 192 | } | ||
157 | 172 | } | 193 | } |
158 | 173 | } | 194 | } |
159 | 195 | |||
160 | 196 | SpreadsheetSelector { | ||
161 | 197 | visible: loPage.isSpreadsheet | ||
162 | 198 | view: loView | ||
163 | 199 | } | ||
164 | 174 | } | 200 | } |
165 | 175 | } | 201 | } |
166 | 176 | } | 202 | } |
167 | 177 | 203 | ||
168 | === added file 'src/app/qml/loView/SpreadsheetSelector.qml' | |||
169 | --- src/app/qml/loView/SpreadsheetSelector.qml 1970-01-01 00:00:00 +0000 | |||
170 | +++ src/app/qml/loView/SpreadsheetSelector.qml 2016-02-03 00:12:17 +0000 | |||
171 | @@ -0,0 +1,84 @@ | |||
172 | 1 | /* | ||
173 | 2 | * Copyright (C) 2016 Stefano Verzegnassi | ||
174 | 3 | * | ||
175 | 4 | * This program is free software; you can redistribute it and/or modify | ||
176 | 5 | * it under the terms of the GNU General Public License as published by | ||
177 | 6 | * the Free Software Foundation; version 3. | ||
178 | 7 | * | ||
179 | 8 | * This program is distributed in the hope that it will be useful, | ||
180 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
181 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
182 | 11 | * GNU General Public License for more details. | ||
183 | 12 | * | ||
184 | 13 | * You should have received a copy of the GNU General Public License | ||
185 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
186 | 15 | */ | ||
187 | 16 | |||
188 | 17 | import QtQuick 2.4 | ||
189 | 18 | import Ubuntu.Components 1.3 | ||
190 | 19 | import DocumentViewer.LibreOffice 1.0 | ||
191 | 20 | |||
192 | 21 | import "../common" | ||
193 | 22 | |||
194 | 23 | Item { | ||
195 | 24 | id: spreadsheetSelector | ||
196 | 25 | anchors { left: parent.left; right: parent.right } | ||
197 | 26 | height: visible ? units.gu(6) : 0 | ||
198 | 27 | |||
199 | 28 | property Viewer view | ||
200 | 29 | |||
201 | 30 | Rectangle { | ||
202 | 31 | anchors.fill: parent | ||
203 | 32 | color: theme.palette.normal.background | ||
204 | 33 | } | ||
205 | 34 | |||
206 | 35 | ListView { | ||
207 | 36 | id: listView | ||
208 | 37 | anchors.fill: parent | ||
209 | 38 | boundsBehavior: Flickable.StopAtBounds | ||
210 | 39 | orientation: ListView.Horizontal | ||
211 | 40 | |||
212 | 41 | model: spreadsheetSelector.view.partsModel | ||
213 | 42 | |||
214 | 43 | delegate: AbstractButton { | ||
215 | 44 | id: del | ||
216 | 45 | property bool selected: spreadsheetSelector.view.currentPart == model.index | ||
217 | 46 | |||
218 | 47 | width: nameLabel.paintedWidth + units.gu(4) | ||
219 | 48 | height: parent.height | ||
220 | 49 | |||
221 | 50 | onClicked: spreadsheetSelector.view.currentPart = model.index | ||
222 | 51 | |||
223 | 52 | Rectangle { | ||
224 | 53 | anchors.fill: parent | ||
225 | 54 | visible: del.selected | ||
226 | 55 | color: theme.palette.selected.background | ||
227 | 56 | } | ||
228 | 57 | |||
229 | 58 | Label { | ||
230 | 59 | id: nameLabel | ||
231 | 60 | anchors.centerIn: parent | ||
232 | 61 | |||
233 | 62 | // TRANSLATORS: Please don't add any space between "Sheet" and "%1". | ||
234 | 63 | // This is the default name for a sheet in LibreOffice. | ||
235 | 64 | text: model.name || i18n.tr("Sheet%1").arg(model.index + 1) | ||
236 | 65 | color: del.selected ? UbuntuColors.orange : theme.palette.normal.baseText | ||
237 | 66 | } | ||
238 | 67 | |||
239 | 68 | Rectangle { | ||
240 | 69 | anchors { | ||
241 | 70 | left: parent.left | ||
242 | 71 | right: parent.right | ||
243 | 72 | bottom: parent.bottom | ||
244 | 73 | } | ||
245 | 74 | height: units.dp(2) | ||
246 | 75 | color: UbuntuColors.orange | ||
247 | 76 | visible: del.selected | ||
248 | 77 | } | ||
249 | 78 | } | ||
250 | 79 | } | ||
251 | 80 | |||
252 | 81 | HorizontalDivider { | ||
253 | 82 | anchors { left: parent.left; right: parent.right } | ||
254 | 83 | } | ||
255 | 84 | } | ||
256 | 0 | 85 | ||
257 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp' | |||
258 | --- src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-12-14 00:40:55 +0000 | |||
259 | +++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2016-02-03 00:12:17 +0000 | |||
260 | @@ -127,25 +127,16 @@ | |||
261 | 127 | return m_docType; | 127 | return m_docType; |
262 | 128 | } | 128 | } |
263 | 129 | 129 | ||
264 | 130 | int LODocument::documentPart() const | ||
265 | 131 | { | ||
266 | 132 | return m_lokDocument->getPart(); | ||
267 | 133 | } | ||
268 | 134 | |||
269 | 135 | void LODocument::setDocumentPart(int p) | ||
270 | 136 | { | ||
271 | 137 | if (documentPart() != p) | ||
272 | 138 | m_lokDocument->setPart(p); | ||
273 | 139 | } | ||
274 | 140 | |||
275 | 141 | // Return the size of the document, in TWIPs | 130 | // Return the size of the document, in TWIPs |
277 | 142 | QSize LODocument::documentSize() const | 131 | QSize LODocument::documentSize(int part) const |
278 | 143 | { | 132 | { |
279 | 144 | if (!m_lokDocument) | 133 | if (!m_lokDocument) |
280 | 145 | return QSize(0, 0); | 134 | return QSize(0, 0); |
281 | 146 | 135 | ||
282 | 147 | long pWidth(0); | 136 | long pWidth(0); |
283 | 148 | long pHeight(0); | 137 | long pHeight(0); |
284 | 138 | |||
285 | 139 | m_lokDocument->setPart(part); | ||
286 | 149 | m_lokDocument->getDocumentSize(&pWidth, &pHeight); | 140 | m_lokDocument->getDocumentSize(&pWidth, &pHeight); |
287 | 150 | 141 | ||
288 | 151 | return QSize(pWidth, pHeight); | 142 | return QSize(pWidth, pHeight); |
289 | @@ -184,15 +175,16 @@ | |||
290 | 184 | if (!m_lokDocument) | 175 | if (!m_lokDocument) |
291 | 185 | return QImage(); | 176 | return QImage(); |
292 | 186 | 177 | ||
293 | 187 | m_lokDocument->setPart(part); | ||
294 | 188 | |||
295 | 189 | #ifdef DEBUG_TILE_BENCHMARK | 178 | #ifdef DEBUG_TILE_BENCHMARK |
296 | 190 | QElapsedTimer renderTimer; | 179 | QElapsedTimer renderTimer; |
297 | 191 | renderTimer.start(); | 180 | renderTimer.start(); |
298 | 192 | #endif | 181 | #endif |
299 | 193 | 182 | ||
302 | 194 | qreal tWidth = this->documentSize().width(); | 183 | long tWidth(0); |
303 | 195 | qreal tHeight = this->documentSize().height(); | 184 | long tHeight(0); |
304 | 185 | |||
305 | 186 | m_lokDocument->setPart(part); | ||
306 | 187 | m_lokDocument->getDocumentSize(&tWidth, &tHeight); | ||
307 | 196 | 188 | ||
308 | 197 | QSize resultSize; | 189 | QSize resultSize; |
309 | 198 | 190 | ||
310 | 199 | 191 | ||
311 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.h' | |||
312 | --- src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-12-14 00:40:55 +0000 | |||
313 | +++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2016-02-03 00:12:17 +0000 | |||
314 | @@ -35,7 +35,6 @@ | |||
315 | 35 | Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) | 35 | Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) |
316 | 36 | // Declare partsCount as constant at the moment, since LOK-plugin is just a viewer for now. | 36 | // Declare partsCount as constant at the moment, since LOK-plugin is just a viewer for now. |
317 | 37 | Q_PROPERTY(int partsCount READ partsCount CONSTANT) | 37 | Q_PROPERTY(int partsCount READ partsCount CONSTANT) |
318 | 38 | Q_PROPERTY(int documentPart READ documentPart WRITE setDocumentPart NOTIFY documentPartChanged) | ||
319 | 39 | Q_PROPERTY(DocumentType documentType READ documentType NOTIFY documentTypeChanged) | 38 | Q_PROPERTY(DocumentType documentType READ documentType NOTIFY documentTypeChanged) |
320 | 40 | Q_PROPERTY(LibreOfficeError::Error error READ error NOTIFY errorChanged) | 39 | Q_PROPERTY(LibreOfficeError::Error error READ error NOTIFY errorChanged) |
321 | 41 | Q_ENUMS(DocumentType) | 40 | Q_ENUMS(DocumentType) |
322 | @@ -57,10 +56,7 @@ | |||
323 | 57 | 56 | ||
324 | 58 | DocumentType documentType() const; | 57 | DocumentType documentType() const; |
325 | 59 | 58 | ||
330 | 60 | int documentPart() const; | 59 | QSize documentSize(int part) const; |
327 | 61 | void setDocumentPart(int p); | ||
328 | 62 | |||
329 | 63 | QSize documentSize() const; | ||
331 | 64 | 60 | ||
332 | 65 | QImage paintTile(int part, const QSize& canvasSize, const QRect& tileSize, const qreal& zoom = 1.0); | 61 | QImage paintTile(int part, const QSize& canvasSize, const QRect& tileSize, const qreal& zoom = 1.0); |
333 | 66 | QImage paintThumbnail(int part, qreal size); | 62 | QImage paintThumbnail(int part, qreal size); |
334 | @@ -74,7 +70,6 @@ | |||
335 | 74 | Q_SIGNALS: | 70 | Q_SIGNALS: |
336 | 75 | void pathChanged(); | 71 | void pathChanged(); |
337 | 76 | void documentTypeChanged(); | 72 | void documentTypeChanged(); |
338 | 77 | void documentPartChanged(); | ||
339 | 78 | void errorChanged(); | 73 | void errorChanged(); |
340 | 79 | 74 | ||
341 | 80 | private: | 75 | private: |
342 | 81 | 76 | ||
343 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.cpp' | |||
344 | --- src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2016-01-26 11:46:42 +0000 | |||
345 | +++ src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2016-02-03 00:12:17 +0000 | |||
346 | @@ -42,6 +42,7 @@ | |||
347 | 42 | 42 | ||
348 | 43 | connect(this, &LOView::documentChanged, this, &LOView::updateViewSize); | 43 | connect(this, &LOView::documentChanged, this, &LOView::updateViewSize); |
349 | 44 | connect(this, &LOView::parentFlickableChanged, this, &LOView::updateVisibleRect); | 44 | connect(this, &LOView::parentFlickableChanged, this, &LOView::updateVisibleRect); |
350 | 45 | connect(this, &LOView::currentPartChanged, this, &LOView::invalidateAllTiles); | ||
351 | 45 | connect(this, &LOView::cacheBufferChanged, this, &LOView::updateVisibleRect); | 46 | connect(this, &LOView::cacheBufferChanged, this, &LOView::updateVisibleRect); |
352 | 46 | connect(&m_updateTimer, &QTimer::timeout, this, &LOView::updateVisibleRect); | 47 | connect(&m_updateTimer, &QTimer::timeout, this, &LOView::updateVisibleRect); |
353 | 47 | 48 | ||
354 | @@ -114,9 +115,6 @@ | |||
355 | 114 | engine->addImageProvider("lok", m_imageProvider); | 115 | engine->addImageProvider("lok", m_imageProvider); |
356 | 115 | // -------------------------------------------------- | 116 | // -------------------------------------------------- |
357 | 116 | 117 | ||
358 | 117 | setCurrentPart(0); | ||
359 | 118 | connect(this, SIGNAL(currentPartChanged()), this, SLOT(invalidateAllTiles())); | ||
360 | 119 | |||
361 | 120 | Q_EMIT documentChanged(); | 118 | Q_EMIT documentChanged(); |
362 | 121 | 119 | ||
363 | 122 | // Init zoom settings | 120 | // Init zoom settings |
364 | @@ -203,7 +201,7 @@ | |||
365 | 203 | if (!m_document) | 201 | if (!m_document) |
366 | 204 | return; | 202 | return; |
367 | 205 | 203 | ||
369 | 206 | QSize docSize = m_document->documentSize(); | 204 | QSize docSize = m_document->documentSize(m_currentPart); |
370 | 207 | qreal zoomFactor = m_zoomSettings->zoomFactor(); | 205 | qreal zoomFactor = m_zoomSettings->zoomFactor(); |
371 | 208 | 206 | ||
372 | 209 | this->setWidth(Twips::convertTwipsToPixels(docSize.width(), zoomFactor)); | 207 | this->setWidth(Twips::convertTwipsToPixels(docSize.width(), zoomFactor)); |
373 | 210 | 208 | ||
374 | === modified file 'src/plugin/libreofficetoolkit-qml-plugin/lozoom.cpp' | |||
375 | --- src/plugin/libreofficetoolkit-qml-plugin/lozoom.cpp 2016-01-21 14:24:02 +0000 | |||
376 | +++ src/plugin/libreofficetoolkit-qml-plugin/lozoom.cpp 2016-02-03 00:12:17 +0000 | |||
377 | @@ -161,8 +161,10 @@ | |||
378 | 161 | if (changeMode) | 161 | if (changeMode) |
379 | 162 | setZoomMode(LOZoom::FitToWidth); | 162 | setZoomMode(LOZoom::FitToWidth); |
380 | 163 | 163 | ||
381 | 164 | int currentPart = m_view->currentPart(); | ||
382 | 165 | |||
383 | 164 | m_valueFitToWidthZoom = getZoomToFitWidth(m_view->parentFlickable()->width(), | 166 | m_valueFitToWidthZoom = getZoomToFitWidth(m_view->parentFlickable()->width(), |
385 | 165 | m_view->document()->documentSize().width()); | 167 | m_view->document()->documentSize(currentPart).width()); |
386 | 166 | 168 | ||
387 | 167 | if (m_zoomFactor != m_valueFitToWidthZoom) { | 169 | if (m_zoomFactor != m_valueFitToWidthZoom) { |
388 | 168 | setZoomFactor(m_valueFitToWidthZoom); | 170 | setZoomFactor(m_valueFitToWidthZoom); |
389 | @@ -182,8 +184,10 @@ | |||
390 | 182 | if (changeMode) | 184 | if (changeMode) |
391 | 183 | setZoomMode(LOZoom::FitToHeight); | 185 | setZoomMode(LOZoom::FitToHeight); |
392 | 184 | 186 | ||
393 | 187 | int currentPart = m_view->currentPart(); | ||
394 | 188 | |||
395 | 185 | m_valueFitToHeightZoom = getZoomToFitHeight(m_view->parentFlickable()->height(), | 189 | m_valueFitToHeightZoom = getZoomToFitHeight(m_view->parentFlickable()->height(), |
397 | 186 | m_view->document()->documentSize().height()); | 190 | m_view->document()->documentSize(currentPart).height()); |
398 | 187 | 191 | ||
399 | 188 | if (m_zoomFactor != m_valueFitToHeightZoom) { | 192 | if (m_zoomFactor != m_valueFitToHeightZoom) { |
400 | 189 | setZoomFactor(m_valueFitToHeightZoom); | 193 | setZoomFactor(m_valueFitToHeightZoom); |
401 | @@ -203,11 +207,13 @@ | |||
402 | 203 | if (changeMode) | 207 | if (changeMode) |
403 | 204 | setZoomMode(LOZoom::Automatic); | 208 | setZoomMode(LOZoom::Automatic); |
404 | 205 | 209 | ||
405 | 210 | int currentPart = m_view->currentPart(); | ||
406 | 211 | |||
407 | 206 | m_valueFitToWidthZoom = getZoomToFitWidth(m_view->parentFlickable()->width(), | 212 | m_valueFitToWidthZoom = getZoomToFitWidth(m_view->parentFlickable()->width(), |
409 | 207 | m_view->document()->documentSize().width()); | 213 | m_view->document()->documentSize(currentPart).width()); |
410 | 208 | 214 | ||
411 | 209 | m_valueFitToHeightZoom = getZoomToFitHeight(m_view->parentFlickable()->height(), | 215 | m_valueFitToHeightZoom = getZoomToFitHeight(m_view->parentFlickable()->height(), |
413 | 210 | m_view->document()->documentSize().height()); | 216 | m_view->document()->documentSize(currentPart).height()); |
414 | 211 | 217 | ||
415 | 212 | m_valueAutomaticZoom = qMin(m_valueFitToWidthZoom, m_valueFitToHeightZoom); | 218 | m_valueAutomaticZoom = qMin(m_valueFitToWidthZoom, m_valueFitToHeightZoom); |
416 | 213 | 219 |
PASSED: Continuous integration, rev:243 /core-apps- jenkins. ubuntu. com/job/ run-ap- tests-ci/ 172/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/456/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ run-ap- tests-ci/ 172/rebuild
https:/