From 61043b78a58fe1433bed511b75366206ca816e9a Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Thu, 16 Oct 2025 09:52:47 +0800 Subject: [PATCH 1/6] feat(bar): Introduce core density scaling mechanism --- Modules/Bar/Bar.qml | 6 ++++++ Modules/Bar/Extras/BarWidgetLoader.qml | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index fa61bd95..31504433 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -102,6 +102,7 @@ Variants { model: Settings.data.bar.widgets.left delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, @@ -124,6 +125,7 @@ Variants { model: Settings.data.bar.widgets.center delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, @@ -147,6 +149,7 @@ Variants { model: Settings.data.bar.widgets.right delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, @@ -180,6 +183,7 @@ Variants { model: Settings.data.bar.widgets.left delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, @@ -204,6 +208,7 @@ Variants { model: Settings.data.bar.widgets.center delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, @@ -229,6 +234,7 @@ Variants { model: Settings.data.bar.widgets.right delegate: BarWidgetLoader { widgetId: (modelData.id !== undefined ? modelData.id : "") + barDensity: Settings.data.bar.density widgetProps: { "screen": root.modelData || null, "widgetId": modelData.id, diff --git a/Modules/Bar/Extras/BarWidgetLoader.qml b/Modules/Bar/Extras/BarWidgetLoader.qml index fff11ebf..40610d3a 100644 --- a/Modules/Bar/Extras/BarWidgetLoader.qml +++ b/Modules/Bar/Extras/BarWidgetLoader.qml @@ -12,6 +12,19 @@ Item { property string section: widgetProps && widgetProps.section || "" property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0 + property string barDensity: "default" + readonly property real scaling: (function() { + switch (barDensity) { + case "mini": + return 0.8 + case "compact": + return 0.9 + case "comfortable": + default: + return 1.0 + } + })() + // Don't reserve space unless the loaded widget is really visible implicitWidth: getImplicitSize(loader.item, "implicitWidth") implicitHeight: getImplicitSize(loader.item, "implicitHeight") @@ -40,6 +53,10 @@ Item { item[prop] = widgetProps[prop] } } + // Explicitly set scaling property + if (item.hasOwnProperty("scaling")) { + item.scaling = Qt.binding(function() { return root.scaling; }) + } } // Register this widget instance with BarService From d11a8fc3119e00b99f0632e0f308bb324e115ded Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Thu, 16 Oct 2025 09:53:00 +0800 Subject: [PATCH 2/6] feat(bar): Adapt ActiveWindow to bar density scaling --- Modules/Bar/Widgets/ActiveWindow.qml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 745f69b5..79670824 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -18,6 +18,7 @@ Item { property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 + property real scaling: 1.0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { @@ -55,8 +56,7 @@ Item { } function calculatedVerticalDimension() { - const ratio = (Settings.data.bar.density === "mini") ? 0.67 : 0.8 - return Math.round(Style.baseWidgetSize * ratio) + return Math.round((Style.baseWidgetSize - 5) * scaling) } function getAppIcon() { @@ -107,7 +107,7 @@ Item { id: fullTitleMetrics visible: false text: windowTitle - pointSize: Style.fontSizeS + pointSize: Style.fontSizeS * scaling applyUiScale: false font.weight: Style.fontWeightMedium } @@ -125,21 +125,21 @@ Item { Item { id: mainContainer anchors.fill: parent - anchors.leftMargin: isVerticalBar ? 0 : Style.marginS - anchors.rightMargin: isVerticalBar ? 0 : Style.marginS + anchors.leftMargin: isVerticalBar ? 0 : Style.marginS * scaling + anchors.rightMargin: isVerticalBar ? 0 : Style.marginS * scaling // Horizontal layout for top/bottom bars RowLayout { id: rowLayout anchors.verticalCenter: parent.verticalCenter - spacing: Style.marginS + spacing: Style.marginS * scaling visible: !isVerticalBar z: 1 // Window icon Item { - Layout.preferredWidth: 18 - Layout.preferredHeight: 18 + Layout.preferredWidth: 18 * scaling + Layout.preferredHeight: 18 * scaling Layout.alignment: Qt.AlignVCenter visible: showIcon @@ -254,7 +254,7 @@ Item { NText { id: titleText text: windowTitle - pointSize: Style.fontSizeS + pointSize: Style.fontSizeS * scaling applyUiScale: false font.weight: Style.fontWeightMedium verticalAlignment: Text.AlignVCenter @@ -265,7 +265,7 @@ Item { NText { text: windowTitle font: titleText.font - pointSize: Style.fontSizeS + pointSize: Style.fontSizeS * scaling applyUiScale: false verticalAlignment: Text.AlignVCenter color: Color.mOnSurface @@ -316,7 +316,7 @@ Item { // Window icon Item { - width: Style.baseWidgetSize * 0.5 + width: Style.baseWidgetSize * 0.5 * scaling height: width anchors.centerIn: parent visible: windowTitle !== "" From 04d091465e648aac07a88cabc8311b7589c8ff69 Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Thu, 16 Oct 2025 09:53:08 +0800 Subject: [PATCH 3/6] feat(bar): Adapt Clock to bar density scaling --- Modules/Bar/Widgets/Clock.qml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index cbbecd2f..11cd31cf 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -15,6 +15,7 @@ Rectangle { property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 + property real scaling: 1.0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { @@ -66,11 +67,13 @@ Rectangle { visible: text !== "" text: modelData family: useCustomFont && customFont ? customFont : Settings.data.ui.fontDefault - pointSize: { - if (repeater.model.length == 1) { - return Style.fontSizeS - } else { - return (index == 0) ? Style.fontSizeXS : Style.fontSizeXXS + Binding on pointSize { + value: { + if (repeater.model.length == 1) { + return Style.fontSizeS * scaling + } else { + return (index == 0) ? Style.fontSizeXS * scaling : Style.fontSizeXXS * scaling + } } } applyUiScale: false @@ -97,8 +100,11 @@ Rectangle { visible: text !== "" text: modelData family: useCustomFont && customFont ? customFont : Settings.data.ui.fontDefault - pointSize: Style.fontSizeS + Binding on pointSize { + value: Style.fontSizeS * scaling + } applyUiScale: false + font.weight: Style.fontWeightBold color: usePrimaryColor ? Color.mPrimary : Color.mOnSurface wrapMode: Text.WordWrap From ec5a60e92c85cc8ed51b34a48e000ade5f82712c Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Thu, 16 Oct 2025 09:53:37 +0800 Subject: [PATCH 4/6] feat(bar): Adapt MediaMini to bar density scaling --- Modules/Bar/Widgets/MediaMini.qml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 922316f4..263164d5 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -17,6 +17,7 @@ Item { property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 + property real scaling: 1.0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { @@ -76,8 +77,7 @@ Item { } function calculatedVerticalDimension() { - const ratio = (Settings.data.bar.density === "mini") ? 0.67 : 0.8 - return Math.round(Style.baseWidgetSize * ratio) + return Math.round((Style.baseWidgetSize - 5) * scaling) } // A hidden text element to safely measure the full title width @@ -86,7 +86,7 @@ Item { visible: false text: titleText.text font: titleText.font - applyUiScale: false + pointSize: Style.fontSizeS * scaling } Rectangle { @@ -102,8 +102,8 @@ Item { Item { id: mainContainer anchors.fill: parent - anchors.leftMargin: isVerticalBar ? 0 : Style.marginS - anchors.rightMargin: isVerticalBar ? 0 : Style.marginS + anchors.leftMargin: isVerticalBar ? 0 : Style.marginS * scaling + anchors.rightMargin: isVerticalBar ? 0 : Style.marginS * scaling Loader { anchors.verticalCenter: parent.verticalCenter @@ -155,7 +155,7 @@ Item { id: rowLayout anchors.verticalCenter: parent.verticalCenter - spacing: Style.marginS + spacing: Style.marginS * scaling visible: !isVerticalBar z: 1 // Above the visualizer @@ -163,7 +163,7 @@ Item { id: windowIcon icon: hasActivePlayer ? (MediaService.isPlaying ? "media-pause" : "media-play") : "disc" color: hasActivePlayer ? Color.mOnSurface : Color.mOnSurfaceVariant - pointSize: Style.fontSizeL + pointSize: Style.fontSizeL * scaling verticalAlignment: Text.AlignVCenter Layout.alignment: Qt.AlignVCenter visible: !hasActivePlayer || (!showAlbumArt && !trackArt.visible) @@ -175,8 +175,8 @@ Item { spacing: 0 Item { - Layout.preferredWidth: Math.round(21 * Style.uiScaleRatio) - Layout.preferredHeight: Math.round(21 * Style.uiScaleRatio) + Layout.preferredWidth: Math.round(21 * Style.uiScaleRatio * scaling) + Layout.preferredHeight: Math.round(21 * Style.uiScaleRatio * scaling) NImageCircled { id: trackArt @@ -288,7 +288,7 @@ Item { NText { id: titleText text: hasActivePlayer ? getTitle() : placeholderText - pointSize: Style.fontSizeS + pointSize: Style.fontSizeS * scaling applyUiScale: false font.weight: Style.fontWeightMedium verticalAlignment: Text.AlignVCenter @@ -299,7 +299,7 @@ Item { NText { text: hasActivePlayer ? getTitle() : placeholderText font: titleText.font - applyUiScale: false + pointSize: Style.fontSizeS * scaling verticalAlignment: Text.AlignVCenter horizontalAlignment: hasActivePlayer ? Text.AlignLeft : Text.AlignHCenter color: hasActivePlayer ? Color.mOnSurface : Color.mOnSurfaceVariant @@ -359,7 +359,7 @@ Item { anchors.fill: parent icon: hasActivePlayer ? (MediaService.isPlaying ? "media-pause" : "media-play") : "disc" color: hasActivePlayer ? Color.mOnSurface : Color.mOnSurfaceVariant - pointSize: Style.fontSizeL + pointSize: Style.fontSizeL * scaling verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } From 9f46f8bed89bb63ddb6014493ff2999f266887a6 Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Fri, 17 Oct 2025 06:30:55 +0800 Subject: [PATCH 5/6] refactor(bar): Use ternary operator for scaling property --- Modules/Bar/Extras/BarWidgetLoader.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Modules/Bar/Extras/BarWidgetLoader.qml b/Modules/Bar/Extras/BarWidgetLoader.qml index 40610d3a..1f3b10a3 100644 --- a/Modules/Bar/Extras/BarWidgetLoader.qml +++ b/Modules/Bar/Extras/BarWidgetLoader.qml @@ -13,17 +13,7 @@ Item { property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0 property string barDensity: "default" - readonly property real scaling: (function() { - switch (barDensity) { - case "mini": - return 0.8 - case "compact": - return 0.9 - case "comfortable": - default: - return 1.0 - } - })() + readonly property real scaling: barDensity === "mini" ? 0.8 : (barDensity === "compact" ? 0.9 : 1.0) // Don't reserve space unless the loaded widget is really visible implicitWidth: getImplicitSize(loader.item, "implicitWidth") From a230ec4a2df14f619782f04a8ced16741f7a15ce Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Fri, 17 Oct 2025 06:31:40 +0800 Subject: [PATCH 6/6] fix(mediamini): add applyuiscale --- Modules/Bar/Widgets/MediaMini.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 263164d5..21ab5c36 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -86,6 +86,7 @@ Item { visible: false text: titleText.text font: titleText.font + applyUiScale: false pointSize: Style.fontSizeS * scaling } @@ -299,6 +300,7 @@ Item { NText { text: hasActivePlayer ? getTitle() : placeholderText font: titleText.font + applyUiScale: false pointSize: Style.fontSizeS * scaling verticalAlignment: Text.AlignVCenter horizontalAlignment: hasActivePlayer ? Text.AlignLeft : Text.AlignHCenter