From 72f792b5430e70c2e896e5c5d24e3a0942a1f687 Mon Sep 17 00:00:00 2001 From: Parminder Klair Date: Mon, 17 Aug 2026 13:30:06 +0100 Subject: [PATCH] feat: use SUB/WAVE mark in bar --- BarWidget.qml | 32 +++++++++----------------------- SubwaveMark.qml | 8 ++++++++ subwave-mark.svg | 27 +++++++++++++++++++++++++++ tests/run | 8 ++++++++ tests/tst_subwavemark.qml | 21 +++++++++++++++++++++ 5 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 SubwaveMark.qml create mode 100644 subwave-mark.svg create mode 100644 tests/tst_subwavemark.qml diff --git a/BarWidget.qml b/BarWidget.qml index 16010cb..746fcea 100644 --- a/BarWidget.qml +++ b/BarWidget.qml @@ -79,7 +79,7 @@ BarWidget { nowProcess.running = true } - implicitWidth: row.implicitWidth + Style.space(14) + implicitWidth: Style.space(32) implicitHeight: barSize FileView { @@ -121,30 +121,16 @@ BarWidget { onTriggered: root.refreshNowPlaying() } - Row { - id: row + SubwaveMark { + id: mark anchors.centerIn: parent - spacing: Style.space(6) - - Text { - anchors.verticalCenter: parent.verticalCenter - text: "󰝚" - color: root.playerRunning && !root.playerPaused && root.stationOnline - ? Color.accent : root.bar.barForeground - font.family: root.bar.fontFamily - font.pixelSize: Style.font.body - } + width: Math.min(Style.space(20), root.barSize - Style.space(6)) + height: width + opacity: root.playerRunning + ? (!root.playerPaused && root.stationOnline ? 1 : 0.55) + : 0.82 - Text { - visible: !root.vertical - width: Math.min(implicitWidth, Style.space(180)) - anchors.verticalCenter: parent.verticalCenter - text: root.label - color: root.bar.barForeground - font.family: root.bar.fontFamily - font.pixelSize: Style.font.body - elide: Text.ElideRight - } + Behavior on opacity { NumberAnimation { duration: 120 } } } MouseArea { diff --git a/SubwaveMark.qml b/SubwaveMark.qml new file mode 100644 index 0000000..6537dcb --- /dev/null +++ b/SubwaveMark.qml @@ -0,0 +1,8 @@ +import QtQuick + +Image { + source: Qt.resolvedUrl("subwave-mark.svg") + fillMode: Image.PreserveAspectFit + smooth: true + mipmap: true +} diff --git a/subwave-mark.svg b/subwave-mark.svg new file mode 100644 index 0000000..cf10f29 --- /dev/null +++ b/subwave-mark.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/run b/tests/run index 3e6880b..069a2d4 100755 --- a/tests/run +++ b/tests/run @@ -6,6 +6,14 @@ node "$root/tests/model.test.mjs" bash "$root/tests/fetch.test.sh" bash "$root/tests/player.test.sh" +if [[ -x /usr/lib/qt6/bin/qmltestrunner ]]; then + QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \ + /usr/lib/qt6/bin/qmltestrunner \ + -input "$root/tests/tst_subwavemark.qml" \ + -import "$root" \ + -o -,txt +fi + if command -v omarchy >/dev/null 2>&1; then omarchy plugin validate "$root" fi diff --git a/tests/tst_subwavemark.qml b/tests/tst_subwavemark.qml new file mode 100644 index 0000000..106b656 --- /dev/null +++ b/tests/tst_subwavemark.qml @@ -0,0 +1,21 @@ +import QtQuick +import QtTest + +TestCase { + id: testCase + name: "SubwaveMark" + + function test_loadsBrandedArtworkAtCompactSize() { + var component = Qt.createComponent("../SubwaveMark.qml") + tryCompare(component, "status", Component.Ready) + + var mark = component.createObject(testCase, { width: 20, height: 20 }) + verify(mark !== null) + tryCompare(mark, "status", Image.Ready) + compare(mark.width, 20) + compare(mark.height, 20) + verify(mark.paintedWidth > 0) + verify(mark.paintedHeight > 0) + mark.destroy() + } +}