Merge lp:~nik90/ubuntu-clock-app/edit-alarm-feature into lp:ubuntu-clock-app
- edit-alarm-feature
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 13 |
Proposed branch: | lp:~nik90/ubuntu-clock-app/edit-alarm-feature |
Merge into: | lp:ubuntu-clock-app |
Diff against target: |
1036 lines (+793/-129) 11 files modified
app/alarm/AlarmLabel.qml (+61/-0) app/alarm/AlarmList.qml (+117/-72) app/alarm/AlarmPage.qml (+14/-0) app/alarm/AlarmRepeat.qml (+108/-0) app/alarm/AlarmSound.qml (+115/-0) app/alarm/AlarmUtils.qml (+109/-50) app/alarm/EditAlarmPage.qml (+131/-0) app/clock/ClockPage.qml (+6/-2) app/components/PullToAdd.qml (+77/-0) app/components/SubtitledListItem.qml (+55/-0) app/ubuntu-clock-app.qml (+0/-5) |
To merge this branch: | bzr merge lp:~nik90/ubuntu-clock-app/edit-alarm-feature |
Related bugs: | |
Related blueprints: |
Alarms RTM
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Victor Thompson | Approve | ||
Andrew Hayzen | Pending | ||
Ubuntu Clock Developers | Pending | ||
Review via email: mp+224360@code.launchpad.net |
Commit message
Added support for creating new alarms and made the pulltoadd component as a generic component since it is required in two places.
Description of the change
This MP adds the following,
- Added support for creating new alarms
- Made the pulltoadd component as a generic component since it is required in two places
I will add support to edit saved alarms in my next branch
- 29. By Nekhelesh Ramananthan
-
merged trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 30. By Nekhelesh Ramananthan
-
merge master
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:30
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
Just a note that browsing the ringtones does not work on Trusty, conceivably because /usr/share/
Consider making the naming on the AlarmLabel.qml consistent. The page title is "Label", but the Label component on top of the text field is "Alarm Label". Consider getting rid of the Label "Alarm Label" since it is redundant information. Similarly, the word "Label" is poor terminology. I know it is what is in the design spec, but it is a poor term for a title or name of an alarm.
In my opinion there should not be a default "label" for a new alarm. The user should simply be required to add a label. No real person makes an alarm and lets it be labeled "Alarm #1".
The new alarm date picker should conform to the user's locale. In my locale I should see 7 AM, 12 PM, etc for 12 hour time.
When selecting multiple dates for an alarm, say Monday and Tuesday, when they are displayed in a comma separated fashion there is no space between them. Instead the days are displayed as "Monday,Tuesday". It'd be best to have a space in between.
There are numerous instances where "anchors" properties can be grouped. Consider doing so.
- 31. By Nekhelesh Ramananthan
-
Ensured strings are translatable
- 32. By Nekhelesh Ramananthan
-
Corrected code style for anchor properties
- 33. By Nekhelesh Ramananthan
-
reported upstream bug about date picker ignoring time locale of user. Added fixme note for that
Nekhelesh Ramananthan (nik90) wrote : | # |
> Consider making the naming on the AlarmLabel.qml consistent. The page title is
> "Label", but the Label component on top of the text field is "Alarm Label".
> Consider getting rid of the Label "Alarm Label" since it is redundant
> information. Similarly, the word "Label" is poor terminology. I know it is
> what is in the design spec, but it is a poor term for a title or name of an
> alarm.
>
I cannot change this without consulting with the with the designers about this. I would like to remove the "Alarm Label" as it is indeed redundant. Will see if I get a reply within 1-2 days. If not we should proceed to take care of this later as the current implementation does follow the design specs.
> In my opinion there should not be a default "label" for a new alarm. The user
> should simply be required to add a label. No real person makes an alarm and
> lets it be labeled "Alarm #1".
>
> The new alarm date picker should conform to the user's locale. In my locale I
> should see 7 AM, 12 PM, etc for 12 hour time.
This is a SDK bug. I have reported the issue and added a FIXME note in rev 33
>
> When selecting multiple dates for an alarm, say Monday and Tuesday, when they
> are displayed in a comma separated fashion there is no space between them.
> Instead the days are displayed as "Monday,Tuesday". It'd be best to have a
> space in between.
I am not sure how to fix this. In the output I have already added a empty string " " but it seems to be ignored. Got any ideas on how to fix this?
577 + else {
578 + return occurs + " "
579 + }
>
> There are numerous instances where "anchors" properties can be grouped.
> Consider doing so.
Fixed in rev 31
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:33
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
> Just a note that browsing the ringtones does not work on Trusty, conceivably
> because /usr/share/
> the current directory in this case. Perhaps you need some sort of fall back to
> show nothing when this directory does not exist. Otherwise the user can select
> random files in the current directory. Likewise, filtering on ogg and mp3
> files might be a good idea.
From Ubuntu 14.04 onwards, you need a specific package to get the ubuntu touch ringtones on the desktop. I am unable to remember what that package is. I have it installed on my 14.04 setup and I can browse the ringtones properly. Once we get the packaging fixed, that package will be added as a dependency for the clock app. So this shouldn't be an issue then.
I am not sure how to detect the existance of a folder. The QML FolderListModel http://
Nekhelesh Ramananthan (nik90) wrote : | # |
Victor, you will need the package ubuntu-touch-sounds package installed on your system. I will add it to the debian control file once the debian packaging is done.
Victor Thompson (vthompson) wrote : | # |
In order to fix the comma issue, I think you just need to do this:
bzr diff
=== modified file 'app/alarm/
--- app/alarm/
+++ app/alarm/
@@ -129,6 +129,8 @@
}
+ occurs = occurs.join(', ');
+
return occurs;
}
}
Victor Thompson (vthompson) wrote : | # |
Nik, could you address this:
> In my opinion there should not be a default "label" for a new alarm. The user should simply be
> required to add a label. No real person makes an alarm and lets it be labeled "Alarm #1".
Victor Thompson (vthompson) wrote : | # |
In terms of reacting to when the ringtones folder doesn't exist, perhaps you could do the following:
bzr diff
=== modified file 'app/alarm/
--- app/alarm/
+++ app/alarm/
@@ -31,6 +31,8 @@
FolderList
id: _soundModel
+ showDirs: false
+ nameFilters: [ "*.ogg", "*.mp3" ]
folder: "/usr/share/
}
This would 1) prevent directories from being shown in the model, and 2) filter the files allowable to just mp3 and ogg. I think you should do #1 because a directory can never be selected. I think it would be a good idea to do #2 as an additional safe guard, but one could argue that it would add extra maintenance work if the ringtones include additional filetypes in the future. As of right now they are all ogg files.
- 34. By Nekhelesh Ramananthan
-
Fixed alarm days spacing
- 35. By Nekhelesh Ramananthan
-
Ensured directories are never shown in the alarm sounds list. Also filtered the type of files that are shown.
- 36. By Nekhelesh Ramananthan
-
Set the default alarm name to Alarm
Nekhelesh Ramananthan (nik90) wrote : | # |
> In order to fix the comma issue, I think you just need to do this:
>
> bzr diff
> === modified file 'app/alarm/
> --- app/alarm/
> +++ app/alarm/
> @@ -129,6 +129,8 @@
> occurs.
> }
>
> + occurs = occurs.join(', ');
> +
> return occurs;
> }
> }
Thnx. That did the trick. Fixed in rev 34
Nekhelesh Ramananthan (nik90) wrote : | # |
> In terms of reacting to when the ringtones folder doesn't exist, perhaps you
> could do the following:
>
> bzr diff
> === modified file 'app/alarm/
> --- app/alarm/
> +++ app/alarm/
> @@ -31,6 +31,8 @@
>
> FolderListModel {
> id: _soundModel
> + showDirs: false
> + nameFilters: [ "*.ogg", "*.mp3" ]
> folder: "/usr/share/
> }
>
Fixed in rev 35
>
> This would 1) prevent directories from being shown in the model, and 2) filter
> the files allowable to just mp3 and ogg. I think you should do #1 because a
> directory can never be selected. I think it would be a good idea to do #2 as
> an additional safe guard, but one could argue that it would add extra
> maintenance work if the ringtones include additional filetypes in the future.
> As of right now they are all ogg files.
Nekhelesh Ramananthan (nik90) wrote : | # |
> Nik, could you address this:
>
> > In my opinion there should not be a default "label" for a new alarm. The
> user should simply be
> > required to add a label. No real person makes an alarm and lets it be
> labeled "Alarm #1".
I changed the default "label" for new alarms to just "Alarm" as specified in visual mock up shown to us at Malta https:/
I compared our solution with iOS and Android and noticed they do it as well.
The reason I don't want to keep it empty is because it increases the amount of steps the user needs to do before saving an alarm. As of now, the user needs to only adjust the time to create the alarm. Every other field has a sensible default value defined.
Victor Thompson (vthompson) wrote : | # |
Thanks for the explanation. lgtm now!
Nekhelesh Ramananthan (nik90) wrote : | # |
Victor Thanks a lot for taking the time to review :)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:36
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file 'app/alarm/AlarmLabel.qml' | |||
2 | --- app/alarm/AlarmLabel.qml 1970-01-01 00:00:00 +0000 | |||
3 | +++ app/alarm/AlarmLabel.qml 2014-07-07 08:40:55 +0000 | |||
4 | @@ -0,0 +1,61 @@ | |||
5 | 1 | /* | ||
6 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
7 | 3 | * | ||
8 | 4 | * This program is free software: you can redistribute it and/or modify | ||
9 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
10 | 6 | * published by the Free Software Foundation. | ||
11 | 7 | * | ||
12 | 8 | * This program is distributed in the hope that it will be useful, | ||
13 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | 11 | * GNU General Public License for more details. | ||
16 | 12 | * | ||
17 | 13 | * You should have received a copy of the GNU General Public License | ||
18 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | 15 | */ | ||
20 | 16 | |||
21 | 17 | import QtQuick 2.0 | ||
22 | 18 | import Ubuntu.Components 1.1 | ||
23 | 19 | |||
24 | 20 | Page { | ||
25 | 21 | id: _alarmLabelPage | ||
26 | 22 | |||
27 | 23 | visible: false | ||
28 | 24 | title: i18n.tr("Label") | ||
29 | 25 | |||
30 | 26 | // Property to set the alarm label in the edit alarm page | ||
31 | 27 | property var alarmLabel | ||
32 | 28 | |||
33 | 29 | Column { | ||
34 | 30 | id: _labelColumn | ||
35 | 31 | |||
36 | 32 | spacing: units.gu(0.5) | ||
37 | 33 | |||
38 | 34 | anchors { | ||
39 | 35 | fill: parent | ||
40 | 36 | margins: units.gu(2) | ||
41 | 37 | } | ||
42 | 38 | |||
43 | 39 | Label { | ||
44 | 40 | text: i18n.tr("Label") | ||
45 | 41 | } | ||
46 | 42 | |||
47 | 43 | TextField { | ||
48 | 44 | id: _labelEntry | ||
49 | 45 | text: alarmLabel.subText | ||
50 | 46 | width: parent.width | ||
51 | 47 | } | ||
52 | 48 | } | ||
53 | 49 | |||
54 | 50 | tools: ToolbarItems { | ||
55 | 51 | back: Button { | ||
56 | 52 | action: Action { | ||
57 | 53 | iconName: "back" | ||
58 | 54 | onTriggered: { | ||
59 | 55 | alarmLabel.subText = _labelEntry.text | ||
60 | 56 | mainStack.pop() | ||
61 | 57 | } | ||
62 | 58 | } | ||
63 | 59 | } | ||
64 | 60 | } | ||
65 | 61 | } | ||
66 | 0 | 62 | ||
67 | === modified file 'app/alarm/AlarmList.qml' | |||
68 | --- app/alarm/AlarmList.qml 2014-06-19 15:31:18 +0000 | |||
69 | +++ app/alarm/AlarmList.qml 2014-07-07 08:40:55 +0000 | |||
70 | @@ -17,89 +17,134 @@ | |||
71 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
72 | 18 | import Ubuntu.Components 1.1 | 18 | import Ubuntu.Components 1.1 |
73 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem |
74 | 20 | import "../components" | ||
75 | 21 | import "../components/Utils.js" as Utils | ||
76 | 20 | 22 | ||
79 | 21 | Column { | 23 | Flickable { |
80 | 22 | id: listAlarm | 24 | id: alarmListFlickable |
81 | 25 | objectName: "alarmListFlickable" | ||
82 | 23 | 26 | ||
83 | 24 | // Property to set the model of the saved alarm list | 27 | // Property to set the model of the saved alarm list |
85 | 25 | property alias model: listSavedAlarm.model | 28 | property var model |
86 | 29 | |||
87 | 30 | /* | ||
88 | 31 | Property to set the maximum drag distance before freezing the pull to add | ||
89 | 32 | button resize | ||
90 | 33 | */ | ||
91 | 34 | property int _maxThreshold: -80 | ||
92 | 35 | |||
93 | 36 | /* | ||
94 | 37 | Property to set the minimum drag distance before activating the add | ||
95 | 38 | alarm signal | ||
96 | 39 | */ | ||
97 | 40 | property int _minThreshold: _maxThreshold + 10 | ||
98 | 41 | |||
99 | 42 | clip: true | ||
100 | 43 | anchors.fill: parent | ||
101 | 44 | contentHeight: alarmList.height | ||
102 | 26 | 45 | ||
103 | 27 | AlarmUtils { | 46 | AlarmUtils { |
104 | 28 | id: alarmUtils | 47 | id: alarmUtils |
105 | 29 | } | 48 | } |
106 | 30 | 49 | ||
142 | 31 | ListView { | 50 | PullToAdd { |
143 | 32 | id: listSavedAlarm | 51 | id: addAlarmButton |
144 | 33 | objectName: "listSavedAlarm" | 52 | |
145 | 34 | 53 | anchors { | |
146 | 35 | clip: true | 54 | top: parent.top |
147 | 36 | height: parent.height | 55 | topMargin: -labelHeight - units.gu(6) |
148 | 37 | anchors.left: parent.left | 56 | horizontalCenter: parent.horizontalCenter |
149 | 38 | anchors.right: parent.right | 57 | } |
150 | 39 | 58 | ||
151 | 40 | currentIndex: -1 | 59 | leftLabel: i18n.tr("Add") |
152 | 41 | 60 | rightLabel: i18n.tr("Alarm") | |
153 | 42 | delegate: ListItem.Base { | 61 | maxThreshold: alarmListFlickable._maxThreshold |
154 | 43 | objectName: "alarm" + index | 62 | } |
155 | 44 | 63 | ||
156 | 45 | Label { | 64 | Column { |
157 | 46 | id: alarmTime | 65 | id: alarmList |
158 | 47 | objectName: "listAlarmTime" + index | 66 | anchors.fill: parent |
159 | 48 | 67 | ||
160 | 49 | anchors.verticalCenter: parent.verticalCenter | 68 | Repeater { |
161 | 50 | anchors.left: parent.left | 69 | model: alarmListFlickable.model |
162 | 51 | anchors.leftMargin: units.gu(0) | 70 | ListItem.Base { |
163 | 52 | 71 | ||
164 | 53 | fontSize: "medium" | 72 | height: units.gu(7) |
130 | 54 | text: Qt.formatTime(date) | ||
131 | 55 | } | ||
132 | 56 | |||
133 | 57 | Column { | ||
134 | 58 | id: alarmDetailsColumn | ||
135 | 59 | |||
136 | 60 | anchors { | ||
137 | 61 | left: alarmTime.right | ||
138 | 62 | right: alarmStatus.left | ||
139 | 63 | verticalCenter: parent.verticalCenter | ||
140 | 64 | margins: units.gu(1) | ||
141 | 65 | } | ||
165 | 66 | 73 | ||
166 | 67 | Label { | 74 | Label { |
171 | 68 | id: alarmLabel | 75 | id: alarmTime |
172 | 69 | objectName: "listAlarmLabel" + index | 76 | |
173 | 70 | 77 | anchors { | |
174 | 71 | text: message | 78 | top: alarmDetailsColumn.top |
175 | 79 | left: parent.left | ||
176 | 80 | leftMargin: units.gu(0) | ||
177 | 81 | } | ||
178 | 82 | |||
179 | 72 | fontSize: "medium" | 83 | fontSize: "medium" |
210 | 73 | elide: Text.ElideRight | 84 | text: Qt.formatTime(date) |
211 | 74 | color: UbuntuColors.midAubergine | 85 | } |
212 | 75 | } | 86 | |
213 | 76 | 87 | Column { | |
214 | 77 | Label { | 88 | id: alarmDetailsColumn |
215 | 78 | id: alarmSubtitle | 89 | |
216 | 79 | objectName: "listAlarmSubtitle" + index | 90 | anchors { |
217 | 80 | 91 | left: alarmTime.right | |
218 | 81 | fontSize: "xx-small" | 92 | right: alarmStatus.left |
219 | 82 | text: alarmUtils.format_day_string(daysOfWeek, type) | 93 | verticalCenter: parent.verticalCenter |
220 | 83 | } | 94 | margins: units.gu(1) |
221 | 84 | } | 95 | } |
222 | 85 | 96 | ||
223 | 86 | Switch { | 97 | Label { |
224 | 87 | id: alarmStatus | 98 | id: alarmLabel |
225 | 88 | 99 | ||
226 | 89 | anchors.right: parent.right | 100 | text: message |
227 | 90 | anchors.verticalCenter: parent.verticalCenter | 101 | fontSize: "medium" |
228 | 91 | 102 | elide: Text.ElideRight | |
229 | 92 | enabled: model.enabled | 103 | color: UbuntuColors.midAubergine |
230 | 93 | } | 104 | } |
231 | 94 | 105 | ||
232 | 95 | selected: listSavedAlarm.currentIndex == index | 106 | Label { |
233 | 96 | removable: true | 107 | id: alarmSubtitle |
234 | 97 | confirmRemoval: true | 108 | |
235 | 98 | 109 | fontSize: "xx-small" | |
236 | 99 | onItemRemoved: { | 110 | width: parent.width |
237 | 100 | var alarm = alarmModel.get(index) | 111 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
238 | 101 | alarm.cancel() | 112 | text: alarmUtils.format_day_string(daysOfWeek) |
239 | 102 | } | 113 | } |
240 | 114 | } | ||
241 | 115 | |||
242 | 116 | Switch { | ||
243 | 117 | id: alarmStatus | ||
244 | 118 | |||
245 | 119 | anchors { | ||
246 | 120 | right: parent.right | ||
247 | 121 | verticalCenter: parent.verticalCenter | ||
248 | 122 | } | ||
249 | 123 | |||
250 | 124 | checked: enabled | ||
251 | 125 | } | ||
252 | 126 | |||
253 | 127 | removable: true | ||
254 | 128 | confirmRemoval: true | ||
255 | 129 | |||
256 | 130 | onItemRemoved: { | ||
257 | 131 | var alarm = alarmModel.get(index) | ||
258 | 132 | alarm.cancel() | ||
259 | 133 | } | ||
260 | 134 | } | ||
261 | 135 | } | ||
262 | 136 | } | ||
263 | 137 | |||
264 | 138 | onDragEnded: { | ||
265 | 139 | if(contentY < _minThreshold) | ||
266 | 140 | mainStack.push(Qt.resolvedUrl("EditAlarmPage.qml"), | ||
267 | 141 | {"alarmCount": alarmModel.count}) | ||
268 | 142 | } | ||
269 | 143 | |||
270 | 144 | onContentYChanged: { | ||
271 | 145 | if(contentY < 0 && atYBeginning) { | ||
272 | 146 | addAlarmButton.dragPosition = contentY.toFixed(0) | ||
273 | 103 | } | 147 | } |
274 | 104 | } | 148 | } |
275 | 105 | } | 149 | } |
276 | 150 | |||
277 | 106 | 151 | ||
278 | === modified file 'app/alarm/AlarmPage.qml' | |||
279 | --- app/alarm/AlarmPage.qml 2014-06-16 14:09:12 +0000 | |||
280 | +++ app/alarm/AlarmPage.qml 2014-07-07 08:40:55 +0000 | |||
281 | @@ -16,10 +16,20 @@ | |||
282 | 16 | 16 | ||
283 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
284 | 18 | import Ubuntu.Components 1.1 | 18 | import Ubuntu.Components 1.1 |
285 | 19 | import "../components/Utils.js" as Utils | ||
286 | 19 | 20 | ||
287 | 20 | Page { | 21 | Page { |
288 | 21 | title: "Alarms" | 22 | title: "Alarms" |
289 | 22 | 23 | ||
290 | 24 | flickable: null | ||
291 | 25 | |||
292 | 26 | Component.onCompleted: Utils.log(debugMode, "Alarm Page loaded") | ||
293 | 27 | |||
294 | 28 | AlarmModel { | ||
295 | 29 | id: alarmModel | ||
296 | 30 | Component.onCompleted: Utils.log(debugMode, "Alarm Database loaded") | ||
297 | 31 | } | ||
298 | 32 | |||
299 | 23 | AlarmList{ | 33 | AlarmList{ |
300 | 24 | id: listAlarm | 34 | id: listAlarm |
301 | 25 | model: alarmModel | 35 | model: alarmModel |
302 | @@ -39,6 +49,10 @@ | |||
303 | 39 | ToolbarButton { | 49 | ToolbarButton { |
304 | 40 | action: Action { | 50 | action: Action { |
305 | 41 | iconName: "add" | 51 | iconName: "add" |
306 | 52 | onTriggered: { | ||
307 | 53 | mainStack.push(Qt.resolvedUrl("EditAlarmPage.qml"), | ||
308 | 54 | {"alarmCount": alarmModel.count}) | ||
309 | 55 | } | ||
310 | 42 | } | 56 | } |
311 | 43 | } | 57 | } |
312 | 44 | } | 58 | } |
313 | 45 | 59 | ||
314 | === added file 'app/alarm/AlarmRepeat.qml' | |||
315 | --- app/alarm/AlarmRepeat.qml 1970-01-01 00:00:00 +0000 | |||
316 | +++ app/alarm/AlarmRepeat.qml 2014-07-07 08:40:55 +0000 | |||
317 | @@ -0,0 +1,108 @@ | |||
318 | 1 | /* | ||
319 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
320 | 3 | * | ||
321 | 4 | * This program is free software: you can redistribute it and/or modify | ||
322 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
323 | 6 | * published by the Free Software Foundation. | ||
324 | 7 | * | ||
325 | 8 | * This program is distributed in the hope that it will be useful, | ||
326 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
327 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
328 | 11 | * GNU General Public License for more details. | ||
329 | 12 | * | ||
330 | 13 | * You should have received a copy of the GNU General Public License | ||
331 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
332 | 15 | */ | ||
333 | 16 | |||
334 | 17 | import QtQuick 2.0 | ||
335 | 18 | import Ubuntu.Components 1.1 | ||
336 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
337 | 20 | |||
338 | 21 | Page { | ||
339 | 22 | id: _alarmRepeatPage | ||
340 | 23 | |||
341 | 24 | visible: false | ||
342 | 25 | title: i18n.tr("Repeat") | ||
343 | 26 | |||
344 | 27 | // Property to set the alarm days of the week in the edit alarm page | ||
345 | 28 | property var alarm | ||
346 | 29 | |||
347 | 30 | ListModel { | ||
348 | 31 | id: daysModel | ||
349 | 32 | |||
350 | 33 | ListElement { | ||
351 | 34 | day: "1" | ||
352 | 35 | flag: Alarm.Monday | ||
353 | 36 | } | ||
354 | 37 | |||
355 | 38 | ListElement { | ||
356 | 39 | day: "2" | ||
357 | 40 | flag: Alarm.Tuesday | ||
358 | 41 | } | ||
359 | 42 | |||
360 | 43 | ListElement { | ||
361 | 44 | day: "3" | ||
362 | 45 | flag: Alarm.Wednesday | ||
363 | 46 | } | ||
364 | 47 | |||
365 | 48 | ListElement { | ||
366 | 49 | day: "4" | ||
367 | 50 | flag: Alarm.Thursday | ||
368 | 51 | } | ||
369 | 52 | |||
370 | 53 | ListElement { | ||
371 | 54 | day: "5" | ||
372 | 55 | flag: Alarm.Friday | ||
373 | 56 | } | ||
374 | 57 | |||
375 | 58 | ListElement { | ||
376 | 59 | day: "6" | ||
377 | 60 | flag: Alarm.Saturday | ||
378 | 61 | } | ||
379 | 62 | |||
380 | 63 | ListElement { | ||
381 | 64 | day: "0" | ||
382 | 65 | flag: Alarm.Sunday | ||
383 | 66 | } | ||
384 | 67 | } | ||
385 | 68 | |||
386 | 69 | Column { | ||
387 | 70 | id: _alarmDayColumn | ||
388 | 71 | |||
389 | 72 | anchors.fill: parent | ||
390 | 73 | |||
391 | 74 | Repeater { | ||
392 | 75 | id: _alarmDays | ||
393 | 76 | |||
394 | 77 | model: daysModel | ||
395 | 78 | |||
396 | 79 | ListItem.Standard { | ||
397 | 80 | Label { | ||
398 | 81 | id: _alarmDay | ||
399 | 82 | |||
400 | 83 | anchors { | ||
401 | 84 | left: parent.left | ||
402 | 85 | leftMargin: units.gu(2) | ||
403 | 86 | verticalCenter: parent.verticalCenter | ||
404 | 87 | } | ||
405 | 88 | |||
406 | 89 | color: UbuntuColors.midAubergine | ||
407 | 90 | text: Qt.locale().standaloneDayName(day, Locale.LongFormat) | ||
408 | 91 | } | ||
409 | 92 | |||
410 | 93 | control: Switch { | ||
411 | 94 | checked: (alarm.daysOfWeek & flag) == flag | ||
412 | 95 | onCheckedChanged: { | ||
413 | 96 | if (checked) { | ||
414 | 97 | alarm.daysOfWeek |= flag | ||
415 | 98 | } | ||
416 | 99 | |||
417 | 100 | else { | ||
418 | 101 | alarm.daysOfWeek &= ~flag | ||
419 | 102 | } | ||
420 | 103 | } | ||
421 | 104 | } | ||
422 | 105 | } | ||
423 | 106 | } | ||
424 | 107 | } | ||
425 | 108 | } | ||
426 | 0 | 109 | ||
427 | === added file 'app/alarm/AlarmSound.qml' | |||
428 | --- app/alarm/AlarmSound.qml 1970-01-01 00:00:00 +0000 | |||
429 | +++ app/alarm/AlarmSound.qml 2014-07-07 08:40:55 +0000 | |||
430 | @@ -0,0 +1,115 @@ | |||
431 | 1 | /* | ||
432 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
433 | 3 | * | ||
434 | 4 | * This program is free software: you can redistribute it and/or modify | ||
435 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
436 | 6 | * published by the Free Software Foundation. | ||
437 | 7 | * | ||
438 | 8 | * This program is distributed in the hope that it will be useful, | ||
439 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
440 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
441 | 11 | * GNU General Public License for more details. | ||
442 | 12 | * | ||
443 | 13 | * You should have received a copy of the GNU General Public License | ||
444 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
445 | 15 | */ | ||
446 | 16 | |||
447 | 17 | import QtQuick 2.0 | ||
448 | 18 | import Ubuntu.Components 1.1 | ||
449 | 19 | import Qt.labs.folderlistmodel 2.1 | ||
450 | 20 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
451 | 21 | |||
452 | 22 | Page { | ||
453 | 23 | id: _alarmSoundPage | ||
454 | 24 | |||
455 | 25 | title: i18n.tr("Sound") | ||
456 | 26 | flickable: _pageFlickable | ||
457 | 27 | visible: false | ||
458 | 28 | |||
459 | 29 | // Property to set the alarm sound in the edit alarm page | ||
460 | 30 | property var alarmSound | ||
461 | 31 | |||
462 | 32 | FolderListModel { | ||
463 | 33 | id: _soundModel | ||
464 | 34 | showDirs: false | ||
465 | 35 | nameFilters: [ "*.ogg", "*.mp3" ] | ||
466 | 36 | folder: "/usr/share/sounds/ubuntu/ringtones" | ||
467 | 37 | } | ||
468 | 38 | |||
469 | 39 | Flickable { | ||
470 | 40 | id: _pageFlickable | ||
471 | 41 | |||
472 | 42 | clip: true | ||
473 | 43 | anchors.fill: parent | ||
474 | 44 | contentHeight: _soundModel.count * units.gu(7) | ||
475 | 45 | |||
476 | 46 | Column { | ||
477 | 47 | id: _alarmSoundColumn | ||
478 | 48 | |||
479 | 49 | anchors.fill: parent | ||
480 | 50 | |||
481 | 51 | Repeater { | ||
482 | 52 | id: _alarmSounds | ||
483 | 53 | |||
484 | 54 | model: _soundModel | ||
485 | 55 | |||
486 | 56 | ListItem.Base { | ||
487 | 57 | id: _alarmSoundDelegate | ||
488 | 58 | |||
489 | 59 | property alias isChecked: _soundStatus.checked | ||
490 | 60 | |||
491 | 61 | height: units.gu(7) | ||
492 | 62 | |||
493 | 63 | Label { | ||
494 | 64 | id: _soundName | ||
495 | 65 | |||
496 | 66 | anchors { | ||
497 | 67 | left: parent.left | ||
498 | 68 | verticalCenter: parent.verticalCenter | ||
499 | 69 | } | ||
500 | 70 | |||
501 | 71 | color: UbuntuColors.midAubergine | ||
502 | 72 | fontSize: "medium" | ||
503 | 73 | text: fileBaseName | ||
504 | 74 | } | ||
505 | 75 | |||
506 | 76 | CheckBox { | ||
507 | 77 | id: _soundStatus | ||
508 | 78 | |||
509 | 79 | anchors { | ||
510 | 80 | right: parent.right | ||
511 | 81 | verticalCenter: parent.verticalCenter | ||
512 | 82 | } | ||
513 | 83 | |||
514 | 84 | checked: alarmSound.subText === _soundName.text ? true : | ||
515 | 85 | false | ||
516 | 86 | onClicked: { | ||
517 | 87 | if (checked) { | ||
518 | 88 | alarmSound.subText = _soundName.text | ||
519 | 89 | |||
520 | 90 | // Ensures only one alarm sound is selected | ||
521 | 91 | for(var i=0; i<_soundModel.count; i++) { | ||
522 | 92 | if(_alarmSounds.itemAt(i).isChecked && | ||
523 | 93 | i !== index) { | ||
524 | 94 | _alarmSounds.itemAt(i).isChecked = false | ||
525 | 95 | } | ||
526 | 96 | } | ||
527 | 97 | } | ||
528 | 98 | } | ||
529 | 99 | } | ||
530 | 100 | } | ||
531 | 101 | } | ||
532 | 102 | } | ||
533 | 103 | } | ||
534 | 104 | |||
535 | 105 | tools: ToolbarItems { | ||
536 | 106 | back: Button { | ||
537 | 107 | action: Action { | ||
538 | 108 | iconName: "back" | ||
539 | 109 | onTriggered: { | ||
540 | 110 | mainStack.pop() | ||
541 | 111 | } | ||
542 | 112 | } | ||
543 | 113 | } | ||
544 | 114 | } | ||
545 | 115 | } | ||
546 | 0 | 116 | ||
547 | === modified file 'app/alarm/AlarmUtils.qml' | |||
548 | --- app/alarm/AlarmUtils.qml 2014-06-19 15:31:18 +0000 | |||
549 | +++ app/alarm/AlarmUtils.qml 2014-07-07 08:40:55 +0000 | |||
550 | @@ -17,61 +17,120 @@ | |||
551 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
552 | 18 | import Ubuntu.Components 1.1 | 18 | import Ubuntu.Components 1.1 |
553 | 19 | 19 | ||
554 | 20 | /* | ||
555 | 21 | Qt Object containing a collection of useful alarm functions | ||
556 | 22 | */ | ||
557 | 20 | QtObject { | 23 | QtObject { |
558 | 21 | id: alarmUtils | 24 | id: alarmUtils |
559 | 22 | 25 | ||
563 | 23 | function format_day_string(value, type) { | 26 | // Function to format the alarm days accordingly to their occurance |
564 | 24 | var occurs = get_day(value, type); | 27 | function format_day_string(value) { |
565 | 25 | var WeekDay = 0; | 28 | var occurs = _get_day(value) |
566 | 29 | |||
567 | 30 | if (value === _get_weekdays()) { | ||
568 | 31 | return i18n.tr("Weekdays") | ||
569 | 32 | } | ||
570 | 33 | |||
571 | 34 | else if (value === _get_weekends()) { | ||
572 | 35 | return i18n.tr("Weekends") | ||
573 | 36 | } | ||
574 | 37 | |||
575 | 38 | else if (value === Alarm.Daily) { | ||
576 | 39 | return i18n.tr("Daily") | ||
577 | 40 | } | ||
578 | 41 | |||
579 | 42 | else { | ||
580 | 43 | return occurs | ||
581 | 44 | } | ||
582 | 45 | } | ||
583 | 46 | |||
584 | 47 | /* | ||
585 | 48 | INTERNAL FUNCTIONS | ||
586 | 49 | */ | ||
587 | 50 | |||
588 | 51 | // Function to determine the locale's weekdays value | ||
589 | 52 | function _get_weekdays() { | ||
590 | 53 | var weekDays = 0 | ||
591 | 26 | for (var i = 0; i < Qt.locale().weekDays.length; ++i) { | 54 | for (var i = 0; i < Qt.locale().weekDays.length; ++i) { |
592 | 27 | switch (Qt.locale().weekDays[i]) { | 55 | switch (Qt.locale().weekDays[i]) { |
640 | 28 | case Qt.Monday: | 56 | case Qt.Monday: { |
641 | 29 | WeekDay |= Alarm.Monday | 57 | weekDays |= Alarm.Monday |
642 | 30 | break; | 58 | break |
643 | 31 | case Qt.Tuesday: | 59 | } |
644 | 32 | WeekDay |= Alarm.Tuesday | 60 | |
645 | 33 | break; | 61 | case Qt.Tuesday: { |
646 | 34 | case Qt.Wednesday: | 62 | weekDays |= Alarm.Tuesday |
647 | 35 | WeekDay |= Alarm.Wednesday | 63 | break |
648 | 36 | break; | 64 | } |
649 | 37 | case Qt.Thursday: | 65 | |
650 | 38 | WeekDay |= Alarm.Thursday | 66 | case Qt.Wednesday: { |
651 | 39 | break; | 67 | weekDays |= Alarm.Wednesday |
652 | 40 | case Qt.Friday: | 68 | break |
653 | 41 | WeekDay |= Alarm.Friday | 69 | } |
654 | 42 | break; | 70 | |
655 | 43 | case Qt.Saturday: | 71 | case Qt.Thursday: { |
656 | 44 | WeekDay |= Alarm.Saturday | 72 | weekDays |= Alarm.Thursday |
657 | 45 | break; | 73 | break |
658 | 46 | case Qt.Sunday: | 74 | } |
659 | 47 | WeekDay |= Alarm.Sunday | 75 | |
660 | 48 | break; | 76 | case Qt.Friday: { |
661 | 49 | } | 77 | weekDays |= Alarm.Friday |
662 | 50 | } | 78 | break |
663 | 51 | 79 | } | |
664 | 52 | if (value == WeekDay) { | 80 | |
665 | 53 | return i18n.tr("Every weekday") | 81 | case Qt.Saturday: { |
666 | 54 | } | 82 | weekDays |= Alarm.Saturday |
667 | 55 | else if (value == Alarm.Daily) { | 83 | break |
668 | 56 | return i18n.tr("Daily") | 84 | } |
669 | 57 | } | 85 | |
670 | 58 | else { | 86 | case Qt.Sunday: { |
671 | 59 | if (type === Alarm.Repeating) | 87 | weekDays |= Alarm.Sunday |
672 | 60 | return i18n.tr("Every ") + occurs | 88 | break |
673 | 61 | else | 89 | } |
674 | 62 | return i18n.tr("Once on ") + occurs | 90 | } |
675 | 63 | } | 91 | } |
676 | 64 | } | 92 | return weekDays |
677 | 65 | 93 | } | |
678 | 66 | function get_day(value, type) { | 94 | |
679 | 67 | var occurs = []; | 95 | // Function to determine the locale's weekends value |
680 | 68 | if (value & Alarm.Monday) occurs.push(Qt.locale().standaloneDayName(1, Locale.ShortFormat)); | 96 | function _get_weekends() { |
681 | 69 | if (value & Alarm.Tuesday) occurs.push(Qt.locale().standaloneDayName(2, Locale.ShortFormat)); | 97 | return (Alarm.Daily - _get_weekdays()) |
682 | 70 | if (value & Alarm.Wednesday) occurs.push(Qt.locale().standaloneDayName(3, Locale.ShortFormat)); | 98 | } |
683 | 71 | if (value & Alarm.Thursday) occurs.push(Qt.locale().standaloneDayName(4, Locale.ShortFormat)); | 99 | |
684 | 72 | if (value & Alarm.Friday) occurs.push(Qt.locale().standaloneDayName(5, Locale.ShortFormat)); | 100 | // Function to retrieve the days of the week in the locale system |
685 | 73 | if (value & Alarm.Saturday) occurs.push(Qt.locale().standaloneDayName(6, Locale.ShortFormat)); | 101 | function _get_day(value) { |
686 | 74 | if (value & Alarm.Sunday) occurs.push(Qt.locale().standaloneDayName(7, Locale.ShortFormat)); | 102 | var occurs = [] |
687 | 103 | |||
688 | 104 | if (value & Alarm.Monday) { | ||
689 | 105 | occurs.push(Qt.locale().standaloneDayName(1, Locale.LongFormat)) | ||
690 | 106 | } | ||
691 | 107 | |||
692 | 108 | if (value & Alarm.Tuesday) { | ||
693 | 109 | occurs.push(Qt.locale().standaloneDayName(2, Locale.LongFormat)) | ||
694 | 110 | } | ||
695 | 111 | |||
696 | 112 | if (value & Alarm.Wednesday) { | ||
697 | 113 | occurs.push(Qt.locale().standaloneDayName(3, Locale.LongFormat)) | ||
698 | 114 | } | ||
699 | 115 | |||
700 | 116 | if (value & Alarm.Thursday) { | ||
701 | 117 | occurs.push(Qt.locale().standaloneDayName(4, Locale.LongFormat)) | ||
702 | 118 | } | ||
703 | 119 | |||
704 | 120 | if (value & Alarm.Friday) { | ||
705 | 121 | occurs.push(Qt.locale().standaloneDayName(5, Locale.LongFormat)) | ||
706 | 122 | } | ||
707 | 123 | |||
708 | 124 | if (value & Alarm.Saturday) { | ||
709 | 125 | occurs.push(Qt.locale().standaloneDayName(6, Locale.LongFormat)) | ||
710 | 126 | } | ||
711 | 127 | |||
712 | 128 | if (value & Alarm.Sunday) { | ||
713 | 129 | occurs.push(Qt.locale().standaloneDayName(0, Locale.LongFormat)) | ||
714 | 130 | } | ||
715 | 131 | |||
716 | 132 | occurs = occurs.join(', '); | ||
717 | 133 | |||
718 | 75 | return occurs; | 134 | return occurs; |
719 | 76 | } | 135 | } |
720 | 77 | } | 136 | } |
721 | 78 | 137 | ||
722 | === added file 'app/alarm/EditAlarmPage.qml' | |||
723 | --- app/alarm/EditAlarmPage.qml 1970-01-01 00:00:00 +0000 | |||
724 | +++ app/alarm/EditAlarmPage.qml 2014-07-07 08:40:55 +0000 | |||
725 | @@ -0,0 +1,131 @@ | |||
726 | 1 | /* | ||
727 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
728 | 3 | * | ||
729 | 4 | * This program is free software: you can redistribute it and/or modify | ||
730 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
731 | 6 | * published by the Free Software Foundation. | ||
732 | 7 | * | ||
733 | 8 | * This program is distributed in the hope that it will be useful, | ||
734 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
735 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
736 | 11 | * GNU General Public License for more details. | ||
737 | 12 | * | ||
738 | 13 | * You should have received a copy of the GNU General Public License | ||
739 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
740 | 15 | */ | ||
741 | 16 | |||
742 | 17 | import QtQuick 2.0 | ||
743 | 18 | import Ubuntu.Components 1.1 | ||
744 | 19 | import Ubuntu.Components.Pickers 1.0 | ||
745 | 20 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
746 | 21 | import "../components" | ||
747 | 22 | import "../components/Utils.js" as Utils | ||
748 | 23 | |||
749 | 24 | Page { | ||
750 | 25 | id: _addAlarmPage | ||
751 | 26 | |||
752 | 27 | title: i18n.tr("New Alarm") | ||
753 | 28 | visible: false | ||
754 | 29 | |||
755 | 30 | // Function to save a new alarm | ||
756 | 31 | function saveNewAlarm() { | ||
757 | 32 | var alarmTime = new Date() | ||
758 | 33 | alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0) | ||
759 | 34 | |||
760 | 35 | _alarm.message = _alarmLabel.subText | ||
761 | 36 | _alarm.date = alarmTime | ||
762 | 37 | _alarm.type = Alarm.Repeating | ||
763 | 38 | _alarm.enabled = true | ||
764 | 39 | _alarm.save() | ||
765 | 40 | } | ||
766 | 41 | |||
767 | 42 | Alarm { | ||
768 | 43 | id: _alarm | ||
769 | 44 | onStatusChanged: { | ||
770 | 45 | if (status !== Alarm.Ready) | ||
771 | 46 | return; | ||
772 | 47 | if ((operation > Alarm.NoOperation) && | ||
773 | 48 | (operation < Alarm.Reseting)) { | ||
774 | 49 | mainStack.pop(); | ||
775 | 50 | } | ||
776 | 51 | } | ||
777 | 52 | } | ||
778 | 53 | |||
779 | 54 | AlarmUtils { | ||
780 | 55 | id: alarmUtils | ||
781 | 56 | } | ||
782 | 57 | |||
783 | 58 | Column { | ||
784 | 59 | id: _alarmColumn | ||
785 | 60 | |||
786 | 61 | anchors.fill: parent | ||
787 | 62 | |||
788 | 63 | DatePicker { | ||
789 | 64 | id: _timePicker | ||
790 | 65 | |||
791 | 66 | /* | ||
792 | 67 | #FIXME: DatePicker does not respect the user's locale. The bug | ||
793 | 68 | has been reported at http://pad.lv/1338138 | ||
794 | 69 | */ | ||
795 | 70 | |||
796 | 71 | anchors { | ||
797 | 72 | left: parent.left | ||
798 | 73 | right: parent.right | ||
799 | 74 | margins: units.gu(-2) | ||
800 | 75 | } | ||
801 | 76 | |||
802 | 77 | clip: true | ||
803 | 78 | mode: "Hours|Minutes" | ||
804 | 79 | } | ||
805 | 80 | |||
806 | 81 | SubtitledListItem { | ||
807 | 82 | id: _alarmRepeat | ||
808 | 83 | |||
809 | 84 | text: i18n.tr("Repeat") | ||
810 | 85 | subText: alarmUtils.format_day_string(_alarm.daysOfWeek) | ||
811 | 86 | onClicked: mainStack.push(Qt.resolvedUrl("AlarmRepeat.qml"), | ||
812 | 87 | {"alarm": _alarm}) | ||
813 | 88 | } | ||
814 | 89 | |||
815 | 90 | SubtitledListItem { | ||
816 | 91 | id: _alarmLabel | ||
817 | 92 | |||
818 | 93 | text: i18n.tr("Label") | ||
819 | 94 | subText: i18n.tr("Alarm") | ||
820 | 95 | onClicked: mainStack.push(Qt.resolvedUrl("AlarmLabel.qml"), | ||
821 | 96 | {"alarmLabel": _alarmLabel}) | ||
822 | 97 | } | ||
823 | 98 | |||
824 | 99 | SubtitledListItem { | ||
825 | 100 | id: _alarmSound | ||
826 | 101 | /* | ||
827 | 102 | #TODO: Add support for choosing new alarm sound when indicator- | ||
828 | 103 | datetime supports custom alarm sounds | ||
829 | 104 | */ | ||
830 | 105 | text: i18n.tr("Sound (disabled)") | ||
831 | 106 | subText: "Suru arpeggio" | ||
832 | 107 | onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"), | ||
833 | 108 | {"alarmSound": _alarmSound}) | ||
834 | 109 | } | ||
835 | 110 | } | ||
836 | 111 | |||
837 | 112 | tools: ToolbarItems { | ||
838 | 113 | back: Button { | ||
839 | 114 | action: Action { | ||
840 | 115 | iconName: "close" | ||
841 | 116 | onTriggered: { | ||
842 | 117 | mainStack.pop() | ||
843 | 118 | } | ||
844 | 119 | } | ||
845 | 120 | } | ||
846 | 121 | |||
847 | 122 | ToolbarButton { | ||
848 | 123 | action: Action { | ||
849 | 124 | iconName: "save" | ||
850 | 125 | onTriggered: { | ||
851 | 126 | saveNewAlarm() | ||
852 | 127 | } | ||
853 | 128 | } | ||
854 | 129 | } | ||
855 | 130 | } | ||
856 | 131 | } | ||
857 | 0 | 132 | ||
858 | === modified file 'app/clock/ClockPage.qml' | |||
859 | --- app/clock/ClockPage.qml 2014-06-21 16:42:08 +0000 | |||
860 | +++ app/clock/ClockPage.qml 2014-07-07 08:40:55 +0000 | |||
861 | @@ -49,12 +49,16 @@ | |||
862 | 49 | contentWidth: parent.width | 49 | contentWidth: parent.width |
863 | 50 | contentHeight: clock.height + date.height + locationRow.height | 50 | contentHeight: clock.height + date.height + locationRow.height |
864 | 51 | 51 | ||
866 | 52 | AddCityButton { | 52 | PullToAdd { |
867 | 53 | id: addCityButton | 53 | id: addCityButton |
868 | 54 | |||
869 | 54 | anchors.top: parent.top | 55 | anchors.top: parent.top |
870 | 55 | anchors.topMargin: -labelHeight - units.gu(6) | 56 | anchors.topMargin: -labelHeight - units.gu(6) |
871 | 56 | anchors.horizontalCenter: parent.horizontalCenter | 57 | anchors.horizontalCenter: parent.horizontalCenter |
873 | 57 | maxThreshold: _maxThreshold | 58 | |
874 | 59 | leftLabel: i18n.tr("Add") | ||
875 | 60 | rightLabel: i18n.tr("City") | ||
876 | 61 | maxThreshold: clockPage._maxThreshold | ||
877 | 58 | } | 62 | } |
878 | 59 | 63 | ||
879 | 60 | Clock { | 64 | Clock { |
880 | 61 | 65 | ||
881 | === added file 'app/components/PullToAdd.qml' | |||
882 | --- app/components/PullToAdd.qml 1970-01-01 00:00:00 +0000 | |||
883 | +++ app/components/PullToAdd.qml 2014-07-07 08:40:55 +0000 | |||
884 | @@ -0,0 +1,77 @@ | |||
885 | 1 | /* | ||
886 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
887 | 3 | * | ||
888 | 4 | * This program is free software: you can redistribute it and/or modify | ||
889 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
890 | 6 | * published by the Free Software Foundation. | ||
891 | 7 | * | ||
892 | 8 | * This program is distributed in the hope that it will be useful, | ||
893 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
894 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
895 | 11 | * GNU General Public License for more details. | ||
896 | 12 | * | ||
897 | 13 | * You should have received a copy of the GNU General Public License | ||
898 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
899 | 15 | */ | ||
900 | 16 | |||
901 | 17 | import QtQuick 2.0 | ||
902 | 18 | import Ubuntu.Components 1.1 | ||
903 | 19 | |||
904 | 20 | Row { | ||
905 | 21 | id: _pullToAdd | ||
906 | 22 | |||
907 | 23 | // Property to get the position of the button from the top | ||
908 | 24 | property int dragPosition: 0 | ||
909 | 25 | |||
910 | 26 | // Property to store the height of the label | ||
911 | 27 | property alias labelHeight: _leftLabel.height | ||
912 | 28 | |||
913 | 29 | // Property to set the label on the left side of the add button | ||
914 | 30 | property alias leftLabel: _leftLabel.text | ||
915 | 31 | |||
916 | 32 | // Property to set the label on the right side of the add button | ||
917 | 33 | property alias rightLabel: _rightLabel.text | ||
918 | 34 | |||
919 | 35 | // Property to set the maximum threshold beyond which the button shouldn't resize | ||
920 | 36 | property int maxThreshold | ||
921 | 37 | |||
922 | 38 | spacing: units.gu(1) | ||
923 | 39 | |||
924 | 40 | Label { | ||
925 | 41 | id: _leftLabel | ||
926 | 42 | |||
927 | 43 | text: "pull" | ||
928 | 44 | fontSize: "medium" | ||
929 | 45 | color: UbuntuColors.midAubergine | ||
930 | 46 | anchors.verticalCenter: parent.verticalCenter | ||
931 | 47 | } | ||
932 | 48 | |||
933 | 49 | ClockCircle { | ||
934 | 50 | id: _addButton | ||
935 | 51 | |||
936 | 52 | isOuter: true | ||
937 | 53 | width: dragPosition >= maxThreshold ? dragPosition * units.gu(6.5)/maxThreshold : units.gu(6.5) | ||
938 | 54 | |||
939 | 55 | ClockCircle { | ||
940 | 56 | width: dragPosition >= maxThreshold ? dragPosition * units.gu(4.5)/maxThreshold : units.gu(4.5) | ||
941 | 57 | anchors.centerIn: parent | ||
942 | 58 | |||
943 | 59 | Label { | ||
944 | 60 | id: plusLabel | ||
945 | 61 | |||
946 | 62 | anchors.centerIn: parent | ||
947 | 63 | font.pixelSize: dragPosition >= maxThreshold ? dragPosition * units.dp(30)/maxThreshold : units.dp(30) | ||
948 | 64 | text: "+" | ||
949 | 65 | } | ||
950 | 66 | } | ||
951 | 67 | } | ||
952 | 68 | |||
953 | 69 | Label { | ||
954 | 70 | id: _rightLabel | ||
955 | 71 | |||
956 | 72 | text: "down" | ||
957 | 73 | fontSize: "medium" | ||
958 | 74 | color: UbuntuColors.midAubergine | ||
959 | 75 | anchors.verticalCenter: parent.verticalCenter | ||
960 | 76 | } | ||
961 | 77 | } | ||
962 | 0 | 78 | ||
963 | === added file 'app/components/SubtitledListItem.qml' | |||
964 | --- app/components/SubtitledListItem.qml 1970-01-01 00:00:00 +0000 | |||
965 | +++ app/components/SubtitledListItem.qml 2014-07-07 08:40:55 +0000 | |||
966 | @@ -0,0 +1,55 @@ | |||
967 | 1 | /* | ||
968 | 2 | * Copyright (C) 2014 Canonical Ltd | ||
969 | 3 | * | ||
970 | 4 | * This program is free software: you can redistribute it and/or modify | ||
971 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
972 | 6 | * published by the Free Software Foundation. | ||
973 | 7 | * | ||
974 | 8 | * This program is distributed in the hope that it will be useful, | ||
975 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
976 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
977 | 11 | * GNU General Public License for more details. | ||
978 | 12 | * | ||
979 | 13 | * You should have received a copy of the GNU General Public License | ||
980 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
981 | 15 | */ | ||
982 | 16 | |||
983 | 17 | import QtQuick 2.0 | ||
984 | 18 | import Ubuntu.Components 1.1 | ||
985 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
986 | 20 | |||
987 | 21 | /* | ||
988 | 22 | This component is almost an identical copy of the SDK's subtitled with the | ||
989 | 23 | exception of the font size and color required by the new clock app design. | ||
990 | 24 | |||
991 | 25 | #TODO: Revert to using the SDK Subtitled Component when they change the | ||
992 | 26 | design to match the new clock app design. | ||
993 | 27 | */ | ||
994 | 28 | ListItem.Base { | ||
995 | 29 | id: _subtitledContainer | ||
996 | 30 | |||
997 | 31 | // Property to set the main text label | ||
998 | 32 | property alias text: _mainText.text | ||
999 | 33 | |||
1000 | 34 | // Property to set the subtitle label | ||
1001 | 35 | property alias subText: _subText.text | ||
1002 | 36 | |||
1003 | 37 | height: units.gu(7) | ||
1004 | 38 | |||
1005 | 39 | Column { | ||
1006 | 40 | id: _labelColumn | ||
1007 | 41 | |||
1008 | 42 | anchors.verticalCenter: parent.verticalCenter | ||
1009 | 43 | |||
1010 | 44 | Label { | ||
1011 | 45 | id: _mainText | ||
1012 | 46 | fontSize: "medium" | ||
1013 | 47 | color: UbuntuColors.midAubergine | ||
1014 | 48 | } | ||
1015 | 49 | |||
1016 | 50 | Label { | ||
1017 | 51 | id: _subText | ||
1018 | 52 | fontSize: "xx-small" | ||
1019 | 53 | } | ||
1020 | 54 | } | ||
1021 | 55 | } | ||
1022 | 0 | 56 | ||
1023 | === modified file 'app/ubuntu-clock-app.qml' | |||
1024 | --- app/ubuntu-clock-app.qml 2014-06-17 18:06:24 +0000 | |||
1025 | +++ app/ubuntu-clock-app.qml 2014-07-07 08:40:55 +0000 | |||
1026 | @@ -74,11 +74,6 @@ | |||
1027 | 74 | onTriggered: clockPage.updateTime() | 74 | onTriggered: clockPage.updateTime() |
1028 | 75 | } | 75 | } |
1029 | 76 | 76 | ||
1030 | 77 | AlarmModel { | ||
1031 | 78 | id: alarmModel | ||
1032 | 79 | Component.onCompleted: Utils.log(debugMode, "Alarm Database loaded") | ||
1033 | 80 | } | ||
1034 | 81 | |||
1035 | 82 | PageStack { | 77 | PageStack { |
1036 | 83 | id: mainStack | 78 | id: mainStack |
1037 | 84 | 79 |
FAILED: Continuous integration, rev:29 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-ci/ 3/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 705/console 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-utopic- amd64-ci/ 3/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-ci/ 3/rebuild
http://