standardize services import alias to S in applets and lock

This commit is contained in:
Damocles 2026-04-17 23:13:54 +02:00
parent 0160e4a1fb
commit 9a079fe2f1
10 changed files with 202 additions and 202 deletions

View file

@ -1,5 +1,5 @@
import QtQuick
import "../services" as M
import "../services" as S
Column {
id: root
@ -14,7 +14,7 @@ Column {
property bool active: true
property string deviceFilter: ""
property color stateColor: temp > hot ? M.Theme.base08 : temp > warm ? M.Theme.base0A : root.accentColor
property color stateColor: temp > hot ? S.Theme.base08 : temp > warm ? S.Theme.base0A : root.accentColor
Behavior on stateColor {
ColorAnimation {
duration: 300
@ -23,8 +23,8 @@ Column {
function _tempColor(celsius) {
const t = Math.max(0, Math.min(100, celsius)) / 100;
const a = t < 0.5 ? M.Theme.base0B : M.Theme.base0A;
const b = t < 0.5 ? M.Theme.base0A : M.Theme.base08;
const a = t < 0.5 ? S.Theme.base0B : S.Theme.base0A;
const b = t < 0.5 ? S.Theme.base0A : S.Theme.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
@ -40,8 +40,8 @@ Column {
anchors.verticalCenter: parent.verticalCenter
text: root.temp + "\u00B0C"
color: root.stateColor
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
font.bold: true
width: _tempSizer.implicitWidth
horizontalAlignment: Text.AlignRight
@ -71,7 +71,7 @@ Column {
Rectangle {
anchors.fill: parent
color: M.Theme.base02
color: S.Theme.base02
radius: 3
}
@ -95,7 +95,7 @@ Column {
width: 1
height: parent.height + 4
anchors.verticalCenter: parent.verticalCenter
color: M.Theme.base0A
color: S.Theme.base0A
opacity: 0.6
}
@ -105,7 +105,7 @@ Column {
width: 1
height: parent.height + 4
anchors.verticalCenter: parent.verticalCenter
color: M.Theme.base08
color: S.Theme.base08
opacity: 0.6
}
}
@ -149,7 +149,7 @@ Column {
// Warm threshold line
const warmY = height - height * (root.warm / 100);
ctx.strokeStyle = M.Theme.base0A.toString();
ctx.strokeStyle = S.Theme.base0A.toString();
ctx.globalAlpha = 0.3;
ctx.lineWidth = 1;
ctx.setLineDash([3, 3]);
@ -160,7 +160,7 @@ Column {
// Hot threshold line
const hotY = height - height * (root.hot / 100);
ctx.strokeStyle = M.Theme.base08.toString();
ctx.strokeStyle = S.Theme.base08.toString();
ctx.beginPath();
ctx.moveTo(0, hotY);
ctx.lineTo(width, hotY);
@ -173,7 +173,7 @@ Column {
const offset = maxSamples - d.length;
for (let i = 0; i < d.length; i++) {
const barH = Math.max(1, height * d[i] / 100);
const barColor = d[i] > root.hot ? M.Theme.base08 : d[i] > root.warm ? M.Theme.base0A : _col;
const barColor = d[i] > root.hot ? S.Theme.base08 : d[i] > root.warm ? S.Theme.base0A : _col;
ctx.fillStyle = barColor.toString();
ctx.fillRect((offset + i) * bw, height - barH, Math.max(1, bw - 0.5), barH);
}
@ -190,9 +190,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "warm " + root.warm + "\u00B0 hot " + root.hot + "\u00B0"
color: M.Theme.base03
font.pixelSize: M.Theme.fontSize - 3
font.family: M.Theme.fontFamily
color: S.Theme.base03
font.pixelSize: S.Theme.fontSize - 3
font.family: S.Theme.fontFamily
font.letterSpacing: 0.5
}
@ -201,9 +201,9 @@ Column {
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "10 min"
color: M.Theme.base03
font.pixelSize: M.Theme.fontSize - 3
font.family: M.Theme.fontFamily
color: S.Theme.base03
font.pixelSize: S.Theme.fontSize - 3
font.family: S.Theme.fontFamily
}
}
@ -212,7 +212,7 @@ Column {
width: root.width - 16
height: 1
anchors.horizontalCenter: parent.horizontalCenter
color: M.Theme.base03
color: S.Theme.base03
visible: root.devices.length > 0
}
@ -238,9 +238,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: modelData.name
color: _isActive ? root.accentColor : M.Theme.base04
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
color: _isActive ? root.accentColor : S.Theme.base04
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
elide: Text.ElideRight
width: parent.width - 80
}
@ -251,8 +251,8 @@ Column {
anchors.verticalCenter: parent.verticalCenter
text: modelData.celsius + "\u00B0C"
color: root._tempColor(modelData.celsius)
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
font.bold: _isActive
}
}