Merge lp:~ubuntu-clock-dev/ubuntu-clock-app/night-mode into lp:ubuntu-clock-app

Proposed by Victor Thompson
Status: Work in progress
Proposed branch: lp:~ubuntu-clock-dev/ubuntu-clock-app/night-mode
Merge into: lp:ubuntu-clock-app
Diff against target: 510 lines (+133/-42)
15 files modified
app/alarm/AlarmPage.qml (+2/-0)
app/alarm/AlarmSettingsPage.qml (+44/-0)
app/alarm/EditAlarmPage.qml (+2/-0)
app/clock/ClockPage.qml (+2/-2)
app/components/Background.qml (+1/-1)
app/components/Clock.qml (+3/-3)
app/components/ClockCircle.qml (+1/-1)
app/components/DigitalMode.qml (+2/-2)
app/components/LightBackground.qml (+32/-0)
app/ubuntu-clock-app.qml (+3/-1)
app/upstreamcomponents/PageWithBottomEdge.qml (+2/-1)
app/worldclock/AddWorldCityButton.qml (+3/-3)
app/worldclock/UserWorldCityDelegate.qml (+3/-1)
app/worldclock/WorldCityList.qml (+2/-0)
po/com.ubuntu.clock.pot (+31/-27)
To merge this branch: bzr merge lp:~ubuntu-clock-dev/ubuntu-clock-app/night-mode
Reviewer Review Type Date Requested Status
Bartosz Kosiorek Needs Information
Review via email: mp+250543@code.launchpad.net

Commit message

Introduce Night mode user setting

Description of the change

This MP is just to get a diff of the this WIP prototype

To post a comment you must log in.
203. By Victor Thompson

Merge of trunk

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Wow. Awensome work.
I wish I could approve that MR. Could you please ask ~raecontreras, if he has spare time to approve UX design for that?

review: Needs Information
204. By Victor Thompson

Update some colors, update new component to QTQ 2.4 and UC 1.2.

205. By Victor Thompson

Merge of trunk

Unmerged revisions

205. By Victor Thompson

Merge of trunk

204. By Victor Thompson

Update some colors, update new component to QTQ 2.4 and UC 1.2.

203. By Victor Thompson

Merge of trunk

202. By Victor Thompson

* Prototype initial Night mode

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmPage.qml'
2--- app/alarm/AlarmPage.qml 2015-07-16 21:02:18 +0000
3+++ app/alarm/AlarmPage.qml 2015-07-17 21:47:41 +0000
4@@ -139,6 +139,8 @@
5 }
6 }
7
8+ LightBackground {}
9+
10 AlarmList {
11 id: alarmListView
12 listModel: alarmModel
13
14=== modified file 'app/alarm/AlarmSettingsPage.qml'
15--- app/alarm/AlarmSettingsPage.qml 2015-07-15 22:31:52 +0000
16+++ app/alarm/AlarmSettingsPage.qml 2015-07-17 21:47:41 +0000
17@@ -45,6 +45,8 @@
18 id: alarmSettings
19 }
20
21+ LightBackground {}
22+
23 ListModel {
24 id: durationModel
25 Component.onCompleted: initialise()
26@@ -209,6 +211,48 @@
27 }
28 }
29
30+ ListItem.Empty {
31+ Label {
32+ text: i18n.tr("Night mode")
33+ color: UbuntuColors.midAubergine
34+ anchors {
35+ left: parent.left
36+ leftMargin: units.gu(2)
37+ verticalCenter: parent.verticalCenter
38+ }
39+ }
40+
41+ Switch {
42+ id: nightModeSwitch
43+
44+ anchors {
45+ right: parent.right
46+ rightMargin: units.gu(2)
47+ verticalCenter: parent.verticalCenter
48+ }
49+
50+ checked: isNightMode === true
51+
52+ onCheckedChanged: {
53+ isNightMode = checked
54+ checked: isNightMode === true
55+ var appSettings = JSON.parse
56+ (JSON.stringify(clockModeDocument.contents))
57+ appSettings.nightMode = isNightMode
58+
59+ if(checked) {
60+ clockModeDocument.contents = appSettings
61+ } else {
62+ clockModeDocument.contents = appSettings
63+ }
64+ }
65+ }
66+
67+ onClicked: {
68+ nightModeSwitch.checked = !nightModeSwitch.checked
69+ }
70+ }
71+
72 SubtitledListItem {
73 text: i18n.tr("Change time and date")
74 subText: {
75
76=== modified file 'app/alarm/EditAlarmPage.qml'
77--- app/alarm/EditAlarmPage.qml 2015-05-27 16:03:23 +0000
78+++ app/alarm/EditAlarmPage.qml 2015-07-17 21:47:41 +0000
79@@ -153,6 +153,8 @@
80 }
81 }
82
83+ LightBackground {}
84+
85 Alarm {
86 id: _alarm
87
88
89=== modified file 'app/clock/ClockPage.qml'
90--- app/clock/ClockPage.qml 2015-05-27 16:03:23 +0000
91+++ app/clock/ClockPage.qml 2015-07-17 21:47:41 +0000
92@@ -244,7 +244,7 @@
93
94 text: clock.analogTime.toLocaleDateString()
95 opacity: settingsIcon.opacity
96- color: locationRow.visible ? Theme.palette.baseText : UbuntuColors.midAubergine
97+ color: isNightMode ? UbuntuColors.warmGrey : (locationRow.visible ? Theme.palette.baseText : UbuntuColors.midAubergine)
98 fontSize: "medium"
99 }
100
101@@ -275,7 +275,7 @@
102
103 fontSize: "medium"
104 anchors.verticalCenter: locationIcon.verticalCenter
105- color: UbuntuColors.midAubergine
106+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
107
108 text: {
109 if (userLocationDocument.contents.location === "Null"
110
111=== modified file 'app/components/Background.qml'
112--- app/components/Background.qml 2015-05-27 16:03:23 +0000
113+++ app/components/Background.qml 2015-07-17 21:47:41 +0000
114@@ -28,5 +28,5 @@
115
116 asynchronous: true
117 anchors.fill: parent
118- source: "../graphics/Background_Texture.jpg"
119+ source: isNightMode ? "../graphics/Background_Texture_Dark.jpg" : "../graphics/Background_Texture.jpg"
120 }
121
122=== modified file 'app/components/Clock.qml'
123--- app/components/Clock.qml 2015-05-27 16:03:23 +0000
124+++ app/components/Clock.qml 2015-07-17 21:47:41 +0000
125@@ -243,10 +243,10 @@
126 analogShadow.source = digitalShadow.source = ""
127
128 if(isMainClock) {
129- var isDigitalSetting = JSON.parse
130+ var appSettings = JSON.parse
131 (JSON.stringify(clockModeDocument.contents))
132- isDigitalSetting.digitalMode = isDigital
133- clockModeDocument.contents = isDigitalSetting
134+ appSettings.digitalMode = isDigital
135+ clockModeDocument.contents = appSettings
136 }
137 }
138 }
139
140=== modified file 'app/components/ClockCircle.qml'
141--- app/components/ClockCircle.qml 2015-05-27 16:03:23 +0000
142+++ app/components/ClockCircle.qml 2015-07-17 21:47:41 +0000
143@@ -89,7 +89,7 @@
144 Image {
145 smooth: false
146 fillMode: Image.PreserveAspectFit
147- source: "../graphics/Inner_Clock_Texture.png"
148+ source: isNightMode ? "../graphics/Inner_Clock_Texture_Dark.png" : "../graphics/Inner_Clock_Texture.png"
149 }
150 }
151
152
153=== modified file 'app/components/DigitalMode.qml'
154--- app/components/DigitalMode.qml 2015-05-27 16:03:23 +0000
155+++ app/components/DigitalMode.qml 2015-07-17 21:47:41 +0000
156@@ -53,7 +53,7 @@
157
158 anchors.centerIn: parent
159
160- color: UbuntuColors.midAubergine
161+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
162 font.pixelSize: units.dp(1)
163 text: {
164 if (time.search(Qt.locale().amText) !== -1) {
165@@ -77,7 +77,7 @@
166 anchors.top: _digitalTime.bottom
167 anchors.horizontalCenter: parent.horizontalCenter
168
169- color: UbuntuColors.midAubergine
170+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
171 font.pixelSize: units.dp(1)
172 visible: text !== ""
173 text: {
174
175=== added file 'app/components/LightBackground.qml'
176--- app/components/LightBackground.qml 1970-01-01 00:00:00 +0000
177+++ app/components/LightBackground.qml 2015-07-17 21:47:41 +0000
178@@ -0,0 +1,32 @@
179+/*
180+ * Copyright (C) 2014-2015 Canonical Ltd
181+ *
182+ * This file is part of Ubuntu Clock App
183+ *
184+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
185+ * it under the terms of the GNU General Public License version 3 as
186+ * published by the Free Software Foundation.
187+ *
188+ * Ubuntu Clock App is distributed in the hope that it will be useful,
189+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
190+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
191+ * GNU General Public License for more details.
192+ *
193+ * You should have received a copy of the GNU General Public License
194+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
195+ */
196+
197+import QtQuick 2.4
198+import Ubuntu.Components 1.2
199+
200+/*
201+ Component to set the background of the app
202+ */
203+
204+Image {
205+ id: _background
206+
207+ asynchronous: true
208+ anchors.fill: parent
209+ source: "../graphics/Background_Texture.jpg"
210+}
211
212=== added file 'app/graphics/Background_Texture_Dark.jpg'
213Binary files app/graphics/Background_Texture_Dark.jpg 1970-01-01 00:00:00 +0000 and app/graphics/Background_Texture_Dark.jpg 2015-07-17 21:47:41 +0000 differ
214=== added file 'app/graphics/Inner_Clock_Texture_Dark.png'
215Binary files app/graphics/Inner_Clock_Texture_Dark.png 1970-01-01 00:00:00 +0000 and app/graphics/Inner_Clock_Texture_Dark.png 2015-07-17 21:47:41 +0000 differ
216=== modified file 'app/ubuntu-clock-app.qml'
217--- app/ubuntu-clock-app.qml 2015-07-15 22:31:52 +0000
218+++ app/ubuntu-clock-app.qml 2015-07-17 21:47:41 +0000
219@@ -42,6 +42,8 @@
220 */
221 automaticOrientation: false
222
223+ property bool isNightMode: clockModeDocument.contents.nightMode
224+
225 /*
226 The width and height defined below are the same dimension used by the
227 designers in the clock visual spec.
228@@ -67,7 +69,7 @@
229 create: true
230 database: clockDB
231 docId: "clockModeDocument"
232- defaults: { "digitalMode": false }
233+ defaults: { "digitalMode": false, "nightMode": false }
234 }
235
236 U1db.Document {
237
238=== modified file 'app/upstreamcomponents/PageWithBottomEdge.qml'
239--- app/upstreamcomponents/PageWithBottomEdge.qml 2015-05-27 16:03:23 +0000
240+++ app/upstreamcomponents/PageWithBottomEdge.qml 2015-07-17 21:47:41 +0000
241@@ -175,7 +175,7 @@
242 z: 1
243 width: tipLabel.paintedWidth + units.gu(6)
244 height: bottomEdge.tipHeight + units.gu(1)
245- color: Theme.palette.normal.overlay
246+ color: isNightMode ? "black" : Theme.palette.normal.overlay // CUSTOM
247 Label {
248 id: tipLabel
249
250@@ -184,6 +184,7 @@
251 left: parent.left
252 right: parent.right
253 }
254+ color: isNightMode ? UbuntuColors.warmGrey : "black" // CUSTOM
255 height: bottomEdge.tipHeight
256 verticalAlignment: Text.AlignVCenter
257 horizontalAlignment: Text.AlignHCenter
258
259=== modified file 'app/worldclock/AddWorldCityButton.qml'
260--- app/worldclock/AddWorldCityButton.qml 2015-05-27 16:03:23 +0000
261+++ app/worldclock/AddWorldCityButton.qml 2015-07-17 21:47:41 +0000
262@@ -28,7 +28,7 @@
263
264 Label {
265 text: i18n.tr("Add")
266- color: UbuntuColors.midAubergine
267+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
268 anchors {
269 right: _addButton.left
270 rightMargin: units.gu(1)
271@@ -49,7 +49,7 @@
272
273 Icon {
274 anchors.centerIn: parent
275- color: UbuntuColors.coolGrey
276+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.coolGrey
277 name: "add"
278 height: units.gu(2)
279 width: height
280@@ -59,7 +59,7 @@
281
282 Label {
283 text: i18n.tr("City")
284- color: UbuntuColors.midAubergine
285+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
286 anchors {
287 left: _addButton.right
288 leftMargin: units.gu(1)
289
290=== modified file 'app/worldclock/UserWorldCityDelegate.qml'
291--- app/worldclock/UserWorldCityDelegate.qml 2015-05-27 16:03:23 +0000
292+++ app/worldclock/UserWorldCityDelegate.qml 2015-07-17 21:47:41 +0000
293@@ -56,7 +56,7 @@
294 objectName: "userCityNameText"
295 width: parent.width
296 elide: Text.ElideRight
297- color: UbuntuColors.midAubergine
298+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.midAubergine
299 }
300
301 Label {
302@@ -65,6 +65,7 @@
303 fontSize: "xx-small"
304 width: parent.width
305 elide: Text.ElideRight
306+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.coolGrey
307 }
308 }
309
310@@ -138,6 +139,7 @@
311 maximumLineCount: 2
312 elide: Text.ElideRight
313 horizontalAlignment: Text.AlignRight
314+ color: isNightMode ? UbuntuColors.warmGrey : UbuntuColors.coolGrey
315 text: {
316 var day;
317
318
319=== modified file 'app/worldclock/WorldCityList.qml'
320--- app/worldclock/WorldCityList.qml 2015-06-18 22:57:49 +0000
321+++ app/worldclock/WorldCityList.qml 2015-07-17 21:47:41 +0000
322@@ -152,6 +152,8 @@
323 }
324 }
325
326+ LightBackground {}
327+
328 /*
329 Loader to allow for dynamic loading/unloading of the json model only when
330 necessary.
331
332=== modified file 'po/com.ubuntu.clock.pot'
333--- po/com.ubuntu.clock.pot 2015-07-15 23:50:07 +0000
334+++ po/com.ubuntu.clock.pot 2015-07-17 21:47:41 +0000
335@@ -8,7 +8,7 @@
336 msgstr ""
337 "Project-Id-Version: \n"
338 "Report-Msgid-Bugs-To: \n"
339-"POT-Creation-Date: 2015-07-16 01:36+0200\n"
340+"POT-Creation-Date: 2015-07-17 16:44-0500\n"
341 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
342 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
343 "Language-Team: LANGUAGE <LL@li.org>\n"
344@@ -19,7 +19,7 @@
345 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
346
347 #: ../app/alarm/AlarmLabel.qml:30 ../app/alarm/AlarmLabel.qml:56
348-#: ../app/alarm/EditAlarmPage.qml:291
349+#: ../app/alarm/EditAlarmPage.qml:293
350 msgid "Label"
351 msgstr ""
352
353@@ -38,7 +38,7 @@
354 msgstr ""
355
356 #: ../app/alarm/AlarmPage.qml:51 ../app/alarm/EditAlarmPage.qml:44
357-#: ../app/alarm/EditAlarmPage.qml:166
358+#: ../app/alarm/EditAlarmPage.qml:168
359 msgid "Alarm"
360 msgstr ""
361
362@@ -50,15 +50,15 @@
363 msgid "Select All"
364 msgstr ""
365
366-#: ../app/alarm/AlarmPage.qml:162
367+#: ../app/alarm/AlarmPage.qml:164
368 msgid "No saved alarms"
369 msgstr ""
370
371-#: ../app/alarm/AlarmPage.qml:163
372+#: ../app/alarm/AlarmPage.qml:165
373 msgid "Tap the + icon to add an alarm"
374 msgstr ""
375
376-#: ../app/alarm/AlarmRepeat.qml:34 ../app/alarm/EditAlarmPage.qml:281
377+#: ../app/alarm/AlarmRepeat.qml:34 ../app/alarm/EditAlarmPage.qml:283
378 msgid "Repeat"
379 msgstr ""
380
381@@ -68,39 +68,43 @@
382
383 #. TRANSLATORS: Silence after
384 #. TRANSLATORS: Snooze for
385-#: ../app/alarm/AlarmSettingsPage.qml:54 ../app/alarm/AlarmSettingsPage.qml:55
386 #: ../app/alarm/AlarmSettingsPage.qml:56 ../app/alarm/AlarmSettingsPage.qml:57
387-#: ../app/alarm/AlarmSettingsPage.qml:67 ../app/alarm/AlarmSettingsPage.qml:68
388+#: ../app/alarm/AlarmSettingsPage.qml:58 ../app/alarm/AlarmSettingsPage.qml:59
389 #: ../app/alarm/AlarmSettingsPage.qml:69 ../app/alarm/AlarmSettingsPage.qml:70
390-#: ../app/alarm/AlarmSettingsPage.qml:126
391-#: ../app/alarm/AlarmSettingsPage.qml:154
392+#: ../app/alarm/AlarmSettingsPage.qml:71 ../app/alarm/AlarmSettingsPage.qml:72
393+#: ../app/alarm/AlarmSettingsPage.qml:128
394+#: ../app/alarm/AlarmSettingsPage.qml:156
395 #, qt-format
396 msgid "%1 minute"
397 msgid_plural "%1 minutes"
398 msgstr[0] ""
399 msgstr[1] ""
400
401-#: ../app/alarm/AlarmSettingsPage.qml:94
402+#: ../app/alarm/AlarmSettingsPage.qml:96
403 msgid "Alarm volume"
404 msgstr ""
405
406-#: ../app/alarm/AlarmSettingsPage.qml:125
407+#: ../app/alarm/AlarmSettingsPage.qml:127
408 msgid "Silence after"
409 msgstr ""
410
411-#: ../app/alarm/AlarmSettingsPage.qml:153
412+#: ../app/alarm/AlarmSettingsPage.qml:155
413 msgid "Snooze for"
414 msgstr ""
415
416-#: ../app/alarm/AlarmSettingsPage.qml:179
417+#: ../app/alarm/AlarmSettingsPage.qml:181
418 msgid "Vibration"
419 msgstr ""
420
421-#: ../app/alarm/AlarmSettingsPage.qml:213
422+#: ../app/alarm/AlarmSettingsPage.qml:216
423+msgid "Night mode"
424+msgstr ""
425+
426+#: ../app/alarm/AlarmSettingsPage.qml:257
427 msgid "Change time and date"
428 msgstr ""
429
430-#: ../app/alarm/AlarmSound.qml:28 ../app/alarm/EditAlarmPage.qml:304
431+#: ../app/alarm/AlarmSound.qml:28 ../app/alarm/EditAlarmPage.qml:306
432 msgid "Sound"
433 msgstr ""
434
435@@ -156,7 +160,7 @@
436 msgid "Edit alarm"
437 msgstr ""
438
439-#: ../app/alarm/EditAlarmPage.qml:325
440+#: ../app/alarm/EditAlarmPage.qml:327
441 msgid "Delete alarm"
442 msgstr ""
443
444@@ -175,37 +179,37 @@
445
446 #. TRANSLATORS: this indicates if the time in a world clock
447 #. is behind or ahead of the time at the current location
448-#: ../app/worldclock/UserWorldCityDelegate.qml:146
449+#: ../app/worldclock/UserWorldCityDelegate.qml:148
450 msgid "behind"
451 msgstr ""
452
453-#: ../app/worldclock/UserWorldCityDelegate.qml:147
454+#: ../app/worldclock/UserWorldCityDelegate.qml:149
455 msgid "ahead"
456 msgstr ""
457
458 #. TRANSLATORS: the first argument is hour, followed by
459 #. minute, and the translation for either 'behind' or
460 #. 'ahead'
461-#: ../app/worldclock/UserWorldCityDelegate.qml:157
462+#: ../app/worldclock/UserWorldCityDelegate.qml:159
463 #, qt-format
464 msgid "%1h %2m %3"
465 msgstr ""
466
467 #. TRANSLATORS: the first argument is hour, followed by the
468 #. translation for either 'behind' or 'ahead'
469-#: ../app/worldclock/UserWorldCityDelegate.qml:166
470+#: ../app/worldclock/UserWorldCityDelegate.qml:168
471 #, qt-format
472 msgid "%1h %2"
473 msgstr ""
474
475 #. TRANSLATORS: the first argument is minute, followed by the
476 #. translation for either 'behind' or 'ahead'
477-#: ../app/worldclock/UserWorldCityDelegate.qml:174
478+#: ../app/worldclock/UserWorldCityDelegate.qml:176
479 #, qt-format
480 msgid "%1m %2"
481 msgstr ""
482
483-#: ../app/worldclock/UserWorldCityDelegate.qml:180
484+#: ../app/worldclock/UserWorldCityDelegate.qml:182
485 msgid "Same time"
486 msgstr ""
487
488@@ -217,19 +221,19 @@
489 msgid "Search..."
490 msgstr ""
491
492-#: ../app/worldclock/WorldCityList.qml:213
493+#: ../app/worldclock/WorldCityList.qml:215
494 msgid "Searching for a city"
495 msgstr ""
496
497-#: ../app/worldclock/WorldCityList.qml:218
498+#: ../app/worldclock/WorldCityList.qml:220
499 msgid "No City Found"
500 msgstr ""
501
502-#: ../app/worldclock/WorldCityList.qml:224
503+#: ../app/worldclock/WorldCityList.qml:226
504 msgid "Unable to connect."
505 msgstr ""
506
507-#: ../app/worldclock/WorldCityList.qml:225
508+#: ../app/worldclock/WorldCityList.qml:227
509 msgid "Please check your network connection and try again"
510 msgstr ""
511

Subscribers

People subscribed via source and target branches

to all changes: