25 import QtQml.Models 2.12
27 import
Qt.labs.platform 1.1 as Platform
32 import
org.
kde.kitemmodels 1.0 as KItemModels
43 signal configurationChanged
45 property var cfg_totalSensors: []
46 property var cfg_highPrioritySensorIds: []
47 property var cfg_sensorColors: {}
49 property var cfg_lowPrioritySensorIds: []
51 onCfg_totalSensorsChanged: configurationChanged();
52 onCfg_highPrioritySensorIdsChanged: configurationChanged();
53 onCfg_sensorColorsChanged: configurationChanged();
54 onCfg_lowPrioritySensorIdsChanged: configurationChanged();
56 property Faces.SensorFaceController controller
58 function saveConfig() {
59 controller.totalSensors = cfg_totalSensors;
60 controller.highPrioritySensorIds = cfg_highPrioritySensorIds;
61 controller.sensorColors = cfg_sensorColors;
62 controller.lowPrioritySensorIds = cfg_lowPrioritySensorIds;
65 function loadConfig() {
66 cfg_totalSensors = controller.totalSensors;
67 totalChoice.selected = controller.totalSensors;
69 cfg_highPrioritySensorIds = controller.highPrioritySensorIds;
70 highPriorityChoice.selected = controller.highPrioritySensorIds;
72 cfg_sensorColors = controller.sensorColors;
74 cfg_lowPrioritySensorIds = controller.lowPrioritySensorIds;
75 lowPriorityChoice.selected = controller.lowPrioritySensorIds;
87 Component.onCompleted: loadConfig()
91 function onTotalSensorsChanged() {
92 Qt.callLater(root.loadConfig);
94 function onHighPrioritySensorIdsChanged() {
95 Qt.callLater(root.loadConfig);
97 function onSensorColorsChanged() {
98 Qt.callLater(root.loadConfig);
100 function onLowPrioritySensorIdsChanged() {
101 Qt.callLater(root.loadConfig);
105 Platform.ColorDialog {
107 property string destinationSensor
109 currentColor: destinationSensor !=
"" ? controller.sensorColors[destinationSensor] :
"" 111 cfg_sensorColors[destinationSensor] = color
112 root.cfg_sensorColorsChanged();
118 text:
i18ndp(
"KSysGuardSensorFaces",
"Total Sensor",
"Total Sensors", controller.maxTotalSensors)
119 visible: controller.supportsTotalSensors
123 Layout.fillWidth:
true 124 visible: controller.supportsTotalSensors
125 supportsColors:
false 126 maxAllowedSensors: controller.maxTotalSensors
128 onSelectedChanged: root.cfg_totalSensors = selected
132 text:
i18nd(
"KSysGuardSensorFaces",
"Sensors")
135 id: highPriorityChoice
136 Layout.fillWidth:
true 137 supportsColors: controller.supportsSensorsColors
139 onSelectedChanged: root.cfg_highPrioritySensorIds = selected
141 colors: root.cfg_sensorColors
143 colorDialog.destinationSensor = sensorId
146 onColorForSensorGenerated: {
147 cfg_sensorColors[sensorId] = color
148 root.cfg_sensorColorsChanged();
153 text:
i18nd(
"KSysGuardSensorFaces",
"Text-Only Sensors")
154 visible: controller.supportsLowPrioritySensors
157 id: lowPriorityChoice
158 Layout.fillWidth:
true 159 visible: controller.supportsLowPrioritySensors
160 supportsColors:
false 162 onSelectedChanged: root.cfg_lowPrioritySensorIds = selected
166 Layout.fillHeight:
true
QString i18ndp(const char *domain, const char *singular, const char *plural, const TYPE &arg...)
QString i18nd(const char *domain, const char *text, const TYPE &arg...)