small tweak to stats button, check the new config

This commit is contained in:
SomeElse
2026-04-29 07:50:20 +00:00
parent 1682c0a208
commit cd4e373898
4 changed files with 53 additions and 12 deletions

View File

@@ -136,15 +136,51 @@ Rectangle {
HoverHandler { id: hov }
property bool showAlt: false
onShowAltChanged: arc.requestPaint()
Connections {
target: hov
function onHoveredChanged() {
if (!hov.hovered) ring.showAlt = false
}
}
TapHandler {
enabled: !Cfg.Config.statsHideTextUntilHover || hov.hovered
onTapped: ring.showAlt = !ring.showAlt
}
Text {
anchors.centerIn: parent
text: Cfg.Config.statsShowPercentByDefault
? (hov.hovered ? ring.label : Math.round(ring.value) + "%")
: (hov.hovered ? Math.round(ring.value) + "%" : ring.label)
text: {
if (Cfg.Config.statsHideTextUntilHover) {
if (!hov.hovered) return ""
var showPct = ring.showAlt
? !Cfg.Config.statsShowPercentByDefault
: Cfg.Config.statsShowPercentByDefault
return showPct ? Math.round(ring.value) + "%" : ring.label
} else {
var baseShowPct = Cfg.Config.statsShowPercentByDefault
? !hov.hovered
: hov.hovered
var finalShowPct = ring.showAlt ? !baseShowPct : baseShowPct
return finalShowPct ? Math.round(ring.value) + "%" : ring.label
}
}
color: ring.labelColor
font.pixelSize: Cfg.Config.statsRingFontSize
font.bold: true
font.family: "monospace"
opacity: (Cfg.Config.statsHideTextUntilHover && !hov.hovered) ? 0 : 1
Behavior on opacity {
NumberAnimation { duration: 180; easing.type: Easing.OutCubic }
}
}
}
@@ -178,4 +214,3 @@ Rectangle {
}
}
}