formatter

This commit is contained in:
Zacharias-Brohn
2026-02-24 23:20:11 +01:00
parent 40cd984b6d
commit d56a0260fb
202 changed files with 15037 additions and 15352 deletions
+110 -114
View File
@@ -11,173 +11,169 @@ Item {
required property var wrapper
implicitWidth: profiles.implicitWidth
implicitHeight: profiles.implicitHeight
implicitWidth: profiles.implicitWidth
CustomRect {
id: profiles
CustomRect {
id: profiles
property string current: {
const p = PowerProfiles.profile;
if (p === PowerProfile.PowerSaver)
return saver.icon;
if (p === PowerProfile.Performance)
return perf.icon;
return balance.icon;
}
property string current: {
const p = PowerProfiles.profile;
if (p === PowerProfile.PowerSaver)
return saver.icon;
if (p === PowerProfile.Performance)
return perf.icon;
return balance.icon;
}
anchors.horizontalCenter: parent.horizontalCenter
implicitWidth: saver.implicitHeight + balance.implicitHeight + perf.implicitHeight + 8 * 2 + saverLabel.contentWidth
implicitHeight: Math.max(saver.implicitHeight, balance.implicitHeight, perf.implicitHeight) + 5 * 2 + saverLabel.contentHeight
color: DynamicColors.tPalette.m3surfaceContainer
anchors.horizontalCenter: parent.horizontalCenter
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: Math.max(saver.implicitHeight, balance.implicitHeight, perf.implicitHeight) + 5 * 2 + saverLabel.contentHeight
implicitWidth: saver.implicitHeight + balance.implicitHeight + perf.implicitHeight + 8 * 2 + saverLabel.contentWidth
// color: "transparent"
radius: 6
radius: 6
CustomRect {
id: indicator
CustomRect {
id: indicator
color: DynamicColors.palette.m3primary
radius: 1000
state: profiles.current
color: DynamicColors.palette.m3primary
radius: 1000
state: profiles.current
states: [
State {
name: saver.icon
states: [
State {
name: saver.icon
Fill {
item: saver
}
},
State {
name: balance.icon
Fill {
item: saver
}
},
State {
name: balance.icon
Fill {
item: balance
}
},
State {
name: perf.icon
Fill {
item: balance
}
},
State {
name: perf.icon
Fill {
item: perf
}
}
]
transitions: Transition {
AnchorAnimation {
duration: MaterialEasing.expressiveEffectsTime
easing.bezierCurve: MaterialEasing.expressiveEffects
Fill {
item: perf
}
}
]
transitions: Transition {
AnchorAnimation {
duration: MaterialEasing.expressiveEffectsTime
easing.bezierCurve: MaterialEasing.expressiveEffects
easing.type: Easing.BezierSpline
}
}
}
}
}
}
Profile {
id: saver
Profile {
id: saver
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 25
anchors.top: parent.top
anchors.topMargin: 8
anchors.left: parent.left
anchors.leftMargin: 25
icon: "nest_eco_leaf"
profile: PowerProfile.PowerSaver
text: "Power Saver"
profile: PowerProfile.PowerSaver
icon: "nest_eco_leaf"
}
}
CustomText {
id: saverLabel
anchors.top: saver.bottom
anchors.horizontalCenter: saver.horizontalCenter
anchors.top: saver.bottom
font.bold: true
text: saver.text
}
Profile {
id: balance
Profile {
id: balance
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 8
anchors.horizontalCenter: parent.horizontalCenter
icon: "power_settings_new"
profile: PowerProfile.Balanced
text: "Balanced"
profile: PowerProfile.Balanced
icon: "power_settings_new"
}
}
CustomText {
id: balanceLabel
anchors.top: balance.bottom
anchors.horizontalCenter: balance.horizontalCenter
anchors.top: balance.bottom
font.bold: true
text: balance.text
}
Profile {
id: perf
Profile {
id: perf
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 25
anchors.top: parent.top
anchors.topMargin: 8
anchors.right: parent.right
anchors.rightMargin: 25
icon: "bolt"
profile: PowerProfile.Performance
text: "Performance"
profile: PowerProfile.Performance
icon: "bolt"
}
}
CustomText {
id: perfLabel
anchors.top: perf.bottom
anchors.horizontalCenter: perf.horizontalCenter
anchors.top: perf.bottom
font.bold: true
text: perf.text
}
}
}
component Fill: AnchorChanges {
required property Item item
target: indicator
anchors.left: item.left
anchors.right: item.right
anchors.top: item.top
anchors.bottom: item.bottom
}
component Fill: AnchorChanges {
required property Item item
anchors.bottom: item.bottom
anchors.left: item.left
anchors.right: item.right
anchors.top: item.top
target: indicator
}
component Profile: Item {
required property string icon
required property int profile
required property string icon
required property int profile
required property string text
implicitWidth: icon.implicitHeight + 5 * 2
implicitHeight: icon.implicitHeight + 5 * 2
implicitHeight: icon.implicitHeight + 5 * 2
implicitWidth: icon.implicitHeight + 5 * 2
StateLayer {
radius: 1000
color: profiles.current === parent.icon ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
StateLayer {
function onClicked(): void {
PowerProfiles.profile = parent.profile;
}
function onClicked(): void {
PowerProfiles.profile = parent.profile;
}
}
color: profiles.current === parent.icon ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
radius: 1000
}
MaterialIcon {
id: icon
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.centerIn: parent
color: profiles.current === text ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
fill: profiles.current === text ? 1 : 0
font.pointSize: 36
text: parent.icon
text: parent.icon
font.pointSize: 36
color: profiles.current === text ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
fill: profiles.current === text ? 1 : 0
Behavior on fill {
Anim {}
}
}
}
Behavior on fill {
Anim {
}
}
}
}
}
+7 -6
View File
@@ -8,25 +8,28 @@ import qs.Helpers as Helpers
Item {
id: root
implicitWidth: layout.childrenRect.width + 10 * 2
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.top: parent.top
implicitWidth: layout.childrenRect.width + 10 * 2
CustomRect {
anchors.bottomMargin: 4
anchors.fill: parent
anchors.topMargin: 4
anchors.bottomMargin: 4
color: DynamicColors.tPalette.m3surfaceContainer
radius: 1000
}
RowLayout {
id: layout
anchors.centerIn: parent
MaterialIcon {
animate: true
Layout.alignment: Qt.AlignVCenter
animate: true
color: !Helpers.UPower.onBattery || UPower.displayDevice.percentage > 0.2 ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3error
fill: 1
text: {
if (!Helpers.UPower.displayDevice.isLaptopBattery) {
if (PowerProfiles.profile === PowerProfile.PowerSaver)
@@ -45,8 +48,6 @@ Item {
level--;
return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
}
color: !Helpers.UPower.onBattery || UPower.displayDevice.percentage > 0.2 ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3error
fill: 1
}
CustomText {