Merge lp:~chocanto/ubuntu-docviewer-app/plainText into lp:ubuntu-docviewer-app/trunk

Proposed by Anthony Granger
Status: Merged
Approved by: David Planella
Approved revision: 14
Merged at revision: 4
Proposed branch: lp:~chocanto/ubuntu-docviewer-app/plainText
Merge into: lp:ubuntu-docviewer-app/trunk
Diff against target: 396 lines (+228/-87)
10 files modified
.bzrignore (+6/-1)
README (+12/-1)
debian/control (+3/-1)
docviewer.qml (+133/-0)
launcher/src/docviewer-launcher.pri (+14/-0)
launcher/src/main.cpp (+59/-0)
main.pro (+1/-0)
ubuntu-doc-viewer.qml (+0/-72)
ubuntu-docviewer-app (+0/-2)
ubuntu-docviewer-app.desktop (+0/-10)
To merge this branch: bzr merge lp:~chocanto/ubuntu-docviewer-app/plainText
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Michael Hall Approve
Review via email: mp+159440@code.launchpad.net

Commit message

Initial support for opening text files, includes a C++ wrapper for reading commandline arguments.

Description of the change

-First lines of code
-Added the "main" tab
-Added the "details" tab
-Can now read plainText
-Added a "special" launcher

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

This is great, thanks!

Can you remove the binary file ubuntu-docviewer-app from bzr? We should have people (and eventually the .deb package) build that fresh, rather than keeping it in version control.

Once that's done, I'll approve this so it can land in trunk.

review: Needs Fixing
Revision history for this message
Michael Hall (mhall119) wrote :

Looks great! Thanks

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~chocanto/ubuntu-docviewer-app/plainText/+merge/159440/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
7. By Anthony Granger

Fix conflicts

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
8. By Anthony Granger

Merged from lp:~didrocks/ubuntu-docviewer-app/build-fix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
9. By Anthony Granger

Fix debuild errors

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
10. By Anthony Granger

Fix for debuild errors

11. By Anthony Granger

Added qtchooser in debian/control

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
12. By Anthony Granger
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
13. By Anthony Granger

Fix build depends

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
14. By Anthony Granger

Fix build depends

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-04-04 11:05:43 +0000
3+++ .bzrignore 2013-04-20 21:38:24 +0000
4@@ -1,4 +1,9 @@
5-*.qmlproject.user
6+Makefile
7+ubuntu-docviewer-app
8+docviewer.qmlproject.user
9+launcher/build-docviewer-launcher-Desktop-Debug/
10+launcher/build-docviewer-launcher-Desktop-Release/
11+launcher/src/docviewer-launcher.pro.user
12
13 debian/files
14 debian/app-template/
15
16=== modified file 'README'
17--- README 2013-02-12 16:18:48 +0000
18+++ README 2013-04-20 21:38:24 +0000
19@@ -1,1 +1,12 @@
20-this is an example README file.
21+HOW TO BUILD THE LAUNCHER :
22+
23+1. Be sure to have the last version of QtCreator. If not, install it with
24+ apt-get install qtcreator
25+2. Generate the Makefile with : "qmake main.pro"
26+3. Then compile the project with : "make"
27+
28+USAGE :
29+
30+./ubuntu-docviewer-app [filename]
31+
32+filename : The path where the file you want to open is located.
33
34=== modified file 'debian/control'
35--- debian/control 2013-04-11 20:58:07 +0000
36+++ debian/control 2013-04-20 21:38:24 +0000
37@@ -2,6 +2,8 @@
38 Priority: extra
39 Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>
40 Build-Depends: debhelper (>= 9),
41+ qt5-default,
42+ qtdeclarative5-dev
43 Standards-Version: 3.9.4
44 Section: misc
45 Homepage: https://launchpad.net/ubuntu-docviewer-app
46@@ -13,6 +15,6 @@
47 Depends: ${misc:Depends},
48 qmlscene,
49 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
50- qtdeclarative5-qtquick2-plugin
51+ qtdeclarative5-qtquick2-plugin,
52 Description: Document Viewer application
53 Core Document Viewer application
54
55=== added file 'docviewer.qml'
56--- docviewer.qml 1970-01-01 00:00:00 +0000
57+++ docviewer.qml 2013-04-20 21:38:24 +0000
58@@ -0,0 +1,133 @@
59+import QtQuick 2.0
60+import Ubuntu.Components 0.1
61+import Ubuntu.Components.ListItems 0.1 as ListItem
62+
63+MainView {
64+ // objectName for functional testing purposes (autopilot-qt5)
65+ objectName: "docviewer"
66+
67+ applicationName: "ubuntu-docviewer-app"
68+
69+ width: units.gu(50)
70+ height: units.gu(75)
71+
72+ Component.onCompleted: {
73+
74+ }
75+
76+ Component.onDestruction: {
77+
78+ }
79+
80+ Tabs {
81+ id: tabs
82+ anchors.fill: parent
83+
84+ Tab {
85+ objectName: "tabViewer"
86+ id: tabViewer;
87+
88+ title: getNameOfFile(file);
89+
90+ page: Page {
91+
92+ tools: ToolbarActions {
93+ back {
94+ visible: true
95+ }
96+ }
97+
98+ Column {
99+ id: columnMain;
100+ width: parent.width;
101+ height: childrenRect.height;
102+
103+ TextArea {
104+
105+ id: textAreaMain;
106+
107+ width: parent.width;
108+ height: units.gu(66);
109+
110+ activeFocusOnPress: false;
111+ highlighted: true;
112+
113+ signal loadCompleted()
114+
115+ Component.onCompleted: {
116+ var xhr = new XMLHttpRequest;
117+
118+ xhr.open("GET", file);
119+ xhr.onreadystatechange = function() {
120+ if (xhr.readyState === XMLHttpRequest.DONE) {
121+ textAreaMain.text = xhr.responseText;
122+ textAreaMain.loadCompleted();
123+ }
124+ }
125+
126+ xhr.send();
127+ }
128+ }
129+ }
130+ }
131+ }
132+
133+ Tab {
134+ objectName: "TabDetails"
135+ id: tabDetails;
136+
137+ title: i18n.tr("Details")
138+ page: Page {
139+ Column {
140+ width: units.gu(50)
141+ ListItem.SingleValue {
142+ text: i18n.tr("Location")
143+ value: file
144+ }
145+ ListItem.SingleValue {
146+ text: i18n.tr("Size")
147+ value: printSize(textAreaMain.text.length);
148+ }
149+
150+ ListItem.SingleValue {
151+ text: i18n.tr("Created")
152+ value: "01/01/2001";
153+ }
154+
155+ ListItem.SingleValue {
156+ text: i18n.tr("Modified")
157+ value: "01/01/2001";
158+ }
159+ }
160+ }
161+ }
162+ }
163+
164+ function printSize(size)
165+ {
166+ if (size >= 1073741824)
167+ {
168+ return parseInt(size/1073741824) + "," + size%1073741824 + " Gio";
169+ }
170+
171+ if (size >= 1048576)
172+ {
173+ return parseInt(size/1048576) + "," + size%1048576 + " Mio";
174+ }
175+
176+ if (size >= 1024)
177+ {
178+ return parseInt(size/1024) + "," + size%1024 + " Kio";
179+ }
180+
181+ return size + " o";
182+ }
183+
184+ function getNameOfFile(path)
185+ {
186+ var name = String(path);
187+
188+ return name.substring(name.lastIndexOf('/')+1);
189+
190+ }
191+}
192
193=== added directory 'launcher'
194=== added directory 'launcher/src'
195=== added file 'launcher/src/docviewer-launcher.pri'
196--- launcher/src/docviewer-launcher.pri 1970-01-01 00:00:00 +0000
197+++ launcher/src/docviewer-launcher.pri 2013-04-20 21:38:24 +0000
198@@ -0,0 +1,14 @@
199+#-------------------------------------------------
200+#
201+# Project created by QtCreator 2013-04-16T15:04:12
202+#
203+#-------------------------------------------------
204+
205+QT += gui qml quick
206+
207+TARGET = ubuntu-docviewer-app
208+
209+TEMPLATE = app
210+
211+
212+SOURCES += launcher/src/main.cpp
213
214=== added file 'launcher/src/main.cpp'
215--- launcher/src/main.cpp 1970-01-01 00:00:00 +0000
216+++ launcher/src/main.cpp 2013-04-20 21:38:24 +0000
217@@ -0,0 +1,59 @@
218+#include <QGuiApplication>
219+
220+#include <QtQml/qqmlengine.h>
221+#include <QtQml/qqmlcomponent.h>
222+#include <QtQml/qqmlcontext.h>
223+
224+#include <QtQuick/qquickitem.h>
225+#include <QtQuick/qquickview.h>
226+
227+#include <QStringList>
228+#include <qdebug.h>
229+
230+int main(int argc, char *argv[])
231+{
232+ QGuiApplication launcher(argc, argv);
233+
234+ QQmlEngine engine;
235+
236+ QQmlComponent *component = new QQmlComponent(&engine);
237+
238+ component->loadUrl(QString("docviewer.qml"));
239+
240+ QString argument = "";
241+ if (launcher.arguments().size() >= 2)
242+ argument = launcher.arguments().at(1);
243+
244+ /**SEND ARGUMENT**/
245+ //engine.rootContext()->setContextProperty("fileName", launcher.arguments().at(1));
246+ engine.rootContext()->setContextProperty("file", QVariant::fromValue(argument));
247+
248+ /*if ( !component->isReady() ) {
249+ qFatal(qPrintable(component->errorString()));
250+ return -1;
251+ } FIXME */
252+
253+ QObject *topLevel = component->create();
254+ QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
255+ QQuickView* qxView = 0;
256+
257+ if (!window) {
258+
259+ QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel);
260+
261+ if (contentItem) {
262+
263+ qxView = new QQuickView(&engine, NULL);
264+ window = qxView;
265+ window->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
266+
267+ qxView->setResizeMode(QQuickView::SizeRootObjectToView);
268+ qxView->setContent(QString("docviewer.qml"), component, contentItem);
269+ }
270+ }
271+
272+ if (window)
273+ window->show();
274+
275+ return launcher.exec();
276+}
277
278=== added file 'main.pro'
279--- main.pro 1970-01-01 00:00:00 +0000
280+++ main.pro 2013-04-20 21:38:24 +0000
281@@ -0,0 +1,1 @@
282+include(launcher/src/docviewer-launcher.pri)
283
284=== removed file 'ubuntu-doc-viewer.qml'
285--- ubuntu-doc-viewer.qml 2013-04-11 20:58:07 +0000
286+++ ubuntu-doc-viewer.qml 1970-01-01 00:00:00 +0000
287@@ -1,72 +0,0 @@
288-import QtQuick 2.0
289-import Ubuntu.Components 0.1
290-
291-/*!
292- \brief MainView with Tabs element.
293- First Tab has a single Label and
294- second Tab has a single ToolbarAction.
295-*/
296-
297-MainView {
298- // objectName for functional testing purposes (autopilot-qt5)
299- objectName: "docviewer"
300- applicationName: "ubuntu-docviewer-app"
301-
302- width: units.gu(50)
303- height: units.gu(75)
304-
305- Tabs {
306- id: tabs
307- anchors.fill: parent
308-
309- // First tab begins here
310- Tab {
311- objectName: "Tab1"
312-
313- title: i18n.tr("Document Viewer")
314-
315- // Tab content begins here
316- page: Page {
317- Column {
318- anchors.centerIn: parent
319- Label {
320- text: i18n.tr("Swipe from right to left to change tab.")
321- }
322- }
323- }
324- }
325-
326- // Second tab begins here
327- Tab {
328- objectName: "Tab2"
329-
330- title: i18n.tr("Optional Screen")
331- page: Page {
332- anchors.margins: units.gu(2)
333-
334- tools: ToolbarActions {
335- Action {
336- objectName: "action"
337-
338- iconSource: Qt.resolvedUrl("avatar.png")
339- text: i18n.tr("Tap me!")
340-
341- onTriggered: {
342- label.text = i18n.tr("Toolbar tapped")
343- }
344- }
345- }
346-
347- Column {
348- anchors.centerIn: parent
349- Label {
350- id: label
351- objectName: "label"
352-
353- text: i18n.tr("Swipe from bottom to up to reveal the toolbar.")
354- }
355- }
356- }
357- }
358- }
359-}
360
361=== removed file 'ubuntu-docviewer-app'
362--- ubuntu-docviewer-app 2013-04-11 20:58:07 +0000
363+++ ubuntu-docviewer-app 1970-01-01 00:00:00 +0000
364@@ -1,2 +0,0 @@
365-#!/bin/bash
366-qmlscene /usr/share/ubuntu-docviewer-app/ubuntu-docviewer-app.qml
367
368=== added file 'ubuntu-docviewer-app.desktop'
369--- ubuntu-docviewer-app.desktop 1970-01-01 00:00:00 +0000
370+++ ubuntu-docviewer-app.desktop 2013-04-20 21:38:24 +0000
371@@ -0,0 +1,10 @@
372+[Desktop Entry]
373+Encoding=UTF-8
374+Version=1.0
375+Type=Application
376+Terminal=false
377+Exec=qmlscene /usr/share/ubuntu-docviewer-app/ubuntu-docviewer-app.qml
378+Icon=/usr/share/ubuntu-docviewer-app/docviewer64.png
379+Name=Document Viewer
380+X-Ubuntu-Touch=true
381+X-Ubuntu-StageHint=SideStage
382
383=== removed file 'ubuntu-docviewer-app.desktop'
384--- ubuntu-docviewer-app.desktop 2013-04-11 20:58:07 +0000
385+++ ubuntu-docviewer-app.desktop 1970-01-01 00:00:00 +0000
386@@ -1,10 +0,0 @@
387-[Desktop Entry]
388-Encoding=UTF-8
389-Version=1.0
390-Type=Application
391-Terminal=false
392-Exec=qmlscene /usr/share/ubuntu-docviewer-app/ubuntu-docviewer-app.qml
393-Icon=/usr/share/ubuntu-docviewer-app/docviewer64.png
394-Name=Document Viewer
395-X-Ubuntu-Touch=true
396-X-Ubuntu-StageHint=SideStage

Subscribers

People subscribed via source and target branches