Bar widgets: modular loading refactoring via BarWidgetRegistry+NWidgetLoader

- Hot reload is working again.
- Should also be more memory efficient on multi monitors.
This commit is contained in:
LemmyCook 2025-08-24 23:50:09 -04:00
parent a110a0d636
commit a10d55e7f5
36 changed files with 514 additions and 446 deletions

View file

@ -16,10 +16,11 @@ Item {
property color collapsedIconColor: Color.mOnSurface
property real sizeMultiplier: 0.8
property bool autoHide: false
// When true, keep the pill expanded regardless of hover state
property bool forceShown: false
property bool forceOpen: false
property bool disableOpen: false
// Effective shown state (true if hovered/animated open or forced)
readonly property bool effectiveShown: forceShown || showPill
readonly property bool effectiveShown: forceOpen || showPill
signal shown
signal hidden
@ -85,7 +86,7 @@ Item {
height: iconSize
radius: width * 0.5
// When forced shown, match pill background; otherwise use accent when hovered
color: forceShown ? pillColor : (showPill ? iconCircleColor : Color.mSurfaceVariant)
color: forceOpen ? pillColor : (showPill ? iconCircleColor : Color.mSurfaceVariant)
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
@ -100,7 +101,7 @@ Item {
text: root.icon
font.pointSize: Style.fontSizeM * scaling
// When forced shown, use pill text color; otherwise accent color when hovered
color: forceShown ? textColor : (showPill ? iconTextColor : Color.mOnSurface)
color: forceOpen ? textColor : (showPill ? iconTextColor : Color.mOnSurface)
anchors.centerIn: parent
}
}
@ -194,18 +195,21 @@ Item {
anchors.fill: parent
hoverEnabled: true
onEntered: {
if (!forceShown) {
root.entered()
tooltip.show()
if (disableOpen) {
return
}
if (!forceOpen) {
showDelayed()
}
tooltip.show()
root.entered()
}
onExited: {
if (!forceShown) {
root.exited()
if (!forceOpen) {
hide()
}
tooltip.hide()
root.exited()
}
onClicked: {
root.clicked()
@ -226,7 +230,7 @@ Item {
}
function hide() {
if (forceShown) {
if (forceOpen) {
return
}
if (showPill) {
@ -245,8 +249,8 @@ Item {
}
}
onForceShownChanged: {
if (forceShown) {
onForceOpenChanged: {
if (forceOpen) {
// Immediately lock open without animations
showAnim.stop()
hideAnim.stop()