Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/libreoffice-splashscreen into lp:ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 218
Merged at revision: 217
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/libreoffice-splashscreen
Merge into: lp:ubuntu-docviewer-app
Diff against target: 868 lines (+318/-273)
11 files modified
po/com.ubuntu.docviewer.pot (+23/-16)
src/app/CMakeLists.txt (+0/-9)
src/app/qml/common/ViewerPage.qml (+53/-0)
src/app/qml/loView/KeybHelper.js (+1/-1)
src/app/qml/loView/LOViewDefaultHeader.qml (+39/-39)
src/app/qml/loView/LOViewGotoDialog.qml (+4/-2)
src/app/qml/loView/LOViewPage.qml (+138/-160)
src/app/qml/loView/PanelButton.qml (+0/-31)
src/app/qml/loView/Splashscreen.qml (+48/-0)
src/app/qml/loView/ZoomSelector.qml (+9/-15)
src/app/qml/ubuntu-docviewer-app.qml (+3/-0)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/libreoffice-splashscreen
Reviewer Review Type Date Requested Status
Roman Shchekin Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+278957@code.launchpad.net

Commit message

* Added splashscreen for loViewer
* Moved the async logic that loads loViewer in another component
* Removed 'PanelButton' component - no longer used
* Changed the behaviour of the header in the loViewer: if (textDocument) hideableHeader = true
* Don't use a global 'graphics' folder. Assets are now placed in the module which uses them.

Description of the change

* Added splashscreen for loViewer
* Moved the async logic that loads loViewer in another component
* Removed 'PanelButton' component - no longer used
* Changed the behaviour of the header in the loViewer: if (textDocument) hideableHeader = true
* Don't use a global 'graphics' folder. Assets are now placed in the module which uses them.

P.S. Part of the diff is just trash (i.e. indentation changed).

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

LGTM. Nice one!

review: Approve
Revision history for this message
Roman Shchekin (mrqtros) wrote :

Looks ok!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/com.ubuntu.docviewer.pot'
2--- po/com.ubuntu.docviewer.pot 2015-11-28 22:11:54 +0000
3+++ po/com.ubuntu.docviewer.pot 2015-11-30 12:25:27 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2015-11-29 01:09+0300\n"
9+"POT-Creation-Date: 2015-11-30 13:11+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -42,7 +42,7 @@
14 msgstr ""
15
16 #: ../src/app/qml/common/DetailsPage.qml:25
17-#: ../src/app/qml/loView/LOViewDefaultHeader.qml:108
18+#: ../src/app/qml/loView/LOViewDefaultHeader.qml:107
19 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:83
20 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:69
21 msgid "Details"
22@@ -114,7 +114,7 @@
23 #: ../src/app/qml/common/UnknownTypeDialog.qml:38
24 #: ../src/app/qml/documentPage/DeleteFileDialog.qml:55
25 #: ../src/app/qml/documentPage/DocumentPagePickModeHeader.qml:28
26-#: ../src/app/qml/loView/LOViewGotoDialog.qml:53
27+#: ../src/app/qml/loView/LOViewGotoDialog.qml:55
28 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:51
29 msgid "Cancel"
30 msgstr ""
31@@ -334,50 +334,57 @@
32 msgid "Unknown type document"
33 msgstr ""
34
35-#: ../src/app/qml/loView/LOViewDefaultHeader.qml:95
36+#: ../src/app/qml/loView/LOViewDefaultHeader.qml:85
37 msgid "Go to position..."
38 msgstr ""
39
40-#: ../src/app/qml/loView/LOViewDefaultHeader.qml:102
41+#: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
42 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
43 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
44 msgid "Disable night mode"
45 msgstr ""
46
47-#: ../src/app/qml/loView/LOViewDefaultHeader.qml:102
48+#: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
49 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
50 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
51 msgid "Enable night mode"
52 msgstr ""
53
54-#: ../src/app/qml/loView/LOViewGotoDialog.qml:28
55+#: ../src/app/qml/loView/LOViewGotoDialog.qml:30
56 msgid "Go to position"
57 msgstr ""
58
59-#: ../src/app/qml/loView/LOViewGotoDialog.qml:29
60+#: ../src/app/qml/loView/LOViewGotoDialog.qml:31
61 msgid "Choose a position between 1% and 100%"
62 msgstr ""
63
64-#: ../src/app/qml/loView/LOViewGotoDialog.qml:60
65+#: ../src/app/qml/loView/LOViewGotoDialog.qml:62
66 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:58
67 msgid "GO!"
68 msgstr ""
69
70-#: ../src/app/qml/loView/LOViewPage.qml:149
71+#: ../src/app/qml/loView/LOViewPage.qml:128
72 msgid "LibreOffice binaries not found."
73 msgstr ""
74
75-#: ../src/app/qml/loView/LOViewPage.qml:152
76+#: ../src/app/qml/loView/LOViewPage.qml:131
77 msgid "Error while loading LibreOffice."
78 msgstr ""
79
80-#: ../src/app/qml/loView/LOViewPage.qml:155
81+#: ../src/app/qml/loView/LOViewPage.qml:134
82 msgid ""
83 "Document not loaded.\n"
84 "The requested document may be corrupt."
85 msgstr ""
86
87-#: ../src/app/qml/loView/ZoomSelector.qml:116
88+#. TRANSLATORS: 'LibreOfficeKit' is the name of the library used by
89+#. Document Viewer for rendering LibreOffice/MS-Office documents.
90+#. Ref. https://docs.libreoffice.org/libreofficekit.html
91+#: ../src/app/qml/loView/Splashscreen.qml:45
92+msgid "Powered by LibreOfficeKit"
93+msgstr ""
94+
95+#: ../src/app/qml/loView/ZoomSelector.qml:110
96 msgid "Fit width"
97 msgstr ""
98
99@@ -411,7 +418,7 @@
100 msgid "Choose a page between 1 and %1"
101 msgstr ""
102
103-#: ../src/app/qml/ubuntu-docviewer-app.qml:115
104+#: ../src/app/qml/ubuntu-docviewer-app.qml:118
105 msgid "File does not exist."
106 msgstr ""
107
108@@ -429,10 +436,10 @@
109 msgid "copy %1"
110 msgstr ""
111
112-#: /home/qtros/dev/ubuntu-docviewer-app-cpp-optimizations-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
113+#: /tmp/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
114 msgid "Document Viewer"
115 msgstr ""
116
117-#: /home/qtros/dev/ubuntu-docviewer-app-cpp-optimizations-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
118+#: /tmp/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
119 msgid "documents;viewer;pdf;reader;"
120 msgstr ""
121
122=== modified file 'src/app/CMakeLists.txt'
123--- src/app/CMakeLists.txt 2015-10-21 13:16:12 +0000
124+++ src/app/CMakeLists.txt 2015-11-30 12:25:27 +0000
125@@ -1,5 +1,4 @@
126 file(GLOB_RECURSE QML_SRCS *.qml *.js)
127-file(GLOB_RECURSE IMAGE_FILES *.qml *.js)
128
129 find_package(Qt5Core)
130 find_package(Qt5Gui)
131@@ -37,15 +36,7 @@
132 )
133 endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
134
135-if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
136-add_custom_target(docviewer-imagefiles ALL
137- COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/graphics ${CMAKE_CURRENT_BINARY_DIR}
138- DEPENDS ${IMAGE_FILES}
139-)
140-endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
141-
142 install(DIRECTORY qml DESTINATION ${DATA_DIR})
143-install(DIRECTORY graphics DESTINATION ${DATA_DIR})
144
145 if(CLICK_MODE)
146 install(TARGETS ubuntu-docviewer-app DESTINATION ${BIN_DIR})
147
148=== removed directory 'src/app/graphics'
149=== added file 'src/app/qml/common/ViewerPage.qml'
150--- src/app/qml/common/ViewerPage.qml 1970-01-01 00:00:00 +0000
151+++ src/app/qml/common/ViewerPage.qml 2015-11-30 12:25:27 +0000
152@@ -0,0 +1,53 @@
153+/*
154+ * Copyright (C) 2015 Stefano Verzegnassi <verzegnassi.stefano@gmail.com>
155+ *
156+ * This program is free software; you can redistribute it and/or modify
157+ * it under the terms of the GNU General Public License as published by
158+ * the Free Software Foundation; version 3.
159+ *
160+ * This program is distributed in the hope that it will be useful,
161+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
162+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
163+ * GNU General Public License for more details.
164+ *
165+ * You should have received a copy of the GNU General Public License
166+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
167+ */
168+
169+import QtQuick 2.4
170+import Ubuntu.Components 1.3
171+
172+// A page that loads its content asynchronously.
173+
174+Page {
175+ id: viewerPage
176+
177+ property alias splashScreen: splashScreenItem.data
178+
179+ property alias content: contentLoader.sourceComponent
180+ property alias contentItem: contentLoader.item
181+
182+ property bool loaded: contentLoader.status == Loader.Ready
183+ property alias loaderProgress: contentLoader.progress
184+ property alias loaderStatus: contentLoader.status
185+
186+ signal contentLoaded()
187+
188+ Loader {
189+ id: contentLoader
190+ anchors.fill: parent
191+
192+ asynchronous: true
193+ sourceComponent: viewerPage.contents
194+
195+ onLoaded: viewerPage.contentLoaded()
196+ }
197+
198+ Item {
199+ id: splashScreenItem
200+ anchors.fill: parent
201+
202+ visible: contentLoader.status != Loader.Ready
203+ enabled: visible
204+ }
205+}
206
207=== modified file 'src/app/qml/loView/KeybHelper.js'
208--- src/app/qml/loView/KeybHelper.js 2015-10-19 11:44:11 +0000
209+++ src/app/qml/loView/KeybHelper.js 2015-11-30 12:25:27 +0000
210@@ -17,7 +17,7 @@
211 function parseEvent(event) {
212 var pixelDiff = 5;
213
214- var view = loPageContentLoader.item.loView
215+ var view = loPage.contentItem.loView
216 var isPresentation = view.document.documentType === LibreOffice.Document.PresentationDocument
217
218 if (event.key == Qt.Key_PageUp) {
219
220=== modified file 'src/app/qml/loView/LOViewDefaultHeader.qml'
221--- src/app/qml/loView/LOViewDefaultHeader.qml 2015-11-13 21:35:22 +0000
222+++ src/app/qml/loView/LOViewDefaultHeader.qml 2015-11-30 12:25:27 +0000
223@@ -37,32 +37,32 @@
224 Layout.fillWidth: true
225
226 Label {
227- anchors { left: parent.left; right: parent.right }
228- elide: Text.ElideMiddle
229- font.weight: Font.DemiBold
230- text: targetPage.title
231- }
232- Label {
233- anchors { left: parent.left; right: parent.right }
234- elide: Text.ElideMiddle
235- textSize: Label.Small
236- text: {
237- if (!loPageContentLoader.item)
238- return i18n.tr("Loading...")
239+ anchors { left: parent.left; right: parent.right }
240+ elide: Text.ElideMiddle
241+ font.weight: Font.DemiBold
242+ text: targetPage.title
243+ }
244+ Label {
245+ anchors { left: parent.left; right: parent.right }
246+ elide: Text.ElideMiddle
247+ textSize: Label.Small
248+ text: {
249+ if (!targetPage.contentItem)
250+ return i18n.tr("Loading...")
251
252- switch(loPageContentLoader.item.loDocument.documentType) {
253- case 0:
254- return i18n.tr("LibreOffice text document")
255- case 1:
256- return i18n.tr("LibreOffice spread sheet")
257- case 2:
258- return i18n.tr("LibreOffice presentation")
259- case 3:
260- return i18n.tr("LibreOffice Draw document")
261- case 4:
262- return i18n.tr("Unknown LibreOffice document")
263- default:
264- return i18n.tr("Unknown type document")
265+ switch(targetPage.contentItem.loDocument.documentType) {
266+ case 0:
267+ return i18n.tr("LibreOffice text document")
268+ case 1:
269+ return i18n.tr("LibreOffice spread sheet")
270+ case 2:
271+ return i18n.tr("LibreOffice presentation")
272+ case 3:
273+ return i18n.tr("LibreOffice Draw document")
274+ case 4:
275+ return i18n.tr("Unknown LibreOffice document")
276+ default:
277+ return i18n.tr("Unknown type document")
278 }
279 }
280 }
281@@ -72,34 +72,33 @@
282 Layout.preferredWidth: units.gu(12)
283 Layout.preferredHeight: units.gu(4)
284
285- visible: {
286- if (!loPageContentLoader.item)
287- return false
288-
289- return DocumentViewer.desktopMode || targetPage.width > units.gu(80)
290- }
291+ view: targetPage.contentItem.loView
292+ visible: targetPage.contentItem && (DocumentViewer.desktopMode || mainView.wideWindow)
293 }
294 }
295
296 actions: [
297- /* Action {
298- iconName: "Search"
299- text: i18n.tr("Search")
300- enabled: false
301- },*/
302-
303 Action {
304 // FIXME: Autopilot test broken... seems not to detect we're now using an ActionBar since the switch to UITK 1.3
305 objectName: "gotopage"
306 iconName: "browser-tabs"
307 text: i18n.tr("Go to position...")
308- onTriggered: PopupUtils.open(Qt.resolvedUrl("LOViewGotoDialog.qml"), targetPage)
309- visible: loPageContentLoader.item.loDocument.documentType == LibreOffice.Document.TextDocument
310+ visible: targetPage.contentItem.loDocument.documentType == LibreOffice.Document.TextDocument
311+
312+ onTriggered: {
313+ PopupUtils.open(
314+ Qt.resolvedUrl("LOViewGotoDialog.qml"),
315+ targetPage,
316+ {
317+ view: targetPage.contentItem.loView
318+ })
319+ }
320 },
321
322 Action {
323 iconName: "night-mode"
324 text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")
325+
326 onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled
327 },
328
329@@ -107,6 +106,7 @@
330 objectName: "detailsAction"
331 text: i18n.tr("Details")
332 iconName: "info"
333+
334 onTriggered: pageStack.push(Qt.resolvedUrl("../common/DetailsPage.qml"))
335 }
336 ]
337
338=== modified file 'src/app/qml/loView/LOViewGotoDialog.qml'
339--- src/app/qml/loView/LOViewGotoDialog.qml 2015-10-23 11:19:19 +0000
340+++ src/app/qml/loView/LOViewGotoDialog.qml 2015-11-30 12:25:27 +0000
341@@ -25,6 +25,8 @@
342 id: goToPageDialog
343 objectName: "LOViewGotoDialog"
344
345+ property var view
346+
347 title: i18n.tr("Go to position")
348 text: i18n.tr("Choose a position between 1% and 100%")
349
350@@ -67,9 +69,9 @@
351 }
352
353 function goToPage() {
354- var pos = loView.contentHeight * parseInt(goToPageTextField.text) / 100
355+ var pos = view.contentHeight * parseInt(goToPageTextField.text) / 100
356
357- loView.contentY = Math.min(pos, (loView.contentHeight - loView.height))
358+ view.contentY = Math.min(pos, (view.contentHeight - view.height))
359 PopupUtils.close(goToPageDialog)
360 }
361 }
362
363=== modified file 'src/app/qml/loView/LOViewPage.qml'
364--- src/app/qml/loView/LOViewPage.qml 2015-11-27 16:47:28 +0000
365+++ src/app/qml/loView/LOViewPage.qml 2015-11-30 12:25:27 +0000
366@@ -24,172 +24,150 @@
367 import "../common"
368 import "KeybHelper.js" as KeybHelper
369
370-Page {
371+ViewerPage {
372 id: loPage
373- title: Utils.getNameOfFile(file.path)
374- flickable: null
375-
376- readonly property bool wideWindow: width > units.gu(120)
377-
378- Loader {
379- id: loPageContentLoader
380-
381- asynchronous: true
382+
383+ property bool isPresentation: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.PresentationDocument)
384+ property bool isTextDocument: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.TextDocument)
385+
386+ title: Utils.getNameOfFile(file.path);
387+ flickable: isTextDocument ? loPage.contentItem.loView : null
388+
389+ splashScreen: Splashscreen { }
390+
391+ content: FocusScope {
392+ id: loPageContent
393 anchors.fill: parent
394- sourceComponent: loPageContentComponent
395-
396- onLoaded: {
397- if (loaded) {
398- // FIXME: At the moment don't hide header if the document is a presentation
399- var isPresentation = (item.loDocument.documentType === LibreOffice.Document.PresentationDocument)
400- loPage.flickable = isPresentation ? null : item.loView
401- } else loPage.flickable = null
402- }
403- }
404-
405- ActivityIndicator {
406- running: loPageContentLoader.status != Loader.Ready
407- visible: running
408- anchors.centerIn: parent
409- }
410-
411- Component {
412- id: loPageContentComponent
413-
414- FocusScope {
415- id: loPageContent
416+
417+ property alias loDocument: loView.document
418+ property alias loView: loView
419+
420+ Layouts {
421+ id: layouts
422 anchors.fill: parent
423
424- property alias loDocument: loView.document
425- property alias loView: loView
426-
427- Layouts {
428- id: layouts
429- anchors.fill: parent
430-
431- layouts: [
432- ConditionalLayout {
433- when: wideWindow
434- name: "wideWindowLayout"
435-
436- Item {
437- anchors.fill: parent
438-
439- ResizeableSidebar {
440- id: leftSidebar
441- anchors.left: parent.left
442- anchors.bottom: parent.bottom
443- visible: loDocument.documentType == LibreOffice.Document.PresentationDocument
444-
445- width: visible ? units.gu(40) : 0
446-
447- PartsView {
448- id: partsView
449- anchors.fill: parent
450- model: loView.partsModel
451- }
452- }
453-
454- ItemLayout {
455- item: "pinchArea"
456- anchors {
457- left: leftSidebar.right
458- right: parent.right
459- top: parent.top
460- bottom: parent.bottom
461- }
462- }
463- }
464- }
465- ]
466-
467- ScalingPinchArea {
468- id: pinchArea
469- objectName: "pinchArea"
470- Layouts.item: "pinchArea"
471-
472- targetFlickable: loView
473- onTotalScaleChanged: targetFlickable.updateContentSize(totalScale)
474-
475+ layouts: [
476+ ConditionalLayout {
477+ when: mainView.veryWideWindow
478+ name: "wideWindowLayout"
479+
480+ Item {
481+ anchors.fill: parent
482+
483+ ResizeableSidebar {
484+ id: leftSidebar
485+ anchors.left: parent.left
486+ anchors.bottom: parent.bottom
487+ visible: loPage.isPresentation
488+
489+ width: visible ? units.gu(40) : 0
490+
491+ PartsView {
492+ id: partsView
493+ anchors.fill: parent
494+ model: loView.partsModel
495+ }
496+ }
497+
498+ ItemLayout {
499+ item: "pinchArea"
500+ anchors {
501+ left: leftSidebar.right
502+ right: parent.right
503+ top: parent.top
504+ bottom: parent.bottom
505+ }
506+ }
507+ }
508+ }
509+ ]
510+
511+ ScalingPinchArea {
512+ id: pinchArea
513+ objectName: "pinchArea"
514+ Layouts.item: "pinchArea"
515+
516+ targetFlickable: loView
517+ onTotalScaleChanged: targetFlickable.updateContentSize(totalScale)
518+
519+ anchors {
520+ top: parent.top
521+ left: parent.left
522+ right: parent.right
523+ bottom: bottomBar.top
524+ }
525+
526+ LibreOffice.Viewer {
527+ id: loView
528+ objectName: "loView"
529+ anchors.fill: parent
530+
531+ clip: true
532+ documentPath: file.path
533+
534+ function updateContentSize(tgtScale) {
535+ zoomFactor = tgtScale
536+ }
537+
538+ // Keyboard events
539+ focus: true
540+ Keys.onPressed: KeybHelper.parseEvent(event)
541+
542+ Component.onCompleted: {
543+ // WORKAROUND: Fix for wrong grid unit size
544+ flickDeceleration = 1500 * units.gridUnit / 8
545+ maximumFlickVelocity = 2500 * units.gridUnit / 8
546+ loPageContent.forceActiveFocus()
547+ }
548+
549+ onErrorChanged: {
550+ var errorString;
551+
552+ switch(error) {
553+ case LibreOffice.Error.LibreOfficeNotFound:
554+ errorString = i18n.tr("LibreOffice binaries not found.")
555+ break;
556+ case LibreOffice.Error.LibreOfficeNotInitialized:
557+ errorString = i18n.tr("Error while loading LibreOffice.")
558+ break;
559+ case LibreOffice.Error.DocumentNotLoaded:
560+ errorString = i18n.tr("Document not loaded.\nThe requested document may be corrupt.")
561+ break;
562+ }
563+
564+ if (errorString) {
565+ loPage.pageStack.pop()
566+
567+ // We create the dialog in the MainView, so that it isn't
568+ // initialized by 'loPage' and keep on working after the
569+ // page is destroyed.
570+ mainView.showErrorDialog(errorString);
571+ }
572+ }
573+
574+ Scrollbar { flickableItem: loView; parent: loView.parent }
575+ Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom }
576+ }
577+ }
578+
579+ PartsView {
580+ id: bottomBar
581+ anchors {
582+ left: parent.left
583+ right: parent.right
584+ bottom: parent.bottom
585+ }
586+ height: visible ? units.gu(12) : 0
587+ visible: loPage.isPresentation
588+
589+ model: loView.partsModel
590+ orientation: ListView.Horizontal
591+
592+ HorizontalDivider {
593 anchors {
594+ left: parent.left
595+ right: parent.right
596 top: parent.top
597- left: parent.left
598- right: parent.right
599- bottom: bottomBar.top
600- }
601-
602- LibreOffice.Viewer {
603- id: loView
604- objectName: "loView"
605- anchors.fill: parent
606-
607- clip: true
608- documentPath: file.path
609-
610- function updateContentSize(tgtScale) {
611- zoomFactor = tgtScale
612- }
613-
614- // Keyboard events
615- focus: true
616- Keys.onPressed: KeybHelper.parseEvent(event)
617-
618- Component.onCompleted: {
619- // WORKAROUND: Fix for wrong grid unit size
620- flickDeceleration = 1500 * units.gridUnit / 8
621- maximumFlickVelocity = 2500 * units.gridUnit / 8
622- loPageContent.forceActiveFocus()
623- }
624-
625- onErrorChanged: {
626- var errorString;
627-
628- switch(error) {
629- case LibreOffice.Error.LibreOfficeNotFound:
630- errorString = i18n.tr("LibreOffice binaries not found.")
631- break;
632- case LibreOffice.Error.LibreOfficeNotInitialized:
633- errorString = i18n.tr("Error while loading LibreOffice.")
634- break;
635- case LibreOffice.Error.DocumentNotLoaded:
636- errorString = i18n.tr("Document not loaded.\nThe requested document may be corrupt.")
637- break;
638- }
639-
640- if (errorString) {
641- loPage.pageStack.pop()
642-
643- // We create the dialog in the MainView, so that it isn't
644- // initialized by 'loPage' and keep on working after the
645- // page is destroyed.
646- mainView.showErrorDialog(errorString);
647- }
648- }
649-
650- Scrollbar { flickableItem: loView; parent: loView.parent }
651- Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom }
652- }
653- }
654-
655- PartsView {
656- id: bottomBar
657- anchors {
658- left: parent.left
659- right: parent.right
660- bottom: parent.bottom
661- }
662- height: visible ? units.gu(12) : 0
663- visible: loDocument.documentType == LibreOffice.Document.PresentationDocument
664-
665- model: loView.partsModel
666- orientation: ListView.Horizontal
667-
668- HorizontalDivider {
669- anchors {
670- left: parent.left
671- right: parent.right
672- top: parent.top
673- }
674 }
675 }
676 }
677
678=== removed file 'src/app/qml/loView/PanelButton.qml'
679--- src/app/qml/loView/PanelButton.qml 2015-10-19 13:00:11 +0000
680+++ src/app/qml/loView/PanelButton.qml 1970-01-01 00:00:00 +0000
681@@ -1,31 +0,0 @@
682-/*
683- * Copyright (C) 2015 Canonical, Ltd.
684- *
685- * This program is free software; you can redistribute it and/or modify
686- * it under the terms of the GNU General Public License as published by
687- * the Free Software Foundation; version 3.
688- *
689- * This program is distributed in the hope that it will be useful,
690- * but WITHOUT ANY WARRANTY; without even the implied warranty of
691- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
692- * GNU General Public License for more details.
693- *
694- * You should have received a copy of the GNU General Public License
695- * along with this program. If not, see <http://www.gnu.org/licenses/>.
696- */
697-
698-import QtQuick 2.4
699-import Ubuntu.Components 1.3
700-
701-AbstractButton {
702- width: units.gu(4); height: parent.height
703-
704- property alias iconName: icon.name
705- property alias iconSource: icon.source
706-
707- Icon {
708- id: icon
709- anchors.centerIn: parent
710- width: units.gu(2.5); height: width
711- }
712-}
713
714=== added file 'src/app/qml/loView/Splashscreen.qml'
715--- src/app/qml/loView/Splashscreen.qml 1970-01-01 00:00:00 +0000
716+++ src/app/qml/loView/Splashscreen.qml 2015-11-30 12:25:27 +0000
717@@ -0,0 +1,48 @@
718+/*
719+ * Copyright (C) 2015 Stefano Verzegnassi
720+ *
721+ * This program is free software; you can redistribute it and/or modify
722+ * it under the terms of the GNU General Public License as published by
723+ * the Free Software Foundation; version 3.
724+ *
725+ * This program is distributed in the hope that it will be useful,
726+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
727+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
728+ * GNU General Public License for more details.
729+ *
730+ * You should have received a copy of the GNU General Public License
731+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
732+ */
733+
734+import QtQuick 2.4
735+import Ubuntu.Components 1.3
736+
737+Column {
738+ spacing: units.gu(4)
739+ anchors {
740+ verticalCenter: parent.verticalCenter
741+ left: parent.left; right: parent.right
742+ }
743+
744+ ActivityIndicator {
745+ running: visible
746+ anchors.horizontalCenter: parent.horizontalCenter
747+ }
748+
749+ Image {
750+ source: Qt.resolvedUrl("graphics/libreoffice.png")
751+ fillMode: Image.PreserveAspectFit
752+ horizontalAlignment: Image.AlignHCenter
753+
754+ height: units.gu(8)
755+ anchors { left: parent.left; right: parent.right }
756+ }
757+
758+ Label {
759+ // TRANSLATORS: 'LibreOfficeKit' is the name of the library used by
760+ // Document Viewer for rendering LibreOffice/MS-Office documents.
761+ // Ref. https://docs.libreoffice.org/libreofficekit.html
762+ text: i18n.tr("Powered by LibreOfficeKit")
763+ anchors.horizontalCenter: parent.horizontalCenter
764+ }
765+}
766
767=== modified file 'src/app/qml/loView/ZoomSelector.qml'
768--- src/app/qml/loView/ZoomSelector.qml 2015-11-13 21:35:22 +0000
769+++ src/app/qml/loView/ZoomSelector.qml 2015-11-30 12:25:27 +0000
770@@ -26,27 +26,27 @@
771 anchors.verticalCenter: parent.verticalCenter
772 width: units.gu(12)
773
774- property var view: loPageContentLoader.item.loView
775+ property var view
776
777 hasClearButton: true
778 inputMethodHints: Qt.ImhFormattedNumbersOnly
779 validator: IntValidator { bottom: 50; top: 400 }
780
781 onAccepted: {
782- view.setZoom(parseInt(text) / 100)
783+ textField.view.setZoom(parseInt(text) / 100)
784 focus = false
785 }
786
787 onHighlightedChanged: {
788 if (highlighted) {
789- text = parseInt(view.zoomFactor * 100)
790+ text = parseInt(textField.view.zoomFactor * 100)
791 } else text = ""
792 }
793
794 Label {
795 anchors.centerIn: parent
796 visible: !textField.highlighted
797- text: "%1%".arg(parseInt(view.zoomFactor*100))
798+ text: "%1%".arg(parseInt(textField.view.zoomFactor*100))
799 }
800
801 popover: TextFieldButtonPopover {
802@@ -62,10 +62,7 @@
803 Layout.fillHeight: true
804 Layout.fillWidth: true
805
806- onClicked: {
807- var view = loPageContentLoader.item.loView
808- view.setZoom(view.zoomFactor + 0.1)
809- }
810+ onClicked: textField.view.setZoom(textField.view.zoomFactor + 0.1)
811
812 Icon {
813 width: units.gu(2); height: width
814@@ -84,10 +81,7 @@
815 Layout.fillHeight: true
816 Layout.fillWidth: true
817
818- onClicked: {
819- var view = loPageContentLoader.item.loView
820- view.setZoom(view.zoomFactor - 0.1)
821- }
822+ onClicked: textField.view.setZoom(textField.view.zoomFactor - 0.1)
823
824 Icon {
825 width: units.gu(2); height: width
826@@ -104,7 +98,7 @@
827 divider.visible: false
828
829 onClicked: {
830- view.adjustZoomToWidth()
831+ textField.view.adjustZoomToWidth()
832 zoomSelectorDialogue.close()
833 }
834
835@@ -121,7 +115,7 @@
836 width: units.gu(2); height: width
837 name: "tick"
838 color: UbuntuColors.green
839- visible: view.zoomMode == LibreOffice.View.FitToWidth
840+ visible: textField.view.zoomMode == LibreOffice.View.FitToWidth
841 }
842 }
843 } // ListItem
844@@ -147,7 +141,7 @@
845 height: units.gu(4)
846
847 onClicked: {
848- view.setZoom(modelData.value)
849+ textField.view.setZoom(modelData.value)
850 zoomSelectorDialogue.close()
851 }
852
853
854=== added directory 'src/app/qml/loView/graphics'
855=== added file 'src/app/qml/loView/graphics/libreoffice.png'
856Binary files src/app/qml/loView/graphics/libreoffice.png 1970-01-01 00:00:00 +0000 and src/app/qml/loView/graphics/libreoffice.png 2015-11-30 12:25:27 +0000 differ
857=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
858--- src/app/qml/ubuntu-docviewer-app.qml 2015-11-27 16:39:21 +0000
859+++ src/app/qml/ubuntu-docviewer-app.qml 2015-11-30 12:25:27 +0000
860@@ -30,6 +30,9 @@
861
862 property bool pickMode: commandLineProxy.pickMode
863 property bool fullscreen: commandLineProxy.fullscreen
864+
865+ readonly property bool wideWindow: width > units.gu(80)
866+ readonly property bool veryWideWindow: width > units.gu(120)
867 readonly property bool isLandscape: Screen.orientation == Qt.LandscapeOrientation ||
868 Screen.orientation == Qt.InvertedLandscapeOrientation
869

Subscribers

People subscribed via source and target branches