2023-11-30 18:28:55 +00:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
2022-05-13 13:12:05 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2020-03-26 16:01:51 +00:00
|
|
|
import QtQuick
|
2023-05-11 02:27:08 +00:00
|
|
|
import WearableStyle
|
|
|
|
import WearableSettings
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2017-03-13 07:34:08 +00:00
|
|
|
Item {
|
2023-11-30 18:28:55 +00:00
|
|
|
id: settingspage
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
property alias listView: listViewItem
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
component SettingsItem: ListItem {
|
|
|
|
id: settingsItem
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
property string title
|
|
|
|
property string icon
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: itemIcon
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.margins: 15
|
|
|
|
source: UIStyle.iconPath(settingsItem.icon)
|
|
|
|
height: 40
|
|
|
|
width: 40
|
2017-03-13 10:08:07 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
Text {
|
|
|
|
anchors.left: itemIcon.right
|
|
|
|
anchors.verticalCenter: itemIcon.verticalCenter
|
|
|
|
anchors.margins: 15
|
|
|
|
text: settingsItem.title
|
|
|
|
color: UIStyle.textColor
|
|
|
|
font: UIStyle.h3
|
|
|
|
}
|
|
|
|
}
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
component SettingsBoolItem: SettingsItem {
|
|
|
|
height: 70
|
|
|
|
|
|
|
|
property alias checked: onSwitchItem.checked
|
|
|
|
|
|
|
|
Switch {
|
|
|
|
id: onSwitchItem
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.margins: 15
|
|
|
|
onCheckedChanged: parent.onCheckedChanged()
|
2018-09-10 14:15:01 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
function toggle() { onSwitchItem.toggle() }
|
|
|
|
signal onCheckedChanged()
|
2018-09-10 14:15:01 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
component SettingsIntItem: SettingsItem {
|
|
|
|
height: 110
|
|
|
|
|
|
|
|
property alias value: valueSliderItem.value
|
|
|
|
|
|
|
|
Slider {
|
|
|
|
id: valueSliderItem
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.margins: 15
|
|
|
|
from: 0
|
|
|
|
to: 100
|
|
|
|
onValueChanged: parent.onValueChanged()
|
2016-12-17 03:20:45 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
|
|
|
|
signal onValueChanged()
|
2017-03-13 10:08:07 +00:00
|
|
|
}
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
Flickable {
|
|
|
|
id: listViewItem
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 15
|
|
|
|
anchors.topMargin: 40 + 15
|
|
|
|
contentHeight: content.height
|
|
|
|
|
|
|
|
// aliases for the demo mode
|
|
|
|
property alias brightnessItem: brightnessItem
|
|
|
|
property alias bluetoothItem: bluetoothItem
|
|
|
|
property alias wifiItem: wifiItem
|
|
|
|
property alias darkmodeItem: darkmodeItem
|
|
|
|
property alias demomodeItem: demomodeItem
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: content
|
|
|
|
spacing: 10
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
SettingsIntItem {
|
|
|
|
id: brightnessItem
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Brightness")
|
|
|
|
icon: "sun"
|
|
|
|
value: WearableSettings.brightness
|
|
|
|
onValueChanged: WearableSettings.brightness = value
|
|
|
|
}
|
|
|
|
SettingsBoolItem {
|
|
|
|
id: bluetoothItem
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Bluetooth")
|
|
|
|
icon: "bluetooth"
|
|
|
|
checked: WearableSettings.bluetooth
|
|
|
|
onCheckedChanged: WearableSettings.bluetooth = checked
|
|
|
|
}
|
|
|
|
SettingsBoolItem {
|
|
|
|
id: wifiItem
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Wi-Fi")
|
|
|
|
icon: "wifi"
|
|
|
|
checked: WearableSettings.wireless
|
|
|
|
onCheckedChanged: WearableSettings.wireless = checked
|
|
|
|
}
|
|
|
|
SettingsBoolItem {
|
|
|
|
id: darkmodeItem
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Change theme")
|
|
|
|
icon: "darkmode"
|
|
|
|
checked: WearableSettings.darkTheme
|
|
|
|
onCheckedChanged: WearableSettings.darkTheme = checked
|
|
|
|
}
|
|
|
|
SettingsBoolItem {
|
|
|
|
id: demomodeItem
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Demo mode")
|
|
|
|
icon: "demomode"
|
|
|
|
checked: WearableSettings.demoMode
|
|
|
|
onCheckedChanged: WearableSettings.demoMode = checked
|
|
|
|
}
|
|
|
|
}
|
2016-12-17 03:20:45 +00:00
|
|
|
}
|
|
|
|
}
|