Merge branch 'main' into qt-scaling

This commit is contained in:
ItsLemmy
2025-10-12 18:27:56 -04:00
27 changed files with 600 additions and 241 deletions
+75 -76
View File
@@ -129,17 +129,9 @@ Variants {
readonly property int hHeight: Math.round(64)
readonly property int vHeight: Math.round(320) // Vertical OSD height (matches horizontal width)
// Ensure an even width to keep the vertical bar perfectly centered
readonly property int barThickness: (function () {
readonly property int barThickness: {
const base = Math.max(8, Math.round(8))
return (base % 2 === 0) ? base : base + 1
})()
Component.onCompleted: {
}
Component.onDestruction: {
}
// Anchor selection based on location (window edges)
@@ -218,8 +210,10 @@ Variants {
opacity: 0
scale: 0.85
anchors.horizontalCenter: verticalMode ? undefined : parent.horizontalCenter
anchors.verticalCenter: verticalMode ? parent.verticalCenter : undefined
// Only horizontally center when the window itself is centered (top/bottom positions)
// For left/right vertical mode, fill the parent width
anchors.horizontalCenter: (!panel.verticalMode && panel.isCentered) ? parent.horizontalCenter : undefined
anchors.verticalCenter: panel.verticalMode ? parent.verticalCenter : undefined
Behavior on opacity {
NumberAnimation {
@@ -336,85 +330,90 @@ Variants {
Component {
id: verticalContent
ColumnLayout {
// Ensure inner padding respects the rounded corners; avoid clipping the icon/text
property int vMargin: (function () {
const styleMargin = Math.round(Style.marginL)
const cornerGuard = Math.round(osdItem.radius)
return Math.max(styleMargin, cornerGuard)
})()
property int vMarginTop: Math.max(Math.round(osdItem.radius), Math.round(Style.marginS))
property int balanceDelta: Math.round(Style.marginS)
Item {
anchors.fill: parent
anchors.topMargin: vMargin
anchors.leftMargin: vMargin
anchors.rightMargin: vMargin
anchors.bottomMargin: vMargin
spacing: Math.round(Style.marginS)
// Percentage text at top
Item {
Layout.fillWidth: true
Layout.preferredHeight: percentText.implicitHeight
NText {
id: percentText
text: root.getDisplayPercentage()
color: Color.mOnSurface
pointSize: Style.fontSizeS
family: Settings.data.ui.fontFixed
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
ColumnLayout {
// Ensure inner padding respects the rounded corners; avoid clipping the icon/text
property int vMargin: {
const styleMargin = Style.marginL
const cornerGuard = Math.round(osdItem.radius)
return Math.max(styleMargin, cornerGuard)
}
}
property int vMarginTop: Math.max(Math.round(osdItem.radius), Style.marginS)
property int balanceDelta: Style.marginS
anchors.fill: parent
anchors.topMargin: vMargin
anchors.leftMargin: vMargin
anchors.rightMargin: vMargin
anchors.bottomMargin: vMargin
spacing: Style.marginS
// Progress bar
Item {
Layout.fillWidth: true
Layout.fillHeight: true // Fill remaining space between text and icon
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.bottom: parent.bottom
width: panel.barThickness
radius: Math.round(panel.barThickness / 2)
color: Color.mSurfaceVariant
// Percentage text at top
Item {
Layout.fillWidth: true
Layout.preferredHeight: 20
NText {
id: percentText
text: root.getDisplayPercentage()
color: Color.mOnSurface
pointSize: Style.fontSizeS
family: Settings.data.ui.fontFixed
width: 50
height: parent.height
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
// Progress bar
Item {
Layout.fillWidth: true
Layout.fillHeight: true // Fill remaining space between text and icon
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.bottom: parent.bottom
height: parent.height * Math.min(1.0, root.getCurrentValue())
radius: parent.radius
color: root.getProgressColor()
width: panel.barThickness
radius: Math.round(panel.barThickness / 2)
color: Color.mSurfaceVariant
Behavior on height {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: parent.height * Math.min(1.0, root.getCurrentValue())
radius: parent.radius
color: root.getProgressColor()
Behavior on height {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
}
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
}
}
}
}
// Icon at bottom
NIcon {
icon: root.getIcon()
color: root.getIconColor()
pointSize: Style.fontSizeXL
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
// Icon at bottom
NIcon {
icon: root.getIcon()
color: root.getIconColor()
pointSize: Style.fontSizeXL
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutQuad
}
}
}
}