Warning, /utilities/powerplant/src/contents/ui/HealthSlider.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.15
0002 import QtQuick.Controls 2.15 as Controls
0003 import QtQuick.Layouts 1.15
0004 import org.kde.kirigami 2.19 as Kirigami
0005 import QtQuick.Shapes 1.5 as Shapes
0006 import QtGraphicalEffects 1.0
0007 import org.kde.powerplant 1.0
0008
0009 Controls.Slider {
0010 id: control
0011 focusPolicy: Qt.TabFocus
0012
0013 implicitHeight: 30
0014 property int weirdNumber: 25
0015 property string healthColor: colorInterpolation.color
0016
0017 ColorInterpolator {
0018 id: colorInterpolation
0019 progress: control.value / 100
0020 gradientStops: [{
0021 "position": gradientStop1.position,
0022 "color": gradientStop1.color
0023 }, {
0024 "position": gradientStop2.position,
0025 "color": gradientStop2.color
0026 }, {
0027 "position": gradientStop3.position,
0028 "color": gradientStop3.color
0029 }]
0030 }
0031 background: Rectangle {
0032 id: background
0033 x: control.leftPadding
0034 y: control.topPadding + weirdNumber - height / 2
0035 implicitWidth: 200
0036 implicitHeight: 15
0037 width: control.availableWidth
0038 height: implicitHeight
0039 radius: 5
0040 border.color: Kirigami.ColorUtils.linearInterpolation(
0041 Kirigami.Theme.backgroundColor,
0042 Kirigami.Theme.textColor, 0.3)
0043 border.width: 1
0044 Rectangle {
0045 property int margin: 2
0046 width: parent.width - margin * 2
0047 height: parent.height - margin * 2
0048 anchors.centerIn: parent
0049 radius: parent.radius - margin / 2
0050
0051 gradient: Gradient {
0052 orientation: Gradient.Horizontal
0053 GradientStop {
0054 id: gradientStop1
0055 position: 0.0
0056 color: "#c8c196"
0057 }
0058 GradientStop {
0059 id: gradientStop2
0060
0061 position: 0.33
0062 color: "#e5d975"
0063 }
0064 GradientStop {
0065 id: gradientStop3
0066
0067 position: 1.0
0068 color: "#b4e479"
0069 }
0070 }
0071 }
0072 }
0073 DropShadow {
0074 z: handleShape.z - 1
0075 anchors.fill: handleShape
0076 horizontalOffset: 2
0077 verticalOffset: 2
0078 radius: 10
0079 samples: 17
0080 color: Qt.rgba(0, 0, 0, 0.3)
0081 source: handleShape
0082 }
0083 handle: Shapes.Shape {
0084 Rectangle {
0085 height: 10
0086 width: 10
0087 radius: 5
0088 color: healthColor
0089 border.color: control.hovered
0090 || control.activeFocus ? Kirigami.Theme.hoverColor : Kirigami.ColorUtils.linearInterpolation(
0091 Kirigami.Theme.backgroundColor,
0092 Kirigami.Theme.textColor,
0093 0.3)
0094 border.width: 1
0095 x: -4.5
0096 y: -5
0097 }
0098 id: handleShape
0099 x: control.leftPadding + control.visualPosition * (control.availableWidth)
0100 y: control.topPadding + weirdNumber - height / 2
0101 implicitWidth: 26
0102 implicitHeight: 26
0103 antialiasing: true
0104 Shapes.ShapePath {
0105 strokeWidth: 1
0106 strokeColor: control.hovered
0107 || control.activeFocus ? Kirigami.Theme.hoverColor : Kirigami.ColorUtils.linearInterpolation(
0108 Kirigami.Theme.backgroundColor,
0109 Kirigami.Theme.textColor,
0110 0.3)
0111 fillGradient: Shapes.LinearGradient {
0112 x1: 0
0113 y1: 0
0114 x2: 0
0115 y2: 26
0116 GradientStop {
0117 position: 0
0118 color: Kirigami.Theme.backgroundColor
0119 }
0120 GradientStop {
0121 position: 1
0122 color: Kirigami.ColorUtils.linearInterpolation(
0123 Kirigami.Theme.backgroundColor,
0124 Kirigami.Theme.textColor,
0125 0.3)
0126 }
0127 }
0128 PathSvg {
0129 path: "m 0.238879,-10.451756 c -5.236275,0 -9.481142,4.1008135 -9.481142,9.1594965 0,11.5813965 9.481142,18.3189895 9.481142,18.3189895 0,0 9.481178,-6.737593 9.481178,-18.3189895 0,-5.058683 -4.244867,-9.1594965 -9.481178,-9.1594965 z"
0130 }
0131 }
0132 }
0133 }