11import QtQuick.Controls as QQC2
13import org.kde.kirigami as Kirigami
14import org.kde.kquickcontrols
16import org.kde.newstuff as NewStuff
18import org.kde.quickcharts as Charts
19import org.kde.ksysguard.sensors as Sensors
20import org.kde.ksysguard.faces as Faces
25 signal configurationChanged
27 function saveConfig() {
28 controller.title = cfg_title;
29 controller.faceId = cfg_chartFace;
30 controller.showTitle = cfg_showTitle
31 controller.updateRateLimit = cfg_updateRateLimit
33 var preset = pendingPreset;
36 controller.loadPreset(preset);
37 root.controller.highPrioritySensorColors = automaticColorSource.colors
41 property Faces.SensorFaceController controller
42 property alias cfg_title: titleField.text
43 property alias cfg_showTitle: showTitleCheckbox.checked
44 property string cfg_chartFace
45 property alias cfg_updateRateLimit: updateRateLimitSpinBox.value
47 onCfg_titleChanged: configurationChanged();
48 onCfg_showTitleChanged: configurationChanged()
49 onCfg_chartFaceChanged: configurationChanged();
50 onCfg_updateRateLimitChanged: configurationChanged();
53 property
string pendingPreset
55 Component.onCompleted: {
56 cfg_title = controller.title;
57 cfg_chartFace = controller.faceId;
58 cfg_showTitle = controller.showTitle
59 cfg_updateRateLimit = controller.updateRateLimit
62 Charts.ColorGradientSource {
63 id: automaticColorSource
64 baseColor:
Kirigami.Theme.highlightColor
65 itemCount: root.controller.highPrioritySensorIds.length
72 title:
i18nd(
"KSysGuardSensorFaces",
"Load Preset")
75 implicitWidth:
Kirigami.Units.gridUnit * 15
76 implicitHeight:
Kirigami.Units.gridUnit * 20
78 model: controller.availablePresetsModel
79 delegate: QQC2.ItemDelegate {
81 width: ListView.view.width
85 contentItem: RowLayout {
88 property bool truncated:
label.truncated
92 Layout.fillWidth:
true
93 elide:
Text.ElideRight
99 text:
i18nd(
"KSysGuardSensorFaces",
"Delete this preset")
101 visible: model.writable
102 onClicked: controller.uninstallPreset(model.pluginId);
103 display: QQC2.ToolButton.IconOnly
106 text: deleteButton.text
112 cfg_title = model.display;
113 pendingPreset = model.pluginId;
114 if (model.config.chartFace) {
115 cfg_chartFace = model.config.chartFace;
118 root.configurationChanged();
119 presetDialog.close();
125 Kirigami.FormData.label:
i18nd(
"KSysGuardSensorFaces",
"Presets:")
128 icon.name:
"document-open"
129 text:
i18nd(
"KSysGuardSensorFaces",
"Load Preset...")
130 onClicked: presetDialog.open()
134 Accessible.name:
i18nd(
"KSysGuardSensorFaces",
"Get new presets...")
135 configFile: "systemmonitor-presets.knsrc"
137 onEntryEvent: controller.availablePresetsModel.reload();
139 text: parent.Accessible.name
145 icon.name:
"document-save"
146 text:
i18nd(
"KSysGuardSensorFaces",
"Save Settings As Preset")
147 onClicked: controller.savePreset();
156 Kirigami.FormData.label:
i18nd(
"KSysGuardSensorFaces",
"Title:")
161 id: showTitleCheckbox
162 text:
i18nd(
"KSysGuardSensorFaces",
"Show Title")
167 Kirigami.FormData.label:
i18nd(
"KSysGuardSensorFaces",
"Display Style:")
170 model: controller.availableFacesModel
174 for (var i = 0; i < count; ++i) {
175 if (model.pluginId(i) === cfg_chartFace) {
182 cfg_chartFace = model.pluginId(index);
187 text:
i18nd(
"KSysGuardSensorFaces",
"Get New Display Styles...")
188 configFile: "systemmonitor-faces.knsrc"
189 onEntryEvent: controller.availableFacesModel.reload();
194 id: updateRateLimitSpinBox
195 Layout.preferredWidth: titleField.implicitWidth
197 Kirigami.FormData.label:
i18nd(
"KSysGuardSensorFaces",
"Minimum Time Between Updates:")
204 textFromValue: function(value, locale) {
206 return i18nd(
"KSysGuardSensorFaces",
"No Limit");
208 var seconds = value / 1000;
210 return i18nd(
"KSysGuardSensorFaces",
"1 second");
212 return i18nd(
"KSysGuardSensorFaces",
"%1 seconds", seconds);
216 valueFromText: function(value, locale) {
220 var v = parseInt(value)
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
QString label(StandardShortcut id)