summaryrefslogtreecommitdiffstats
path: root/src/settingsui/bluetooth/Bluetooth.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/settingsui/bluetooth/Bluetooth.qml')
-rw-r--r--src/settingsui/bluetooth/Bluetooth.qml101
1 files changed, 63 insertions, 38 deletions
diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml
index 72b4ae6..4c82904 100644
--- a/src/settingsui/bluetooth/Bluetooth.qml
+++ b/src/settingsui/bluetooth/Bluetooth.qml
@@ -30,56 +30,81 @@ import QtQuick 2.6
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
import QtDeviceUtilities.BluetoothSettings 1.0
+import "../common"
Item {
id: root
- property string title: qsTr("Bluetooth Settings")
- ColumnLayout {
- anchors.margins: 20
- anchors.fill: parent
- id: content
- spacing: 20
+ Row {
+ id: bluetoothRow
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ spacing: parent.width * 0.025
+
+ Text {
+ id: bluetoothSwitchText
+ anchors.verticalCenter: parent.verticalCenter
+ font.pixelSize: pluginMain.subTitleFontSize
+ font.family: appFont
+ color: "white"
+ text: qsTr("Bluetooth")
+ }
+ CustomSwitch {
+ anchors.verticalCenter: parent.verticalCenter
+ indicatorWidth: root.width * 0.15
+ indicatorHeight: root.height * 0.06
- GroupBox {
- id: groupBox
- width: parent.width
- title: qsTr("Bluetooth status")
- Layout.fillWidth: true
- Layout.alignment: Qt.AlignTop
enabled: BtDevice.available
+ checked: BtDevice.powered
+ onCheckedChanged: BtDevice.powered = checked
+ }
- RowLayout {
- spacing: 10
- Label {
- id: off
- text: qsTr("Off")
- }
- Switch {
- checked: BtDevice.powered
- onCheckedChanged: {
- BtDevice.powered = checked
- }
- }
+ Text {
+ id: scanningText
+ anchors.verticalCenter: parent.verticalCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: pluginMain.valueFontSize
+ color: "white"
+ text: "Scanning"
+ font.family: appFont
+ opacity: (BtDevice.scanning && BtDevice.powered) ? 1.0 : 0.0
+ visible: opacity > 0
+ Behavior on opacity {
+ NumberAnimation {duration: 150}
+ }
- Connections {
- target: BtDevice
- onPoweredChanged: {
- if (BtDevice.powered)
- BtDevice.scanning = true
- }
- }
+ Timer {
+ id: scanningTimer
+ interval: 1000
+ repeat: true
+ running: BtDevice.scanning
- Label {
- text: qsTr("On")
+ onTriggered: {
+ if (scanningText.text.indexOf("...") !== -1)
+ scanningText.text = "Scanning"
+ else
+ scanningText.text += "."
}
}
}
- Discovery {
- id: discovery
- visible: BtDevice.powered
- Layout.fillWidth: true
- Layout.fillHeight: true
+
+ Connections {
+ target: BtDevice
+ onPoweredChanged: {
+ if (BtDevice.powered)
+ BtDevice.scanning = true
+ }
}
}
+
+ Discovery {
+ id: discovery
+ anchors.top: bluetoothRow.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: parent.height * 0.085
+ visible: BtDevice.powered
+ }
}