Merge lp:~nik90/ubuntu-clock-app/migrate-u1db-to-qtlabs into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan on 2015-08-18
Status: Work in progress
Proposed branch: lp:~nik90/ubuntu-clock-app/migrate-u1db-to-qtlabs
Merge into: lp:ubuntu-clock-app
Diff against target: 241 lines (+40/-53)
8 files modified
app/clock/ClockPage.qml (+10/-20)
app/clock/MainClock.qml (+1/-1)
app/components/Clock.qml (+1/-4)
app/ubuntu-clock-app.qml (+12/-14)
app/worldclock/UserWorldCityDelegate.qml (+2/-2)
debian/changelog (+1/-0)
debian/control (+1/-0)
tests/unit/MockClockApp.qml (+12/-12)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/migrate-u1db-to-qtlabs
Reviewer Review Type Date Requested Status
Bartosz Kosiorek 2015-08-18 Needs Fixing on 2016-01-05
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-08-18
Review via email: mp+268384@code.launchpad.net

Commit message

Migrated user clock settings from u1db to qt.labs.settings.

Description of the change

Migrates clock settings such as user location settings, digital/analogue mode setting from u1db to Qt.labs.settings for the following reasons,

- Recommended by the SDK developers to store app settings using Qt.labs.settings
- Code syntax is also much easier to understand and maintain
- Future stopwatch branch is also using Qt.labs.settings to store stopwatch status. So this will be a good point to unify them.

To post a comment you must log in.
review: Needs Fixing (continuous-integration)
342. By Nekhelesh Ramananthan on 2015-08-18

Added qt labs depedency to debian to fix failing unit test

review: Needs Fixing (continuous-integration)
343. By Nekhelesh Ramananthan on 2015-08-18

Added u1db database as it is needed for world city list

review: Approve (continuous-integration)
Bartosz Kosiorek (gang65) wrote :

I notices some issues regarding restoring clock type (analog or digital).
Steps to reproduce:

1. Add several world clock
2. Change clock from analog to digital. Notice that world clock are changed to digital
3. Close app
4. Run clock again
5. Notice that main clock face is digital, but all world clock is analog. Switching to analog is causing that world cities times are switching to digital

review: Needs Fixing
Bartosz Kosiorek (gang65) wrote :

After further testing, it seems that time need to start increased from 3,825s to 5.15s

I think it needs to be fixed.

review: Needs Fixing

Unmerged revisions

343. By Nekhelesh Ramananthan on 2015-08-18

Added u1db database as it is needed for world city list

342. By Nekhelesh Ramananthan on 2015-08-18

Added qt labs depedency to debian to fix failing unit test

341. By Nekhelesh Ramananthan on 2015-08-18

Updated debian changelog

340. By Nekhelesh Ramananthan on 2015-08-18

merged lp:ubuntu-clock-app

339. By Nekhelesh Ramananthan on 2015-08-18

Migrated clock settings from U1db to Qt.labs.settings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/clock/ClockPage.qml'
--- app/clock/ClockPage.qml 2015-08-07 11:45:17 +0000
+++ app/clock/ClockPage.qml 2015-08-18 21:21:30 +0000
@@ -17,7 +17,6 @@
17 */17 */
1818
19import QtQuick 2.419import QtQuick 2.4
20import U1db 1.0 as U1db
21import QtPositioning 5.220import QtPositioning 5.2
22import Ubuntu.Components 1.221import Ubuntu.Components 1.2
23import GeoLocation 1.022import GeoLocation 1.0
@@ -74,12 +73,8 @@
7473
75 // If this is the first time, then set location as Denied74 // If this is the first time, then set location as Denied
76 // to indicate user denying clock app location access.75 // to indicate user denying clock app location access.
77 if (userLocationDocument.contents.location === "Null") {76 if (clockLocationSetting.location === "Null") {
78 var locationData = JSON.parse77 clockLocationSetting.location = "Denied"
79 (JSON.stringify(userLocationDocument.contents))
80
81 locationData.location = "Denied"
82 userLocationDocument.contents = locationData
83 }78 }
84 }79 }
85 }80 }
@@ -94,8 +89,8 @@
94 Stop querying for the user location if it is found to be89 Stop querying for the user location if it is found to be
95 the same as the one stored in the app setting database90 the same as the one stored in the app setting database
96 */91 */
97 if (userLongitude === userLocationDocument.contents.long ||92 if (userLongitude === clockLocationSetting.longitude ||
98 userLatitude === userLocationDocument.contents.lat) {93 userLatitude === clockLocationSetting.latitude) {
99 if (geoposition.active) {94 if (geoposition.active) {
100 console.log("[LOG]: Stopping geolocation update service")95 console.log("[LOG]: Stopping geolocation update service")
101 geoposition.stop()96 geoposition.stop()
@@ -146,14 +141,9 @@
146 }141 }
147142
148 onLocationChanged: {143 onLocationChanged: {
149 var locationData = JSON.parse144 clockLocationSetting.latitude = geoposition.userLatitude
150 (JSON.stringify(userLocationDocument.contents))145 clockLocationSetting.longitude = geoposition.userLongitude
151146 clockLocationSetting.location = userLocation.location
152 locationData.lat = geoposition.userLatitude
153 locationData.long = geoposition.userLongitude
154 locationData.location = userLocation.location
155
156 userLocationDocument.contents = locationData
157147
158 /*148 /*
159 Stop querying the user coordinates once the user location has been149 Stop querying the user coordinates once the user location has been
@@ -278,14 +268,14 @@
278 color: UbuntuColors.midAubergine268 color: UbuntuColors.midAubergine
279269
280 text: {270 text: {
281 if (userLocationDocument.contents.location === "Null"271 if (clockLocationSetting.location === "Null"
282 || userLocationDocument.contents.location === "Denied"272 || clockLocationSetting.location === "Denied"
283 && geoposition.sourceError === PositionSource.NoError) {273 && geoposition.sourceError === PositionSource.NoError) {
284 return i18n.tr("Retrieving location...")274 return i18n.tr("Retrieving location...")
285 }275 }
286276
287 else {277 else {
288 return userLocationDocument.contents.location278 return clockLocationSetting.location
289 }279 }
290 }280 }
291 }281 }
292282
=== modified file 'app/clock/MainClock.qml'
--- app/clock/MainClock.qml 2015-05-27 16:03:23 +0000
+++ app/clock/MainClock.qml 2015-08-18 21:21:30 +0000
@@ -32,7 +32,7 @@
3232
33 isMainClock: true33 isMainClock: true
3434
35 isDigital: clockModeDocument.contents.digitalMode ? true : false35 isDigital: clockSetting.digitalMode ? true : false
3636
37 Component.onCompleted: {37 Component.onCompleted: {
38 clockOpenAnimation.start()38 clockOpenAnimation.start()
3939
=== modified file 'app/components/Clock.qml'
--- app/components/Clock.qml 2015-08-14 05:34:49 +0000
+++ app/components/Clock.qml 2015-08-18 21:21:30 +0000
@@ -243,10 +243,7 @@
243 analogShadow.source = digitalShadow.source = ""243 analogShadow.source = digitalShadow.source = ""
244244
245 if(isMainClock) {245 if(isMainClock) {
246 var isDigitalSetting = JSON.parse246 clockSetting.digitalMode = isDigital
247 (JSON.stringify(clockModeDocument.contents))
248 isDigitalSetting.digitalMode = isDigital
249 clockModeDocument.contents = isDigitalSetting
250 }247 }
251 }248 }
252 }249 }
253250
=== modified file 'app/ubuntu-clock-app.qml'
--- app/ubuntu-clock-app.qml 2015-07-15 22:31:52 +0000
+++ app/ubuntu-clock-app.qml 2015-08-18 21:21:30 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.419import QtQuick 2.4
20import DateTime 1.020import DateTime 1.0
21import U1db 1.0 as U1db21import U1db 1.0 as U1db
22import Qt.labs.settings 1.0
22import Ubuntu.Components 1.223import Ubuntu.Components 1.2
23import "clock"24import "clock"
24import "components"25import "components"
@@ -55,27 +56,24 @@
5556
56 Background {}57 Background {}
5758
58 // Database to store the user preferences locally59 // Database to store the saved user world city list locally
59 U1db.Database {60 U1db.Database {
60 id: clockDB61 id: clockDB
61 path: "user-preferences"62 path: "user-preferences"
62 }63 }
6364
64 // Document to store clock mode chosen by user65 Settings {
65 U1db.Document {66 id: clockSetting
66 id: clockModeDocument67 category: "Clock"
67 create: true68 property bool digitalMode: false
68 database: clockDB
69 docId: "clockModeDocument"
70 defaults: { "digitalMode": false }
71 }69 }
7270
73 U1db.Document {71 Settings {
74 id: userLocationDocument72 id: clockLocationSetting
75 create: true73 category: "Location"
76 database: clockDB74 property string latitude: "NaN"
77 docId: "userLocationDocument"75 property string longitude: "NaN"
78 defaults: { "lat": "NaN", "long": "Nan", "location": "Null" }76 property string location: "Null"
79 }77 }
8078
81 DateTime {79 DateTime {
8280
=== modified file 'app/worldclock/UserWorldCityDelegate.qml'
--- app/worldclock/UserWorldCityDelegate.qml 2015-08-14 05:34:49 +0000
+++ app/worldclock/UserWorldCityDelegate.qml 2015-08-18 21:21:30 +0000
@@ -104,8 +104,8 @@
104 }104 }
105105
106 Component.onCompleted: {106 Component.onCompleted: {
107 isDigital = clockModeDocument.contents.digitalMode ? true : false107 isDigital = clockSetting.digitalMode ? true : false
108 if (clockModeDocument.contents.digitalMode) {108 if (clockSetting.digitalMode) {
109 digitalModeLoader.setSource109 digitalModeLoader.setSource
110 ("../components/DigitalMode.qml",110 ("../components/DigitalMode.qml",
111 {111 {
112112
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-16 20:53:03 +0000
+++ debian/changelog 2015-08-18 21:21:30 +0000
@@ -14,6 +14,7 @@
14 * Added README.mergeproposal checklist to help with the review process.14 * Added README.mergeproposal checklist to help with the review process.
15 * Fix alarm interval information being inconsistent (LP: #1466000)15 * Fix alarm interval information being inconsistent (LP: #1466000)
16 * Changed default alarm sound (LP: #1354370)16 * Changed default alarm sound (LP: #1354370)
17 * Migrated clock settings from U1db to Qt.labs.settings 1.0
1718
18 [Victor Thompson]19 [Victor Thompson]
19 * Show all README files in QtCreator 20 * Show all README files in QtCreator
2021
=== modified file 'debian/control'
--- debian/control 2015-07-27 20:52:03 +0000
+++ debian/control 2015-08-18 21:21:30 +0000
@@ -10,6 +10,7 @@
10 ubuntu-touch-sounds,10 ubuntu-touch-sounds,
11 suru-icon-theme | ubuntu-mobile-icons,11 suru-icon-theme | ubuntu-mobile-icons,
12 qml-module-qttest,12 qml-module-qttest,
13 qml-module-qt-labs-settings,
13 qtdeclarative5-u1db1.0,14 qtdeclarative5-u1db1.0,
14 qtdeclarative5-qtmultimedia-plugin,15 qtdeclarative5-qtmultimedia-plugin,
15 qtdeclarative5-qtpositioning-plugin,16 qtdeclarative5-qtpositioning-plugin,
1617
=== modified file 'tests/unit/MockClockApp.qml'
--- tests/unit/MockClockApp.qml 2015-08-14 05:34:49 +0000
+++ tests/unit/MockClockApp.qml 2015-08-18 21:21:30 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.419import QtQuick 2.4
20import DateTime 1.020import DateTime 1.0
21import U1db 1.0 as U1db21import U1db 1.0 as U1db
22import Qt.labs.settings 1.0
22import Ubuntu.Components 1.223import Ubuntu.Components 1.2
23import "../../app/clock"24import "../../app/clock"
24import "../../app/components"25import "../../app/components"
@@ -39,25 +40,24 @@
39 height: units.gu(70)40 height: units.gu(70)
40 applicationName: "com.ubuntu.fakeclock.test"41 applicationName: "com.ubuntu.fakeclock.test"
4142
43 // Database to store the saved user world city list locally
42 U1db.Database {44 U1db.Database {
43 id: clockDB45 id: clockDB
44 path: "user-preferences"46 path: "user-preferences"
45 }47 }
4648
47 U1db.Document {49 Settings {
48 id: clockModeDocument50 id: clockSetting
49 create: true51 category: "Clock"
50 database: clockDB52 property bool digitalMode: false
51 docId: "clockModeDocument"
52 defaults: { "digitalMode": false }
53 }53 }
5454
55 U1db.Document {55 Settings {
56 id: userLocationDocument56 id: clockLocationSetting
57 create: true57 category: "Location"
58 database: clockDB58 property string latitude: "NaN"
59 docId: "userLocationDocument"59 property string longitude: "NaN"
60 defaults: { "lat": "NaN", "long": "Nan", "location": "Null" }60 property string location: "Null"
61 }61 }
6262
63 DateTime {63 DateTime {

Subscribers

People subscribed via source and target branches