62
Component.onCompleted: initialise()
64
function initialise() {
65
snoozeModel.append({ "duration": 2, "text": i18n.tr("%1 minutes").arg(2) })
66
snoozeModel.append({ "duration": 4, "text": i18n.tr("%1 minutes").arg(4) })
67
snoozeModel.append({ "duration": 5, "text": i18n.tr("%1 minutes").arg(5) })
68
snoozeModel.append({ "duration": 10, "text": i18n.tr("%1 minutes").arg(10) })
75
contentHeight: _settingsColumn.height
62
76
anchors.fill: parent
65
height: 2 * implicitHeight
68
color: UbuntuColors.midAubergine
69
text: i18n.tr("Alarm volume")
70
anchors.top: parent.top
71
anchors.topMargin: units.gu(1)
75
anchors.centerIn: parent
80
value: alarmSettings.volume
83
alarmSettings.volume = formatValue(value)
93
85
right: parent.right
98
expandedHeight: _contentColumn.height + units.gu(1)
106
height: _alarmDuration.collapsedHeight
110
text: i18n.tr("Silence after")
111
subText: i18n.tr("%1 minutes").arg(alarmSettings.duration)
112
onClicked: _alarmDuration.expanded = true
119
anchors.right: parent.right
120
anchors.verticalCenter: parent.verticalCenter
124
rotation: _alarmDuration.expanded ? 180 : 0
126
Behavior on rotation {
127
UbuntuNumberAnimation {}
139
delegate: ListItem.Standard {
142
alarmSettings.duration = duration
143
_alarmDuration.expanded = false
152
text: i18n.tr("Vibration")
153
color: UbuntuColors.midAubergine
154
anchors.verticalCenter: parent.verticalCenter
162
verticalCenter: parent.verticalCenter
165
checked: alarmSettings.vibration === "pulse"
168
alarmSettings.vibration = "pulse"
170
alarmSettings.vibration = "none"
176
vibrateSwitch.checked = !vibrateSwitch.checked
181
text: i18n.tr("Change time and date")
89
height: 2 * implicitHeight
92
color: UbuntuColors.midAubergine
93
text: i18n.tr("Alarm volume")
94
anchors.top: parent.top
95
anchors.topMargin: units.gu(1)
99
anchors.centerIn: parent
104
value: alarmSettings.volume
107
alarmSettings.volume = formatValue(value)
112
ListItem.Expandable {
118
margins: units.gu(-2)
121
collapseOnClick: true
122
expandedHeight: _contentColumn.height + units.gu(1)
130
height: _alarmDuration.collapsedHeight
134
text: i18n.tr("Silence after")
135
subText: i18n.tr("%1 minutes").arg(alarmSettings.duration)
136
onClicked: _alarmDuration.expanded = true
143
anchors.right: parent.right
144
anchors.verticalCenter: parent.verticalCenter
148
rotation: _alarmDuration.expanded ? 180 : 0
150
Behavior on rotation {
151
UbuntuNumberAnimation {}
164
delegate: ListItem.Standard {
167
alarmSettings.duration = duration
168
_alarmDuration.expanded = false
175
ListItem.Expandable {
181
margins: units.gu(-2)
184
collapseOnClick: true
185
expandedHeight: _snoozeContentColumn.height + units.gu(1)
188
id: _snoozeContentColumn
193
height: _alarmSnooze.collapsedHeight
197
text: i18n.tr("Snooze for")
198
subText: i18n.tr("%1 minutes").arg(alarmSettings.snoozeDuration)
199
onClicked: _alarmSnooze.expanded = true
206
anchors.right: parent.right
207
anchors.verticalCenter: parent.verticalCenter
211
rotation: _alarmSnooze.expanded ? 180 : 0
213
Behavior on rotation {
214
UbuntuNumberAnimation {}
221
id: _snoozeResultsList
228
delegate: ListItem.Standard {
231
alarmSettings.snoozeDuration = duration
232
_alarmSnooze.expanded = false
241
text: i18n.tr("Vibration")
242
color: UbuntuColors.midAubergine
243
anchors.verticalCenter: parent.verticalCenter
251
verticalCenter: parent.verticalCenter
254
checked: alarmSettings.vibration === "pulse"
257
alarmSettings.vibration = "pulse"
259
alarmSettings.vibration = "none"
265
vibrateSwitch.checked = !vibrateSwitch.checked
270
text: i18n.tr("Change time and date")
184
273
FIXME: When the upstream QT bug at
185
274
https://bugreports.qt-project.org/browse/QTBUG-40275 is fixed
186
275
it will be possible to receive a datetime object directly
187
276
instead of using this hack.
189
var localTime = new Date
191
localTimeSource.localDateString.split(":")[0],
192
localTimeSource.localDateString.split(":")[1]-1,
193
localTimeSource.localDateString.split(":")[2],
194
localTimeSource.localTimeString.split(":")[0],
195
localTimeSource.localTimeString.split(":")[1],
196
localTimeSource.localTimeString.split(":")[2],
197
localTimeSource.localTimeString.split(":")[3]
199
return localTime.toLocaleString()
278
var localTime = new Date
280
localTimeSource.localDateString.split(":")[0],
281
localTimeSource.localDateString.split(":")[1]-1,
282
localTimeSource.localDateString.split(":")[2],
283
localTimeSource.localTimeString.split(":")[0],
284
localTimeSource.localTimeString.split(":")[1],
285
localTimeSource.localTimeString.split(":")[2],
286
localTimeSource.localTimeString.split(":")[3]
288
return localTime.toLocaleString()
203
Qt.openUrlExternally("settings:///system/time-date")
292
Qt.openUrlExternally("settings:///system/time-date")