Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fullscreen-support into lp:~verzegnassi-stefano/ubuntu-docviewer-app/pdf-toc-improvements

Proposed by Stefano Verzegnassi
Status: Superseded
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/fullscreen-support
Merge into: lp:~verzegnassi-stefano/ubuntu-docviewer-app/pdf-toc-improvements
Diff against target: 413 lines (+102/-25)
12 files modified
po/com.ubuntu.docviewer.pot (+3/-3)
po/fr.po (+4/-4)
po/gd.po (+4/-4)
po/hu.po (+4/-4)
po/pa.po (+4/-4)
src/app/command-line-parser.cpp (+5/-0)
src/app/command-line-parser.h (+2/-0)
src/app/docviewer-application.cpp (+47/-1)
src/app/docviewer-application.h (+6/-0)
src/app/qml/pdfView/PdfContentsPage.qml (+1/-2)
src/app/qml/pdfView/PdfView.qml (+3/-3)
src/app/qml/ubuntu-docviewer-app.qml (+19/-0)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fullscreen-support
Reviewer Review Type Date Requested Status
Stefano Verzegnassi Pending
Review via email: mp+255855@code.launchpad.net

Commit message

Open a document in fullscreen mode on devices

Description of the change

Open a document in fullscreen mode on devices

This MP depends on lp:~verzegnassi-stefano/ubuntu-docviewer-app/pdf-toc-improvements, since that branch introduces some fix for the invisible header in PdfContentsPage.

To post a comment you must log in.

Unmerged revisions

117. By Stefano Verzegnassi

Merge with lp:~verzegnassi-stefano/ubuntu-docviewer-app/pdf-toc-improvements and avoid conflicts with earlier changes in PdfContentsPage

116. By Stefano Verzegnassi

Added fullscreen support

115. By Launchpad Translations on behalf of ubuntu-docviewer-dev

Launchpad automatic translations update.

114. By Launchpad Translations on behalf of ubuntu-docviewer-dev

Launchpad automatic translations update.

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-04-08 14:17:06 +0000
3+++ po/com.ubuntu.docviewer.pot 2015-04-10 15:51:48 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2015-04-08 16:15+0200\n"
9+"POT-Creation-Date: 2015-04-10 17:46+0200\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@@ -189,7 +189,7 @@
14 msgstr ""
15
16 #: ../src/app/qml/documentPage/DocumentPage.qml:25
17-#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
18+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
19 msgid "Document Viewer"
20 msgstr ""
21
22@@ -268,6 +268,6 @@
23 msgid "Loading..."
24 msgstr ""
25
26-#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
27+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
28 msgid "documents;viewer;pdf;reader;"
29 msgstr ""
30
31=== modified file 'po/fr.po'
32--- po/fr.po 2015-04-08 05:37:26 +0000
33+++ po/fr.po 2015-04-10 15:51:48 +0000
34@@ -8,14 +8,14 @@
35 "Project-Id-Version: ubuntu-docviewer-app\n"
36 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
37 "POT-Creation-Date: 2015-04-07 16:14+0200\n"
38-"PO-Revision-Date: 2015-03-19 20:27+0000\n"
39+"PO-Revision-Date: 2015-04-10 00:23+0000\n"
40 "Last-Translator: Anne <anneonyme017@gmail.com>\n"
41 "Language-Team: French <fr@li.org>\n"
42 "MIME-Version: 1.0\n"
43 "Content-Type: text/plain; charset=UTF-8\n"
44 "Content-Transfer-Encoding: 8bit\n"
45 "Plural-Forms: nplurals=2; plural=n > 1;\n"
46-"X-Launchpad-Export-Date: 2015-04-08 05:37+0000\n"
47+"X-Launchpad-Export-Date: 2015-04-10 05:12+0000\n"
48 "X-Generator: Launchpad (build 17413)\n"
49
50 #: ../src/app/qml/common/DetailsPage.qml:27
51@@ -244,12 +244,12 @@
52 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
53 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
54 msgid "Disable night mode"
55-msgstr ""
56+msgstr "Désactiver le mode nuit"
57
58 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
59 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
60 msgid "Enable night mode"
61-msgstr ""
62+msgstr "Activer le mode nuit"
63
64 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:25
65 msgid "Go to page"
66
67=== modified file 'po/gd.po'
68--- po/gd.po 2015-04-08 05:37:26 +0000
69+++ po/gd.po 2015-04-10 15:51:48 +0000
70@@ -8,7 +8,7 @@
71 "Project-Id-Version: ubuntu-docviewer-app\n"
72 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
73 "POT-Creation-Date: 2015-04-07 16:14+0200\n"
74-"PO-Revision-Date: 2015-03-13 02:46+0000\n"
75+"PO-Revision-Date: 2015-04-08 09:51+0000\n"
76 "Last-Translator: GunChleoc <Unknown>\n"
77 "Language-Team: Fòram na Gàidhlig\n"
78 "MIME-Version: 1.0\n"
79@@ -16,7 +16,7 @@
80 "Content-Transfer-Encoding: 8bit\n"
81 "Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : "
82 "(n > 2 && n < 20) ? 2 : 3;\n"
83-"X-Launchpad-Export-Date: 2015-04-08 05:37+0000\n"
84+"X-Launchpad-Export-Date: 2015-04-09 05:40+0000\n"
85 "X-Generator: Launchpad (build 17413)\n"
86 "Language: gd\n"
87
88@@ -258,12 +258,12 @@
89 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
90 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
91 msgid "Disable night mode"
92-msgstr ""
93+msgstr "Cuir am modh oidhche à comas"
94
95 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
96 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
97 msgid "Enable night mode"
98-msgstr ""
99+msgstr "Cuir am modh oidhche an comas"
100
101 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:25
102 msgid "Go to page"
103
104=== modified file 'po/hu.po'
105--- po/hu.po 2015-04-08 05:37:26 +0000
106+++ po/hu.po 2015-04-10 15:51:48 +0000
107@@ -8,14 +8,14 @@
108 "Project-Id-Version: ubuntu-docviewer-app\n"
109 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
110 "POT-Creation-Date: 2015-04-07 16:14+0200\n"
111-"PO-Revision-Date: 2015-03-13 07:56+0000\n"
112+"PO-Revision-Date: 2015-04-08 07:34+0000\n"
113 "Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n"
114 "Language-Team: Hungarian <hu@li.org>\n"
115 "MIME-Version: 1.0\n"
116 "Content-Type: text/plain; charset=UTF-8\n"
117 "Content-Transfer-Encoding: 8bit\n"
118 "Plural-Forms: nplurals=2; plural=n != 1;\n"
119-"X-Launchpad-Export-Date: 2015-04-08 05:37+0000\n"
120+"X-Launchpad-Export-Date: 2015-04-09 05:40+0000\n"
121 "X-Generator: Launchpad (build 17413)\n"
122
123 #: ../src/app/qml/common/DetailsPage.qml:27
124@@ -244,12 +244,12 @@
125 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
126 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
127 msgid "Disable night mode"
128-msgstr ""
129+msgstr "Éjjeli mód letiltása"
130
131 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
132 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
133 msgid "Enable night mode"
134-msgstr ""
135+msgstr "Éjjeli mód engedélyezése"
136
137 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:25
138 msgid "Go to page"
139
140=== modified file 'po/pa.po'
141--- po/pa.po 2015-04-08 05:37:26 +0000
142+++ po/pa.po 2015-04-10 15:51:48 +0000
143@@ -8,14 +8,14 @@
144 "Project-Id-Version: ubuntu-docviewer-app\n"
145 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
146 "POT-Creation-Date: 2015-04-07 16:14+0200\n"
147-"PO-Revision-Date: 2015-03-16 13:12+0000\n"
148+"PO-Revision-Date: 2015-04-08 11:16+0000\n"
149 "Last-Translator: Gursharnjit_Singh <ubuntuser13@gmail.com>\n"
150 "Language-Team: Punjabi <pa@li.org>\n"
151 "MIME-Version: 1.0\n"
152 "Content-Type: text/plain; charset=UTF-8\n"
153 "Content-Transfer-Encoding: 8bit\n"
154 "Plural-Forms: nplurals=2; plural=n != 1;\n"
155-"X-Launchpad-Export-Date: 2015-04-08 05:37+0000\n"
156+"X-Launchpad-Export-Date: 2015-04-09 05:40+0000\n"
157 "X-Generator: Launchpad (build 17413)\n"
158
159 #: ../src/app/qml/common/DetailsPage.qml:27
160@@ -244,12 +244,12 @@
161 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
162 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
163 msgid "Disable night mode"
164-msgstr ""
165+msgstr "ਰਾਤ ਮੋਡ ਬੰਦ ਕਰੋ"
166
167 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
168 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
169 msgid "Enable night mode"
170-msgstr ""
171+msgstr "ਰਾਤ ਮੋਡ ਚਾਲੂ ਕਰੋ"
172
173 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:25
174 msgid "Go to page"
175
176=== modified file 'src/app/command-line-parser.cpp'
177--- src/app/command-line-parser.cpp 2015-02-13 15:30:01 +0000
178+++ src/app/command-line-parser.cpp 2015-04-10 15:51:48 +0000
179@@ -31,6 +31,7 @@
180 CommandLineParser::CommandLineParser()
181 : m_pickMode(false),
182 m_testability(false),
183+ m_isFullscreen(false),
184 m_documentFile("")
185 {
186 m_urlHandler = new UrlHandler();
187@@ -51,6 +52,9 @@
188 usage();
189 return false;
190 }
191+ else if (args[i] == "--fullscreen") {
192+ m_isFullscreen = true;
193+ }
194 else if (args[i] == "--pick-mode") {
195 m_pickMode = true;
196 }
197@@ -88,6 +92,7 @@
198 QTextStream out(stdout);
199 out << "Usage: ubuntu-docviewer-app [options] [file_path]" << endl;
200 out << "Options:" << endl;
201+ out << " --fullscreen\trun fullscreen" << endl;
202 out << " --pick-mode\t\tEnable mode to pick photos" << endl;
203 out << " file_path\t\tOpens ubuntu-docviewer-app displaying the selected file" << endl;
204 }
205
206=== modified file 'src/app/command-line-parser.h'
207--- src/app/command-line-parser.h 2015-02-13 15:30:01 +0000
208+++ src/app/command-line-parser.h 2015-04-10 15:51:48 +0000
209@@ -38,6 +38,7 @@
210
211 bool processArguments(const QStringList& args);
212
213+ bool isFullscreen() const { return m_isFullscreen; }
214 bool pickModeEnabled() const { return m_pickMode; }
215 bool testability() const { return m_testability; }
216 const QString &documentFile() const { return m_documentFile; }
217@@ -48,6 +49,7 @@
218
219 UrlHandler *m_urlHandler;
220
221+ bool m_isFullscreen;
222 bool m_pickMode;
223 bool m_testability;
224 QString m_documentFile;
225
226=== modified file 'src/app/docviewer-application.cpp'
227--- src/app/docviewer-application.cpp 2015-03-03 15:41:11 +0000
228+++ src/app/docviewer-application.cpp 2015-04-10 15:51:48 +0000
229@@ -113,6 +113,7 @@
230 {
231 // Set up import paths
232 QStringList importPathList = m_view->engine()->importPathList();
233+
234 // Prepend the location of the plugin in the build dir,
235 // so that Qt Creator finds it there, thus overriding the one installed
236 // in the sistem if there is one
237@@ -123,6 +124,29 @@
238 }
239
240 /*!
241+ * \brief DocViewerApplication::isDesktopMode
242+ * Returns true if the DESKTOP_MODE env var is set
243+ */
244+bool DocViewerApplication::isDesktopMode() const
245+{
246+
247+ // Assume that platformName (QtUbuntu) with ubuntu
248+ // in name means it's running on device
249+ // TODO: replace this check with SDK call for formfactor
250+ QString platform = QGuiApplication::platformName();
251+ return !((platform == "ubuntu") || (platform == "ubuntumirclient"));
252+}
253+
254+/*!
255+ * \brief DocViewerApplication::isFullScreen
256+ * Returns true if window is on FullScreen mode
257+ */
258+bool DocViewerApplication::isFullScreen() const
259+{
260+ return m_view->windowState() == Qt::WindowFullScreen;
261+}
262+
263+/*!
264 * \brief DocViewerApplication::getDocumentFile
265 * Returns the document file passed as a parameter
266 */
267@@ -175,7 +199,14 @@
268 setDocumentFile(m_cmdLineParser->documentFile());
269
270 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
271- m_view->show();
272+
273+ //run fullscreen if specified at command line
274+ if (m_cmdLineParser->isFullscreen()) {
275+ setFullScreen(true);
276+ m_view->showFullScreen();
277+ } else {
278+ m_view->show();
279+ }
280 }
281
282 /*!
283@@ -229,6 +260,21 @@
284 Q_EMIT browseModeRequested();
285 }
286
287+/*!
288+ * \brief DocViewerApplication::setFullScreen
289+ * Change window state to fullScreen or no state
290+ */
291+void DocViewerApplication::setFullScreen(bool fullScreen)
292+{
293+ if(fullScreen) {
294+ m_view->setWindowState(Qt::WindowFullScreen);
295+ } else {
296+ m_view->setWindowState(Qt::WindowNoState);
297+ }
298+
299+ Q_EMIT fullScreenChanged();
300+}
301+
302 void DocViewerApplication::setDocumentFile(const QString &documentFile)
303 {
304 if(!documentFile.isEmpty()) {
305
306=== modified file 'src/app/docviewer-application.h'
307--- src/app/docviewer-application.h 2015-02-13 15:30:01 +0000
308+++ src/app/docviewer-application.h 2015-04-10 15:51:48 +0000
309@@ -38,6 +38,8 @@
310 {
311 Q_OBJECT
312 Q_PROPERTY(bool pickModeEnabled READ pickModeEnabled NOTIFY pickModeEnabledChanged)
313+ Q_PROPERTY(bool desktopMode READ isDesktopMode CONSTANT)
314+ Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
315 Q_PROPERTY(QString documentFile READ getDocumentFile WRITE setDocumentFile NOTIFY documentFileChanged)
316
317 public:
318@@ -56,6 +58,8 @@
319 UiMode defaultUiMode() const;
320 void setUiMode(UiMode mode);
321 bool pickModeEnabled() const;
322+ bool isDesktopMode() const;
323+ bool isFullScreen() const;
324 const QString &getDocumentFile() const;
325
326 Q_INVOKABLE void returnPickedContent(QList<QString> paths);
327@@ -65,12 +69,14 @@
328
329 signals:
330 void pickModeEnabledChanged();
331+ void fullScreenChanged();
332 void documentFileChanged();
333 void browseModeRequested();
334
335 private slots:
336 void switchToPickMode();
337 void switchToBrowseMode();
338+ void setFullScreen(bool fullScreen);
339 void setDocumentFile(const QString &documentFile);
340
341 private:
342
343=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
344--- src/app/qml/pdfView/PdfContentsPage.qml 2015-04-08 14:17:06 +0000
345+++ src/app/qml/pdfView/PdfContentsPage.qml 2015-04-10 15:51:48 +0000
346@@ -36,8 +36,7 @@
347
348 onActiveChanged: {
349 // If the header was hidden in the PdfPage, make it visible.
350- if (!pdfPage.header.visible)
351- pdfPage.header.visible = true;
352+ mainView.setHeaderVisibility(true);
353
354 // Find out the current page position in the ToC index
355 var i=0
356
357=== modified file 'src/app/qml/pdfView/PdfView.qml'
358--- src/app/qml/pdfView/PdfView.qml 2015-04-07 14:14:52 +0000
359+++ src/app/qml/pdfView/PdfView.qml 2015-04-10 15:51:48 +0000
360@@ -1,5 +1,5 @@
361 /*
362- * Copyright (C) 2013-2014 Canonical, Ltd.
363+ * Copyright (C) 2013-2015 Canonical, Ltd.
364 *
365 * This program is free software; you can redistribute it and/or modify
366 * it under the terms of the GNU General Public License as published by
367@@ -85,7 +85,7 @@
368 objectName: "mouseArea"
369
370 anchors.fill: parent
371- onClicked: pdfPage.header.visible = !pdfPage.header.visible
372+ onClicked: mainView.toggleHeaderVisibility()
373 }
374 }
375
376@@ -109,7 +109,7 @@
377 pdfPage.title = title;
378
379 // Hide header when the document is ready
380- pdfPage.header.visible = false;
381+ mainView.setHeaderVisibility(false);
382 }
383 }
384
385
386=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
387--- src/app/qml/ubuntu-docviewer-app.qml 2015-03-26 13:58:31 +0000
388+++ src/app/qml/ubuntu-docviewer-app.qml 2015-04-10 15:51:48 +0000
389@@ -54,6 +54,25 @@
390 PopupUtils.open(Qt.resolvedUrl("common/UnknownTypeDialog.qml"), mainView, { parent: mainView });
391 }
392
393+ function setFullScreen(fullScreen) {
394+ DOC_VIEWER.fullScreen = fullScreen;
395+ }
396+
397+ function toggleFullScreen() {
398+ DOC_VIEWER.fullScreen = !APP.fullScreen;
399+ }
400+
401+ function setHeaderVisibility(visible, toggleFullscreen) {
402+ toggleFullscreen = typeof toggleFullscreen !== 'undefined' ? toggleFullscreen : true
403+ header.visible = visible;
404+ if (!DOC_VIEWER.desktopMode && toggleFullscreen)
405+ setFullScreen(!visible);
406+ }
407+
408+ function toggleHeaderVisibility() {
409+ setHeaderVisibility(!header.visible);
410+ }
411+
412 Component.onCompleted: {
413 pageStack.push(Qt.resolvedUrl("documentPage/DocumentPage.qml"));
414

Subscribers

People subscribed via source and target branches

to all changes: