~jonas-drange/ubuntu-system-settings/update-cannot-be-ota

« back to all changes in this revision

Viewing changes to plugins/sound/PageComponent.qml

  • Committer: Bileto Bot
  • Author(s): Ken VanDine
  • Date: 2016-07-22 14:38:13 UTC
  • mfrom: (1556.3.32 slotsLayout)
  • Revision ID: ci-train-bot@canonical.com-20160722143813-ht9e4766lm0ie5fa
Ported to use Slots layout and updated visuals (LP: #1596529)

Approved by: Jonas G. Drange

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * This file is part of system-settings
3
3
 *
4
 
 * Copyright (C) 2013 Canonical Ltd.
 
4
 * Copyright (C) 2013-2016 Canonical Ltd.
5
5
 *
6
6
 * Contact: Sebastien Bacher <sebastien.bacher@canonical.com>
7
7
 *
21
21
import GSettings 1.0
22
22
import QtQuick 2.4
23
23
import Ubuntu.Components 1.3
24
 
import Ubuntu.Components.ListItems 1.3 as ListItem
25
 
import Ubuntu.Connectivity 1.0
26
24
import SystemSettings 1.0
 
25
import SystemSettings.ListItems 1.0 as SettingsListItems
27
26
import Ubuntu.SystemSettings.Sound 1.0
28
27
import Ubuntu.Settings.Menus 0.1 as Menus
29
28
import Ubuntu.Settings.Components 0.1 as USC
67
66
            anchors.left: parent.left
68
67
            anchors.right: parent.right
69
68
 
70
 
            ListItem.Standard {
71
 
                control: Switch {
 
69
            SettingsListItems.Standard {
 
70
                text: i18n.tr("Silent Mode")
 
71
 
 
72
                Switch {
72
73
                    id: silentModeSwitch
73
74
                    objectName: "silentMode"
74
75
                    property bool serverChecked: soundActionGroup.silentMode.state
82
83
                        onSyncTriggered: soundActionGroup.silentMode.activate()
83
84
                    }
84
85
                }
85
 
                text: i18n.tr("Silent Mode")
86
 
            }
87
 
 
88
 
            QDBusActionGroup {
89
 
                id: soundActionGroup
90
 
                busType: DBus.SessionBus
91
 
                busName: "com.canonical.indicator.sound"
92
 
                objectPath: "/com/canonical/indicator/sound"
93
 
 
94
 
                property variant volume: action("volume")
95
 
                property variant silentMode: action("silent-mode")
96
 
                property variant highVolume: action("high-volume")
97
 
 
98
 
                Component.onCompleted: start()
99
86
            }
100
87
 
101
88
            Column  {
107
94
                    text: i18n.tr("Ringer:")
108
95
                }
109
96
 
 
97
                QDBusActionGroup {
 
98
                    id: soundActionGroup
 
99
                    busType: DBus.SessionBus
 
100
                    busName: "com.canonical.indicator.sound"
 
101
                    objectPath: "/com/canonical/indicator/sound"
 
102
 
 
103
                    property variant volume: action("volume")
 
104
                    property variant silentMode: action("silent-mode")
 
105
                    property variant highVolume: action("high-volume")
 
106
    
 
107
                    Component.onCompleted: start()
 
108
                }
 
109
 
110
110
                Menus.SliderMenu {
111
111
                    id: volumeSlider
112
112
                    objectName: "sliderMenu"
129
129
                    }
130
130
                }
131
131
 
132
 
                ListItem.Standard {
 
132
                SettingsListItems.Standard {
133
133
                    id: highVolumeWarning
134
134
                    visible: soundActionGroup.highVolume.state == true
135
135
                    text: i18n.tr("High volume can damage your hearing.")
136
136
                }
137
 
 
 
137
    
138
138
                SettingsItemTitle {
139
139
                    text: i18n.tr("Phone calls:")
140
140
                }
141
141
 
142
 
                ListItem.SingleValue {
 
142
                SettingsListItems.SingleValueProgression {
143
143
                    text: i18n.tr("Ringtone")
144
 
                    value: Utilities.buildDisplayName(
145
 
                               backendInfo.incomingCallSound)
146
 
                    progression: true
 
144
                    value: Utilities.buildDisplayName(backendInfo.incomingCallSound)
 
145
 
147
146
                    onClicked: pageStack.push(
148
 
                                   Qt.resolvedUrl("SoundsList.qml"),
149
 
                                   { title: i18n.tr("Ringtone"),
150
 
                                     showStopButton: true,
151
 
                                     soundType: 0,
152
 
                                     soundsDir:
153
 
                                       "/usr/share/sounds/ubuntu/ringtones/" })
 
147
                        Qt.resolvedUrl("SoundsList.qml"), {
 
148
                            title: i18n.tr("Ringtone"),
 
149
                            showStopButton: true,
 
150
                            soundType: 0,
 
151
                            soundsDir: "/usr/share/sounds/ubuntu/ringtones/"
 
152
                        }
 
153
                    )
154
154
                }
155
155
 
156
 
                ListItem.Standard {
157
 
                    control: CheckBox {
 
156
                SettingsListItems.Standard {
 
157
                    CheckBox {
158
158
                        objectName: "callVibrate"
 
159
                        SlotsLayout.position: SlotsLayout.First
159
160
                        property bool serverChecked: backendInfo.incomingCallVibrate
160
161
                        onServerCheckedChanged: checked = serverChecked
161
162
                        Component.onCompleted: checked = serverChecked
164
165
                    text: i18n.tr("Vibrate on ring")
165
166
                }
166
167
 
167
 
                ListItem.Standard {
168
 
                    control: CheckBox {
 
168
                SettingsListItems.Standard {
 
169
                    CheckBox {
169
170
                        objectName: "callVibrateSilentMode"
 
171
                        SlotsLayout.position: SlotsLayout.First
170
172
                        property bool serverChecked: backendInfo.incomingCallVibrateSilentMode
171
173
                        onServerCheckedChanged: checked = serverChecked
172
174
                        Component.onCompleted: checked = serverChecked
175
177
                    text: i18n.tr("Vibrate in Silent Mode")
176
178
                }
177
179
 
178
 
                ListItem.Standard {
179
 
                    control: Switch {
 
180
                SettingsListItems.Standard {
 
181
                    Switch {
180
182
                        objectName: "dialpadSounds"
181
183
                        property bool serverChecked: backendInfo.dialpadSoundsEnabled
182
184
                        onServerCheckedChanged: checked = serverChecked
195
197
                    text: i18n.tr("Messages:")
196
198
                }
197
199
 
198
 
                ListItem.SingleValue {
 
200
                SettingsListItems.SingleValueProgression {
199
201
                    text: i18n.tr("Message received")
200
202
                    value:Utilities.buildDisplayName(
201
203
                              backendInfo.incomingMessageSound)
202
 
                    progression: true
203
204
                    onClicked: pageStack.push(
204
205
                                   Qt.resolvedUrl("SoundsList.qml"),
205
206
                                   { title: i18n.tr("Message received"),
208
209
                                       "/usr/share/sounds/ubuntu/notifications/" })
209
210
                }
210
211
 
211
 
                ListItem.Standard {
212
 
                    control: CheckBox {
 
212
                SettingsListItems.Standard {
 
213
                    CheckBox {
213
214
                        objectName: "messageVibrate"
 
215
                        SlotsLayout.position: SlotsLayout.First
214
216
                        property bool serverChecked: backendInfo.incomingMessageVibrate
215
217
                        onServerCheckedChanged: checked = serverChecked
216
218
                        Component.onCompleted: checked = serverChecked
219
221
                    text: i18n.tr("Vibrate with message sound")
220
222
                }
221
223
 
222
 
                ListItem.Standard {
223
 
                    control: CheckBox {
 
224
                SettingsListItems.Standard {
 
225
                    CheckBox {
224
226
                        objectName: "messageVibrateSilentMode"
 
227
                        SlotsLayout.position: SlotsLayout.First
225
228
                        property bool serverChecked: backendInfo.incomingMessageVibrateSilentMode
226
229
                        onServerCheckedChanged: checked = serverChecked
227
230
                        Component.onCompleted: checked = serverChecked
235
238
                text: i18n.tr("Other sounds:")
236
239
            }
237
240
 
238
 
            ListItem.Standard {
 
241
            SettingsListItems.Standard {
239
242
                text: i18n.tr("Keyboard sound")
240
243
 
241
 
                control: Switch {
 
244
                Switch {
242
245
                    objectName: "keyboardSoundSwitch"
243
246
                    property bool serverChecked: keyboardSettings.keyPressFeedback
244
247
                    onServerCheckedChanged: checked = serverChecked
247
250
                }
248
251
            }
249
252
 
250
 
            ListItem.Standard {
 
253
            SettingsListItems.Standard {
251
254
                id: lockSound
252
 
                control: Switch {
 
255
 
 
256
                Switch {
253
257
                    checked: false
254
258
                }
255
259
                text: i18n.tr("Lock sound")
256
260
                visible: showAllUI
257
261
            }
258
262
 
259
 
            ListItem.Divider {}
 
263
            /* Add some artificial spacing here, once we update the QtQuick.Layouts plugin 
 
264
             * to 1.3 we can replace this with Layout.bottomMargin(units.gu(2))
 
265
             */
 
266
            Item { height: 1; width: 1 }
260
267
 
261
 
            ListItem.Standard {
 
268
            SettingsListItems.Standard {
262
269
                text: i18n.tr("Other vibrations")
263
 
                control: Switch {
 
270
 
 
271
                Switch {
264
272
                    objectName: "otherVibrateSwitch"
265
273
                    property bool serverChecked: backendInfo.otherVibrate
266
274
                    onServerCheckedChanged: checked = serverChecked