~ken-vandine/ubuntu-system-settings/no_s_i_d

« back to all changes in this revision

Viewing changes to plugins/bluetooth/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 ubuntu-system-settings
3
3
 *
4
 
 * Copyright (C) 2013-2015 Canonical Ltd.
 
4
 * Copyright (C) 2013-2016 Canonical Ltd.
5
5
 *
6
6
 * Contact: Charles Kerr <charles.kerr@canonical.com>
7
7
 *
21
21
import QMenuModel 0.1
22
22
import QtQuick 2.4
23
23
import SystemSettings 1.0
 
24
import SystemSettings.ListItems 1.0 as SettingsListItems
24
25
import Ubuntu.Components 1.3
25
26
import Ubuntu.Components.Popups 1.3
26
 
import Ubuntu.Components.ListItems 1.3 as ListItem
27
27
import Ubuntu.SystemSettings.Bluetooth 1.0
28
28
import Ubuntu.Settings.Components 0.1 as USC
29
29
 
229
229
                Component.onCompleted: start()
230
230
            }
231
231
 
232
 
            ListItem.Standard {
 
232
            SettingsListItems.Standard {
233
233
                text: i18n.tr("Bluetooth")
234
 
                control: Switch {
 
234
                Switch {
235
235
                    id: btSwitch
236
236
                    property bool serverChecked: bluetoothActionGroup.enabled.state != undefined ? bluetoothActionGroup.enabled.state : false
237
237
                    USC.ServerPropertySynchroniser {
246
246
            }
247
247
 
248
248
            // Discoverability
249
 
            ListItem.Standard {
 
249
            SettingsListItems.SingleValue {
 
250
                text: backend.discoverable ? i18n.tr("Discoverable") : i18n.tr("Not discoverable")
 
251
                value: backend.discoverable ? backend.adapterName() : ""
250
252
                enabled: bluetoothActionGroup.enabled
251
253
                showDivider: false
252
254
 
253
 
                Rectangle {
254
 
                    color: "transparent"
255
 
                    anchors.fill: parent
256
 
                    anchors.topMargin: units.gu(1)
257
 
                    anchors.leftMargin: units.gu(2)
258
 
                    anchors.rightMargin: units.gu(2)
259
 
 
260
 
                    Label {
261
 
                        anchors {
262
 
                            top: parent.top
263
 
                            left: parent.left
264
 
                            topMargin: units.gu(1)
265
 
                        }
266
 
                        height: units.gu(3)
267
 
                        text: backend.discoverable ? i18n.tr("Discoverable") : i18n.tr("Not discoverable")
268
 
                    }
269
 
 
270
 
                    Label {
271
 
                        anchors {
272
 
                            top: parent.top
273
 
                            right: parent.right
274
 
                            topMargin: units.gu(1)
275
 
                        }
276
 
                        height: units.gu(3)
277
 
                        text: backend.discoverable ? backend.adapterName : ""
278
 
                        color: "darkgrey"
279
 
                        visible: backend.discoverable
280
 
                        enabled: false
281
 
                    }
282
 
 
283
 
                    Label {
284
 
                        anchors {
285
 
                            top: parent.top
286
 
                            right: parent.right
287
 
                            topMargin: units.gu(1)
288
 
                        }
289
 
                        color: "darkgrey"
290
 
                        visible: backend.powered && !backend.discoverable
291
 
                        text: i18n.tr("Searching…")
292
 
                    }
 
255
                Label {
 
256
                    anchors {
 
257
                        verticalCenter: parent.verticalCenter
 
258
                        right: parent.right
 
259
                        rightMargin: units.gu(2)
 
260
                    }
 
261
                    color: "darkgrey"
 
262
                    visible: backend.powered && !backend.discoverable
 
263
                    text: i18n.tr("Searching…")
 
264
                    fontSize: "x-small"
 
265
                    SlotsLayout.position: SlotsLayout.Trailing
 
266
                    SlotsLayout.overrideVerticalPositioning: true
293
267
                }
294
268
            }
295
269
 
296
 
            ListItem.Standard {
 
270
            SettingsItemTitle {
297
271
                id: connectedHeader
298
272
                text: i18n.tr("Connected devices:")
299
273
 
313
287
                Repeater {
314
288
                    id: connectedRepeater
315
289
                    model: backend.connectedDevices
316
 
                    delegate: ListItem.Standard {
 
290
                    delegate: SettingsListItems.IconProgression {
317
291
                        iconSource: iconPath
318
 
                        iconFrame: false
319
292
                        text: getDisplayName(type, displayName)
320
 
                        control: ActivityIndicator {
 
293
                        layout.subtitle.text: connection == Device.Connecting ? i18n.tr("Connecting…") : i18n.tr("Connected")
 
294
                        layout.subtitle.color: UbuntuColors.green
 
295
 
 
296
                        ActivityIndicator {
321
297
                            visible: connection == Device.Connecting
322
298
                            running: visible
323
299
                        }
325
301
                            backend.setSelectedDevice(addressName);
326
302
                            pageStack.push(Qt.resolvedUrl("DevicePage.qml"), {backend: backend, root: root});
327
303
                        }
328
 
                        progression: true
329
304
                    }
330
305
                }
331
306
            }
334
309
                id: disconnectedHeader
335
310
                text: connectedList.visible ? i18n.tr("Connect another device:") : i18n.tr("Connect a device:")
336
311
                enabled: bluetoothActionGroup.enabled.state != undefined ? bluetoothActionGroup.enabled.state : false
337
 
                control: Label {
 
312
                Label {
338
313
                    anchors {
339
 
                        top: parent.top
 
314
                        verticalCenter: parent.verticalCenter
340
315
                        right: parent.right
341
 
                        topMargin: units.gu(1)
 
316
                        rightMargin: units.gu(2)
342
317
                    }
343
318
                    color: "darkgrey"
344
319
                    visible: backend.powered && backend.discovering
345
320
                    text: i18n.tr("Searching…")
 
321
                    fontSize: "x-small"
 
322
                    SlotsLayout.position: SlotsLayout.Trailing
 
323
                    SlotsLayout.overrideVerticalPositioning: true
346
324
                }
347
325
            }
348
326
 
358
336
                Repeater {
359
337
                    id: disconnectedRepeater
360
338
                    model: backend.disconnectedDevices
361
 
                    delegate: ListItem.Standard {
 
339
                    delegate: SettingsListItems.IconProgression {
362
340
                        iconSource: iconPath
363
 
                        iconFrame: false
364
341
                        text: getDisplayName(type, displayName)
365
342
                        onClicked: {
366
343
                            backend.setSelectedDevice(addressName);
367
344
                            pageStack.push(Qt.resolvedUrl("DevicePage.qml"), {backend: backend, root: root});
368
345
                        }
369
 
                        progression: true
370
346
                    }
371
347
                }
372
348
            }
373
 
            ListItem.Standard {
 
349
            SettingsListItems.Standard {
374
350
                id: disconnectedNone
375
351
                text: i18n.tr("None detected")
376
352
                visible: !disconnectedList.visible && disconnectedHeader.visible
377
 
                enabled: false
378
353
            }
379
354
 
380
355
            SettingsItemTitle {
395
370
                Repeater {
396
371
                    id: autoconnectRepeater
397
372
                    model: backend.autoconnectDevices
398
 
                    delegate: ListItem.Standard {
 
373
                    delegate: SettingsListItems.IconProgression {
399
374
                        iconSource: iconPath
400
 
                        iconFrame: false
401
375
                        text: getDisplayName(type, displayName)
402
376
                        onClicked: {
403
377
                            backend.setSelectedDevice(addressName);
404
378
                            pageStack.push(Qt.resolvedUrl("DevicePage.qml"), {backend: backend, root: root});
405
379
                        }
406
 
                        progression: true
407
380
                    }
408
381
                }
409
382
            }