Compare commits
2 commits
7633ed75a9
...
26de0d6c4f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26de0d6c4f | ||
|
|
03554e5ad3 |
2 changed files with 18 additions and 10 deletions
|
|
@ -102,6 +102,14 @@ M.BarSection {
|
||||||
onTriggered: root._pinned = false
|
onTriggered: root._pinned = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _loadColor(pct) {
|
||||||
|
const t = Math.max(0, Math.min(100, pct)) / 100;
|
||||||
|
const a = t < 0.5 ? M.Theme.base0B : M.Theme.base0A;
|
||||||
|
const b = t < 0.5 ? M.Theme.base0A : M.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);
|
||||||
|
}
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
icon: "\uF2DB"
|
icon: "\uF2DB"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -167,6 +175,7 @@ M.BarSection {
|
||||||
|
|
||||||
readonly property int _u: root._coreUsage[index] ?? 0
|
readonly property int _u: root._coreUsage[index] ?? 0
|
||||||
readonly property real _f: root._coreFreq[index] ?? 0
|
readonly property real _f: root._coreFreq[index] ?? 0
|
||||||
|
readonly property color _barColor: root._loadColor(_u)
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: coreLabel
|
id: coreLabel
|
||||||
|
|
@ -197,7 +206,7 @@ M.BarSection {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width * (parent.parent._u / 100)
|
width: parent.width * (parent.parent._u / 100)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: root.accentColor
|
color: parent.parent._barColor
|
||||||
radius: 2
|
radius: 2
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
@ -213,7 +222,7 @@ M.BarSection {
|
||||||
anchors.rightMargin: 12
|
anchors.rightMargin: 12
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: parent._f.toFixed(2)
|
text: parent._f.toFixed(2)
|
||||||
color: M.Theme.base04
|
color: parent._barColor
|
||||||
font.pixelSize: M.Theme.fontSize - 2
|
font.pixelSize: M.Theme.fontSize - 2
|
||||||
font.family: M.Theme.fontFamily
|
font.family: M.Theme.fontFamily
|
||||||
width: 32
|
width: 32
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,13 @@ M.BarSection {
|
||||||
}
|
}
|
||||||
|
|
||||||
on_ExpandedChanged: console.log("[vol] expanded →", _expanded)
|
on_ExpandedChanged: console.log("[vol] expanded →", _expanded)
|
||||||
on_AnyHoverChanged: console.log("[vol] anyHover →", _anyHover, "| barHover:", root._hovered, "| panelHover:", hoverPanel.panelHovered)
|
on_AnyHoverChanged: {
|
||||||
|
console.log("[vol] anyHover →", _anyHover, "| barHover:", root._hovered, "| panelHover:", hoverPanel.panelHovered);
|
||||||
|
if (_anyHover)
|
||||||
|
_collapseTimer.stop();
|
||||||
|
else if (_expanded)
|
||||||
|
_collapseTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
onVolumeChanged: _flashPanel()
|
onVolumeChanged: _flashPanel()
|
||||||
onMutedChanged: _flashPanel()
|
onMutedChanged: _flashPanel()
|
||||||
|
|
@ -66,13 +72,6 @@ M.BarSection {
|
||||||
onTriggered: root._osdActive = false
|
onTriggered: root._osdActive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
on_AnyHoverChanged: {
|
|
||||||
if (_anyHover)
|
|
||||||
_collapseTimer.stop();
|
|
||||||
else if (_expanded)
|
|
||||||
_collapseTimer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: _collapseTimer
|
id: _collapseTimer
|
||||||
interval: 1500
|
interval: 1500
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue