A CD-shaped music player for Linux, with local playback and Cider integration.
Refine player controls, scaling and rendering performance
yappologistic00467ed8f409
diff --git a/.gitignore b/.gitignoreindex cf80943..17342ab 100644--- a/.gitignore+++ b/.gitignore@@ -27,7 +27,8 @@!/assets//assets/*-!/assets/spun.svg+!/assets/spun-icon.png+!/assets/spun-window.png!/assets/First-Light.flac!/assets/screenshots//assets/screenshots/*diff --git a/CMakeLists.txt b/CMakeLists.txtindex bc84110..7eb0919 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -76,7 +76,7 @@ function(spun_application target)set(asset_compression --compress-algo zlib --compress 9 --threshold 0)endif()qt_add_resources(${target} "${target}_assets" PREFIX "/"- FILES ${SPUN_SYMBOLS} assets/spun.svg licenses/MaterialSymbols-LICENSE.txt+ FILES ${SPUN_SYMBOLS} assets/spun-window.png licenses/MaterialSymbols-LICENSE.txtOPTIONS ${asset_compression})if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")target_compile_options(${target} PRIVATE "$<$<CONFIG:Release>:${SPUN_SIZE_OPTIMIZATION};-ffunction-sections;-fdata-sections>")diff --git a/README.md b/README.mdindex 4163bf2..6a484ba 100644--- a/README.md+++ b/README.md@@ -1,6 +1,6 @@<h1 align="center">Spun</h1>-<p align="center">A CD and vinyl music player for Linux.</p>+<p align="center">A CD, vinyl and cassette music player for Linux.</p><p align="center"><img src="assets/screenshots/spun-vinyl.png" alt="Spun in vinyl mode with a gold tonearm and the Cider queue alongside it" width="1000">@@ -102,8 +102,13 @@ Spun connects to Cider's local API on port 10767. Basic playback controls use Li- **Audio quality:** choose **Audio quality** in the current song’s **⋯** menu. Spun displays the quality Cider reports and labels device output separately; it does not infer lossless or Atmos from device support. Details are fetched only when opened or refreshed.- **Copy song link:** use **Copy song link** in the current song, browser or Cider queue’s **⋯** menu. Library songs use their public catalog identity; uploaded or unavailable songs may have no shareable link.- **Music links:** paste an Apple Music song, album, playlist or station link into search, or drop it on the player. Spun shows the result before you choose playback.+- **Interface size:** choose 85–150% in **Preferences → Interface size**. Text, controls and artwork scale together; large layouts fit the available screen.+- **Fine seeking:** hold **Shift** while dragging a progress bar, the disc rim or vinyl needle. Progress bars preview your position and seek on release; **Esc** cancels. Cassette reels wind with the preview and respect reduced motion and the cassette sound preference.+- **Artwork:** choose **View artwork** from the player's **⋯** menu to inspect the full cover without the disc cutout.+- **Queue browsing:** scrolling away keeps your place when playback advances. **Current song** returns to the playing track and resumes following it.- **Disc reverse:** double-click the disc or press **F** to see album details and tracks. Switch to lyrics with **Y** when available. Local lyrics can come from matching `.lrc` / `.txt` files or embedded metadata.-- **Disc appearance:** choose **CD** or **Vinyl** in **More → Preferences**. Vinyl keeps the artwork on its center label, with grooves, a small spindle hole, and a gold tonearm. The arm lowers for playback, tracks inward through the song, and parks on pause. It scales with Mini mode, stays out of the reverse view and disc swaps, and respects reduced motion. Both styles share playback, reverse, lyrics, the progress ring, disc swaps and mini mode. Your choice is remembered.+- **Disc appearance:** choose **CD**, **Vinyl** or **Cassette** in **More → Preferences**. Vinyl keeps the artwork on its center label, with grooves, a small spindle hole, and a gold tonearm. The arm lowers for playback, tracks inward through the song, and parks on pause. It scales with Mini mode, stays out of the reverse view and disc swaps, and respects reduced motion. Cassette mode adds a tape shell, animated reels, a horizontal progress bar and optional transport sounds. All three styles share playback, reverse-side details, lyrics and Mini mode. Your choice is remembered.+- **Vinyl controls:** choose 33⅓ or 45 RPM, enable a horizontal progress bar, or add optional crackle, hiss and groove skips in Preferences. Drag the needle onto the grooves to seek and play.- **Mini mode:** a little disc with controls underneath. Optionally keep it above other windows in Preferences. Hover or keyboard-focus **Next** to preview the upcoming artwork, title and artist. Cider’s queue is checked on demand; an unknown next track is shown honestly, including local shuffle. No extra polling runs while the preview is closed.**More → Preferences** contains CD/Vinyl appearance, the font picker, background blur, disc animation and other playback options. Spun follows Noctalia's colors and reduced-motion preference when available. Hyprland integration depends on the compositor's supported interfaces.diff --git a/assets/spun-icon.png b/assets/spun-icon.pngnew file mode 100644index 0000000..6504ba2Binary files /dev/null and b/assets/spun-icon.png differdiff --git a/assets/spun-window.png b/assets/spun-window.pngnew file mode 100644index 0000000..bd7a2b8Binary files /dev/null and b/assets/spun-window.png differdiff --git a/assets/spun.svg b/assets/spun.svgdeleted file mode 100644index 9da6143..0000000--- a/assets/spun.svg+++ /dev/null@@ -1 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><defs><linearGradient id="m" x2="1" y2="1"><stop stop-color="#dce7e1"/><stop offset=".3" stop-color="#a6a3c7"/><stop offset=".55" stop-color="#f4d6b2"/><stop offset=".8" stop-color="#a3bdc6"/><stop offset="1" stop-color="#eee0de"/></linearGradient><linearGradient id="a" x2=".2" y2="1"><stop stop-color="#303750"/><stop offset=".6" stop-color="#be8e87"/><stop offset="1" stop-color="#242739"/></linearGradient><mask id="h"><rect width="128" height="128" fill="white"/><circle cx="64" cy="64" r="9" fill="black"/></mask></defs><g mask="url(#h)"><circle cx="64" cy="64" r="60" fill="url(#m)"/><circle cx="64" cy="64" r="55" fill="url(#a)"/><circle cx="84" cy="42" r="10" fill="#edc29e"/><path d="M12 72Q35 43 66 77T116 69A55 55 0 0 1 12 72" fill="#303145"/><circle cx="64" cy="64" r="16" fill="url(#m)"/><circle cx="64" cy="64" r="11" fill="#6f727b"/></g></svg>diff --git a/qml/CassetteReels.qml b/qml/CassetteReels.qmlindex 14cc1c2..a66a78e 100644--- a/qml/CassetteReels.qml+++ b/qml/CassetteReels.qml@@ -6,7 +6,7 @@ Item {readonly property real leftAngle: outgoing ? app.outgoingCassetteLeftAngle : app.cassetteLeftAnglereadonly property real rightAngle: outgoing ? app.outgoingCassetteRightAngle : app.cassetteRightAngleproperty bool outgoing: false- readonly property real progress: Math.max(0, Math.min(1, app.progress))+ readonly property real progress: Math.max(0, Math.min(1, app.cassetteVisualProgress))Repeater {model: 2Item {diff --git a/qml/FontPicker.qml b/qml/FontPicker.qmlindex 8b0be7c..17fb017 100644--- a/qml/FontPicker.qml+++ b/qml/FontPicker.qml@@ -9,8 +9,8 @@ Popup {popupType: Popup.Itemfocus: truemodal: true; dim: false- width: Math.min(352, app.width - 24)- height: Math.min(Math.max(424, preferences.height), app.height - 24)+ width: Math.min(352, (app.layoutWidth || app.width) - 24)+ height: Math.min(Math.max(424, preferences.height), (app.layoutHeight || app.height) - 24)padding: 12parent: app.contentItemx: Math.max(12, preferences.x)diff --git a/qml/LibraryPanel.qml b/qml/LibraryPanel.qmlindex eb592e8..ad6aae9 100644--- a/qml/LibraryPanel.qml+++ b/qml/LibraryPanel.qml@@ -29,6 +29,7 @@ Rectangle {}readonly property bool artistSongs: artistPage && browser.artistView === "songs"property var savedPositions: []+ property int navigationDirection: 0property var selectionKeys: []property int selectionAnchor: -1readonly property int selectionCount: selectionKeys.length@@ -111,9 +112,10 @@ Rectangle {NumberAnimation { target: entranceOffset; property: "x"; from: 12; to: 0; duration: panel.transitionTime; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.enterCurve }}ParallelAnimation {- id: listEntrance+ id: listEntrance; objectName: "libraryListEntrance"+ property real startOffset: 0NumberAnimation { target: list; property: "opacity"; from: 0; to: 1; duration: panel.feedbackTime; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve }- NumberAnimation { target: listOffset; property: "x"; from: panel.detail ? 12 : 0; to: 0; duration: panel.transitionTime; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.enterCurve }+ NumberAnimation { target: listOffset; property: "x"; from: listEntrance.startOffset; to: 0; duration: panel.transitionTime; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.enterCurve }}color: app.surface; radius: SpunStyle.panelRadiuswidth: 310@@ -122,16 +124,17 @@ Rectangle {function activate(index) {if (index < 0) returnif (!detail) savedY = list.contentY+ list.currentIndex = indexbrowser.open(index)if (detail) list.forceActiveFocus()}Connections {target: panel.browser- function onNavigating() { panel.savedPositions = panel.savedPositions.slice(-15).concat([list.contentY]) }- function onNavigationReset() { panel.savedPositions = []; panel.clearSelection() }+ function onNavigating() { panel.navigationDirection = 1; panel.savedPositions = panel.savedPositions.slice(-15).concat([{ y: list.contentY, index: list.currentIndex }]) }+ function onNavigationReset() { panel.savedPositions = []; panel.navigationDirection = 0; panel.clearSelection() }function onItemsChanging(append) { if (!append) panel.clearSelection(); panel.closeActions(); panel.appending = append; panel.pageY = append ? list.contentY : 0; panel.pageIndex = append ? list.currentIndex : -1 }- function onItemsChanged() { const keys = new Set(panel.browser.items.map((item, index) => panel.rowKey(index, item))); panel.selectionKeys = panel.selectionKeys.filter(key => keys.has(key)); Qt.callLater(function() { list.contentY = panel.pageY; list.currentIndex = panel.pageIndex; if (!panel.appending && panel.app.animate && panel.visible && list.count) listEntrance.restart() }) }- function onReturned() { const positions = panel.savedPositions.slice(); const y = positions.pop() || 0; panel.savedPositions = positions; Qt.callLater(function() { list.contentY = y; list.forceActiveFocus() }) }+ function onItemsChanged() { const keys = new Set(panel.browser.items.map((item, index) => panel.rowKey(index, item))); panel.selectionKeys = panel.selectionKeys.filter(key => keys.has(key)); Qt.callLater(function() { list.contentY = panel.pageY; list.currentIndex = panel.pageIndex; if (!panel.appending && panel.visible && list.count) { if (panel.app.animate) { listEntrance.startOffset = panel.navigationDirection * 12; listEntrance.restart() }; panel.navigationDirection = 0 } }) }+ function onReturned() { const positions = panel.savedPositions.slice(); const previous = positions.pop() || { y: 0, index: -1 }; panel.savedPositions = positions; panel.navigationDirection = -1; Qt.callLater(function() { list.currentIndex = Math.min(list.count - 1, previous.index); list.contentY = previous.y; list.forceActiveFocus(Qt.BacktabFocusReason) }) }}component SmallButton: AbstractButton {id: controldiff --git a/qml/Main.qml b/qml/Main.qmlindex 4a514eb..cee2845 100644--- a/qml/Main.qml+++ b/qml/Main.qml@@ -8,10 +8,15 @@ ApplicationWindow {objectName: "spunWindow"title: "Spun"visible: true- width: miniMode ? 300 : sideOpen ? 860 : 530- height: miniMode ? (showHorizontalSeek ? 382 : 354) : 730- minimumWidth: 300; maximumWidth: 860- minimumHeight: 300; maximumHeight: 730+ readonly property real layoutWidth: miniMode ? 300 : sideOpen ? 860 : 530+ readonly property real layoutHeight: miniMode ? (showHorizontalSeek ? 382 : 354) : 730+ readonly property real uiScale: testMode ? typography.uiScale : Math.min(typography.uiScale,+ Math.max(.5, (Screen.desktopAvailableWidth - 40) / layoutWidth),+ Math.max(.5, (Screen.desktopAvailableHeight - 40) / layoutHeight))+ width: Math.round(layoutWidth * uiScale); height: Math.round(layoutHeight * uiScale)+ minimumWidth: 150; maximumWidth: 1290+ minimumHeight: 150; maximumHeight: 1095+ onUiScaleChanged: Qt.callLater(updateMask)color: "transparent"flags: Qt.Window | Qt.FramelessWindowHint | (miniPinned && !native.supportsBlur ? Qt.WindowStaysOnTopHint : 0)font.family: SpunStyle.family@@ -61,7 +66,7 @@ ApplicationWindow {running: root.vinyl && player.vinylSkips && root.deckPlayer.playing && !root.needleDraggingonTriggered: { root.skipGroove(); interval = 45000 + Math.floor(Math.random()*35000) }}- onUseCiderChanged: { recoveryPopup.close(); quickJump.close(); savedQueuePicker.close(); clearQueueSelection(); cleanupPopup.close(); qualityPopup.close(); if(libraryDragging)endLibraryDrag(false); preferences.close(); crossfadeMenu.close(); queueMenu.close(); cancelQueueDrag(); songMenu.close(); musicBrowser.closeActions(); if (!useCider) libraryOpen = false; if (useCider) player.pause(); root.ciderService.queueVisible = queueOpen && useCider; discFlipped = false; closeQueueSearch(); Qt.callLater(presentDisc); syncLyrics() }+ onUseCiderChanged: { cancelSeekPreview(); artworkPopup.close(); recoveryPopup.close(); quickJump.close(); savedQueuePicker.close(); clearQueueSelection(); cleanupPopup.close(); qualityPopup.close(); if(libraryDragging)endLibraryDrag(false); preferences.close(); crossfadeMenu.close(); queueMenu.close(); cancelQueueDrag(); songMenu.close(); musicBrowser.closeActions(); if (!useCider) libraryOpen = false; if (useCider) player.pause(); root.ciderService.queueVisible = queueOpen && useCider; discFlipped = false; closeQueueSearch(); Qt.callLater(presentDisc); syncLyrics() }property bool lyricsView: falseproperty real swapOffset: 0property real outgoingOffset: 0@@ -78,14 +83,14 @@ ApplicationWindow {function syncLibrary() { if (!visible || visibility === Window.Minimized) { songMenu.close(); musicBrowser.closeActions() }; library.active = libraryOpen && useCider && visible && visibility !== Window.Minimized }function syncLyrics() { lyrics.remote = useCider; lyrics.active = discFlipped && lyricsView && visible && visibility !== Window.Minimized }onLyricsViewChanged: { syncLyrics(); if (!lyricsView && lyricList.activeFocus) contentItem.forceActiveFocus() }- onVisibilityChanged: { syncLibrary(); syncLyrics(); if (root.visibility === Window.Minimized) stopSwap() }- onVisibleChanged: { syncLibrary(); syncLyrics(); if (!root.visible) stopSwap() }- onAnimateChanged: if (!animate) stopSwap()+ onVisibilityChanged: { syncLibrary(); syncLyrics(); if (root.visibility === Window.Minimized) { stopSwap(); cancelSeekPreview() } }+ onVisibleChanged: { syncLibrary(); syncLyrics(); if (!root.visible) { stopSwap(); cancelSeekPreview() } }+ onAnimateChanged: if (!animate) { stopSwap(); tapeWindSpeed = 0 }property bool discFlipped: falsereadonly property var discDetails: deckPlayer.discDetailsreadonly property var albumTracks: discDetails.tracks || []onDiscFlippedChanged: {- scrubber.cancelScrub()+ cancelSeekPreview(); scrubber.cancelScrub()stopSwap()root.ciderService.discVisible = discFlipped && useCidersyncLyrics()@@ -95,8 +100,8 @@ ApplicationWindow {onMiniPinnedChanged: native.effects(root, backgroundBlur)property bool miniMode: player.miniModeonMiniModeChanged: Qt.callLater(function() {- scrubber.cancelScrub(); stopSwap()- if (miniMode) { savedQueuePicker.close(); qualityPopup.close(); if(libraryDragging)endLibraryDrag(false); preferences.close(); crossfadeMenu.close(); songMenu.close(); musicBrowser.closeActions(); libraryOpen = false; queueOpen = false; helpOpen = false; menu.close(); miniReveal.restart() }+ cancelSeekPreview(); scrubber.cancelScrub(); stopSwap()+ if (miniMode) { artworkPopup.close(); savedQueuePicker.close(); qualityPopup.close(); if(libraryDragging)endLibraryDrag(false); preferences.close(); crossfadeMenu.close(); songMenu.close(); musicBrowser.closeActions(); libraryOpen = false; queueOpen = false; helpOpen = false; menu.close(); miniReveal.restart() }updateMask(); native.effects(root, backgroundBlur)})property bool editingText: activeFocusItem instanceof TextInput || activeFocusItem instanceof TextEdit@@ -157,9 +162,10 @@ ApplicationWindow {Qt.callLater(function() { queueSearch.forceActiveFocus(); queueSearch.selectAll() })}function closeQueueSearch() {+ const restoreFocus = queueSearchOpen && queueOpenqueueSearchOpen = falsequeueQuery = ""- if (queueSearch && queueSearch.activeFocus) contentItem.forceActiveFocus()+ if (restoreFocus) queueSearchButton.forceActiveFocus(Qt.BacktabFocusReason)}property bool libraryOpen: falsereadonly property bool sideOpen: queueOpen || libraryOpen@@ -270,7 +276,7 @@ ApplicationWindow {queueMenu.rowIndex = index; queueMenu.revision = root.ciderService.queueRevisionconst point = anchor.mapToItem(root.contentItem,0,anchor.height)queueMenu.x = jewelCase.x + jewelCase.width - queueMenu.width - 16- queueMenu.y = Math.max(jewelCase.y + 12,Math.min(root.height - queueMenu.height - 16,point.y))+ queueMenu.y = Math.max(jewelCase.y + 12,Math.min(root.layoutHeight - queueMenu.height - 16,point.y))queueMenu.open()}Connections {@@ -291,11 +297,15 @@ ApplicationWindow {}property bool queueOpen: falseproperty bool helpOpen: false- readonly property bool menuOpen: recoveryPopup.visible || quickJump.visible || savedQueuePicker.visible || cleanupPopup.visible || qualityPopup.visible || savedQueueMenu.visible || saveQueuePopup.visible || deleteQueuePopup.visible || fontPicker.shown || fontPicker.opening || menu.visible || preferences.visible || crossfadeMenu.visible || queueMenu.visible || songMenu.visible || musicBrowser.actionsOpen+ readonly property bool menuOpen: artworkPopup.visible || helpOpen || recoveryPopup.visible || quickJump.visible || savedQueuePicker.visible || cleanupPopup.visible || qualityPopup.visible || savedQueueMenu.visible || saveQueuePopup.visible || deleteQueuePopup.visible || fontPicker.shown || fontPicker.opening || menu.visible || preferences.visible || crossfadeMenu.visible || queueMenu.visible || songMenu.visible || musicBrowser.actionsOpenproperty bool backgroundBlur: player.backgroundBlur && native.supportsBluronBackgroundBlurChanged: { native.effects(root, backgroundBlur); Qt.callLater(updateMask) }property bool muted: falseproperty real rememberedVolume: .65+ property var activeSeekControl: null+ property real tapeWindSpeed: 0+ readonly property real cassetteVisualProgress: activeSeekControl ? activeSeekControl.value : progress+ function cancelSeekPreview() { if (activeSeekControl) activeSeekControl.cancelSeek() }property real cassetteLeftAngle: 0property real cassetteRightAngle: 0property real outgoingCassetteLeftAngle: 0@@ -331,7 +341,22 @@ ApplicationWindow {if (root.deckPlayer.volume > 0) { rememberedVolume = root.deckPlayer.volume; root.deckPlayer.volume = 0 }else root.deckPlayer.volume = rememberedVolume > 0 ? rememberedVolume : .65}- function updateMask() { native.shape(root, sideOpen) }+ Connections {+ target: Overlay.overlay+ function onXChanged() { if (target.x !== 0) target.x = 0 }+ function onYChanged() { if (target.y !== 0) target.y = 0 }+ function onWidthChanged() { if (target.width !== root.layoutWidth) target.width = root.layoutWidth }+ function onHeightChanged() { if (target.height !== root.layoutHeight) target.height = root.layoutHeight }+ }+ function updateMask() {+ native.shape(root, sideOpen)+ // Popups share the logical scene; their overlay must use the same size.+ Overlay.overlay.transformOrigin = Item.TopLeft+ Overlay.overlay.scale = uiScale+ Overlay.overlay.x = 0; Overlay.overlay.y = 0+ Overlay.overlay.width = layoutWidth+ Overlay.overlay.height = layoutHeight+ }function toggleQueue() {if (miniMode) { player.miniMode = false; queueOpen = true }else queueOpen = !queueOpen@@ -342,7 +367,7 @@ ApplicationWindow {menu.y = Qt.binding(function() { return Math.max(12,deck.y - menu.height - 10) })songMenu.close(); musicBrowser.closeActions(); menu.open()}- onQueueOpenChanged: { clearQueueSelection(); if (queueOpen) queuePrepared = true; queueMenu.close(); cancelQueueDrag(); if (queueOpen) libraryOpen = false; if (!queueOpen) closeQueueSearch(); if (queueOpen && miniMode) player.miniMode = false; root.ciderService.queueVisible = queueOpen && useCider; Qt.callLater(updateMask) }+ onQueueOpenChanged: { clearQueueSelection(); if (queueOpen) { queuePrepared = true; trackList.following = true }; queueMenu.close(); cancelQueueDrag(); if (queueOpen) libraryOpen = false; if (!queueOpen) closeQueueSearch(); if (queueOpen && miniMode) player.miniMode = false; root.ciderService.queueVisible = queueOpen && useCider; Qt.callLater(updateMask) }onHelpOpenChanged: { if (helpOpen && miniMode) player.miniMode = false; Qt.callLater(updateMask) }onMenuOpenChanged: Qt.callLater(updateMask)onWidthChanged: Qt.callLater(updateMask)@@ -351,7 +376,7 @@ ApplicationWindow {Rectangle {objectName: "blurBackdrop"- width: root.width; height: root.height+ width: root.layoutWidth; height: root.layoutHeightvisible: root.backgroundBlurcolor: Qt.alpha(root.inset, .18)radius: 28 * theme.radius@@ -375,7 +400,7 @@ ApplicationWindow {Shortcut { sequence: "Up"; enabled: !root.libraryOpen && !trackList.activeFocus && !root.menuOpen && !root.editingText && !(root.discFlipped && (albumList.activeFocus || lyricList.activeFocus)); onActivated: root.deckPlayer.volume = Math.min(1, root.deckPlayer.volume + .05) }Shortcut { sequence: "Down"; enabled: !root.libraryOpen && !trackList.activeFocus && !root.menuOpen && !root.editingText && !(root.discFlipped && (albumList.activeFocus || lyricList.activeFocus)); onActivated: root.deckPlayer.volume = Math.max(0, root.deckPlayer.volume - .05) }Shortcut { sequence: "M"; enabled: !root.editingText && !root.menuOpen; onActivated: root.toggleMute() }- Shortcut { sequence: "Escape"; onActivated: { if(root.libraryDragging) { root.endLibraryDrag(false);return }; if(quickJump.visible) { quickJump.close();return }; if(savedQueuePicker.visible) { savedQueuePicker.close();return }; if(cleanupPopup.visible) { cleanupPopup.close();return }; if(qualityPopup.visible) { qualityPopup.close();return }; if (saveQueuePopup.visible) { saveQueuePopup.close(); return }; if (deleteQueuePopup.visible) { deleteQueuePopup.close(); return }; if (savedQueueMenu.visible) { savedQueueMenu.close(); return }; if (fontPicker.shown || fontPicker.opening) { fontPicker.close(); return }; if (preferences.visible) { preferences.close(); return }; if (crossfadeMenu.visible) { crossfadeMenu.close(); return }; if (queueMenu.visible) { queueMenu.close(); return }; if (songMenu.visible) { songMenu.close(); return }; if (musicBrowser.actionsOpen) { musicBrowser.closeActions(); return }; if (menu.visible) { menu.close(); return }; if (root.queueSelectionCount > 0) { root.clearQueueSelection(); return }; if (root.queueSearchOpen) { root.closeQueueSearch(); return }; if (root.libraryOpen) { if (musicBrowser.item && musicBrowser.item.selectionCount > 0) musicBrowser.item.clearSelection(); else if (musicBrowser.detail && musicBrowser.browser.collectionQuery.length) musicBrowser.browser.collectionQuery = ""; else if (musicBrowser.detail) musicBrowser.browser.back(); else root.libraryOpen = false; return }; if (root.discFlipped) { root.discFlipped = false; return }; root.queueOpen = false; root.helpOpen = false; menu.close(); if (root.miniMode) player.miniMode = false } }+ Shortcut { sequence: "Escape"; onActivated: { if(artworkPopup.visible) { artworkPopup.close();return }; if(root.activeSeekControl) { root.cancelSeekPreview();return }; if(scrubber.scrubbing) { scrubber.cancelScrub();return }; if(root.libraryDragging) { root.endLibraryDrag(false);return }; if(quickJump.visible) { quickJump.close();return }; if(savedQueuePicker.visible) { savedQueuePicker.close();return }; if(cleanupPopup.visible) { cleanupPopup.close();return }; if(qualityPopup.visible) { qualityPopup.close();return }; if (saveQueuePopup.visible) { saveQueuePopup.close(); return }; if (deleteQueuePopup.visible) { deleteQueuePopup.close(); return }; if (savedQueueMenu.visible) { savedQueueMenu.close(); return }; if (fontPicker.shown || fontPicker.opening) { fontPicker.close(); return }; if (preferences.visible) { preferences.close(); return }; if (crossfadeMenu.visible) { crossfadeMenu.close(); return }; if (queueMenu.visible) { queueMenu.close(); return }; if (songMenu.visible) { songMenu.close(); return }; if (musicBrowser.actionsOpen) { musicBrowser.closeActions(); return }; if (menu.visible) { menu.close(); return }; if (root.queueSelectionCount > 0) { root.clearQueueSelection(); return }; if (root.queueSearchOpen) { root.closeQueueSearch(); return }; if (root.libraryOpen) { if (musicBrowser.item && musicBrowser.item.selectionCount > 0) musicBrowser.item.clearSelection(); else if (musicBrowser.detail && musicBrowser.browser.collectionQuery.length) musicBrowser.browser.collectionQuery = ""; else if (musicBrowser.detail) musicBrowser.browser.back(); else root.libraryOpen = false; return }; if (root.discFlipped) { root.discFlipped = false; return }; root.queueOpen = false; root.helpOpen = false; menu.close(); if (root.miniMode) player.miniMode = false } }Shortcut { sequence: "Y"; enabled: !root.editingText && !root.menuOpen; onActivated: { if (root.deckPlayer.count) { root.discFlipped = true; root.lyricsView = !root.lyricsView } } }Shortcut { sequence: "F"; enabled: !root.editingText && !root.menuOpen; onActivated: root.flipDisc() }Shortcut { sequence: "F1"; enabled: !root.menuOpen; onActivated: root.helpOpen = !root.helpOpen }@@ -393,7 +418,7 @@ ApplicationWindow {Timer {interval: 16; repeat: true- running: root.animate && root.visible && root.visibility !== Window.Minimized && native.exposed && (root.deckPlayer.playing || root.spinSpeed > .02)+ running: root.animate && root.visible && root.visibility !== Window.Minimized && native.exposed && (root.deckPlayer.playing || root.spinSpeed > .02 || root.activeSeekControl || Math.abs(root.tapeWindSpeed) > .5)property double lastTime: 0onRunningChanged: lastTime = Date.now()onTriggered: {@@ -403,17 +428,21 @@ ApplicationWindow {const target = root.deckPlayer.playing ? (root.vinyl ? root.vinylDegreesPerSecond : 9) : 0root.spinSpeed += (target-root.spinSpeed)*Math.min(1,dt*2.2)if (!root.discFlipped) root.spinAngle = (root.spinAngle+root.spinSpeed*dt)%360- if (root.cassette && !root.discFlipped && root.deckPlayer.playing) {- const position = Math.max(0, Math.min(1, root.progress))- root.cassetteLeftAngle = (root.cassetteLeftAngle + dt * 10000 / Math.sqrt(1936 + 3993 * (1-position))) % 360- root.cassetteRightAngle = (root.cassetteRightAngle + dt * 10000 / Math.sqrt(1936 + 3993 * position)) % 360+ const winding = root.cassette && root.activeSeekControl+ const windTarget = winding && now-root.activeSeekControl.lastMove < 120 ? root.activeSeekControl.windDirection * 850 : 0+ root.tapeWindSpeed += (windTarget-root.tapeWindSpeed)*Math.min(1,dt*18)+ if (root.cassette && !root.discFlipped && (root.deckPlayer.playing || winding || Math.abs(root.tapeWindSpeed) > .5)) {+ const position = Math.max(0, Math.min(1, root.cassetteVisualProgress))+ const speed = winding || Math.abs(root.tapeWindSpeed) > .5 ? root.tapeWindSpeed * 55 : 10000+ root.cassetteLeftAngle = (root.cassetteLeftAngle + dt * speed / Math.sqrt(1936 + 3993 * (1-position))) % 360+ root.cassetteRightAngle = (root.cassetteRightAngle + dt * speed / Math.sqrt(1936 + 3993 * position)) % 360}if (root.deckPlayer.playing) root.wavePhase=(root.wavePhase+dt*2.8)%(2*Math.PI)}}Connections {target: root.deckPlayer- function onTrackChanged() { scrubber.cancelScrub(); if (!root.deckPlayer.count) root.discFlipped = false; Qt.callLater(root.presentDisc) }+ function onTrackChanged() { root.cancelSeekPreview(); scrubber.cancelScrub(); if (!root.deckPlayer.count) root.discFlipped = false; Qt.callLater(root.presentDisc) }function onArtworkChanged() { Qt.callLater(root.presentDisc) }function onErrorChanged() { if (root.deckPlayer.error.length && root.miniMode) player.miniMode = false }}@@ -506,7 +535,16 @@ ApplicationWindow {width: 440; height: 440; clip: truescale: root.miniMode ? .64 : 1transformOrigin: Item.TopLeft- HoverHandler { id: platterHover }+ HoverHandler {+ id: platterHover+ readonly property point pointer: point.position+ onHoveredChanged: updateLyricsHover()+ onPointerChanged: updateLyricsHover()+ function updateLyricsHover() {+ const p = lyricList.mapFromItem(platter, pointer.x, pointer.y)+ lyricList.updateHover(hovered, p.x, p.y)+ }+ }// Shadow is circular, so the player keeps its silhouette on any wallpaper.Repeater {model: root.cassette ? 0 : 7@@ -527,7 +565,7 @@ ApplicationWindow {transform: Translate { x: root.outgoingOffset }sourceComponent: Item {Disc { cassette: root.cassette; shellColor: root.surface; vinyl: root.vinyl; anchors.fill: parent; artwork: presentation.outgoing; rotation: root.cassette ? 0 : root.outgoingAngle }- Disc { cassette: root.cassette; shellColor: root.surface; vinyl: root.vinyl; anchors.fill: parent; overlay: true }+ Disc { visible: !root.cassette; cassette: root.cassette; shellColor: root.surface; vinyl: root.vinyl; anchors.fill: parent; overlay: true }Loader { anchors.fill: parent; active: root.cassette; sourceComponent: CassetteReels { app: root; outgoing: true } }}}@@ -556,7 +594,7 @@ ApplicationWindow {artwork: presentation.artworkrotation: root.cassette ? 0 : root.spinAngle}- Disc { cassette: root.cassette; shellColor: root.surface; vinyl: root.vinyl; anchors.fill: parent; overlay: true }+ Disc { visible: !root.cassette; cassette: root.cassette; shellColor: root.surface; vinyl: root.vinyl; anchors.fill: parent; overlay: true }Loader { objectName: "cassetteReelsLoader"; anchors.fill: parent; active: root.cassette; sourceComponent: CassetteReels { app: root } }}back: Item {@@ -688,11 +726,54 @@ ApplicationWindow {activeFocusOnTab: root.discFlipped && root.lyricsViewAccessible.name: "Lyrics"property bool following: true+ property var tipLine: null+ property var hoveredLine: null+ function updateHover(inside, x, y) {+ const index = inside && root.discFlipped && root.lyricsView && visible && !moving && x >= 0 && x < width && y >= 0 && y < height ? indexAt(x, y + contentY) : -1+ const line = index >= 0 ? itemAtIndex(index) : null+ if (hoveredLine !== line) {+ hoveredLine = line+ if (line) line.hintDismissed = false+ dismissSeekTip()+ }+ if (line && !line.hintDismissed) {+ const point = mapToItem(line, x, y)+ showSeekTip(line, point.x, point.y)+ }+ }+ property string tipText: ""+ property real tipOffset: 0+ function dismissSeekTip() { tipLine = null }+ function showSeekTip(line, x, y) {+ const point = line.mapToItem(lyricList, x, y)+ if (!moving && root.discFlipped && root.lyricsView && line.seekable && point.x >= 0 && point.x < width && point.y >= 0 && point.y < height) {+ tipText = "Seek to " + root.time(line.modelData.start)+ tipOffset = Math.max(0, line.y - contentY)+ tipLine = line+ } else if (tipLine === line) dismissSeekTip()+ }+ onContentYChanged: { dismissSeekTip(); hoveredLine = null }+ onVisibleChanged: dismissSeekTip()+ Connections {+ target: root+ function onDiscFlippedChanged() { lyricList.dismissSeekTip() }+ function onLyricsViewChanged() { lyricList.dismissSeekTip() }+ function onMiniModeChanged() { lyricList.dismissSeekTip() }+ function onVisibleChanged() { lyricList.dismissSeekTip() }+ function onActiveChanged() { if (!root.active) lyricList.dismissSeekTip() }+ function onMenuOpenChanged() { if (root.menuOpen) lyricList.dismissSeekTip() }+ }+ SpunToolTip {+ objectName: "lyricSeekToolTip"; parent: lyricList+ visible: !!lyricList.tipLine && lyricList.visible && root.visible && root.discFlipped && root.lyricsView && !root.menuOpen && !lyricList.moving+ text: lyricList.tipText+ y: lyricList.tipOffset - height - 8+ }function followLine() {if (following && lyrics.currentIndex >= 0) positionViewAtIndex(lyrics.currentIndex, ListView.Beginning)}- onModelChanged: { following = true; Qt.callLater(function() { positionViewAtBeginning(); followLine() }) }- onMovementStarted: following = false+ onModelChanged: { dismissSeekTip(); following = true; Qt.callLater(function() { positionViewAtBeginning(); followLine() }) }+ onMovementStarted: { following = false; dismissSeekTip() }Keys.onPressed: event => {if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {following = false; contentY = Math.max(0, Math.min(Math.max(0, contentHeight-height), contentY + (event.key===Qt.Key_Down ? 30 : -30))); event.accepted = true@@ -710,8 +791,10 @@ ApplicationWindow {objectName: "lyricLine" + indexrequired property var modelDatarequired property int index+ property bool hintDismissed: falsereadonly property bool seekable: lyrics.timed && !lyrics.loading && modelData.start >= 0 && modelData.start < root.deckPlayer.duration && (!root.useCider || root.ciderService.canSeek)function seekHere() {+ lyricList.dismissSeekTip()if (seekable && lyrics.seekToLine(index)) {lyricList.following = truelyricList.forceActiveFocus()@@ -722,21 +805,25 @@ ApplicationWindow {text: modelData.text; textFormat: Text.PlainTextwrapMode: Text.WordWrap; horizontalAlignment: Text.AlignHCenterfont.pixelSize: root.miniMode ? 19 : 15- color: (seekable && lyricHit.containsMouse) || (lyrics.timed && index === lyrics.currentIndex) ? root.accent : root.ink- opacity: lyrics.timed && index !== lyrics.currentIndex && !(seekable && lyricHit.containsMouse) ? .62 : 1+ color: (seekable && lyricList.hoveredLine === lyricLine) || (lyrics.timed && index === lyrics.currentIndex) ? root.accent : root.ink+ opacity: lyrics.timed && index !== lyrics.currentIndex && !(seekable && lyricList.hoveredLine === lyricLine) ? .62 : 1Behavior on color { ColorAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }Behavior on opacity { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }Accessible.role: seekable ? Accessible.Button : Accessible.StaticTextAccessible.name: textAccessible.onPressAction: seekHere()- SpunToolTip { visible: lyricLine.seekable && lyricHit.containsMouse; text: "Seek to " + root.time(lyricLine.modelData.start) }+ Component.onDestruction: {+ if (lyricList.tipLine === lyricLine) lyricList.dismissSeekTip()+ if (lyricList.hoveredLine === lyricLine) lyricList.hoveredLine = null+ }MouseArea {id: lyricHitobjectName: "lyricHit" + lyricLine.index- anchors.fill: parent; hoverEnabled: true+ anchors.fill: parentenabled: lyricLine.seekablecursorShape: Qt.PointingHandCursorpreventStealing: false+ onPressed: { lyricLine.hintDismissed = true; lyricList.dismissSeekTip() }onClicked: lyricLine.seekHere()onDoubleClicked: mouse => { mouse.accepted = true }}@@ -895,9 +982,12 @@ ApplicationWindow {id: scrubberobjectName: "scrubber"anchors.fill: parent+ // Reverse-side lyrics keep their hover input; the rim remains seekable.+ containmentMask: QtObject { function contains(point) { return !root.discFlipped || scrubber.onRim(point.x, point.y) } }hoverEnabled: trueproperty bool scrubbing: falseproperty real previewFraction: 0+ property real lastFraction: 0readonly property bool canSeek: !root.swapRunning && root.deckPlayer.duration > 0 && (!root.useCider || root.ciderService.canSeek)readonly property bool showPreview: canSeek && (scrubbing || (containsMouse && onRim(mouseX,mouseY)))cursorShape: canSeek && onRim(mouseX,mouseY) ? Qt.PointingHandCursor : Qt.ArrowCursor@@ -907,12 +997,21 @@ ApplicationWindow {if (a < 0) a += 2*Math.PIpreviewFraction = a/(2*Math.PI)}+ function dragPreview(x,y,fine) {+ const previous=previewFraction+ updatePreview(x,y)+ const pointer=previewFraction+ let delta=pointer-lastFraction+ if(delta>.5)delta-=1;else if(delta < -.5)delta+=1+ previewFraction=Math.max(0,Math.min(1,previous+delta*(fine?.1:1)))+ lastFraction=pointer+ }function cancelScrub() { scrubbing = false }onPressed: mouse => {- if (onRim(mouse.x,mouse.y) && canSeek) { updatePreview(mouse.x,mouse.y); scrubbing=true }+ if (onRim(mouse.x,mouse.y) && canSeek) { updatePreview(mouse.x,mouse.y); lastFraction=previewFraction; if(mouse.modifiers & Qt.ShiftModifier)previewFraction=root.progress; scrubbing=true }else mouse.accepted=false}- onPositionChanged: mouse => { if (scrubbing || onRim(mouse.x,mouse.y)) updatePreview(mouse.x,mouse.y) }+ onPositionChanged: mouse => { if(scrubbing)dragPreview(mouse.x,mouse.y,mouse.modifiers & Qt.ShiftModifier);else if(onRim(mouse.x,mouse.y))updatePreview(mouse.x,mouse.y) }onReleased: {if (scrubbing && canSeek) root.deckPlayer.seek(root.deckPlayer.duration * previewFraction)scrubbing=false@@ -997,7 +1096,7 @@ ApplicationWindow {color: root.surface; border.width: 0MouseArea { anchors.fill: parent; onPressed: root.startSystemMove() }SpunText {- objectName: "songTitle"+ id: playerSongTitle; objectName: "songTitle"x: 24; y: 16; width: root.useCider ? 238 : 272text: root.deckPlayer.title; color: root.ink; elide: Text.ElideRightfont.pixelSize: SpunStyle.title; font.weight: Font.Normal@@ -1020,7 +1119,10 @@ ApplicationWindow {contentItem: SpunText { text: root.deckPlayer.artist; color: playerArtist.hovered || playerArtist.visualFocus ? root.accent : root.mutedInk; elide: Text.ElideRight; font.pixelSize: SpunStyle.body; verticalAlignment: Text.AlignVCenter; font.underline: playerArtist.hovered || playerArtist.visualFocus }}SpunText {- x: 307; y: 18; width: 77; horizontalAlignment: Text.AlignRight+ objectName: "elapsedTime"+ anchors.baseline: playerSongTitle.baseline+ anchors.right: parent.right; anchors.rightMargin: 24+ width: 77; horizontalAlignment: Text.AlignRighttext: root.time(root.deckPlayer.position); color: root.mutedInkfont.pixelSize: 13}@@ -1107,12 +1209,24 @@ ApplicationWindow {app: rootid: queueSearchobjectName: "queueSearchInput"- x: 24; y: 20; width: 214; height: SpunStyle.target+ x: 64; y: 20; width: 222; height: SpunStyle.target; searchIcon: falsevisible: root.queueSearchOpentext: root.queueQueryonTextChanged: root.queueQuery = textplaceholderText: "Song or artist"Accessible.name: "Search queue"+ Keys.onDownPressed: {+ if (trackList.count) {+ trackList.keyboardIndex = 0+ trackList.positionViewAtIndex(0, ListView.Contain)+ trackList.forceActiveFocus(Qt.TabFocusReason)+ }+ }+ IconButton {+ objectName: "clearQueueSearch"; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter+ visible: queueSearch.text.length > 0; glyphName: "close"; tip: "Clear search"; ink: root.mutedInk+ onClicked: { root.queueQuery = ""; queueSearch.forceActiveFocus() }+ }onAccepted: {if (root.filteredQueue.length && (!root.useCider || (root.ciderService.queueReady && !root.ciderService.queueError.length)))root.deckPlayer.select(root.filteredQueue[0].sourceIndex)@@ -1120,9 +1234,9 @@ ApplicationWindow {}IconButton { objectName: "savedQueueMenuButton"; visible: root.useCider && !root.queueSearchOpen; x: 204; y: 20; glyphName: "more"; tip: "Queue actions"; ink: root.mutedInk; onClicked: savedQueueMenu.open() }IconButton {- objectName: "queueSearchButton"- x: 246; y: 20; width: 40; height: 40- glyphName: root.queueSearchOpen ? "close" : "search"+ id: queueSearchButton; objectName: "queueSearchButton"+ x: root.queueSearchOpen ? 16 : 246; y: 20; width: 40; height: 40+ glyphName: root.queueSearchOpen ? "back" : "search"tip: root.queueSearchOpen ? "Close search" : "Search queue · Ctrl+F"ink: root.queueSearchOpen ? root.accent : root.mutedInk; hoverFill: root.hoverFillonClicked: root.queueSearchOpen ? root.closeQueueSearch() : root.openQueueSearch()@@ -1135,40 +1249,60 @@ ApplicationWindow {IconButton { objectName: "clearQueueSelection"; x: parent.width - 42; anchors.verticalCenter: parent.verticalCenter; glyphName: "close"; tip: "Clear selection · Esc"; ink: root.mutedInk; onClicked: root.clearQueueSelection() }}Rectangle { x: 30; y: 65; width: 252; height: 1; color: root.hairline }+ SpunButton {+ id: currentQueueButton; objectName: "currentQueueButton"+ text: "Current song"; tonal: true+ visible: !trackList.following && trackList.playingIndex >= 0 && !root.queueQuery.trim().length && !root.libraryDragging+ x: (parent.width-width)/2; y: queueFooter.y-52; width: 140; height: 36+ onClicked: { trackList.followCurrent(); trackList.forceActiveFocus(Qt.TabFocusReason) }+ }ListView {id: trackList+ property bool following: true+ property real readingY: 0+ function followCurrent() { following = true; if(currentIndex >= 0) positionViewAtIndex(currentIndex,ListView.Contain) }+ function holdPosition() { following = false; readingY = contentY }+ onDraggingChanged: if(dragging) holdPosition()+ onFlickingChanged: if(flicking) holdPosition()+ onContentYChanged: if(!following && moving) readingY = contentY+ onMovementEnded: if(!following) readingY = contentY+ WheelHandler { target: null; blocking: false; acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad; onWheel: event => { trackList.holdPosition(); Qt.callLater(function(){trackList.readingY=trackList.contentY}) } }objectName: "trackList"activeFocusOnTab: visibleproperty int keyboardIndex: -1Keys.onPressed: event => {if (root.useCider && event.key === Qt.Key_A && (event.modifiers & Qt.ControlModifier)) { root.selectUpcomingQueue(); event.accepted = true} else if (root.useCider && event.key === Qt.Key_Space) {- const row = root.filteredQueue[keyboardIndex < 0 ? currentIndex : keyboardIndex]+ const row = root.filteredQueue[keyboardIndex < 0 ? playingIndex : keyboardIndex]if (row) root.chooseQueueRow(row.sourceIndex, event.modifiers | Qt.ControlModifier)event.accepted = true} else if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {- if ((event.modifiers & Qt.ShiftModifier) && root.queueSelectionAnchor < 0) root.queueSelectionAnchor = root.filteredQueue[Math.max(0, keyboardIndex < 0 ? currentIndex : keyboardIndex)]?.sourceIndex ?? -1- keyboardIndex = Math.max(0, Math.min(count - 1, (keyboardIndex < 0 ? currentIndex : keyboardIndex) + (event.key === Qt.Key_Down ? 1 : -1)))+ holdPosition()+ if ((event.modifiers & Qt.ShiftModifier) && root.queueSelectionAnchor < 0) root.queueSelectionAnchor = root.filteredQueue[Math.max(0, keyboardIndex < 0 ? playingIndex : keyboardIndex)]?.sourceIndex ?? -1+ keyboardIndex = Math.max(0, Math.min(count - 1, (keyboardIndex < 0 ? playingIndex : keyboardIndex) + (event.key === Qt.Key_Down ? 1 : -1)))if ((event.modifiers & Qt.ShiftModifier) && root.filteredQueue[keyboardIndex]) root.chooseQueueRow(root.filteredQueue[keyboardIndex].sourceIndex, event.modifiers)- positionViewAtIndex(keyboardIndex, ListView.Contain); event.accepted = true+ positionViewAtIndex(keyboardIndex, ListView.Contain); readingY=contentY; event.accepted = true} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {- const row = root.filteredQueue[keyboardIndex < 0 ? currentIndex : keyboardIndex]+ const row = root.filteredQueue[keyboardIndex < 0 ? playingIndex : keyboardIndex]if (row && root.queueControlsReady) { if (root.queueSelectionCount) root.openQueueSelectionActions(trackList); else root.deckPlayer.select(row.sourceIndex) }event.accepted = true} else if (event.key === Qt.Key_Menu || (event.key === Qt.Key_F10 && (event.modifiers & Qt.ShiftModifier))) {- const row = itemAtIndex(keyboardIndex < 0 ? currentIndex : keyboardIndex)+ const row = itemAtIndex(keyboardIndex < 0 ? playingIndex : keyboardIndex)if (row) root.showQueueActions(row.sourceIndex, row)event.accepted = true}}- x: SpunStyle.inset; y: 80; width: parent.width - 2 * SpunStyle.inset; height: queueFooter.y - 2 * SpunStyle.gap - y - (root.useCider && root.ciderService.queueError.length ? 32 : 0)+ x: SpunStyle.inset; y: 80; width: parent.width - 2 * SpunStyle.inset; height: queueFooter.y - 2 * SpunStyle.gap - y - (currentQueueButton.visible ? 44 : 0) - (root.useCider && root.ciderService.queueError.length ? 32 : 0)model: root.filteredQueue; clip: true; spacing: SpunStyle.smallGapvisible: !root.useCider || root.ciderService.queueReady- currentIndex: root.filteredQueue.findIndex(row => row.sourceIndex === root.deckPlayer.currentIndex)- onCurrentIndexChanged: if (currentIndex >= 0 && !root.queueQuery.trim().length) positionViewAtIndex(currentIndex, ListView.Contain)+ readonly property int playingIndex: root.filteredQueue.findIndex(row => row.sourceIndex === root.deckPlayer.currentIndex)+ // Qt also follows currentIndex internally; release it while the user browses.+ currentIndex: following ? playingIndex : -1+ onCurrentIndexChanged: if (following && currentIndex >= 0 && !root.queueQuery.trim().length) positionViewAtIndex(currentIndex, ListView.Contain)onModelChanged: Qt.callLater(function() {if (root.queueQuery.trim().length) positionViewAtBeginning()- else if (currentIndex >= 0) positionViewAtIndex(currentIndex, ListView.Contain)+ else if (following && currentIndex >= 0) positionViewAtIndex(currentIndex, ListView.Contain)+ else if(!following) contentY=Math.max(originY,Math.min(readingY,originY+Math.max(0,contentHeight-height)))})// Keep the pointer grab on the view, so long drags survive delegate recycling.MouseArea {@@ -1384,8 +1518,8 @@ ApplicationWindow {onClosed: preview = ({})readonly property bool stale: root.ciderService.queueRevision !== preview.revision || !root.ciderService.queueReady || root.ciderService.queueError.length > 0focus: true; modal: true; popupType: Popup.Item; padding: 24- x: (root.width - width) / 2; y: (root.height - height) / 2- width: 360; height: Math.min(440, root.height - 48, 196 + (preview.rows || []).length * 64)+ x: (root.layoutWidth - width) / 2; y: (root.layoutHeight - height) / 2+ width: 360; height: Math.min(440, root.layoutHeight - 48, 196 + (preview.rows || []).length * 64)background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }enter: SpunPopupEnter {}@@ -1429,7 +1563,7 @@ ApplicationWindow {onClosed: renameTarget = ({})function submit(name) { if (renameTarget.id ? service.renameSavedQueue(renameTarget, name) : service.saveQueue(name)) close() }focus: true; modal: true; popupType: Popup.Item- x: (root.width - width) / 2; y: 220; width: 330; height: 200; padding: 24+ x: (root.layoutWidth - width) / 2; y: 220; width: 330; height: 200; padding: 24background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }enter: SpunPopupEnter {}@@ -1444,7 +1578,7 @@ ApplicationWindow {}Popup {id: deleteQueuePopup; focus: true; modal: true; popupType: Popup.Item; property string queueId: ""; property var service: library- x: (root.width - width) / 2; y: 240; width: 330; height: 132; padding: 24+ x: (root.layoutWidth - width) / 2; y: 240; width: 330; height: 132; padding: 24background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }enter: SpunPopupEnter {}@@ -1495,11 +1629,36 @@ ApplicationWindow {onAboutToShow: root.actionService.observing = trueonClosed: root.actionService.observing = false}+ function showArtwork() {+ if(!deckPlayer.count)return+ if(miniMode) { player.miniMode=false;Qt.callLater(showArtwork);return }+ menu.close();songMenu.close();artworkPopup.open()+ }+ Popup {+ id: artworkPopup; objectName: "artworkPopup"; parent: Overlay.overlay+ popupType: Popup.Item; modal: true; dim: false; focus: true+ width: 466; height: 530; x: (root.layoutWidth-width)/2; y: (root.layoutHeight-height)/2; padding: 24+ background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }+ enter: SpunPopupEnter {}+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit } }+ onOpened: if(contentItem.item)contentItem.item.focusClose()+ onClosed: menuButton.forceActiveFocus(Qt.BacktabFocusReason)+ contentItem: Loader { active: artworkPopup.visible; sourceComponent: Item {+ Accessible.role: Accessible.Dialog; Accessible.name: "Album artwork"+ function focusClose() { artworkClose.forceActiveFocus(Qt.TabFocusReason) }+ SpunText { width: parent.width-48; text: root.deckPlayer.album || root.deckPlayer.title; elide: Text.ElideRight; color: root.ink; font.pixelSize: SpunStyle.heading }+ IconButton { id: artworkClose; objectName: "artworkClose"; anchors.right: parent.right; y: -8; glyphName: "close"; ink: root.ink; tip: "Close · Esc"; onClicked: artworkPopup.close() }+ ArtworkView {+ id: fullArtwork; objectName: "fullArtwork"; y: 48; width: parent.width; height: parent.height-y; artwork: root.deckPlayer.artwork+ SpunText { anchors.centerIn: parent; visible: !fullArtwork.hasArtwork; text: "No artwork available"; color: root.mutedInk; font.pixelSize: SpunStyle.body }+ }+ } }+ }function showAudioQuality() { qualityPopup.open();root.ciderService.refreshAudioQuality() }Popup {id: qualityPopup; objectName: "audioQualityPopup"popupType: Popup.Item; focus: true; width: 340; height: 176; padding: 20- x: (root.width - width) / 2; y: Math.min(root.height - height - 24, 330)+ x: (root.layoutWidth - width) / 2; y: Math.min(root.layoutHeight - height - 24, 330)onVisibleChanged: Qt.callLater(root.updateMask)background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.popupRadius }enter: SpunPopupEnter {}@@ -1514,15 +1673,16 @@ ApplicationWindow {function showRecovery() { recoveryPopup.open(); root.listeningService.prepareRecovery() }Popup {id: recoveryPopup; objectName: "recoveryPopup"- parent: Overlay.overlay; x: (parent.width - width) / 2; y: (parent.height - height) / 2- width: Math.min(420, root.width - 24); height: Math.min(260, root.height - 24)+ parent: Overlay.overlay; x: (root.layoutWidth - width) / 2; y: (root.layoutHeight - height) / 2+ width: Math.min(420, root.layoutWidth - 24); height: Math.min(260, root.layoutHeight - 24)padding: 24; modal: true; dim: false; focus: true; popupType: Popup.Itembackground: Rectangle { radius: SpunStyle.popupRadius; color: SpunStyle.popup }enter: SpunPopupEnter {}exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit } }- onOpened: recoveryCancel.forceActiveFocus()+ onOpened: if (contentItem.item) contentItem.item.focusCancel()onClosed: root.listeningService.cancelRecovery()- contentItem: Item {+ contentItem: Loader { active: recoveryPopup.visible; sourceComponent: Item {+ function focusCancel() { recoveryCancel.forceActiveFocus() }SpunText { text: "Recover session"; font.pixelSize: SpunStyle.heading; color: root.ink }SpunText {y: 38; width: parent.width; height: 112; wrapMode: Text.WordWrap; maximumLineCount: 5; elide: Text.ElideRight@@ -1534,7 +1694,7 @@ ApplicationWindow {enabled: !root.listeningService.busy && !!root.listeningService.session.trackCount && root.ciderService.queueReady && !root.ciderService.queueBusy && !root.ciderService.controlBusy && !root.ciderService.queueError.length && root.ciderService.queue.length === 0 && !root.actionService.busyonClicked: root.listeningService.restoreSession()}- }+ } }Connections { target: root.listeningService; function onFeedback(message, error) { if (recoveryPopup.visible && !error && !root.listeningService.busy) recoveryPopup.close() } }}function notifyAction(message, error) { actionNotice.text = message; actionNotice.failed = error; actionNotice.savedUndo = false; actionNotice.undo = !error && message === "Removed from queue" && root.ciderService.canUndoQueue; noticeTimer.interval = error || actionNotice.undo ? 8000 : 2200; noticeTimer.restart() }@@ -1603,6 +1763,7 @@ ApplicationWindow {SettingsAction { objectName: "preferencesAction"; text: "Preferences"; glyphName: "settings"; onTriggered: Qt.callLater(function() { preferences.open() }) }SettingsAction { text: "Play demo"; glyphName: "play"; onTriggered: { root.useLocal(); player.demo() } }SettingsGap {}+ SettingsAction { objectName: "viewArtworkAction"; text: "View artwork"; glyphName: "artwork"; enabled: root.deckPlayer.count > 0; onTriggered: root.showArtwork() }SettingsAction { text: "Keyboard shortcuts"; glyphName: "keyboard"; hint: "F1"; onTriggered: root.helpOpen = true }SettingsAction { text: "Quit Spun"; glyphName: "power"; hint: "Ctrl+Q"; onTriggered: Qt.quit() }}@@ -1613,110 +1774,136 @@ ApplicationWindow {popupType: Popup.Item; focus: truex: deck.x + deck.width - widthy: Math.max(12, deck.y - height - 12)- width: 352; height: Math.min(496, preferenceItems.implicitHeight + 72)+ width: 352; height: Math.min(496, (contentItem.item ? contentItem.item.contentHeight : 424) + 72)padding: 12background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.popupRadius }enter: SpunPopupEnter {}exit: Transition { NumberAnimation { property: "opacity"; from: 1; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }onAboutToShow: fontPicker.prepare()onAboutToHide: fontPicker.close()- onOpened: { if (root.useCider) root.ciderService.refreshModes(); closePreferences.forceActiveFocus() }+ onOpened: { if (root.useCider) root.ciderService.refreshModes(); if (contentItem.item) contentItem.item.focusClose() }onClosed: { fontPicker.close(); menuButton.forceActiveFocus() }- contentItem: Item {- SpunText { x: 12; y: 10; text: "Preferences"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }- IconButton { id: closePreferences; objectName: "closePreferences"; anchors.right: parent.right; glyphName: "close"; tip: "Close preferences"; ink: root.ink; onClicked: preferences.close() }- Flickable {- id: preferenceScroll- x: 0; y: 48; width: parent.width; height: parent.height - y- contentHeight: preferenceItems.implicitHeight; clip: true- boundsBehavior: Flickable.StopAtBounds- ScrollBar.vertical: ScrollBar { }- function reveal(item) { const p = item.mapToItem(preferenceItems, 0, 0); if (p.y < contentY) contentY = p.y; else if (p.y + item.height > contentY + height) contentY = p.y + item.height - height }- Column {- id: preferenceItems; width: parent.width; spacing: 4- Row {- width: parent.width; height: 48; spacing: 4- Repeater {- id: recordChoices- model: ["CD", "Vinyl", "Cassette"]- delegate: AbstractButton {- id: recordChoice- required property string modelData- required property int index- objectName: modelData.toLowerCase() + "StyleButton"- width: (preferenceItems.width - 8) / 3; height: SpunStyle.target- text: modelData; checkable: true; autoExclusive: true; checked: player.medium === modelData.toLowerCase(); hoverEnabled: true- Accessible.name: modelData + " appearance"; Accessible.checked: checked- Keys.onLeftPressed: recordChoices.itemAt(Math.max(0,index-1)).forceActiveFocus(Qt.TabFocusReason)- Keys.onRightPressed: recordChoices.itemAt(Math.min(2,index+1)).forceActiveFocus(Qt.TabFocusReason)- Keys.onReturnPressed: clicked()- Keys.onEnterPressed: clicked()- onClicked: player.medium = modelData.toLowerCase()- onActiveFocusChanged: if(activeFocus) preferenceScroll.reveal(this)- background: Rectangle {- radius: 20 * theme.radius; color: "transparent"- border.width: recordChoice.visualFocus ? 2 : 0; border.color: root.accent- Rectangle { anchors.fill: parent; radius: parent.radius; color: SpunStyle.selected; opacity: recordChoice.checked ? 1 : 0- Behavior on opacity { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }+ contentItem: Loader {+ active: preferences.visible+ sourceComponent: Item {+ readonly property real contentHeight: preferenceItems.implicitHeight+ function focusClose() { closePreferences.forceActiveFocus() }+ function focusFont() { fontChoice.forceActiveFocus() }+ SpunText { x: 12; y: 10; text: "Preferences"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }+ IconButton { id: closePreferences; objectName: "closePreferences"; anchors.right: parent.right; glyphName: "close"; tip: "Close preferences"; ink: root.ink; onClicked: preferences.close() }+ Flickable {+ id: preferenceScroll+ x: 0; y: 48; width: parent.width; height: parent.height - y+ contentHeight: preferenceItems.implicitHeight; clip: true+ boundsBehavior: Flickable.StopAtBounds+ ScrollBar.vertical: ScrollBar { }+ function reveal(item) { const p = item.mapToItem(preferenceItems, 0, 0); if (p.y < contentY) contentY = p.y; else if (p.y + item.height > contentY + height) contentY = p.y + item.height - height }+ Column {+ id: preferenceItems; width: parent.width; spacing: 4+ Row {+ width: parent.width; height: 48; spacing: 4+ Repeater {+ id: recordChoices+ model: ["CD", "Vinyl", "Cassette"]+ delegate: AbstractButton {+ id: recordChoice+ required property string modelData+ required property int index+ objectName: modelData.toLowerCase() + "StyleButton"+ width: (preferenceItems.width - 8) / 3; height: SpunStyle.target+ text: modelData; checkable: true; autoExclusive: true; checked: player.medium === modelData.toLowerCase(); hoverEnabled: true+ Accessible.name: modelData + " appearance"; Accessible.checked: checked+ Keys.onLeftPressed: recordChoices.itemAt(Math.max(0,index-1)).forceActiveFocus(Qt.TabFocusReason)+ Keys.onRightPressed: recordChoices.itemAt(Math.min(2,index+1)).forceActiveFocus(Qt.TabFocusReason)+ Keys.onReturnPressed: clicked()+ Keys.onEnterPressed: clicked()+ onClicked: player.medium = modelData.toLowerCase()+ onActiveFocusChanged: if(activeFocus) preferenceScroll.reveal(this)+ background: Rectangle {+ radius: 20 * theme.radius; color: "transparent"+ border.width: recordChoice.visualFocus ? 2 : 0; border.color: root.accent+ Rectangle { anchors.fill: parent; radius: parent.radius; color: SpunStyle.selected; opacity: recordChoice.checked ? 1 : 0+ Behavior on opacity { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }+ }+ SpunStateLayer { anchors.fill: parent; radius: parent.radius; color: root.ink; hovered: recordChoice.hovered; pressed: recordChoice.down; focused: recordChoice.visualFocus }}- SpunStateLayer { anchors.fill: parent; radius: parent.radius; color: root.ink; hovered: recordChoice.hovered; pressed: recordChoice.down; focused: recordChoice.visualFocus }+ contentItem: SpunText { text: recordChoice.text; color: recordChoice.checked ? root.accent : root.mutedInk; font.pixelSize: SpunStyle.body; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter }}- contentItem: SpunText { text: recordChoice.text; color: recordChoice.checked ? root.accent : root.mutedInk; font.pixelSize: SpunStyle.body; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter }}}- }- AbstractButton {- id: fontChoice- objectName: "fontChoice"- width: parent.width; implicitHeight: 60- hoverEnabled: true; focusPolicy: Qt.StrongFocus- Accessible.name: "Font: " + typography.family- onClicked: fontPicker.open()- onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this)- background: Rectangle {- radius: SpunStyle.rowRadius; color: "transparent"- border.width: fontChoice.visualFocus ? 2 : 0; border.color: root.accent- SpunStateLayer { anchors.fill: parent; radius: parent.radius; color: root.ink; hovered: fontChoice.hovered; pressed: fontChoice.down; focused: fontChoice.visualFocus }+ AbstractButton {+ id: fontChoice+ objectName: "fontChoice"+ width: parent.width; implicitHeight: 60+ hoverEnabled: true; focusPolicy: Qt.StrongFocus+ Accessible.name: "Font: " + typography.family+ onClicked: fontPicker.open()+ onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this)+ background: Rectangle {+ radius: SpunStyle.rowRadius; color: "transparent"+ border.width: fontChoice.visualFocus ? 2 : 0; border.color: root.accent+ SpunStateLayer { anchors.fill: parent; radius: parent.radius; color: root.ink; hovered: fontChoice.hovered; pressed: fontChoice.down; focused: fontChoice.visualFocus }+ }+ contentItem: Item {+ SpunText { x: 12; y: 7; text: "Font"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }+ SpunText { x: 12; y: 27; width: parent.width - 52; text: typography.selectedFamily.length && !typography.missing ? typography.family : "System default"; color: root.ink; font.pixelSize: SpunStyle.body; elide: Text.ElideRight }+ Glyph { anchors.right: parent.right; anchors.rightMargin: 12; anchors.verticalCenter: parent.verticalCenter; name: "down"; ink: root.mutedInk }+ }}- contentItem: Item {- SpunText { x: 12; y: 7; text: "Font"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }- SpunText { x: 12; y: 27; width: parent.width - 52; text: typography.selectedFamily.length && !typography.missing ? typography.family : "System default"; color: root.ink; font.pixelSize: SpunStyle.body; elide: Text.ElideRight }- Glyph { anchors.right: parent.right; anchors.rightMargin: 12; anchors.verticalCenter: parent.verticalCenter; name: "down"; ink: root.mutedInk }+ Column {+ width: parent.width; spacing: 4; visible: root.vinyl+ SpunText { x: 12; text: "Record speed"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }+ Row {+ width: parent.width; spacing: 4+ Repeater {+ model: ["Relaxed", "33⅓ RPM", "45 RPM"]+ SpunButton {+ required property string modelData+ required property int index+ objectName: "vinylSpeed" + index+ width: (preferenceItems.width - 8) / 3; height: 40+ text: modelData; checkable: true; autoExclusive: true; tonal: checked; checked: player.vinylSpeed === [0,33,45][index]+ onClicked: player.vinylSpeed = [0,33,45][index]+ onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this)+ }+ }+ }}- }- Column {- width: parent.width; spacing: 4; visible: root.vinyl- SpunText { x: 12; text: "Record speed"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }- Row {+ PreferenceSwitch { objectName: "horizontalSeekToggle"; app: root; width: parent.width; visible: !root.cassette; height: visible ? implicitHeight : 0; text: "Horizontal progress bar"; glyphName: "minus"; checked: player.horizontalSeek; onToggled: player.horizontalSeek = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "vinylCrackleToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Vinyl crackle"; glyphName: "volume"; checked: player.vinylCrackle; onToggled: player.vinylCrackle = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "vinylStaticToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Surface hiss"; glyphName: "volume"; checked: player.vinylStatic; onToggled: player.vinylStatic = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "vinylSkipsToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Occasional groove skips"; Accessible.description: "Occasionally jumps playback forward by one record revolution"; glyphName: "next"; checked: player.vinylSkips; onToggled: player.vinylSkips = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "miniPinToggle"; app: root; width: parent.width; text: "Keep Mini on top"; glyphName: "pin"; checked: player.miniOnTop; onToggled: player.miniOnTop = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ Column {width: parent.width; spacing: 4- Repeater {- model: ["Relaxed", "33⅓ RPM", "45 RPM"]- SpunButton {- required property string modelData- required property int index- objectName: "vinylSpeed" + index- width: (preferenceItems.width - 8) / 3; height: 40- text: modelData; checkable: true; autoExclusive: true; tonal: checked; checked: player.vinylSpeed === [0,33,45][index]- onClicked: player.vinylSpeed = [0,33,45][index]- onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this)+ SpunText { x: 12; text: "Interface size"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }+ Row {+ width: parent.width; spacing: 4+ Repeater {+ model: [.85, 1, 1.15, 1.25, 1.5]+ SpunButton {+ required property real modelData+ objectName: "uiScale" + Math.round(modelData*100)+ width: (parent.width-16)/5; height: 40+ text: Math.round(modelData*100)+"%"; tonal: Math.abs(typography.uiScale-modelData)<.001+ Accessible.name: "Interface size " + text+ Accessible.role: Accessible.RadioButton; Accessible.checked: tonal+ onClicked: typography.uiScale=modelData+ onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this)+ }}}}+ PreferenceSwitch { objectName: "blurToggle"; app: root; width: parent.width; visible: native.supportsBlur; height: visible ? implicitHeight : 0; text: "Blur background"; glyphName: "blur"; checked: player.backgroundBlur; onToggled: player.backgroundBlur = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "cassetteSoundsToggle"; app: root; width: parent.width; visible: root.cassette; height: visible ? implicitHeight : 0; text: "Cassette sounds"; glyphName: "volume"; checked: player.cassetteSounds; onToggled: player.cassetteSounds = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "motionToggle"; app: root; width: parent.width; text: "Animations"; glyphName: "motion"; checked: player.motion; onToggled: player.motion = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ Rectangle { x: 12; width: parent.width - 24; height: 1; color: root.hairline }+ PreferenceSwitch { objectName: "rememberSessionToggle"; app: root; width: parent.width; text: "Remember Cider session"; glyphName: "queue"; checked: root.listeningService.rememberSession; enabled: !root.listeningService.busy; onToggled: root.listeningService.rememberSession = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "ciderAutoStartToggle"; app: root; width: parent.width; text: "Start Cider with Spun"; glyphName: "power"; checked: player.ciderAutoStart; onToggled: { player.ciderAutoStart = checked; if (checked && root.useCider) root.ciderService.ensureRunning() } onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ PreferenceSwitch { objectName: "autoplayToggle"; app: root; width: parent.width; visible: root.useCider; height: visible ? implicitHeight : 0; text: "Autoplay"; glyphName: "autoplay"; checked: root.ciderService.autoplay; enabled: root.ciderService.modesReady && !root.ciderService.controlBusy; onToggled: root.ciderService.setAutoplay(checked); onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }+ MenuEntry { objectName: "crossfadeAction"; app: root; width: parent.width; visible: root.useCider; text: "Audio settings"; glyphName: "crossfade"; onTriggered: { preferences.close(); Qt.callLater(function() { crossfadeMenu.open() }) } onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }}- PreferenceSwitch { objectName: "horizontalSeekToggle"; app: root; width: parent.width; visible: !root.cassette; height: visible ? implicitHeight : 0; text: "Horizontal progress bar"; glyphName: "minus"; checked: player.horizontalSeek; onToggled: player.horizontalSeek = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "vinylCrackleToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Vinyl crackle"; glyphName: "volume"; checked: player.vinylCrackle; onToggled: player.vinylCrackle = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "vinylStaticToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Surface hiss"; glyphName: "volume"; checked: player.vinylStatic; onToggled: player.vinylStatic = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "vinylSkipsToggle"; app: root; width: parent.width; visible: root.vinyl; height: visible ? implicitHeight : 0; text: "Occasional groove skips"; Accessible.description: "Occasionally jumps playback forward by one record revolution"; glyphName: "next"; checked: player.vinylSkips; onToggled: player.vinylSkips = checked; onActiveFocusChanged: if(activeFocus)preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "miniPinToggle"; app: root; width: parent.width; text: "Keep Mini on top"; glyphName: "pin"; checked: player.miniOnTop; onToggled: player.miniOnTop = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "blurToggle"; app: root; width: parent.width; visible: native.supportsBlur; height: visible ? implicitHeight : 0; text: "Blur background"; glyphName: "blur"; checked: player.backgroundBlur; onToggled: player.backgroundBlur = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "cassetteSoundsToggle"; app: root; width: parent.width; visible: root.cassette; height: visible ? implicitHeight : 0; text: "Cassette sounds"; glyphName: "volume"; checked: player.cassetteSounds; onToggled: player.cassetteSounds = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "motionToggle"; app: root; width: parent.width; text: "Animations"; glyphName: "motion"; checked: player.motion; onToggled: player.motion = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- Rectangle { x: 12; width: parent.width - 24; height: 1; color: root.hairline }- PreferenceSwitch { objectName: "rememberSessionToggle"; app: root; width: parent.width; text: "Remember Cider session"; glyphName: "queue"; checked: root.listeningService.rememberSession; enabled: !root.listeningService.busy; onToggled: root.listeningService.rememberSession = checked; onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "ciderAutoStartToggle"; app: root; width: parent.width; text: "Start Cider with Spun"; glyphName: "power"; checked: player.ciderAutoStart; onToggled: { player.ciderAutoStart = checked; if (checked && root.useCider) root.ciderService.ensureRunning() } onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- PreferenceSwitch { objectName: "autoplayToggle"; app: root; width: parent.width; visible: root.useCider; height: visible ? implicitHeight : 0; text: "Autoplay"; glyphName: "autoplay"; checked: root.ciderService.autoplay; enabled: root.ciderService.modesReady && !root.ciderService.controlBusy; onToggled: root.ciderService.setAutoplay(checked); onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }- MenuEntry { objectName: "crossfadeAction"; app: root; width: parent.width; visible: root.useCider; text: "Audio settings"; glyphName: "crossfade"; onTriggered: { preferences.close(); Qt.callLater(function() { crossfadeMenu.open() }) } onActiveFocusChanged: if (activeFocus) preferenceScroll.reveal(this) }}}}@@ -1737,7 +1924,7 @@ ApplicationWindow {onLoaded: if (opening && preferences.visible) { opening = false; item.open() }Connections {target: fontPicker.item- function onClosed() { if (preferences.visible) fontChoice.forceActiveFocus() }+ function onClosed() { if (preferences.visible && preferences.contentItem.item) preferences.contentItem.item.focusFont() }}}@@ -1748,13 +1935,14 @@ ApplicationWindow {property var service: root.ciderServicepopupType: Popup.Itemx: deck.x + deck.width - width; y: Math.max(12, deck.y - height - 10)- width: 320; height: Math.max(170, audioExtras.y + audioExtras.implicitHeight + 24); padding: 12+ width: 320; height: contentItem.item ? contentItem.item.contentHeight : 170; padding: 12background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.popupRadius }enter: SpunPopupEnter {}exit: Transition { NumberAnimation { property: "opacity"; from: 1; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }onOpened: { service.refreshCrossfade(); service.refreshAudioOptions() }- contentItem: Item {+ contentItem: Loader { active: crossfadeMenu.visible; sourceComponent: Item {+ readonly property real contentHeight: Math.max(170, audioExtras.y + audioExtras.implicitHeight + 24)PreferenceSwitch {app: rootobjectName: "crossfadeToggle"@@ -1822,7 +2010,7 @@ ApplicationWindow {text: "Try again"; glyphName: "refresh"; enabled: !crossfadeMenu.service.crossfadeBusyonTriggered: crossfadeMenu.service.refreshCrossfade()}- }+ } }}Rectangle {@@ -1832,14 +2020,66 @@ ApplicationWindow {SpunText { id: errorText; x: 14; y: 14; width: 310; text: root.deckPlayer.error; color: root.ink; font.pixelSize: SpunStyle.caption; wrapMode: Text.WordWrap }IconButton { x: 342; y: 7; glyphName: "close"; ink: root.mutedInk; tip: "Dismiss"; onClicked: root.deckPlayer.dismissError() }}- Rectangle {- x: 94; y: 110; width: 342; height: 514; radius: 22- visible: root.helpOpen; color: root.surface; border.width: 0- SpunText { x: 24; y: 23; text: "Shortcuts"; font.family: SpunStyle.family; font.pixelSize: 22; color: root.ink }- SpunText {- x: 24; y: 70; width: 294; color: root.mutedInk; font.pixelSize: 12; lineHeight: 1.55- text: "Space Play / pause\n← / → Seek 5 seconds\nCtrl + ← / → Previous / next\n↑ / ↓ Volume\nM Mute\nCtrl + O Add music\nCtrl + L Show queue\nCtrl + F Search panel\nCtrl + K Quick jump\nCtrl + M Mini / full player\nCtrl + B Browse Cider music\nCtrl + V Open music link\nF Flip disc\nY Lyrics / album tracks\nCtrl / Shift + click Select tracks\nCtrl + A / Space Select all / toggle*\n*In a focused track list\n\nDouble-click to flip. Drag to move.\nScrub the outer rim to seek."- }- IconButton { x: 299; y: 8; glyphName: "close"; tip: "Close shortcuts"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: root.helpOpen=false }+ Popup {+ id: shortcutsPopup; objectName: "shortcutsPopup"+ parent: Overlay.overlay; popupType: Popup.Item+ x: (root.layoutWidth - width) / 2; y: (root.layoutHeight - height) / 2+ width: Math.min(440, root.layoutWidth - 24); height: Math.min(650, root.layoutHeight - 24)+ padding: SpunStyle.outerInset; modal: true; dim: false; focus: true+ visible: root.helpOpen+ onOpened: if (contentItem.item) contentItem.item.focusClose()+ onClosed: { root.helpOpen = false; if (!root.miniMode) menuButton.forceActiveFocus(Qt.BacktabFocusReason) }+ background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }+ enter: SpunPopupEnter {}+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }+ contentItem: Loader { active: shortcutsPopup.visible; sourceComponent: Item {+ Accessible.role: Accessible.Dialog; Accessible.name: "Keyboard shortcuts"+ function focusClose() { shortcutsClose.forceActiveFocus(Qt.TabFocusReason) }+ SpunText { text: "Keyboard shortcuts"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }+ IconButton { id: shortcutsClose; objectName: "shortcutsClose"; anchors.right: parent.right; y: -8; glyphName: "close"; tip: "Close · Esc"; ink: root.mutedInk; onClicked: shortcutsPopup.close() }+ Flickable {+ id: shortcutScroll; objectName: "shortcutScroll"+ y: 48; width: parent.width; height: parent.height - y+ contentHeight: shortcutRows.implicitHeight; clip: true; boundsBehavior: Flickable.StopAtBounds+ activeFocusOnTab: true; Accessible.name: "Keyboard shortcuts"+ function scrollBy(amount) { contentY = Math.max(0, Math.min(Math.max(0, contentHeight - height), contentY + amount)) }+ Keys.onDownPressed: scrollBy(24)+ Keys.onUpPressed: scrollBy(-24)+ Keys.onPressed: event => {+ if (event.key === Qt.Key_PageDown || event.key === Qt.Key_PageUp) {+ scrollBy(event.key === Qt.Key_PageDown ? height : -height); event.accepted = true+ }+ }+ ScrollBar.vertical: ScrollBar {}+ Column {+ id: shortcutRows; width: parent.width; spacing: SpunStyle.smallGap+ Repeater {+ model: [+ ["Space", "Play / pause"], ["← / →", "Seek 5 seconds"], ["Shift + drag", "Fine seeking"],+ ["Ctrl + ← / →", "Previous / next"], ["↑ / ↓", "Volume"], ["M", "Mute"],+ ["Ctrl + O", "Add music"], ["Ctrl + Shift + O", "Add album folder"],+ ["Ctrl + L", "Show queue"], ["Ctrl + F", "Search panel"], ["Ctrl + K", "Quick jump"],+ ["Ctrl + M", "Mini / full player"], ["Ctrl + B", "Browse Cider music"],+ ["Ctrl + V", "Open music link"], ["F", "Flip disc"], ["Y", "Lyrics / album tracks"],+ ["Ctrl / Shift + click", "Select tracks"], ["Ctrl + A / Space", "Select all / toggle*"],+ ["Esc", "Back / close"], ["F1", "Keyboard shortcuts"]+ ]+ Item {+ required property var modelData+ width: shortcutRows.width; height: Math.max(20, shortcutKey.implicitHeight, shortcutAction.implicitHeight)+ SpunText { id: shortcutKey; objectName: "shortcutKey"; width: parent.width * .46; text: modelData[0]; color: root.mutedInk; font.pixelSize: SpunStyle.body; wrapMode: Text.WordWrap }+ SpunText { id: shortcutAction; objectName: "shortcutAction"; x: parent.width * .46 + 12; width: parent.width - x - 8; text: modelData[1]; color: root.ink; font.pixelSize: SpunStyle.body; wrapMode: Text.WordWrap }+ }+ }+ SpunText { width: parent.width - 8; text: "*In a focused Cider track list"; color: root.mutedInk; font.pixelSize: SpunStyle.caption; wrapMode: Text.WordWrap }+ Item { width: 1; height: SpunStyle.gap }+ SpunText {+ width: parent.width - 8; color: root.mutedInk; font.pixelSize: SpunStyle.caption; wrapMode: Text.WordWrap+ text: "Double-click to flip. Drag empty space to move.\n" + (root.cassette ? "Drag the progress bar to seek." : root.vinyl ? "Drag the needle or outer rim to seek." : "Drag the outer rim to seek.")+ }+ }+ }+ Rectangle { anchors.fill: shortcutScroll; anchors.margins: -4; radius: SpunStyle.rowRadius; color: "transparent"; border.width: shortcutScroll.activeFocus ? 1.5 : 0; border.color: root.accent }+ } }}}diff --git a/qml/MenuEntry.qml b/qml/MenuEntry.qmlindex 957d90f..402dddd 100644--- a/qml/MenuEntry.qml+++ b/qml/MenuEntry.qml@@ -9,13 +9,15 @@ MenuItem {height: visible ? implicitHeight : 0padding: 0; indicator: null; arrow: nullfont.family: SpunStyle.family; font.pixelSize: SpunStyle.body- background: Rectangle {+ // Keep the MenuItem itself alive for action routing and keyboard navigation.+ // Visuals live through the exit transition, then release their bindings/textures.+ background: Loader { active: entry.visible; sourceComponent: Rectangle {radius: SpunStyle.rowRadiuscolor: "transparent"border.width: entry.visualFocus ? 2 : 0; border.color: entry.app.accentSpunStateLayer { anchors.fill: parent; radius: parent.radius; color: entry.app.ink; enabled: entry.enabled; pressed: entry.down; focused: entry.highlighted; hovered: entry.hovered }- }- contentItem: Item {+ } }+ contentItem: Loader { active: entry.visible; sourceComponent: Item {opacity: entry.enabled ? 1 : SpunStyle.disabledOpacityGlyph { visible: entry.glyphName.length > 0; x: 12; anchors.verticalCenter: parent.verticalCenter; name: entry.glyphName; ink: entry.highlighted ? entry.app.accent : entry.app.mutedInk }SpunText { x: 44; anchors.verticalCenter: parent.verticalCenter; width: parent.width - x - 12 - trailing.width - 8; text: entry.text; font: entry.font; color: entry.app.ink; elide: Text.ElideRight }@@ -26,5 +28,5 @@ MenuItem {SpunText { id: shortcutLabel; visible: !entry.checkable; anchors.centerIn: parent; text: entry.hint; color: entry.app.mutedInk; font.family: SpunStyle.family; font.pixelSize: SpunStyle.caption }Glyph { visible: entry.checkable && entry.checked; anchors.centerIn: parent; name: "check"; ink: entry.app.accent }}- }+ } }}diff --git a/qml/QuickJump.qml b/qml/QuickJump.qmlindex 3e10682..e9f5986 100644--- a/qml/QuickJump.qml+++ b/qml/QuickJump.qml@@ -16,10 +16,10 @@ Popup {}objectName: "quickJump"parent: Overlay.overlay- x: (parent.width - width) / 2- y: Math.max(12, (app.height - 430) / 2)- width: Math.min(440, app.width - 24)- height: Math.min(430, app.height - 24, Math.max(214, 126 + Math.max(1, results.length) * 66 + (notice.length ? 50 : 0)))+ x: ((app.layoutWidth || app.width) - width) / 2+ y: Math.max(12, ((app.layoutHeight || app.height) - 430) / 2)+ width: Math.min(440, (app.layoutWidth || app.width) - 24)+ height: Math.min(430, (app.layoutHeight || app.height) - 24, Math.max(214, 126 + Math.max(1, results.length) * 66 + (notice.length ? 50 : 0)))Behavior on height { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.standardCurve } }padding: 16; focus: true; modal: true; dim: false; popupType: Popup.Itembackground: Rectangle { radius: SpunStyle.popupRadius; color: SpunStyle.popup }diff --git a/qml/SavedQueuePicker.qml b/qml/SavedQueuePicker.qmlindex c3841f3..953fde4 100644--- a/qml/SavedQueuePicker.qml+++ b/qml/SavedQueuePicker.qml@@ -13,9 +13,10 @@ Popup {objectName: "savedQueuePicker"popupType: Popup.Item; focus: true; modal: true; dim: true; padding: 24parent: Overlay.overlay- anchors.centerIn: parent- width: Math.min(360, app.width - 32)- height: Math.min(438, Math.max(310, 252 + rows.length * 62), app.height - 48)+ x: ((app.layoutWidth || app.width) - width) / 2+ y: ((app.layoutHeight || app.height) - height) / 2+ width: Math.min(360, (app.layoutWidth || app.width) - 32)+ height: Math.min(438, Math.max(310, 252 + rows.length * 62), (app.layoutHeight || app.height) - 48)background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }enter: SpunPopupEnter {}diff --git a/qml/SeekSlider.qml b/qml/SeekSlider.qmlindex a2536bc..86735c5 100644--- a/qml/SeekSlider.qml+++ b/qml/SeekSlider.qml@@ -5,10 +5,56 @@ SpunSlider {id: controlrequired property var appenabled: visible && !app.swapRunning && app.deckPlayer.duration > 0 && (!app.useCider || app.ciderService.canSeek)- value: app.progress+ property bool scrubbing: false+ property real previewValue: 0+ property real lastPointer: 0+ property real windDirection: 0+ property double lastMove: 0+ property string seekTrack: ""+ previewing: scrubbing+ value: scrubbing ? previewValue : app.progress+ function cancelSeek() {+ scrubbing=false; windDirection=0+ if(app.activeSeekControl===control)app.activeSeekControl=null+ }+ onEnabledChanged: if(!enabled)cancelSeek()+ onVisibleChanged: if(!visible)cancelSeek()+ Component.onDestruction: if(app.activeSeekControl===control)app.activeSeekControl=nullvalueText: app.time(value * app.deckPlayer.duration)Accessible.name: "Playback position"- onMoved: app.deckPlayer.seek(value * app.deckPlayer.duration)+ onMoved: if(!scrubbing)app.deckPlayer.seek(value * app.deckPlayer.duration)+ MouseArea {+ id: seekPointer; objectName: control.objectName + "Pointer"+ anchors.fill: parent; preventStealing: true; acceptedButtons: Qt.LeftButton+ cursorShape: Qt.PointingHandCursor+ function fraction(x) { return Math.max(0, Math.min(1,(x-control.leftPadding)/(control.availableWidth-control.handle.width))) }+ onPressed: mouse => {+ control.forceActiveFocus(Qt.MouseFocusReason)+ control.seekTrack=control.app.cassetteTrackIdentity+ control.previewValue=(mouse.modifiers & Qt.ShiftModifier)?control.app.progress:fraction(mouse.x)+ control.lastPointer=mouse.x;control.windDirection=Math.sign(control.previewValue-control.app.progress);control.lastMove=Date.now()+ control.scrubbing=true;control.app.activeSeekControl=control+ if(control.app.cassette)tapeSound.transport()+ }+ onPositionChanged: mouse => {+ if(!pressed || !control.scrubbing)return+ const delta=(mouse.x-control.lastPointer)/(control.availableWidth-control.handle.width)+ control.previewValue=Math.max(0,Math.min(1,control.previewValue+delta*((mouse.modifiers & Qt.ShiftModifier)?.1:1)))+ control.lastPointer=mouse.x+ if(delta!==0){control.windDirection=Math.sign(delta);control.lastMove=Date.now()}+ }+ onReleased: {+ if(!control.scrubbing)return+ const valid=control.enabled && control.seekTrack===control.app.cassetteTrackIdentity+ const position=control.previewValue+ control.cancelSeek()+ if(valid){control.app.deckPlayer.seek(position*control.app.deckPlayer.duration);if(control.app.cassette)tapeSound.transport()}+ }+ onCanceled: control.cancelSeek()+ onWheel: wheel => wheel.accepted=false+ }+ Keys.onShortcutOverride: event => { if(event.key===Qt.Key_Escape && scrubbing)event.accepted=true }+ Keys.onEscapePressed: cancelSeek()background: Item {x: 4; y: 4; width: control.availableWidth; height: control.availableHeightreadonly property real head: parent.visualPosition * (width - 4) + 2diff --git a/qml/SpunSlider.qml b/qml/SpunSlider.qmlindex 6073f40..e637233 100644--- a/qml/SpunSlider.qml+++ b/qml/SpunSlider.qml@@ -8,6 +8,7 @@ Slider {padding: 4hoverEnabled: truefocusPolicy: Qt.StrongFocus+ property bool previewing: falseproperty string valueText: Math.round(value * 100) + "%"background: Item {x: control.leftPadding; y: control.topPadding@@ -34,7 +35,7 @@ Slider {handle: Rectangle {x: control.leftPadding + control.visualPosition * (control.availableWidth - 4)y: control.topPadding + (control.availableHeight - height) / 2- width: 4; height: control.pressed ? 20 : 16; radius: 2+ width: 4; height: (control.pressed || control.previewing) ? 20 : 16; radius: 2color: theme.colors.accent; opacity: control.enabled ? 1 : SpunStyle.disabledOpacityBehavior on height { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }Rectangle {@@ -42,5 +43,5 @@ Slider {color: "transparent"; border.width: control.visualFocus ? 2 : 0; border.color: theme.colors.accent}}- SpunToolTip { visible: control.enabled && (control.pressed || control.visualFocus); delay: 0; text: control.valueText }+ SpunToolTip { visible: control.enabled && (control.pressed || control.previewing || control.visualFocus); delay: 0; text: control.valueText }}diff --git a/qml/Tonearm.qml b/qml/Tonearm.qmlindex 0a1a37d..644db0e 100644--- a/qml/Tonearm.qml+++ b/qml/Tonearm.qml@@ -11,7 +11,7 @@ Item {property bool dragging: falseproperty real dragAngle: -4property real rawAngle: -4- property real grabOffset: 0+ property real lastPointerAngle: 0property real pointerDistance: 210property string dragTrack: ""property bool wasPlaying: false@@ -68,10 +68,11 @@ Item {liftMotion.complete(); angleSpring.complete()}SpunToolTip {+ objectName: "needleToolTip"parent: arm; x: 184; y: 60- visible: needleHit.containsMouse || needleHit.activeFocus+ visible: arm.canSeek && arm.app.visible && (arm.dragging || (!needleHit.hintDismissed && needleHit.hoveringNeedle) || (needleHit.activeFocus && !needleHit.pointerFocus))delay: arm.dragging ? 0 : 650- text: arm.dragging ? arm.app.time(arm.previewProgress * arm.app.deckPlayer.duration) : "Drag the needle to seek"+ text: arm.dragging ? arm.app.time(arm.previewProgress * arm.app.deckPlayer.duration) : "Drag to seek · Shift for precision"}// The pivot rests at the record's edge; the stylus stays outside the label.Item {@@ -121,6 +122,7 @@ Item {Rectangle { x: -7; y: -7; width: 14; height: 14; radius: 7; color: arm.gold; border.width: 1; border.color: arm.glint }Rectangle { x: -3; y: -1; width: 6; height: 2; radius: 1; rotation: -35; color: arm.shade }}+ HoverHandler { id: needleHover; blocking: false; onHoveredChanged: if (!hovered) needleHit.hintDismissed = false }// Pointer coordinates must stay fixed while the shaft rotates beneath them.MouseArea {id: needleHit; objectName: "needleHandle"@@ -128,6 +130,11 @@ Item {enabled: arm.canSeek; hoverEnabled: true; preventStealing: trueacceptedButtons: Qt.LeftButtonactiveFocusOnTab: true+ property bool pointerFocus: false+ property bool hintDismissed: false+ readonly property bool hoveringNeedle: needleHover.hovered && Math.hypot(needleHover.point.position.x-tip.x, needleHover.point.position.y-tip.y) <= 27+ onHoveringNeedleChanged: if (!hoveringNeedle) hintDismissed = false+ onActiveFocusChanged: if (!activeFocus) pointerFocus = falsereadonly property point tip: {const angle = arm.armAngle * Math.PI / 180return Qt.point(378 - 197 * Math.sin(angle), 100 + 197 * Math.cos(angle))@@ -138,12 +145,13 @@ Item {cursorShape: arm.dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursorAccessible.role: Accessible.SliderAccessible.name: "Needle position"- Accessible.description: "Drag onto the grooves to seek and play. Arrow keys seek; Enter starts playback; Escape cancels dragging."+ Accessible.description: "Drag onto the grooves to seek and play. Hold Shift for precision. Arrow keys seek; Enter starts playback; Escape cancels dragging."onPressed: mouse => {if (Math.hypot(mouse.x - tip.x, mouse.y - tip.y) > 27) { mouse.accepted = false; return }+ pointerFocus = trueforceActiveFocus()arm.dragAngle = arm.armAngle; arm.rawAngle = arm.armAngle- arm.grabOffset = Math.atan2(378 - mouse.x, mouse.y - 100) * 180 / Math.PI - arm.armAngle+ arm.lastPointerAngle = Math.atan2(378 - mouse.x, mouse.y - 100) * 180 / Math.PIarm.dragTrack = arm.app.cassetteTrackIdentity; arm.wasPlaying = arm.app.deckPlayer.playingarm.pointerDistance = Math.hypot(mouse.x - 378, mouse.y - 100)arm.dragging = true; arm.landing = false; landingTimeout.stop()@@ -153,11 +161,15 @@ Item {if (!pressed || !arm.dragging) returnconst dx = mouse.x - 378, dy = mouse.y - 100arm.pointerDistance = Math.hypot(dx, dy)- arm.rawAngle = Math.atan2(-dx, dy) * 180 / Math.PI - arm.grabOffset+ const pointer = Math.atan2(-dx, dy) * 180 / Math.PI+ let delta=pointer-arm.lastPointerAngle+ if(delta>180)delta-=360;else if(delta < -180)delta+=360+ arm.rawAngle += delta*((mouse.modifiers & Qt.ShiftModifier)?.1:1)+ arm.lastPointerAngle=pointerarm.dragAngle = Math.max(-8, Math.min(38, arm.rawAngle))}- onReleased: arm.dropNeedle()- onCanceled: arm.cancelDrag(true)+ onReleased: { hintDismissed = true; arm.dropNeedle() }+ onCanceled: { hintDismissed = true; arm.cancelDrag(true) }onWheel: wheel => { wheel.accepted = false }Keys.onShortcutOverride: event => { if ([Qt.Key_Escape,Qt.Key_Left,Qt.Key_Right,Qt.Key_Return,Qt.Key_Enter].includes(event.key)) event.accepted = true }Keys.onEscapePressed: arm.cancelDrag(true)@@ -168,7 +180,7 @@ Item {Rectangle {x: needleHit.tip.x - 22; y: needleHit.tip.y - 25; width: 44; height: 50rotation: arm.armAngle; radius: 10; color: "transparent"- border.width: needleHit.activeFocus && !needleHit.containsMouse && !arm.dragging ? 1.5 : 0+ border.width: needleHit.activeFocus && !needleHit.pointerFocus && !arm.dragging ? 1.5 : 0border.color: arm.app.accent}}diff --git a/qml/TrackMenu.qml b/qml/TrackMenu.qmlindex db832c0..2570de3 100644--- a/qml/TrackMenu.qml+++ b/qml/TrackMenu.qml@@ -27,6 +27,7 @@ Menu {enter: SpunPopupEnter {}exit: Transition { NumberAnimation { property: "opacity"; from: 1; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }component Entry: MenuEntry { app: menu.app }+ Entry { objectName: "inspectArtworkAction"; visible: menu.currentSong; text: "View artwork"; glyphName: "artwork"; onTriggered: menu.app.showArtwork() }Entry {objectName: "playNextAction"visible: !menu.currentSong && !menu.station && !menu.artist; text: menu.batch ? "Play next · " + menu.selectionBatch.length : "Play next"; glyphName: "next"diff --git a/scripts/benchmark.py b/scripts/benchmark.pyindex 1209320..b9529bb 100755--- a/scripts/benchmark.py+++ b/scripts/benchmark.py@@ -7,6 +7,9 @@ from pathlib import Pathimport subprocessimport tempfileimport time+import itertools+import shutil+import xml.etree.ElementTree as ETparser = argparse.ArgumentParser(description=__doc__)parser.add_argument('--binary', type=Path, default=Path(__file__).resolve().parents[1] / 'build/spun')@@ -16,6 +19,8 @@ parser.add_argument('--runs', type=int, default=3)parser.add_argument('--startup-only', action='store_true', help='Exit after the first frame and report startup stages')parser.add_argument('--renderer', choices=('opengl', 'software'), default='opengl')parser.add_argument('--scale', type=float, default=1, help='Identical device scale for both builds')+parser.add_argument('--media', nargs='+', choices=('cd', 'vinyl', 'cassette'), default=['cd'])+parser.add_argument('--scenes', nargs='+', choices=('idle', 'playing', 'mini', 'cycle'), default=['idle', 'playing', 'mini'])args = parser.parse_args()if args.runs < 1:parser.error('--runs must be positive')@@ -27,7 +32,7 @@ if args.baseline:versions.insert(0, ('baseline', args.baseline.resolve()))results = []for trial in range(args.runs):- for scene in (('startup',) if args.startup_only else ('idle', 'playing', 'mini')):+ for scene, medium in itertools.product(('startup',) if args.startup_only else args.scenes, args.media):# Alternate order to reduce systematic effects from warm caches and temperature.for version, binary in (versions if trial % 2 == 0 else list(reversed(versions))):with tempfile.TemporaryDirectory(prefix='spun-benchmark-') as cache:@@ -36,10 +41,12 @@ for trial in range(args.runs):QT_SCALE_FACTOR=str(args.scale), QSG_RHI_BACKEND='opengl',QT_QUICK_BACKEND='software' if args.renderer == 'software' else 'rhi',QSG_RENDER_LOOP='basic' if args.renderer == 'software' else 'threaded')- log_path = args.output / f'{version}-{scene}-{trial}.log'+ log_path = args.output / f'{version}-{medium}-{scene}-{trial}.log'samples = []+ gpu_mib = None+ gpu_sampled = Falsewith log_path.open('w') as log:- process = subprocess.Popen([str(binary), '--benchmark', scene], env=env, stdout=log, stderr=log)+ process = subprocess.Popen([str(binary), '--benchmark', scene, '--benchmark-medium', medium], env=env, stdout=log, stderr=log)start, previous = time.monotonic(), Nonetry:while process.poll() is None:@@ -55,7 +62,17 @@ for trial in range(args.runs):previous = now, ticksexcept FileNotFoundError:pass- time.sleep(.25)+ if not args.startup_only and not gpu_sampled and now - start >= 5.5:+ gpu_sampled = True+ if shutil.which('nvidia-smi'):+ try:+ telemetry = subprocess.run(['nvidia-smi', '-q', '-x'], capture_output=True, text=True, timeout=2, check=True)+ for item in ET.fromstring(telemetry.stdout).findall('.//process_info'):+ if item.findtext('pid') == str(process.pid):+ gpu_mib = int(item.findtext('used_memory').split()[0])+ except (subprocess.SubprocessError, ValueError, ET.ParseError, AttributeError):+ pass+ time.sleep(.01 if args.startup_only else .25)finally:if process.poll() is None:process.terminate()@@ -72,7 +89,7 @@ for trial in range(args.runs):raise RuntimeError(f'{version} {scene}: window closed before measurement; see {log_path}')row = json.loads(measurement)if args.startup_only:- row.update(version=version, trial=trial, renderer=args.renderer, scale=args.scale,+ row.update(version=version, trial=trial, medium=medium, renderer=args.renderer, scale=args.scale,binaryBytes=binary.stat().st_size)results.append(row)(args.output / 'results.json').write_text(json.dumps(results, indent=2) + '\n')@@ -82,7 +99,9 @@ for trial in range(args.runs):for key in ('Rss', 'Pss', 'Private_Dirty'):row[key + 'KiB'] = int(next(line.split()[1] for line in memory.splitlines() if line.startswith(key + ':')))row.update(version=version, trial=trial, maxCpu250ms=max(samples, default=0),- validAnimation=scene == 'idle' or row['frames'] >= 300,+ meanCpu250ms=sum(samples)/len(samples) if samples else 0,+ validAnimation=scene in ('idle', 'cycle') or row['frames'] >= 300,+ gpuMemoryMiB=gpu_mib,renderer=args.renderer, scale=args.scale,binaryBytes=binary.stat().st_size)results.append(row)diff --git a/scripts/install-launcher.sh b/scripts/install-launcher.shindex 8c9390a..8c1640e 100755--- a/scripts/install-launcher.sh+++ b/scripts/install-launcher.sh@@ -13,7 +13,7 @@ Type=ApplicationName=SpunComment=CD-shaped music player for local files and Cider.Exec="{escape(root / 'scripts/run.sh')}" %F-Icon={root / 'assets/spun.svg'}+Icon={root / 'assets/spun-icon.png'}Terminal=falseCategories=AudioVideo;Audio;Player;MimeType=audio/mpeg;audio/flac;audio/ogg;audio/x-wav;audio/mp4;diff --git a/src/disc.cpp b/src/disc.cppindex ca29aa3..54f1bd2 100644--- a/src/disc.cpp+++ b/src/disc.cpp@@ -9,6 +9,14 @@#include <QSGGeometryNode>#include <QSGVertexColorMaterial>+void ArtworkView::paint(QPainter *painter) {+ if(m_artwork.isNull())return;+ const auto size=QSizeF(m_artwork.size()).scaled(boundingRect().size(),Qt::KeepAspectRatio);+ const QRectF target((width()-size.width())/2,(height()-size.height())/2,size.width(),size.height());+ painter->setRenderHint(QPainter::SmoothPixmapTransform);+ painter->drawImage(target,m_artwork);+}+Disc::Disc(QQuickItem *parent) : QQuickPaintedItem(parent) {setAntialiasing(true);}@@ -50,6 +58,13 @@ QImage Disc::fallbackArt(int size) {return image;}+// All media use the identical fallback pixels. Share one immutable image even+// after switching appearances; each painted item retains only an implicit copy.+static const QImage &sharedFallbackArt() {+ static const QImage image = Disc::fallbackArt();+ return image;+}+void Disc::paint(QPainter *p) {p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);const double side = qMin(width(), height());@@ -92,8 +107,7 @@ void Disc::paint(QPainter *p) {p->fillPath(label, m_labelColor);} else {if (m_art.isNull() && m_fallback.isNull()) {- static const QImage sharedFallback = fallbackArt();- m_fallback = sharedFallback;+ m_fallback = sharedFallbackArt();}const QImage &art = m_art.isNull() ? m_fallback : m_art;const double crop = qMin(art.width(), art.height());@@ -143,7 +157,7 @@ void Disc::paintVinyl(QPainter *p) {p->save();p->setClipPath(label,Qt::IntersectClip);if(m_labelColor.isValid())p->fillPath(label,m_labelColor);else {- if(m_art.isNull()&&m_fallback.isNull()) { static const QImage shared=fallbackArt();m_fallback=shared; }+ if(m_art.isNull()&&m_fallback.isNull()) { m_fallback=sharedFallbackArt(); }const auto &art=m_art.isNull()?m_fallback:m_art;const double crop=qMin(art.width(),art.height());p->drawImage(QRectF(500-radius,500-radius,radius*2,radius*2),art,QRectF((art.width()-crop)/2,(art.height()-crop)/2,crop,crop));}@@ -197,7 +211,7 @@ void Disc::paintCassette(QPainter *p) {p->save();p->setClipPath(clip);if(m_labelColor.isValid())p->fillPath(clip,m_labelColor);else {- if(m_art.isNull() && m_fallback.isNull()) {static const QImage shared=fallbackArt();m_fallback=shared;}+ if(m_art.isNull() && m_fallback.isNull()) {m_fallback=sharedFallbackArt();}const auto &art=m_art.isNull()?m_fallback:m_art;const double scale=qMax(label.width()/art.width(),label.height()/art.height());const QSizeF crop(label.width()/scale,label.height()/scale);@@ -277,6 +291,10 @@ void Disc::paintCassette(QPainter *p) {class RingNode final : public QSGGeometryNode {public:int capacity = 0, indexCapacity = 0, indexedSteps = -1, indexedDotSteps = -1;+ struct Sample { qreal t, sine, cosine, waveSine, waveCosine, envelope; };+ QList<Sample> samples;+ qreal sampledArc = -1, sampledRadius = -1;+ bool sampledLinear = false;};// Small vertex buffers animate the rim without repainting or uploading a full CD-sized texture.@@ -335,32 +353,27 @@ QSGNode *ProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)(vertices++)->set(point.x(), point.y(), visible ? red : 0, visible ? green : 0,visible ? blue : 0, visible ? opaque : 0);};- auto point = [&](qreal t, qreal offset) {- const qreal envelope = qBound(0., qMin(t,arc-t)*radius/14, 1.);- const qreal r = radius + std::sin(t*28-m_phase)*m_amplitude*envelope + offset;- return center + QPointF(std::sin(t)*r, -std::cos(t)*r);- };+ // Progress changes less often than the animated phase. Reuse the expensive+ // trigonometry between progress updates, retaining the same tessellation.+ if (node->samples.size() != steps+1 || node->sampledArc != arc || node->sampledRadius != radius || node->sampledLinear != m_linear) {+ node->samples.resize(steps+1);+ for (int i=0; i<=steps; ++i) {+ const qreal t=arc*i/steps, wave=t*(m_linear?2*M_PI/24:28);+ node->samples[i]={t,std::sin(t),-std::cos(t),std::sin(wave),std::cos(wave),qBound(0.,qMin(t,arc-t)*radius/14,1.)};+ }+ node->sampledArc=arc;node->sampledRadius=radius;node->sampledLinear=m_linear;+ }+ const qreal phaseSine=std::sin(m_phase),phaseCosine=std::cos(m_phase);constexpr qreal offsets[] = {-1.9, -.9, .9, 1.9};constexpr bool opacity[] = {false, true, true, false};- auto edge = [&](qreal t) {- const qreal envelope = qBound(0., qMin(t,arc-t)*radius/14, 1.);- if (m_linear) {- const qreal y = height()/2 + std::sin(t*2*M_PI/24-m_phase)*m_amplitude*envelope;- std::array<QPointF,4> points;- for (int j=0; j<4; ++j) points[j]=QPointF(t,y+offsets[j]);- return points;+ for (const auto &sample : std::as_const(node->samples)) {+ const qreal wave=(sample.waveSine*phaseCosine-sample.waveCosine*phaseSine)*m_amplitude*sample.envelope;+ for (int band=0; band<4; ++band) {+ const qreal r=radius+wave+offsets[band];+ vertex(m_linear?QPointF(sample.t,height()/2+wave+offsets[band]):center+QPointF(sample.sine*r,sample.cosine*r),opacity[band]);}- const qreal r = radius + std::sin(t*28-m_phase)*m_amplitude*envelope;- const qreal sine = std::sin(t), cosine = -std::cos(t);- std::array<QPointF,4> points;- for (int j=0; j<4; ++j) points[j] = center + QPointF(sine*(r+offsets[j]), cosine*(r+offsets[j]));- return points;- };- for (int i=0; i<=steps; ++i) {- const auto points = edge(arc*i/steps);- for (int band=0; band<4; ++band) vertex(points[band],opacity[band]);}- const QPointF head=point(arc,0);+ const QPointF head=center+QPointF(std::sin(arc)*radius,-std::cos(arc)*radius);for (int i=0; i<dotSteps; ++i) {const qreal a=2*M_PI*i/dotSteps, b=2*M_PI*(i+1)/dotSteps;const QPointF av(std::cos(a),std::sin(a)), bv(std::cos(b),std::sin(b));diff --git a/src/disc.h b/src/disc.hindex af8b14f..7d6b671 100644--- a/src/disc.h+++ b/src/disc.h@@ -3,6 +3,26 @@#include <QImage>#include <QTimer>+// A static view of the already decoded cover; no additional fetch or image cache.+class ArtworkView : public QQuickPaintedItem {+ Q_OBJECT+ Q_PROPERTY(QImage artwork READ artwork WRITE setArtwork NOTIFY artworkChanged)+public:+ Q_PROPERTY(bool hasArtwork READ hasArtwork NOTIFY artworkChanged)+ explicit ArtworkView(QQuickItem *parent=nullptr):QQuickPaintedItem(parent) {}+ bool hasArtwork() const { return !m_artwork.isNull(); }+ QImage artwork() const { return m_artwork; }+ void setArtwork(const QImage &image) {+ if(image.cacheKey()==m_artwork.cacheKey())return;+ m_artwork=image;update();emit artworkChanged();+ }+ void paint(QPainter *painter) override;+signals:+ void artworkChanged();+private:+ QImage m_artwork;+};+class Disc : public QQuickPaintedItem {Q_OBJECTQ_PROPERTY(bool vinyl READ vinyl WRITE setVinyl NOTIFY vinylChanged)diff --git a/src/librarytest.cpp b/src/librarytest.cppindex 969566b..f1f79c4 100644--- a/src/librarytest.cpp+++ b/src/librarytest.cpp@@ -696,12 +696,19 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &caclick("playNextAction");check(wait([&]{return !actions.busy();})&&editPath.endsWith("/add-next")&&plays==beforeUi,"Play Next menu dispatches a queue addition only");click("libraryActions3");testKeyClick(window,Qt::Key_Escape);QTest::qWait(100);check(wait([&]{return !panel->property("actionsOpen").toBool();})&&window->property("libraryOpen").toBool(),"Escape dismisses the track menu before closing the browser");+ openingPlayer->setMotion(true);click("libraryRow3");wait([&]{return !browser.busy();});check(!browser.collection().isEmpty()&&plays==beforeUi,"album row opens its track list without autoplay");if(!captures.isEmpty())window->grabWindow().save(captures+"/06-library-album.png");click("libraryPlayCollection");check(wait([&]{return !browser.starting();})&&plays==beforeUi+1,"collection Play button dispatches playback");testKeyClick(window,Qt::Key_Escape);check(browser.collection().isEmpty(),"Escape returns from collection detail");QTest::qWait(100);check(qAbs(list->property("contentY").toDouble()-120)<1,"Back restores the library scroll position");+ check(list->property("currentIndex").toInt()==3&&list->hasActiveFocus(),"Back restores keyboard focus to the album that opened the collection");+ auto *listMotion=window->findChild<QObject *>("libraryListEntrance");+ check(listMotion&&listMotion->property("startOffset").toReal()==-12,"Back uses the return direction for the library transition");+ QTest::qWait(200);+ if(!captures.isEmpty())window->grabWindow().save(captures+"/24-library-return-focus.png");+ openingPlayer->setMotion(openingMotion);click("libraryTab_search");click("librarySearchInput");auto *search=find(window->contentItem(),"librarySearchInput");check(search && search->hasActiveFocus(),"browser search receives keyboard focus");@@ -761,6 +768,13 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &caif(duration) { duration->forceActiveFocus();testKeyClick(window,Qt::Key_Right); }check(wait([&]{return !cider.crossfadeBusy();})&&fadeSeconds==9,"keyboard adjusts crossfade duration and confirms it");testKeyClick(window,Qt::Key_Escape);check(wait([&]{return !fadeMenu->property("visible").toBool();}),"Escape dismisses crossfade settings");+ check(!window->findChild<QObject *>("crossfadeToggle"), "closed audio popup releases its controls");+ QMetaObject::invokeMethod(fadeMenu,"open");+ check(wait([&]{return fadeMenu->property("opened").toBool()&&!cider.crossfadeBusy()&&!cider.audioBusy();}), "audio popup reopens and reloads confirmed state");+ auto *reopenedToggle=window->findChild<QObject *>("crossfadeToggle");+ check(reopenedToggle&&reopenedToggle->property("checked").toBool()==cider.crossfade(), "recreated audio controls retain the confirmed Cider value");+ QMetaObject::invokeMethod(fadeMenu,"close");+ wait([&]{return !fadeMenu->property("visible").toBool();});fadeMenu->setProperty("service",originalFade);}click("libraryTab_songs");wait([&]{return !browser.busy();});click("recentSongsTab");wait([&]{return !browser.busy();});diff --git a/src/main.cpp b/src/main.cppindex 4608281..087d241 100644--- a/src/main.cpp+++ b/src/main.cpp@@ -114,14 +114,27 @@ public:const bool cassette=window->property("cassette").toBool();const int targetWidth = mini ? 300 : queue ? 860 : 530;const int targetHeight = mini ? (window->property("showHorizontalSeek").toBool()?382:354) : 730;+ const qreal scale=qBound(.5,window->property("uiScale").toDouble(),1.5);+ QTransform zoom;zoom.scale(scale,scale);+ const auto setMask=[&](const QRegion ®ion){window->setMask(zoom.map(region));};+ const auto itemRegion=[&](QQuickItem *item){+ const auto rect=item->mapRectToScene(item->boundingRect());+ return QRegion(QRectF(rect.x()/scale,rect.y()/scale,rect.width()/scale,rect.height()/scale).toAlignedRect());+ };window->setMinimumWidth(0);window->setMinimumHeight(0);- window->setMaximumWidth(targetWidth);- window->setMaximumHeight(targetHeight);- window->resize(targetWidth, targetHeight);- window->setMinimumWidth(targetWidth);- window->setMinimumHeight(targetHeight);- if (mini && window->property("menuOpen").toBool()) { window->setMask(QRegion(0,0,targetWidth,targetHeight));return; }+ window->setMaximumWidth(qRound(targetWidth*scale));+ window->setMaximumHeight(qRound(targetHeight*scale));+ window->resize(qRound(targetWidth*scale), qRound(targetHeight*scale));+ window->setMinimumWidth(qRound(targetWidth*scale));+ window->setMinimumHeight(qRound(targetHeight*scale));+ // Scale the ApplicationWindow scene, never QQuickWindow's input-coordinate root.+ if(auto *content=window->property("contentItem").value<QQuickItem *>()) {+ content->setTransformOrigin(QQuickItem::TopLeft);+ content->setScale(scale);+ content->setSize(QSizeF(targetWidth,targetHeight));+ }+ if (mini && window->property("menuOpen").toBool()) { setMask(QRegion(0,0,targetWidth,targetHeight));return; }if (mini) {QRegion region=cassette?QRegion(18,60,264,176):QRegion(6,6,288,288,QRegion::Ellipse);if(cassette)region|=QRegion(50,240,200,26);@@ -132,34 +145,34 @@ public:else if(!cassette)region-=window->property("vinyl").toBool()?QRegion(146,146,8,8,QRegion::Ellipse):QRegion(136,136,28,28,QRegion::Ellipse);region |= QRegion(50,268,200,targetHeight-270);if (auto *notice=window->findChild<QQuickItem *>("actionNotice"); notice && notice->isVisible())- region |= QRegion(notice->mapRectToScene(notice->boundingRect()).toAlignedRect());- window->setMask(region); return;+ region |= itemRegion(notice);+ setMask(region); return;}if (window->property("helpOpen").toBool() || window->property("menuOpen").toBool()) {- window->setMask(QRegion(0, 0, window->width(), window->height())); return;+ setMask(QRegion(0, 0, targetWidth, targetHeight)); return;}if (window->property("backgroundBlur").toBool()) {- QPainterPath backdrop; backdrop.addRoundedRect(QRectF(0, 0, window->width(), window->height()), 21, 21);- window->setMask(QRegion(backdrop.toFillPolygon().toPolygon())); return;+ QPainterPath backdrop; backdrop.addRoundedRect(QRectF(0, 0, targetWidth, targetHeight), 21, 21);+ setMask(QRegion(backdrop.toFillPolygon().toPolygon())); return;}QRegion region=cassette?QRegion(60,156,410,276):QRegion(44,73,442,442,QRegion::Ellipse);if(cassette)region|=QRegion(115,439,300,36);if(!cassette)region -= window->property("vinyl").toBool()?QRegion(259,288,12,12,QRegion::Ellipse):QRegion(243,272,44,44,QRegion::Ellipse);if (auto *bar = window->findChild<QQuickItem *>("sourceBar"))- region |= QRegion(bar->mapRectToScene(bar->boundingRect()).toAlignedRect());+ region |= itemRegion(bar);if (auto *deck = window->findChild<QQuickItem *>("playerDeck"))- region |= QRegion(deck->mapRectToScene(deck->boundingRect()).toAlignedRect());+ region |= itemRegion(deck);region |= QRegion(65, 701, 400, 26);if (auto *notice=window->findChild<QQuickItem *>("actionNotice"); notice && notice->isVisible())- region |= QRegion(notice->mapRectToScene(notice->boundingRect()).toAlignedRect());+ region |= itemRegion(notice);// Error notices can overlap the otherwise click-through perimeter.region |= QRegion(73, 419, 384, 80);if (queue) {const auto *panelName = window->property("libraryOpen").toBool() ? "libraryPanel" : "queuePanel";if (auto *panel = window->findChild<QQuickItem *>(panelName))- region |= QRegion(panel->mapRectToScene(panel->boundingRect()).toAlignedRect());+ region |= itemRegion(panel);}- window->setMask(region);+ setMask(region);}Q_INVOKABLE void place(QWindow *window) {if (!window) return;@@ -451,11 +464,72 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *check(bar && qAbs(bar->x()+bar->width()/2-265) < .1, "source bar centered over CD");auto *songTitle = window->findChild<QQuickItem *>("songTitle");check(songTitle && songTitle->property("font").value<QFont>().weight() == QFont::Normal, "song title uses regular weight");+ auto *elapsedTime=findItem(window->contentItem(),"elapsedTime");+ check(songTitle&&elapsedTime&&qAbs(songTitle->y()+songTitle->baselineOffset()-elapsedTime->y()-elapsedTime->baselineOffset())<.1,"elapsed time shares the song title baseline");+check(window->property("font").value<QFont>().family() == QFontInfo(QFontDatabase::systemFont(QFontDatabase::GeneralFont)).family(), "new profiles follow the system font");auto *type = qobject_cast<Typography *>(QQmlEngine::contextForObject(window)->contextProperty("typography").value<QObject *>());check(type && type->families().isEmpty(), "installed fonts are listed only when requested");check(!window->findChild<QObject *>("fontPicker"), "font picker objects are absent from startup");+ check(!window->findChild<QObject *>("crossfadeToggle") && !window->findChild<QObject *>("recoveryCancel"),+ "closed audio and recovery popups do not create their controls at startup");+ {+ QList<QUrl> browsingTracks;+ for(int i=0;i<12;++i) {+ const auto path=temp+QString("/queue-browse-%1.flac").arg(i);+ QFile::copy(QStringLiteral(SPUN_SOURCE_DIR "/assets/First-Light.flac"),path);browsingTracks.append(QUrl::fromLocalFile(path));+ }+ player.addUrls(browsingTracks,false);waitFor([&]{return !player.busy()&&player.count()==12;});+ player.select(0,false);player.pause();window->setProperty("queueOpen",true);QTest::qWait(200);+ auto *queueView=findItem(window->contentItem(),"trackList");+ const auto at=queueView->mapToScene(QPointF(queueView->width()/2,queueView->height()/2));+ QWheelEvent browseWheel(at,window->mapToGlobal(at.toPoint()),QPoint(),QPoint(0,-480),Qt::NoButton,Qt::NoModifier,Qt::NoScrollPhase,false);+ QGuiApplication::sendEvent(window,&browseWheel);QTest::qWait(500);+ const auto readingPosition=queueView->property("contentY").toReal();+ if(readingPosition<=50)std::cerr<<"Queue scroll diagnostic: y="<<readingPosition<<" content="<<queueView->property("contentHeight").toReal()<<" viewport="<<queueView->height()<<" count="<<queueView->property("count").toInt()<<" following="<<queueView->property("following").toBool()<<std::endl;+ check(readingPosition>50&&!queueView->property("following").toBool(),"mouse-wheel browsing scrolls a long queue and pauses automatic following");+ const auto rememberedPosition=queueView->property("readingY").toReal();+ player.select(1,false);QTest::qWait(200);+ if(qAbs(queueView->property("contentY").toReal()-readingPosition)>=2)std::cerr<<"Queue restore diagnostic: before="<<readingPosition<<" remembered="<<rememberedPosition<<" after="<<queueView->property("contentY").toReal()<<" origin="<<queueView->property("originY").toReal()<<std::endl;+ check(qAbs(queueView->property("contentY").toReal()-readingPosition)<2,"changing the current song preserves the actual queue scroll position");+ capture("25-queue-browsing");click("currentQueueButton");QTest::qWait(200);+ check(queueView->property("following").toBool()&&queueView->property("contentY").toReal()<readingPosition,"Current song scrolls back to the playing row");+ player.clear();window->setProperty("queueOpen",false);QTest::qWait(100);+ }if (type) {+ type->setUiScale(1.25);QTest::qWait(150);+ check(window->width()==qRound(window->property("layoutWidth").toReal()*1.25)+ &&qFuzzyCompare(window->property("contentItem").value<QQuickItem*>()->scale(),1.25)+ &&qFuzzyCompare(window->contentItem()->scale(),1.),"interface scaling leaves the window input coordinate root unscaled");+ window->setProperty("helpOpen",true);QTest::qWait(250);+ auto *scaledClose=findItem(window->contentItem(),"shortcutsClose");+ check(scaledClose&&window->mask().contains(scaledClose->mapToScene(QPointF(20,20)).toPoint()),"scaled popup controls remain inside the native input mask");+ auto *scaledPopup=window->findChild<QObject *>("shortcutsPopup");+ auto *scaledContent=scaledPopup?scaledPopup->property("contentItem").value<QQuickItem*>():nullptr;+ const auto popupCenter=scaledContent?scaledContent->mapToScene(QPointF(scaledContent->width()/2,scaledContent->height()/2)):QPointF();+ check(scaledContent&&qAbs(popupCenter.x()-window->width()/2.)<1&&qAbs(popupCenter.y()-window->height()/2.)<1,"scaled dialog remains visually centered in the window");+ capture("25-scaled-shortcuts");+ testKeyClick(window,Qt::Key_Escape);QTest::qWait(150);+ {Typography saved(temp+"/player.ini");check(qFuzzyCompare(saved.uiScale(),1.25),"interface scale survives relaunch");}+ type->setUiScale(1.);QTest::qWait(150);+ check(window->width()==530&&window->height()==730&&qFuzzyCompare(window->contentItem()->scale(),1.),"interface scale restores the original layout exactly");+ for(const qreal scale: { .85, 1.5 }) {+ type->setUiScale(scale);window->setProperty("queueOpen",true);QTest::qWait(150);+ auto *panel=findItem(window->contentItem(),"queuePanel");+ check(window->width()==qRound(860*scale)&&panel&&window->mask().contains(panel->mapToScene(QPointF(100,100)).toPoint()),"scaled sidebar retains its native input region");+ auto *localSource=findItem(window->contentItem(),"localSourceButton");+ QTest::mouseMove(window,QPoint(1,1));QTest::qWait(30);+ QTest::mouseMove(window,localSource->mapToScene(QPointF(localSource->width()/2,localSource->height()/2)).toPoint());QTest::qWait(100);+ check(localSource->property("hovered").toBool(),"scaled controls hover at their visible position");+ click("ciderSourceButton");check(window->property("useCider").toBool(),"scaled source selection hits the visible Cider button");+ click("localSourceButton");check(!window->property("useCider").toBool(),"scaled source selection hits the visible Local button");+ window->setProperty("queueOpen",false);player.setMiniMode(true);QTest::qWait(150);+ check(window->width()==qRound(300*scale)&&window->height()==qRound(354*scale),"Mini mode respects the chosen interface size");+ player.setMiniMode(false);window->setProperty("helpOpen",true);QTest::qWait(250);+ capture(QString("25-scale-%1").arg(qRound(scale*100)));+ click("shortcutsClose");check(!window->property("helpOpen").toBool(),"scaled popup closes through its actual pointer target");+ }+ type->setUiScale(1.);QTest::qWait(150);type->loadFamilies();QString chosen;for (const auto &family : type->families()) if (family != type->systemFamily()) { chosen = family; break; }@@ -465,13 +539,18 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *window->setProperty("queueOpen",true);QTest::qWait(200);click("menuButton");QTest::qWait(200);auto *settingsPopup=window->findChild<QObject *>("settingsMenu");+ auto *preferencesAction=window->findChild<QObject *>("preferencesAction");+ auto *menuContent=preferencesAction ? preferencesAction->property("contentItem").value<QObject *>() : nullptr;+ check(menuContent && menuContent->property("item").value<QObject *>(), "opening a menu creates its visible label and icon content");const auto menuVolume=player.volume();testKeyClick(window,Qt::Key_Down);testKeyClick(window,Qt::Key_Down);check(settingsPopup&&settingsPopup->property("currentIndex").toInt()>=0&&player.volume()==menuVolume,"menu arrow navigation moves focus without changing playback volume");testKeyClick(window,Qt::Key_Escape);QTest::qWait(200);check(!settingsPopup->property("visible").toBool()&&window->property("queueOpen").toBool(),"Escape dismisses the settings menu without closing the queue behind it");+ check(menuContent && !menuContent->property("item").value<QObject *>(), "closed menu releases its visual content after the exit transition");window->setProperty("queueOpen",false);QTest::qWait(200);click("menuButton"); QTest::qWait(250);+ check(menuContent && menuContent->property("item").value<QObject *>(), "reopening a menu restores its visual content");auto *fontLoader=window->findChild<QObject *>("fontPickerLoader");auto *fontPreferences=window->findChild<QObject *>("preferencesPopup");QSignalMapper fontLoaded;@@ -615,6 +694,38 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *"rapid hover reversals settle without changing the hover hue");} else check(false, "hover state layer exists");capture("01-empty");+ window->contentItem()->forceActiveFocus(); testKeyClick(window,Qt::Key_F1); QTest::qWait(250);+ auto *shortcuts=window->findChild<QObject *>("shortcutsPopup");+ auto *shortcutsClose=findItem(window->contentItem(),"shortcutsClose");+ check(shortcuts&&shortcuts->property("opened").toBool()&&shortcutsClose&&shortcutsClose->hasActiveFocus(),+ "F1 opens a focused shortcuts dialog");+ const auto helpVolume=player.volume();const auto helpPosition=player.position();+ testKeyClick(window,Qt::Key_Right);testKeyClick(window,Qt::Key_Up);+ check(player.volume()==helpVolume&&player.position()==helpPosition,"shortcuts dialog blocks background playback shortcuts");+ QList<QQuickItem *> helpKeys,helpActions;+ std::function<void(QQuickItem *)> collectHelp=[&](QQuickItem *item) {+ if(item->objectName()=="shortcutKey")helpKeys.append(item);+ if(item->objectName()=="shortcutAction")helpActions.append(item);+ for(auto *child:item->childItems())collectHelp(child);+ };+ collectHelp(window->contentItem());+ bool aligned=helpKeys.size()==20&&helpActions.size()==20;+ for(int i=0;i<helpKeys.size()&&i<helpActions.size();++i)+ aligned &= helpKeys[i]->x()==helpKeys[0]->x()&&helpActions[i]->x()==helpActions[0]->x()+ &&helpKeys[i]->width()+12<=helpActions[i]->x()+.01;+ check(aligned,"shortcut keys and descriptions use aligned columns with a consistent gap");+ capture("23-shortcuts");+ testKeyClick(window,Qt::Key_Tab);+ auto *helpScroll=findItem(window->contentItem(),"shortcutScroll");+ check(helpScroll&&helpScroll->hasActiveFocus(),"Tab reaches the scrollable shortcut list");+ testKeyClick(window,Qt::Key_PageDown);+ check(player.position()==helpPosition,"scrolling shortcuts does not seek playback");+ testKeyClick(window,Qt::Key_Escape);QTest::qWait(200);+ check(!window->property("helpOpen").toBool()&&!window->findChild<QObject *>("shortcutsClose")+ &&findItem(window->contentItem(),"menuButton")->hasActiveFocus(),"Escape closes shortcuts, releases controls and restores focus");+ testKeyClick(window,Qt::Key_F1);QTest::qWait(250);+ check(shortcuts->property("opened").toBool(),"shortcuts can reopen after dismissal");+ testKeyClick(window,Qt::Key_Escape);QTest::qWait(200);const auto demo = QStringLiteral(SPUN_SOURCE_DIR "/assets/First-Light.flac");const auto other = temp + "/Second-Light.flac";QFile::copy(demo, other);@@ -680,6 +791,14 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *check(waitFor([&] { return qAbs(player.position()-7000) < 300; }), "seek changes actual media position");QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(481, 294));check(waitFor([&] { return qAbs(player.position()-player.duration()/4) < 350; }), "outer CD rim scrubs playback");+ {+ auto *scrub=findItem(window->contentItem(),"scrubber");+ QTest::mousePress(window,Qt::LeftButton,Qt::ShiftModifier,QPoint(481,294));+ QMouseEvent fineMove(QEvent::MouseMove,QPointF(265,510),window->mapToGlobal(QPoint(265,510)),Qt::NoButton,Qt::LeftButton,Qt::ShiftModifier);QGuiApplication::sendEvent(window,&fineMove);+ check(scrub&&scrub->property("previewFraction").toReal()>.27&&scrub->property("previewFraction").toReal()<.28,"Shift drag makes precise adjustments on the circular progress ring");+ testKeyClick(window,Qt::Key_Escape);QTest::mouseRelease(window,Qt::LeftButton,Qt::ShiftModifier,QPoint(265,510));+ check(qAbs(player.position()-player.duration()/4)<350,"Escape cancels a circular seek preview");+ }click("shuffleButton"); check(player.shuffle(), "shuffle control toggles");click("repeatButton"); check(player.repeatMode() == 1, "repeat control cycles");player.setShuffle(false); player.setRepeatMode(0);@@ -738,6 +857,13 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *window->setProperty("discFlipped",false);QTest::qWait(400);}{+ QMetaObject::invokeMethod(window,"showArtwork");QTest::qWait(250);+ auto *artView=findItem(window->contentItem(),"fullArtwork");+ check(artView&&qobject_cast<ArtworkView *>(artView)&&!artView->property("artwork").value<QImage>().isNull(),"artwork inspection displays the decoded original cover");+ check(findItem(window->contentItem(),"artworkClose")->hasActiveFocus(),"artwork inspection starts with keyboard focus on Close");+ capture("25-artwork-inspection");+ testKeyClick(window,Qt::Key_Escape);QTest::qWait(200);+ check(!findItem(window->contentItem(),"fullArtwork"),"closing artwork inspection releases its image view");const int originalTrack=player.currentIndex();const auto originalPosition=player.position();const auto speedPosition=player.position();player.setVinylSpeed(33);player.play();window->setProperty("spinSpeed",200.);window->setProperty("spinAngle",0.);QTest::qWait(250);@@ -754,6 +880,17 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *if(seek){QTest::mouseClick(window,Qt::LeftButton,Qt::NoModifier,seek->mapToScene(QPointF(seek->width()*.7,seek->height()/2)).toPoint());check(waitFor([&]{return qAbs(player.position()-player.duration()*.7)<800;}),"horizontal progress bar seeks to the selected point");+ player.seek(player.duration()*.4);QTest::qWait(150);+ const auto start=seek->mapToScene(QPointF(seek->width()*.4,seek->height()/2)).toPoint();+ const auto finish=seek->mapToScene(QPointF(seek->width()*.8,seek->height()/2)).toPoint();+ QTest::mousePress(window,Qt::LeftButton,Qt::ShiftModifier,start);+ QTest::keyPress(window,Qt::Key_Shift);+ QMouseEvent fineMove(QEvent::MouseMove,finish,window->mapToGlobal(finish),Qt::NoButton,Qt::LeftButton,Qt::ShiftModifier);QGuiApplication::sendEvent(window,&fineMove);QTest::qWait(120);+ check(qAbs(player.position()-player.duration()*.4)<600,"drag seeking previews without repeatedly seeking playback");+ const auto fine=seek->property("value").toReal();+ check(fine>.42&&fine<.47,"Shift drag provides fine seeking without an initial jump");+ QTest::mouseRelease(window,Qt::LeftButton,Qt::ShiftModifier,finish);QTest::keyRelease(window,Qt::Key_Shift);+ check(waitFor([&]{return qAbs(player.position()-player.duration()*fine)<700;}),"releasing a fine seek commits the previewed position");const auto before=player.position();QTest::keyClick(window,Qt::Key_Left);check(waitFor([&]{return player.position()<before;}),"horizontal progress bar supports keyboard seeking");}@@ -798,6 +935,19 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *dragTo(16);check(waitFor([&]{return player.playing()&&qAbs(player.position()-player.duration()*.5)<1200;}),"dropping the needle at the middle grooves seeks and starts playback");check(!tonearm->property("dragging").toBool(),"needle releases its pointer after a valid drop");+ QTest::mouseMove(window,QPoint(15,15));QTest::qWait(300);+ auto *needleTip=window->findChild<QObject*>("needleToolTip");+ check(needleTip&&!needleTip->property("visible").toBool(),"needle tooltip closes after dragging when the pointer leaves despite retained focus");+ QTest::qWait(600);+ const auto preciseStart=shaft->mapToScene(QPointF(0,197)).toPoint();+ QTest::mousePress(window,Qt::LeftButton,Qt::ShiftModifier,preciseStart);QTest::qWait(30);+ const auto initialAngle=tonearm->property("rawAngle").toReal();+ const double preciseAngle=(initialAngle+10)*M_PI/180;+ const auto preciseEnd=tonearm->mapToScene(QPointF(378-197*std::sin(preciseAngle),100+197*std::cos(preciseAngle))).toPoint();+ QMouseEvent preciseMove(QEvent::MouseMove,preciseEnd,window->mapToGlobal(preciseEnd),Qt::NoButton,Qt::LeftButton,Qt::ShiftModifier);QGuiApplication::sendEvent(window,&preciseMove);+ const auto adjusted=tonearm->property("rawAngle").toReal()-initialAngle;+ check(adjusted>.8&&adjusted<1.2,"Shift drag reduces tonearm movement to one tenth for precise seeking");+ testKeyClick(window,Qt::Key_Escape);QTest::mouseRelease(window,Qt::LeftButton,Qt::ShiftModifier,preciseEnd);QTest::qWait(600);capture("22-needle-dropped");const auto before=player.position();const auto from=shaft->mapToScene(QPointF(0,197)).toPoint();QTest::mousePress(window,Qt::LeftButton,Qt::NoModifier,from);QTest::qWait(60);QTest::keyClick(window,Qt::Key_Escape);QTest::mouseRelease(window,Qt::LeftButton,Qt::NoModifier,from);@@ -868,6 +1018,22 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *check(reel->rotation()==stopped,"cassette transport stops its reels when paused");check(wave&&qFuzzyIsNull(wave->property("amplitude").toDouble()),"cassette progress wave settles when paused");}+ if(cassetteSeek&&reel) {+ player.pause();player.seek(player.duration()*.25);QTest::qWait(100);+ const auto start=player.position();const auto angle=reel->rotation();+ const auto left=cassetteSeek->mapToScene(QPointF(cassetteSeek->width()*.25,cassetteSeek->height()/2)).toPoint();+ const auto right=cassetteSeek->mapToScene(QPointF(cassetteSeek->width()*.7,cassetteSeek->height()/2)).toPoint();+ QTest::mousePress(window,Qt::LeftButton,Qt::NoModifier,left);QTest::mouseMove(window,right,50);QTest::qWait(80);+ check(cassetteSeek->property("scrubbing").toBool()&&qAbs(player.position()-start)<100,"cassette seeking previews without repeatedly seeking the audio");+ check(reel->rotation()!=angle,"paused cassette reels wind while the seek preview moves");+ capture("25-cassette-winding");+ testKeyClick(window,Qt::Key_Escape);QTest::mouseRelease(window,Qt::LeftButton,Qt::NoModifier,right);QTest::qWait(100);+ check(!cassetteSeek->property("scrubbing").toBool()&&qAbs(player.position()-start)<100,"Escape cancels cassette seeking without changing playback");+ player.setMotion(false);QTest::qWait(80);const auto still=reel->rotation();+ QTest::mousePress(window,Qt::LeftButton,Qt::NoModifier,left);QTest::mouseMove(window,right,50);QTest::qWait(100);+ check(reel->rotation()==still,"cassette seek winding respects reduced motion");+ QTest::mouseRelease(window,Qt::LeftButton,Qt::NoModifier,right);player.setMotion(true);QTest::qWait(150);+ }QTest::mouseClick(window,Qt::LeftButton,Qt::NoModifier,QPoint(340,457));check(waitFor([&]{return qAbs(player.position()-player.duration()*.75)<1000;}),"cassette seek bar scrubs the same player");const auto beforeCassetteKey=player.position();QTest::keyClick(window,Qt::Key_Right);@@ -903,7 +1069,19 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *check(waitFor([&]{return !lyrics.loading() && lyrics.lines().size()==6;}), "lyrics toggle loads a matching local LRC file");player.seek(5500);check(waitFor([&]{return lyrics.currentIndex()==1;}), "timed lyrics follow seeking");capture("02-lyrics");+ auto *lyricTip=window->findChild<QObject *>("lyricSeekToolTip");+ auto hoverLyric=[&](int index) {+ auto *hit=findItem(window->contentItem(),QString("lyricHit%1").arg(index));+ if(!hit)return;+ QTest::mouseMove(window,QPoint(15,15));QTest::qWait(80);+ QTest::mouseMove(window,hit->mapToScene(QPointF(hit->width()/2,hit->height()/2)).toPoint());+ QTest::qWait(850);+ };+ hoverLyric(2);+ check(lyricTip&&lyricTip->property("opened").toBool(),"hovering a visible timed lyric opens the shared seek tooltip");click("lyricHit2");+ QTest::qWait(750);+ check(lyricTip&&!lyricTip->property("visible").toBool(),"clicking a lyric dismisses its tooltip even while the pointer stays over lyrics");check(waitFor([&]{return qAbs(player.position()-10000)<200;}), "clicking a timed lyric seeks to its timestamp");check(!player.playing() && window->property("discFlipped").toBool(), "lyric seeking preserves pause and the reverse view");auto *clickedLine=findItem(window->contentItem(),"lyricHit2");@@ -922,6 +1100,14 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *testKeyClick(window,Qt::Key_Down);QTest::qWait(100);check(!lyricList->property("following").toBool() && player.volume()==lyricsVolume, "manual lyric browsing pauses following without adjusting volume");click("followLyricsButton");check(lyricList->property("following").toBool(), "follow control returns to the current lyric");+ hoverLyric(1);check(lyricTip&&lyricTip->property("opened").toBool(),"lyric tooltip can open again after leaving and returning");+ lyricList->setProperty("contentY",lyricList->property("contentY").toReal()+10);QTest::qWait(250);+ check(!lyricTip->property("visible").toBool(),"scrolling lyrics dismisses the overlay tooltip");+ player.seek(5500);QMetaObject::invokeMethod(lyricList,"followLine");QTest::qWait(100);hoverLyric(1);+ window->setProperty("discFlipped",false);QTest::qWait(450);+ check(!lyricTip->property("visible").toBool(),"flipping away from lyrics dismisses the seek tooltip");+ window->setProperty("discFlipped",true);QTest::qWait(450);+player.setMiniMode(true);QTest::qWait(400);capture("02-mini-lyrics");capture("11-vinyl-mini-lyrics");check(window->width()==300 && lyrics.active(), "lyrics remain readable and active in Mini mode");click("lyricHit1");check(waitFor([&]{return qAbs(player.position()-5000)<200;}), "timed lyric clicks work at Mini mode scale");@@ -951,6 +1137,18 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *testKeyClick(window, Qt::Key_Return);check(waitFor([&]{return player.currentIndex()==1;}), "Enter on filtered queue selects the original track index");player.pause();+ click("clearQueueSearch");+ check(window->property("queueSearchOpen").toBool()&&window->property("queueQuery").toString().isEmpty()+ &&search->hasActiveFocus()&&list->property("count").toInt()==2,"Clear restores all queue rows and keeps search ready for typing");+ search->setProperty("text","second");QTest::qWait(80);player.select(0,false);player.pause();+ testKeyClick(window,Qt::Key_Down);+ check(list->hasActiveFocus()&&list->property("keyboardIndex").toInt()==0&&!player.playing(),"Down moves from queue search to its first result without starting playback");+ capture("24-queue-search-focus");+ testKeyClick(window,Qt::Key_Return);+ check(waitFor([&]{return player.currentIndex()==1&&player.playing();}),"Enter activates the keyboard-focused filtered queue result");+ player.pause();+ QMetaObject::invokeMethod(window,"closeQueueSearch");QTest::qWait(100);+ check(findItem(window->contentItem(),"queueSearchButton")->hasActiveFocus(),"closing queue search restores focus to its entry point");// Exercise Quick jump through real keyboard/mouse input and the audio backend.QMetaObject::invokeMethod(window,"closeQueueSearch");player.select(0,false);player.pause();window->contentItem()->forceActiveFocus();testKeyClick(window,Qt::Key_K,Qt::ControlModifier);QTest::qWait(250);@@ -974,6 +1172,17 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *check(!window->property("vinyl").toBool(),"switching back to CD restores the original renderer");check(!findItem(window->contentItem(),"vinylTonearm"),"switching to CD releases tonearm geometry");capture("02-queue-search");+ if(auto *list=findItem(window->contentItem(),"trackList")) {+ window->setProperty("queueQuery",QString());QMetaObject::invokeMethod(window,"closeQueueSearch");+ QMetaObject::invokeMethod(list,"holdPosition");player.select(0);player.pause();QTest::qWait(100);+ check(!list->property("following").toBool(),"queue updates preserve the user's browsing mode");+ auto *currentButton=findItem(window->contentItem(),"currentQueueButton");+ check(currentButton&¤tButton->isVisible(),"browsing away exposes a compact Current song action");+ capture("25-queue-return");click("currentQueueButton");+ check(list->property("following").toBool(),"Current song resumes automatic queue following");+ player.select(1,false);player.pause();QMetaObject::invokeMethod(window,"openQueueSearch");QTest::qWait(100);+ }+search->setProperty("text", "no-such-track"); QTest::qWait(100);check(list->property("count").toInt()==0, "unmatched search shows an empty result set");testKeyClick(window, Qt::Key_Return);@@ -1222,9 +1431,10 @@ int main(int argc, char **argv) {const qint64 applicationReady = startup.elapsed();app.setApplicationName("spun"); app.setApplicationDisplayName("Spun");app.setOrganizationName("Spun"); app.setApplicationVersion("0.1.0");- app.setDesktopFileName("spun"); app.setWindowIcon(QIcon(":/assets/spun.svg"));+ app.setDesktopFileName("spun"); app.setWindowIcon(QIcon(":/assets/spun-window.png"));QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption();- parser.addOption({"benchmark", "Measure an isolated startup, idle, playing, or mini scene", "scene"});+ parser.addOption({"benchmark", "Measure an isolated startup, idle, playing, mini, or cycle scene", "scene"});+ parser.addOption({"benchmark-medium", "Appearance for isolated measurements", "medium", "cd"});parser.addOption({"test-library", "Run isolated music browser checks"});parser.addOption({"self-test", "Run isolated playback and UI checks"});parser.addOption({"smoke-live", "Run isolated checks on the live desktop"});@@ -1284,6 +1494,7 @@ int main(int argc, char **argv) {if (!test) registerMpris(&player);qmlRegisterType<Symbol>("Spun", 1, 0, "Symbol");qmlRegisterType<Disc>("Spun", 1, 0, "Disc");+ qmlRegisterType<ArtworkView>("Spun", 1, 0, "ArtworkView");qmlRegisterType<ProgressRing>("Spun", 1, 0, "ProgressRing");QQmlApplicationEngine engine;engine.addImageProvider("queueart", new QueueArtworkProvider);@@ -1300,6 +1511,13 @@ int main(int argc, char **argv) {engine.rootContext()->setContextProperty("musicActions", &musicActions);engine.rootContext()->setContextProperty("listening", &listening);engine.rootContext()->setContextProperty("testMode", test);+ const auto benchmarkMedium = parser.value("benchmark-medium");+ if (parser.isSet("benchmark")) {+ if (!QStringList{"cd","vinyl","cassette"}.contains(benchmarkMedium)) return 2;+ player.setMedium(benchmarkMedium);+ }+ QList<double> frameIntervals;+ qint64 lastFrameNs = 0;qint64 firstFrame = -1;int frames = 0;qint64 qmlReady = -1;@@ -1316,6 +1534,9 @@ int main(int argc, char **argv) {QTimer::singleShot(0, &app, &QCoreApplication::quit);}}+ const auto now = startup.nsecsElapsed();+ if (lastFrameNs && startup.elapsed() >= 2000) frameIntervals.append((now-lastFrameNs)/1e6);+ lastFrameNs = now;++frames;});});@@ -1328,13 +1549,18 @@ int main(int argc, char **argv) {window->setProperty("benchmarkPinned", true);player.setVolume(0);const auto scene = parser.value("benchmark");- if (scene != "startup" && scene != "idle" && scene != "playing" && scene != "mini") return 2;+ if (scene != "startup" && scene != "idle" && scene != "playing" && scene != "mini" && scene != "cycle") return 2;if (scene == "playing" || scene == "mini") {player.setRepeatMode(2);player.demo();window->setProperty("progress", 0.75);}if (scene == "mini") player.setMiniMode(true);+ if (scene == "cycle") {+ QTimer::singleShot(250,&app,[&]{player.setMedium("vinyl");});+ QTimer::singleShot(650,&app,[&]{player.setMedium("cassette");});+ QTimer::singleShot(1100,&app,[&]{player.setMedium(benchmarkMedium);});+ }QTimer::singleShot(2000, &app, [&, scene] {struct rusage before{}; getrusage(RUSAGE_SELF, &before);const int startFrames = frames;@@ -1344,7 +1570,13 @@ int main(int argc, char **argv) {QFile memory("/proc/self/smaps_rollup");if (!memory.open(QIODevice::ReadOnly)) { app.exit(1); return; }QJsonObject result{{"scene",scene},{"firstFrameMs",firstFrame},{"cpuSeconds",cpu(after)-cpu(before)},- {"frames",frames-startFrames},{"memory",QString::fromUtf8(memory.readAll())}};+ {"frames",frames-startFrames},{"memory",QString::fromUtf8(memory.readAll())},+ {"medium",benchmarkMedium},{"objects",window->findChildren<QObject *>().size()}};+ std::sort(frameIntervals.begin(),frameIntervals.end());+ if (!frameIntervals.isEmpty()) {+ result["frameMedianMs"] = frameIntervals[frameIntervals.size()/2];+ result["frameP95Ms"] = frameIntervals[qMin(frameIntervals.size()-1,qsizetype(frameIntervals.size()*.95))];+ }std::cout << "BENCHMARK " << QJsonDocument(result).toJson(QJsonDocument::Compact).constData() << std::endl;app.quit();});diff --git a/src/symbol.cpp b/src/symbol.cppindex 2e43575..165a286 100644--- a/src/symbol.cpp+++ b/src/symbol.cpp@@ -11,22 +11,29 @@ void Symbol::setName(const QString &name) {if (name == m_name) return;// The cache can contain only the finite, bundled symbol set. SVGs are parsed// once, independently of theme, scale, hover feedback, and delegate recycling.- static QHash<QString, QSharedPointer<QSvgRenderer>> cache;+ struct CachedSymbol { QSharedPointer<QSvgRenderer> renderer; QRectF bounds; };+ static QHash<QString, CachedSymbol> cache;auto key = name;- QFile file(QStringLiteral(":/assets/icons/") + key + QStringLiteral(".svg"));- if (key.contains('/') || !file.open(QIODevice::ReadOnly)) {- key = QStringLiteral("disc");- file.setFileName(QStringLiteral(":/assets/icons/disc.svg"));- file.open(QIODevice::ReadOnly);+ auto found = cache.constFind(key);+ if (found == cache.cend()) {+ QFile file(QStringLiteral(":/assets/icons/") + key + QStringLiteral(".svg"));+ if (key.contains('/') || !file.open(QIODevice::ReadOnly)) {+ key = QStringLiteral("disc");+ file.setFileName(QStringLiteral(":/assets/icons/disc.svg"));+ file.open(QIODevice::ReadOnly);+ }+ found = cache.constFind(key);+ if (found == cache.cend()) {+ auto data = file.readAll();+ // A render-only id lets Qt measure the original path's visible bounds.+ data.replace("<path ", "<path id=\"symbol\" ");+ auto renderer = QSharedPointer<QSvgRenderer>::create(data);+ const auto bounds = renderer->boundsOnElement(QStringLiteral("symbol"));+ found = cache.insert(key, {renderer, bounds});+ }}- if (!cache.contains(key)) {- auto data = file.readAll();- // A render-only id lets Qt measure the original path's visible bounds.- data.replace("<path ", "<path id=\"symbol\" ");- cache.insert(key, QSharedPointer<QSvgRenderer>::create(data));- }- m_svg = cache.value(key);- m_bounds = m_svg->boundsOnElement(QStringLiteral("symbol"));+ m_svg = found->renderer;+ m_bounds = found->bounds;m_name = name;emit nameChanged();update();diff --git a/src/tapesound.cpp b/src/tapesound.cppindex 686861c..47b6adb 100644--- a/src/tapesound.cpp+++ b/src/tapesound.cpp@@ -20,7 +20,10 @@ void TapeSound::setVolume(qreal volume) {void TapeSound::observe(const QString &source,const QString &key) {const bool transition=!key.isEmpty()&&!m_key.isEmpty()&&source==m_source&&key!=m_key;m_source=source;m_key=key;- if(!transition || !m_enabled || m_volume<=0 || (m_lastCue.isValid()&&m_lastCue.elapsed()<160))return;+ if(transition)transport();+}+void TapeSound::transport() {+ if(!m_enabled || m_volume<=0 || (m_lastCue.isValid()&&m_lastCue.elapsed()<160))return;m_lastCue.restart();emit triggered();if(m_outputEnabled)play();}diff --git a/src/tapesound.h b/src/tapesound.hindex a0fc507..8763851 100644--- a/src/tapesound.h+++ b/src/tapesound.h@@ -19,6 +19,7 @@ public:void setEnabled(bool enabled);void setVolume(qreal volume);Q_INVOKABLE void observe(const QString &source, const QString &key);+ Q_INVOKABLE void transport();static QByteArray synthesize(const QAudioFormat &format);signals:void changed();diff --git a/src/typography.cpp b/src/typography.cppindex 9accb51..d9f207a 100644--- a/src/typography.cpp+++ b/src/typography.cpp@@ -3,11 +3,14 @@#include <QFontInfo>#include <QGuiApplication>#include <algorithm>+#include <cmath>Typography::Typography(const QString &settingsPath, QObject *parent): QObject(parent), m_settings(settingsPath, QSettings::IniFormat),m_selected(m_settings.value("fontFamily").toString()),m_system(QFontInfo(QFontDatabase::systemFont(QFontDatabase::GeneralFont)).family()) {+ const auto savedScale=m_settings.value("uiScale",1.).toDouble();+ m_scale=std::isfinite(savedScale)?qBound(.85,savedScale,1.5):1.;resolve();connect(qGuiApp, &QGuiApplication::fontDatabaseChanged, this, [this] {const bool loaded = m_loaded;@@ -20,6 +23,12 @@ Typography::Typography(const QString &settingsPath, QObject *parent)void Typography::resolve() {m_family = !m_selected.isEmpty() && QFontDatabase::hasFamily(m_selected) ? m_selected : m_system;}+void Typography::setUiScale(qreal scale) {+ if(!std::isfinite(scale))return;+ scale=qBound(.85,scale,1.5);+ if(qFuzzyCompare(m_scale,scale))return;+ m_scale=scale;m_settings.setValue("uiScale",scale);m_settings.sync();emit scaleChanged();+}void Typography::loadFamilies() {if (m_loaded) return;m_families = QFontDatabase::families();diff --git a/src/typography.h b/src/typography.hindex 1f9471e..726de6c 100644--- a/src/typography.h+++ b/src/typography.h@@ -11,6 +11,7 @@ class Typography : public QObject {Q_PROPERTY(QString systemFamily READ systemFamily CONSTANT)Q_PROPERTY(bool missing READ missing NOTIFY changed)Q_PROPERTY(QStringList families READ families NOTIFY familiesChanged)+ Q_PROPERTY(qreal uiScale READ uiScale WRITE setUiScale NOTIFY scaleChanged)public:explicit Typography(const QString &settingsPath, QObject *parent = nullptr);QString selectedFamily() const { return m_selected; }@@ -20,13 +21,17 @@ public:QStringList families() const { return m_families; }Q_INVOKABLE void loadFamilies();Q_INVOKABLE bool select(const QString &family);+ qreal uiScale() const { return m_scale; }+ void setUiScale(qreal scale);signals:void changed();void familiesChanged();+ void scaleChanged();private:void resolve();QSettings m_settings;QString m_selected, m_family, m_system;QStringList m_families;bool m_loaded = false;+ qreal m_scale = 1;};