| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2022 Kai Uwe Broulik <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
import QtQuick |
| 8 |
import QtQuick.Controls |
| 9 |
|
| 10 |
import org.kde.kirigami as Kirigami |
| 11 |
|
| 12 |
import org.kde.ksysguard.sensors as Sensors |
| 13 |
|
| 14 |
Rectangle { |
| 15 |
id: rect |
| 16 |
|
| 17 |
property Sensors.Sensor sensor |
| 18 |
property alias text: label.text |
| 19 |
property color sensorColor |
| 20 |
|
| 21 |
color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.1) |
| 22 |
|
| 23 |
Rectangle { |
| 24 |
anchors.fill: parent |
| 25 |
color: rect.sensorColor |
| 26 |
opacity: (rect.sensor.value / rect.sensor.maximum) |
| 27 |
} |
| 28 |
|
| 29 |
Label { |
| 30 |
id: label |
| 31 |
anchors.fill: parent |
| 32 |
horizontalAlignment: Text.AlignHCenter |
| 33 |
verticalAlignment: Text.AlignVCenter |
| 34 |
textFormat: Text.PlainText |
| 35 |
fontSizeMode: Text.Fit |
| 36 |
minimumPointSize: 6 |
| 37 |
} |
| 38 |
} |