summaryrefslogtreecommitdiff
path: root/modules/controlcenter/dashboard/GeneralSection.qml
blob: 95e7531ed1b71eacab453b1d0d5796f15e59420c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import ".."
import "../components"
import qs.components
import qs.components.controls
import qs.services
import qs.config
import QtQuick
import QtQuick.Layouts

SectionContainer {
    id: root

    required property var rootItem

    Layout.fillWidth: true
    alignTop: true

    StyledText {
        text: qsTr("General Settings")
        font.pointSize: Appearance.font.size.normal
    }

    SwitchRow {
        label: qsTr("Enabled")
        checked: root.rootItem.enabled
        onToggled: checked => {
            root.rootItem.enabled = checked;
            root.rootItem.saveConfig();
        }
    }

    SwitchRow {
        label: qsTr("Show on hover")
        checked: root.rootItem.showOnHover
        onToggled: checked => {
            root.rootItem.showOnHover = checked;
            root.rootItem.saveConfig();
        }
    }

    RowLayout {
        Layout.fillWidth: true
        spacing: Appearance.spacing.normal

        SwitchRow {
            Layout.fillWidth: true
            label: qsTr("Show Dashboard tab")
            checked: root.rootItem.showDashboard
            onToggled: checked => {
                root.rootItem.showDashboard = checked;
                root.rootItem.saveConfig();
            }
        }

        SwitchRow {
            Layout.fillWidth: true
            label: qsTr("Show Media tab")
            checked: root.rootItem.showMedia
            onToggled: checked => {
                root.rootItem.showMedia = checked;
                root.rootItem.saveConfig();
            }
        }

        SwitchRow {
            Layout.fillWidth: true
            label: qsTr("Show Performance tab")
            checked: root.rootItem.showPerformance
            onToggled: checked => {
                root.rootItem.showPerformance = checked;
                root.rootItem.saveConfig();
            }
        }

        SwitchRow {
            Layout.fillWidth: true
            label: qsTr("Show Weather tab")
            checked: root.rootItem.showWeather
            onToggled: checked => {
                root.rootItem.showWeather = checked;
                root.rootItem.saveConfig();
            }
        }
    }

    SliderInput {
        Layout.fillWidth: true

        label: qsTr("Media update interval")
        value: root.rootItem.mediaUpdateInterval
        from: 100
        to: 10000
        stepSize: 100
        suffix: "ms"
        validator: IntValidator {
            bottom: 100
            top: 10000
        }
        formatValueFunction: val => Math.round(val).toString()
        parseValueFunction: text => parseInt(text)

        onValueModified: newValue => {
            root.rootItem.mediaUpdateInterval = Math.round(newValue);
            root.rootItem.saveConfig();
        }
    }

    SliderInput {
        Layout.fillWidth: true

        label: qsTr("Drag threshold")
        value: root.rootItem.dragThreshold
        from: 0
        to: 100
        suffix: "px"
        validator: IntValidator {
            bottom: 0
            top: 100
        }
        formatValueFunction: val => Math.round(val).toString()
        parseValueFunction: text => parseInt(text)

        onValueModified: newValue => {
            root.rootItem.dragThreshold = Math.round(newValue);
            root.rootItem.saveConfig();
        }
    }
}