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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-09-08 16:24:06 +0000
+++ CMakeLists.txt 2014-10-08 15:07:35 +0000
@@ -3,6 +3,11 @@
3find_program(INTLTOOL_MERGE intltool-merge)3find_program(INTLTOOL_MERGE intltool-merge)
4find_program(INTLTOOL_EXTRACT intltool-extract)4find_program(INTLTOOL_EXTRACT intltool-extract)
55
6find_package(Qt5Core REQUIRED)
7find_package(Qt5Qml REQUIRED)
8find_package(Qt5Quick REQUIRED)
9set(CMAKE_AUTOMOC ON)
10
6# Standard install paths11# Standard install paths
7include(GNUInstallDirs)12include(GNUInstallDirs)
813
@@ -17,6 +22,19 @@
17set(AUTOPILOT_DIR ubuntu_weather_app)22set(AUTOPILOT_DIR ubuntu_weather_app)
18set(UBUNTU_MANIFEST_PATH "click/manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")23set(UBUNTU_MANIFEST_PATH "click/manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
1924
25# components PATH
26execute_process(
27 COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
28 OUTPUT_VARIABLE ARCH_TRIPLET
29 OUTPUT_STRIP_TRAILING_WHITESPACE
30)
31set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
32execute_process(
33 COMMAND dpkg-architecture -qDEB_HOST_ARCH
34 OUTPUT_VARIABLE CLICK_ARCH
35 OUTPUT_STRIP_TRAILING_WHITESPACE
36)
37
20if(CLICK_MODE)38if(CLICK_MODE)
21 if(NOT DEFINED BZR_SOURCE)39 if(NOT DEFINED BZR_SOURCE)
22 set(BZR_SOURCE "lp:${APP_HARDCODE}")40 set(BZR_SOURCE "lp:${APP_HARDCODE}")
@@ -26,7 +44,7 @@
26 set(CMAKE_INSTALL_BINDIR /)44 set(CMAKE_INSTALL_BINDIR /)
27 set(DATA_DIR /)45 set(DATA_DIR /)
28 set(ICON ${ICON_FILE})46 set(ICON ${ICON_FILE})
29 set(EXEC "qmlscene ${MAIN_QML}")47 set(EXEC "qmlscene $@ ${MAIN_QML}")
30 set(DESKTOP_DIR ${DATA_DIR})48 set(DESKTOP_DIR ${DATA_DIR})
31else(CLICK_MODE)49else(CLICK_MODE)
32 set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})50 set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})
@@ -73,3 +91,5 @@
73add_subdirectory(po)91add_subdirectory(po)
74add_subdirectory(tests)92add_subdirectory(tests)
75add_subdirectory(components)93add_subdirectory(components)
94add_subdirectory(plugins)
95
7696
=== modified file 'click/manifest.json.in'
--- click/manifest.json.in 2014-09-08 16:24:06 +0000
+++ click/manifest.json.in 2014-10-08 15:07:35 +0000
@@ -1,5 +1,5 @@
1{1{
2 "architecture": "all",2 "architecture": "@CLICK_ARCH@",
3 "description": "A weather forecast application for Ubuntu with support for multiple online weather data sources",3 "description": "A weather forecast application for Ubuntu with support for multiple online weather data sources",
4 "framework": "ubuntu-sdk-14.10-qml-dev3",4 "framework": "ubuntu-sdk-14.10-qml-dev3",
5 "hooks": {5 "hooks": {
66
=== modified file 'debian/changelog'
--- debian/changelog 2014-05-02 12:52:42 +0000
+++ debian/changelog 2014-10-08 15:07:35 +0000
@@ -1,3 +1,10 @@
1ubuntu-weather-app (1.8.3ubuntu1) utopic; urgency=low
2
3 [ Dan Chapman ]
4 * Add timezone c++ extension plugin
5
6 -- Dan Chapman <dpniel@ubuntu.com> Thu, 25 Sep 2014 10:46:29 +0100
7
1ubuntu-weather-app (1.8.3) raring; urgency=low8ubuntu-weather-app (1.8.3) raring; urgency=low
29
3 [ Martin Borho ]10 [ Martin Borho ]
411
=== modified file 'debian/control'
--- debian/control 2014-09-08 20:35:30 +0000
+++ debian/control 2014-10-08 15:07:35 +0000
@@ -3,32 +3,46 @@
3Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>3Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>
4Build-Depends: cmake,4Build-Depends: cmake,
5 debhelper (>= 9),5 debhelper (>= 9),
6 gettext,
6 intltool,7 intltool,
7 python3,8 python3 | python-all | python3-dev | python3-all-dev,
8Standards-Version: 3.9.49 python3-minimal,
10 qtbase5-dev,
11 qtbase5-dev-tools,
12 qtdeclarative5-dev,
13 qtdeclarative5-dev-tools,
14 qtdeclarative5-ubuntu-ui-toolkit-plugin,
15Standards-Version: 3.9.5
9Section: misc16Section: misc
10Homepage: https://launchpad.net/ubuntu-weather-app17Homepage: https://launchpad.net/ubuntu-weather-app
11Vcs-Bzr: https://code.launchpad.net/~ubuntu-weather-dev/ubuntu-weather-app/trunk18Vcs-Bzr: https://code.launchpad.net/~ubuntu-weather-dev/ubuntu-weather-app/trunk
1219
13Package: ubuntu-weather-app20Package: ubuntu-weather-app
14Section: misc
15Architecture: all21Architecture: all
16Depends: qmlscene,22Depends: qmlscene,
17 qtdeclarative5-localstorage-plugin,23 qtdeclarative5-localstorage-plugin,
18 qtdeclarative5-qtquick2-plugin,24 qtdeclarative5-qtquick2-plugin,
19 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,25 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
20 suru-icon-theme | ubuntu-mobile-icons,26 suru-icon-theme | ubuntu-mobile-icons,
21 ${misc:Depends},27 qtdeclarative5-ubuntuweather-timezone-plugin1.0 (>= ${source:Version}),
28 ${misc:Depends}
22Description: Weather application29Description: Weather application
23 Core Weather application30 Core Weather application
2431
32Package: qtdeclarative5-ubuntuweather-timezone-plugin1.0
33Architecture: any
34Depends: ${shlibs:Depends}, ${misc:Depends}
35Description: Timezone plugin, used by the Ubuntu Weather app
36 This package contains the timezone plugin written for the Ubuntu
37 Weather app.
38
25Package: ubuntu-weather-app-autopilot39Package: ubuntu-weather-app-autopilot
26Architecture: all40Architecture: all
27Depends: libautopilot-qt (>= 1.4),41Depends: libautopilot-qt (>= 1.4),
28 libqt5test5,42 libqt5test5,
29 libqt5widgets5,43 libqt5widgets5,
30 ubuntu-ui-toolkit-autopilot,44 ubuntu-ui-toolkit-autopilot,
31 ubuntu-weather-app (= ${source:Version}),45 ubuntu-weather-app (>= ${source:Version}),
32 ${misc:Depends},46 ${misc:Depends}
33Description: Test package for the weather app47Description: Test package for the weather app
34 Autopilot tests for the weather app package48 Autopilot tests for the weather app package
3549
=== added file 'debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install'
--- debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-ubuntuweather-timezone-plugin1.0.install 2014-10-08 15:07:35 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/qt5/
02
=== modified file 'debian/rules'
--- debian/rules 2014-09-08 16:24:06 +0000
+++ debian/rules 2014-10-08 15:07:35 +0000
@@ -9,3 +9,6 @@
99
10override_dh_auto_configure:10override_dh_auto_configure:
11 dh_auto_configure -- -DCLICK_MODE=OFF11 dh_auto_configure -- -DCLICK_MODE=OFF
12
13override_dh_install:
14 dh_install --list-missing
1215
=== added directory 'plugins'
=== added file 'plugins/CMakeLists.txt'
--- plugins/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ plugins/CMakeLists.txt 2014-10-08 15:07:35 +0000
@@ -0,0 +1,27 @@
1include_directories(
2 ${CMAKE_CURRENT_SOURCE_DIR}
3)
4
5set(
6 timeZone_SRCS
7 TimeZone/timezone.cpp
8 TimeZone/timezone_plugin.cpp
9)
10
11add_library(TimeZoneBackend MODULE
12 ${timeZone_SRCS}
13)
14set_target_properties(TimeZoneBackend PROPERTIES
15 LIBRARY_OUTPUT_DIRECTORY TimeZone)
16
17qt5_use_modules(TimeZoneBackend Gui Qml Quick)
18
19# Copy qmldir file to build dir for running in QtCreator
20add_custom_target(TimeZoneBackend-qmldir ALL
21 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/TimeZone/qmldir ${CMAKE_CURRENT_BINARY_DIR}/TimeZone
22 DEPENDS ${QML_JS_FILES}
23)
24
25# Install plugin file
26install(TARGETS TimeZoneBackend DESTINATION ${QT_IMPORTS_DIR}/qt5/qml/UbuntuWeather/TimeZone/)
27install(FILES TimeZone/qmldir DESTINATION ${QT_IMPORTS_DIR}/qt5/qml/UbuntuWeather/TimeZone/)
028
=== added directory 'plugins/TimeZone'
=== added file 'plugins/TimeZone/qmldir'
--- plugins/TimeZone/qmldir 1970-01-01 00:00:00 +0000
+++ plugins/TimeZone/qmldir 2014-10-08 15:07:35 +0000
@@ -0,0 +1,2 @@
1module TimeZone
2plugin TimeZoneBackend
0\ No newline at end of file3\ No newline at end of file
14
=== added file 'plugins/TimeZone/timezone.cpp'
--- plugins/TimeZone/timezone.cpp 1970-01-01 00:00:00 +0000
+++ plugins/TimeZone/timezone.cpp 2014-10-08 15:07:35 +0000
@@ -0,0 +1,30 @@
1#include "timezone.h"
2
3TimeZone::TimeZone(QObject *parent) :
4 QObject(parent)
5{
6}
7/** @short helper property that returns a list of available IANA timezone id's */
8QVariantList TimeZone::availableTimeZoneIds() const
9{
10 QVariantList timeZoneList;
11 Q_FOREACH(const QByteArray &id, QTimeZone::availableTimeZoneIds()) {
12 timeZoneList.append(QString(id));
13 }
14 return timeZoneList;
15}
16
17int TimeZone::getUtcOffsetFromTimeZoneId(const QByteArray &timeZoneId)
18{
19 QTimeZone tzone(timeZoneId);
20 if (tzone.isValid()) {
21 QDateTime tzOffset;
22 tzOffset.setTimeSpec(Qt::TimeZone);
23 tzOffset.setTimeZone(tzone);
24 // Now return the offset from the current UTC time in hours
25 return tzOffset.timeZone().offsetFromUtc(QDateTime::currentDateTimeUtc()) / 3600;
26 } else {
27 emit error(QString("Time zone id %1 is not a valid IANA timezone id").arg(QString(timeZoneId)));
28 return 0;
29 }
30}
031
=== added file 'plugins/TimeZone/timezone.h'
--- plugins/TimeZone/timezone.h 1970-01-01 00:00:00 +0000
+++ plugins/TimeZone/timezone.h 2014-10-08 15:07:35 +0000
@@ -0,0 +1,48 @@
1#ifndef TIMEZONE_H
2#define TIMEZONE_H
3
4#include <QObject>
5#include <QtQuick>
6#include <QDateTime>
7#include <QTimeZone>
8
9/*
10 * Usage:
11 *
12 * import QtQuick 2.2
13 * import Ubuntu.Components 1.1
14 * import TimeZone 1.0
15 *
16 * MainView {
17 * id: root
18 *
19 * Label { text: i18n.tr("UTC offset for America/Phoenix is: %1").arg(parseInt(timeZone.getUtcOffsetFromTimeZoneId("America/Phoenix")) }
20 *
21 * TimeZone {
22 * id: timeZone
23 * }
24 * ## Also the availalbe timezone ids can be used as a listmodel or a list to query using the usual
25 * ## list methods
26 * ListView {
27 * model: timeZone.availableTimeZoneIds
28 * delegate: Label {text: modelData}
29 * }
30 *
31 * */
32
33class TimeZone : public QObject
34{
35 Q_OBJECT
36 Q_PROPERTY(QVariantList availableTimeZoneIds READ availableTimeZoneIds CONSTANT)
37public:
38 explicit TimeZone(QObject *parent = 0);
39
40 QVariantList availableTimeZoneIds() const;
41 Q_INVOKABLE int getUtcOffsetFromTimeZoneId(const QByteArray &timeZoneId);
42
43signals:
44 void error(const QString &errorMsg);
45
46};
47
48#endif // TIMEZONE_H
049
=== added file 'plugins/TimeZone/timezone_plugin.cpp'
--- plugins/TimeZone/timezone_plugin.cpp 1970-01-01 00:00:00 +0000
+++ plugins/TimeZone/timezone_plugin.cpp 2014-10-08 15:07:35 +0000
@@ -0,0 +1,15 @@
1#include <QtQml>
2#include <QtQml/QQmlContext>
3#include "timezone_plugin.h"
4#include "timezone.h"
5
6void timezone_plugin::registerTypes(const char *uri)
7{
8 //@uri TimeZone
9 qmlRegisterType<TimeZone>(uri, 1, 0, "TimeZone");
10}
11
12void timezone_plugin::initializeEngine(QQmlEngine *engine, const char *uri)
13{
14 QQmlExtensionPlugin::initializeEngine(engine, uri);
15}
016
=== added file 'plugins/TimeZone/timezone_plugin.h'
--- plugins/TimeZone/timezone_plugin.h 1970-01-01 00:00:00 +0000
+++ plugins/TimeZone/timezone_plugin.h 2014-10-08 15:07:35 +0000
@@ -0,0 +1,18 @@
1#ifndef TIMEZONE_PLUGIN_H
2#define TIMEZONE_PLUGIN_H
3
4#include <QtQml/QQmlEngine>
5#include <QtQml/QQmlExtensionPlugin>
6
7class timezone_plugin : public QQmlExtensionPlugin
8{
9 Q_OBJECT
10 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
11
12public:
13 void registerTypes(const char *uri);
14 void initializeEngine(QQmlEngine *engine, const char *uri);
15
16};
17
18#endif // TIMEZONE_PLUGIN_H
019
=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot 2014-09-20 10:55:31 +0000
+++ po/com.ubuntu.weather.pot 2014-10-08 15:07:35 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: ubuntu-weather-app\n"9"Project-Id-Version: ubuntu-weather-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-09-20 02:38-0700\n"11"POT-Creation-Date: 2014-09-25 10:14+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"

Subscribers

People subscribed via source and target branches