Libksysguard

FaceDetailsConfig.qml
1/*
2 SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
3 SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
4 SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9import QtQuick
10import QtQuick.Layouts
11
12import org.kde.kirigami as Kirigami
13import org.kde.kquickcontrols
14
15import org.kde.ksysguard.sensors as Sensors
16import org.kde.ksysguard.faces as Faces
17
18Loader {
19 id: root
20
21 property Faces.SensorFaceController controller
22
23 signal configurationChanged
24
25 function saveConfig() {
26 if (item.saveConfig) {
27 item.saveConfig()
28 }
29 for (var key in root.controller.faceConfiguration) {
30 if (item.hasOwnProperty("cfg_" + key)) {
31 root.controller.faceConfiguration[key] = item["cfg_" + key]
32 }
33 }
34 }
35
36
37 onItemChanged: {
38 if (!item || !root.controller.faceConfiguration) {
39 return;
40 }
41
42 for (var key in root.controller.faceConfiguration) {
43 if (!item.hasOwnProperty("cfg_" + key)) {
44 continue;
45 }
46
47 item["cfg_" + key] = root.controller.faceConfiguration[key];
48 var changedSignal = item["cfg_" + key + "Changed"];
49 if (changedSignal) {
50 changedSignal.connect(root.configurationChanged);
51 }
52 }
53 }
54}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.