Merge lp:~ubuntu-weather-dev/ubuntu-weather-app/timezone-plugin into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 384
Merged at revision: 376
Proposed branch: lp:~ubuntu-weather-dev/ubuntu-weather-app/timezone-plugin
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 336 lines (+194/-9)
13 files modified
CMakeLists.txt (+21/-1)
click/manifest.json.in (+1/-1)
debian/changelog (+7/-0)
debian/control (+20/-6)
debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install (+1/-0)
debian/rules (+3/-0)
plugins/CMakeLists.txt (+27/-0)
plugins/TimeZone/qmldir (+2/-0)
plugins/TimeZone/timezone.cpp (+30/-0)
plugins/TimeZone/timezone.h (+48/-0)
plugins/TimeZone/timezone_plugin.cpp (+15/-0)
plugins/TimeZone/timezone_plugin.h (+18/-0)
po/com.ubuntu.weather.pot (+1/-1)
To merge this branch: bzr merge lp:~ubuntu-weather-dev/ubuntu-weather-app/timezone-plugin
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs Pending
Daniel Holbach Pending
Review via email: mp+237613@code.launchpad.net

This proposal supersedes a proposal from 2014-09-20.

Commit message

Adds a TimeZone plugin for getting the Utc offset for a given timezone

Also adds an additional availableTimeZoneIds property to return a list
of IANA zoneIds known by the system/Qt.

Description of the change

Adds a TimeZone plugin for getting the Utc offset for a given timezone

Also adds an additional availableTimeZoneIds property to return a list
of IANA zoneIds known by the system/Qt.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Dan Chapman  (dpniel) wrote : Posted in a previous version of this proposal

I'm not sure what's wrong here with qtdeclarative5-dev being an unmet build dep. Could someone check i've done the debian/controls changes correctly.

Revision history for this message
Martin Borho (martin-borho) wrote : Posted in a previous version of this proposal

dpniel: Can't see what's wrong with the control file, too.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

See comments, I think it might solve the build deps.

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Dan Chapman  (dpniel) wrote : Posted in a previous version of this proposal

also it seems the http://91.189.93.70:8080/job/ubuntu-weather-app-utopic-amd64-ci/81/consoleFull job has no problem with qtdeclarative5-dev but the generic-mediumtests does

Revision history for this message
Dan Chapman  (dpniel) : Posted in a previous version of this proposal
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

Dan, do note the debian control file needs dependencies specified for each package. It seems like you need qtdeclarative5-dev(-tools) for the test build as well?

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

I'll ask dholbach to have a look as we're quite stuck.

Revision history for this message
Dan Chapman  (dpniel) wrote : Posted in a previous version of this proposal

> I'll ask dholbach to have a look as we're quite stuck.

thanks Nicholas :-)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I merged daniel's tweaks and placed them in all in a common branch everyone can tweak.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-08 16:24:06 +0000
3+++ CMakeLists.txt 2014-10-08 15:07:35 +0000
4@@ -3,6 +3,11 @@
5 find_program(INTLTOOL_MERGE intltool-merge)
6 find_program(INTLTOOL_EXTRACT intltool-extract)
7
8+find_package(Qt5Core REQUIRED)
9+find_package(Qt5Qml REQUIRED)
10+find_package(Qt5Quick REQUIRED)
11+set(CMAKE_AUTOMOC ON)
12+
13 # Standard install paths
14 include(GNUInstallDirs)
15
16@@ -17,6 +22,19 @@
17 set(AUTOPILOT_DIR ubuntu_weather_app)
18 set(UBUNTU_MANIFEST_PATH "click/manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
19
20+# components PATH
21+execute_process(
22+ COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
23+ OUTPUT_VARIABLE ARCH_TRIPLET
24+ OUTPUT_STRIP_TRAILING_WHITESPACE
25+)
26+set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
27+execute_process(
28+ COMMAND dpkg-architecture -qDEB_HOST_ARCH
29+ OUTPUT_VARIABLE CLICK_ARCH
30+ OUTPUT_STRIP_TRAILING_WHITESPACE
31+)
32+
33 if(CLICK_MODE)
34 if(NOT DEFINED BZR_SOURCE)
35 set(BZR_SOURCE "lp:${APP_HARDCODE}")
36@@ -26,7 +44,7 @@
37 set(CMAKE_INSTALL_BINDIR /)
38 set(DATA_DIR /)
39 set(ICON ${ICON_FILE})
40- set(EXEC "qmlscene ${MAIN_QML}")
41+ set(EXEC "qmlscene $@ ${MAIN_QML}")
42 set(DESKTOP_DIR ${DATA_DIR})
43 else(CLICK_MODE)
44 set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})
45@@ -73,3 +91,5 @@
46 add_subdirectory(po)
47 add_subdirectory(tests)
48 add_subdirectory(components)
49+add_subdirectory(plugins)
50+
51
52=== modified file 'click/manifest.json.in'
53--- click/manifest.json.in 2014-09-08 16:24:06 +0000
54+++ click/manifest.json.in 2014-10-08 15:07:35 +0000
55@@ -1,5 +1,5 @@
56 {
57- "architecture": "all",
58+ "architecture": "@CLICK_ARCH@",
59 "description": "A weather forecast application for Ubuntu with support for multiple online weather data sources",
60 "framework": "ubuntu-sdk-14.10-qml-dev3",
61 "hooks": {
62
63=== modified file 'debian/changelog'
64--- debian/changelog 2014-05-02 12:52:42 +0000
65+++ debian/changelog 2014-10-08 15:07:35 +0000
66@@ -1,3 +1,10 @@
67+ubuntu-weather-app (1.8.3ubuntu1) utopic; urgency=low
68+
69+ [ Dan Chapman ]
70+ * Add timezone c++ extension plugin
71+
72+ -- Dan Chapman <dpniel@ubuntu.com> Thu, 25 Sep 2014 10:46:29 +0100
73+
74 ubuntu-weather-app (1.8.3) raring; urgency=low
75
76 [ Martin Borho ]
77
78=== modified file 'debian/control'
79--- debian/control 2014-09-08 20:35:30 +0000
80+++ debian/control 2014-10-08 15:07:35 +0000
81@@ -3,32 +3,46 @@
82 Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>
83 Build-Depends: cmake,
84 debhelper (>= 9),
85+ gettext,
86 intltool,
87- python3,
88-Standards-Version: 3.9.4
89+ python3 | python-all | python3-dev | python3-all-dev,
90+ python3-minimal,
91+ qtbase5-dev,
92+ qtbase5-dev-tools,
93+ qtdeclarative5-dev,
94+ qtdeclarative5-dev-tools,
95+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
96+Standards-Version: 3.9.5
97 Section: misc
98 Homepage: https://launchpad.net/ubuntu-weather-app
99 Vcs-Bzr: https://code.launchpad.net/~ubuntu-weather-dev/ubuntu-weather-app/trunk
100
101 Package: ubuntu-weather-app
102-Section: misc
103 Architecture: all
104 Depends: qmlscene,
105 qtdeclarative5-localstorage-plugin,
106 qtdeclarative5-qtquick2-plugin,
107 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
108 suru-icon-theme | ubuntu-mobile-icons,
109- ${misc:Depends},
110+ qtdeclarative5-ubuntuweather-timezone-plugin1.0 (>= ${source:Version}),
111+ ${misc:Depends}
112 Description: Weather application
113 Core Weather application
114
115+Package: qtdeclarative5-ubuntuweather-timezone-plugin1.0
116+Architecture: any
117+Depends: ${shlibs:Depends}, ${misc:Depends}
118+Description: Timezone plugin, used by the Ubuntu Weather app
119+ This package contains the timezone plugin written for the Ubuntu
120+ Weather app.
121+
122 Package: ubuntu-weather-app-autopilot
123 Architecture: all
124 Depends: libautopilot-qt (>= 1.4),
125 libqt5test5,
126 libqt5widgets5,
127 ubuntu-ui-toolkit-autopilot,
128- ubuntu-weather-app (= ${source:Version}),
129- ${misc:Depends},
130+ ubuntu-weather-app (>= ${source:Version}),
131+ ${misc:Depends}
132 Description: Test package for the weather app
133 Autopilot tests for the weather app package
134
135=== added file 'debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install'
136--- debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install 1970-01-01 00:00:00 +0000
137+++ debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install 2014-10-08 15:07:35 +0000
138@@ -0,0 +1,1 @@
139+usr/lib/*/qt5/
140
141=== modified file 'debian/rules'
142--- debian/rules 2014-09-08 16:24:06 +0000
143+++ debian/rules 2014-10-08 15:07:35 +0000
144@@ -9,3 +9,6 @@
145
146 override_dh_auto_configure:
147 dh_auto_configure -- -DCLICK_MODE=OFF
148+
149+override_dh_install:
150+ dh_install --list-missing
151
152=== added directory 'plugins'
153=== added file 'plugins/CMakeLists.txt'
154--- plugins/CMakeLists.txt 1970-01-01 00:00:00 +0000
155+++ plugins/CMakeLists.txt 2014-10-08 15:07:35 +0000
156@@ -0,0 +1,27 @@
157+include_directories(
158+ ${CMAKE_CURRENT_SOURCE_DIR}
159+)
160+
161+set(
162+ timeZone_SRCS
163+ TimeZone/timezone.cpp
164+ TimeZone/timezone_plugin.cpp
165+)
166+
167+add_library(TimeZoneBackend MODULE
168+ ${timeZone_SRCS}
169+)
170+set_target_properties(TimeZoneBackend PROPERTIES
171+ LIBRARY_OUTPUT_DIRECTORY TimeZone)
172+
173+qt5_use_modules(TimeZoneBackend Gui Qml Quick)
174+
175+# Copy qmldir file to build dir for running in QtCreator
176+add_custom_target(TimeZoneBackend-qmldir ALL
177+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/TimeZone/qmldir ${CMAKE_CURRENT_BINARY_DIR}/TimeZone
178+ DEPENDS ${QML_JS_FILES}
179+)
180+
181+# Install plugin file
182+install(TARGETS TimeZoneBackend DESTINATION ${QT_IMPORTS_DIR}/qt5/qml/UbuntuWeather/TimeZone/)
183+install(FILES TimeZone/qmldir DESTINATION ${QT_IMPORTS_DIR}/qt5/qml/UbuntuWeather/TimeZone/)
184
185=== added directory 'plugins/TimeZone'
186=== added file 'plugins/TimeZone/qmldir'
187--- plugins/TimeZone/qmldir 1970-01-01 00:00:00 +0000
188+++ plugins/TimeZone/qmldir 2014-10-08 15:07:35 +0000
189@@ -0,0 +1,2 @@
190+module TimeZone
191+plugin TimeZoneBackend
192\ No newline at end of file
193
194=== added file 'plugins/TimeZone/timezone.cpp'
195--- plugins/TimeZone/timezone.cpp 1970-01-01 00:00:00 +0000
196+++ plugins/TimeZone/timezone.cpp 2014-10-08 15:07:35 +0000
197@@ -0,0 +1,30 @@
198+#include "timezone.h"
199+
200+TimeZone::TimeZone(QObject *parent) :
201+ QObject(parent)
202+{
203+}
204+/** @short helper property that returns a list of available IANA timezone id's */
205+QVariantList TimeZone::availableTimeZoneIds() const
206+{
207+ QVariantList timeZoneList;
208+ Q_FOREACH(const QByteArray &id, QTimeZone::availableTimeZoneIds()) {
209+ timeZoneList.append(QString(id));
210+ }
211+ return timeZoneList;
212+}
213+
214+int TimeZone::getUtcOffsetFromTimeZoneId(const QByteArray &timeZoneId)
215+{
216+ QTimeZone tzone(timeZoneId);
217+ if (tzone.isValid()) {
218+ QDateTime tzOffset;
219+ tzOffset.setTimeSpec(Qt::TimeZone);
220+ tzOffset.setTimeZone(tzone);
221+ // Now return the offset from the current UTC time in hours
222+ return tzOffset.timeZone().offsetFromUtc(QDateTime::currentDateTimeUtc()) / 3600;
223+ } else {
224+ emit error(QString("Time zone id %1 is not a valid IANA timezone id").arg(QString(timeZoneId)));
225+ return 0;
226+ }
227+}
228
229=== added file 'plugins/TimeZone/timezone.h'
230--- plugins/TimeZone/timezone.h 1970-01-01 00:00:00 +0000
231+++ plugins/TimeZone/timezone.h 2014-10-08 15:07:35 +0000
232@@ -0,0 +1,48 @@
233+#ifndef TIMEZONE_H
234+#define TIMEZONE_H
235+
236+#include <QObject>
237+#include <QtQuick>
238+#include <QDateTime>
239+#include <QTimeZone>
240+
241+/*
242+ * Usage:
243+ *
244+ * import QtQuick 2.2
245+ * import Ubuntu.Components 1.1
246+ * import TimeZone 1.0
247+ *
248+ * MainView {
249+ * id: root
250+ *
251+ * Label { text: i18n.tr("UTC offset for America/Phoenix is: %1").arg(parseInt(timeZone.getUtcOffsetFromTimeZoneId("America/Phoenix")) }
252+ *
253+ * TimeZone {
254+ * id: timeZone
255+ * }
256+ * ## Also the availalbe timezone ids can be used as a listmodel or a list to query using the usual
257+ * ## list methods
258+ * ListView {
259+ * model: timeZone.availableTimeZoneIds
260+ * delegate: Label {text: modelData}
261+ * }
262+ *
263+ * */
264+
265+class TimeZone : public QObject
266+{
267+ Q_OBJECT
268+ Q_PROPERTY(QVariantList availableTimeZoneIds READ availableTimeZoneIds CONSTANT)
269+public:
270+ explicit TimeZone(QObject *parent = 0);
271+
272+ QVariantList availableTimeZoneIds() const;
273+ Q_INVOKABLE int getUtcOffsetFromTimeZoneId(const QByteArray &timeZoneId);
274+
275+signals:
276+ void error(const QString &errorMsg);
277+
278+};
279+
280+#endif // TIMEZONE_H
281
282=== added file 'plugins/TimeZone/timezone_plugin.cpp'
283--- plugins/TimeZone/timezone_plugin.cpp 1970-01-01 00:00:00 +0000
284+++ plugins/TimeZone/timezone_plugin.cpp 2014-10-08 15:07:35 +0000
285@@ -0,0 +1,15 @@
286+#include <QtQml>
287+#include <QtQml/QQmlContext>
288+#include "timezone_plugin.h"
289+#include "timezone.h"
290+
291+void timezone_plugin::registerTypes(const char *uri)
292+{
293+ //@uri TimeZone
294+ qmlRegisterType<TimeZone>(uri, 1, 0, "TimeZone");
295+}
296+
297+void timezone_plugin::initializeEngine(QQmlEngine *engine, const char *uri)
298+{
299+ QQmlExtensionPlugin::initializeEngine(engine, uri);
300+}
301
302=== added file 'plugins/TimeZone/timezone_plugin.h'
303--- plugins/TimeZone/timezone_plugin.h 1970-01-01 00:00:00 +0000
304+++ plugins/TimeZone/timezone_plugin.h 2014-10-08 15:07:35 +0000
305@@ -0,0 +1,18 @@
306+#ifndef TIMEZONE_PLUGIN_H
307+#define TIMEZONE_PLUGIN_H
308+
309+#include <QtQml/QQmlEngine>
310+#include <QtQml/QQmlExtensionPlugin>
311+
312+class timezone_plugin : public QQmlExtensionPlugin
313+{
314+ Q_OBJECT
315+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
316+
317+public:
318+ void registerTypes(const char *uri);
319+ void initializeEngine(QQmlEngine *engine, const char *uri);
320+
321+};
322+
323+#endif // TIMEZONE_PLUGIN_H
324
325=== modified file 'po/com.ubuntu.weather.pot'
326--- po/com.ubuntu.weather.pot 2014-09-20 10:55:31 +0000
327+++ po/com.ubuntu.weather.pot 2014-10-08 15:07:35 +0000
328@@ -8,7 +8,7 @@
329 msgstr ""
330 "Project-Id-Version: ubuntu-weather-app\n"
331 "Report-Msgid-Bugs-To: \n"
332-"POT-Creation-Date: 2014-09-20 02:38-0700\n"
333+"POT-Creation-Date: 2014-09-25 10:14+0100\n"
334 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
335 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
336 "Language-Team: LANGUAGE <LL@li.org>\n"

Subscribers

People subscribed via source and target branches