Skip to content

armgit / Spun

Public Imported from GitHub
0

A CD-shaped music player for Linux, with local playback and Cider integration.

Fix QML build on Qt 6.10: rename 'native' context property

stockmind2c1cabcf7b84
diff --git a/qml/Main.qml b/qml/Main.qml
index 842b555..ffc751b 100644
--- a/qml/Main.qml
+++ b/qml/Main.qml
@@ -21,7 +21,7 @@ ApplicationWindow {
minimumHeight: 150; maximumHeight: 1095
onUiScaleChanged: Qt.callLater(updateMask)
color: "transparent"
- flags: Qt.Window | Qt.FramelessWindowHint | (miniPinned && !native.supportsBlur ? Qt.WindowStaysOnTopHint : 0)
+ flags: Qt.Window | Qt.FramelessWindowHint | (miniPinned && !platformNative.supportsBlur ? Qt.WindowStaysOnTopHint : 0)
font.family: SpunStyle.family
readonly property bool threeDGesture: !!activeSeekControl || scrubber.scrubbing || !!(armLoader.item && armLoader.item.dragging)
readonly property bool threeDRequested: supports3D && player.threeD && !miniMode && !discFlipped
@@ -127,7 +127,7 @@ ApplicationWindow {
function stopSwap() { discSwap.stop(); resetSwap(); presentation.releaseOutgoing() }
function presentDisc() {
const albumKey = deckPlayer.count ? (useCider ? "cider:" : "local:") + (deckPlayer.albumKey || deckPlayer.title) : ""
- presentation.present(deckPlayer.artwork, albumKey, animate && !discFlipped && visible && native.exposed)
+ presentation.present(deckPlayer.artwork, albumKey, animate && !discFlipped && visible && platformNative.exposed)
}
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 }
@@ -201,12 +201,12 @@ ApplicationWindow {
}
function flipDisc() { if (deckPlayer.count > 0) discFlipped = !discFlipped }
readonly property bool miniPinned: miniMode && player.miniOnTop
- onMiniPinnedChanged: native.effects(root, backgroundBlur)
+ onMiniPinnedChanged: platformNative.effects(root, backgroundBlur)
property bool miniMode: player.miniMode
onMiniModeChanged: Qt.callLater(function() {
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)
+ updateMask(); platformNative.effects(root, backgroundBlur)
})
property bool editingText: activeFocusItem instanceof TextInput || activeFocusItem instanceof TextEdit
property bool queueSearchOpen: false
@@ -402,8 +402,8 @@ ApplicationWindow {
property bool queueOpen: false
property bool helpOpen: false
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.actionsOpen
- property bool backgroundBlur: player.backgroundBlur && native.supportsBlur
- onBackgroundBlurChanged: { native.effects(root, backgroundBlur); Qt.callLater(updateMask) }
+ property bool backgroundBlur: player.backgroundBlur && platformNative.supportsBlur
+ onBackgroundBlurChanged: { platformNative.effects(root, backgroundBlur); Qt.callLater(updateMask) }
property bool muted: false
property real rememberedVolume: .65
property var activeSeekControl: null
@@ -454,7 +454,7 @@ ApplicationWindow {
function onHeightChanged() { if (target.height !== root.layoutHeight) target.height = root.layoutHeight }
}
function updateMask() {
- native.shape(root, sideOpen)
+ platformNative.shape(root, sideOpen)
// Popups share the logical scene; their overlay must use the same size.
Overlay.overlay.transformOrigin = Item.TopLeft
Overlay.overlay.scale = uiScale
@@ -476,7 +476,7 @@ ApplicationWindow {
onHelpOpenChanged: { if (helpOpen && miniMode) player.miniMode = false; Qt.callLater(updateMask) }
onMenuOpenChanged: Qt.callLater(updateMask)
onWidthChanged: Qt.callLater(updateMask)
- Component.onCompleted: { if (!testMode && player.ciderAutoStart) { useCider = true; root.ciderService.ensureRunning() }; updateMask(); native.place(root); Qt.callLater(presentDisc); syncLyrics() }
+ Component.onCompleted: { if (!testMode && player.ciderAutoStart) { useCider = true; root.ciderService.ensureRunning() }; updateMask(); platformNative.place(root); Qt.callLater(presentDisc); syncLyrics() }
onClosing: player.save()
Rectangle {
@@ -524,7 +524,7 @@ ApplicationWindow {
Timer {
interval: 16; repeat: true
- running: root.animate && root.visible && root.visibility !== Window.Minimized && native.exposed && (root.deckPlayer.playing || root.spinSpeed > .02 || root.activeSeekControl || Math.abs(root.tapeWindSpeed) > .5)
+ running: root.animate && root.visible && root.visibility !== Window.Minimized && platformNative.exposed && (root.deckPlayer.playing || root.spinSpeed > .02 || root.activeSeekControl || Math.abs(root.tapeWindSpeed) > .5)
property double lastTime: 0
onRunningChanged: lastTime = Date.now()
onTriggered: {
@@ -563,7 +563,7 @@ ApplicationWindow {
id: badge
objectName: "sourceBar"
visible: !root.miniMode
- x: 265 - width / 2; y: 13; width: native.hyprland ? 256 : 344; height: 48; radius: 24
+ x: 265 - width / 2; y: 13; width: platformNative.hyprland ? 256 : 344; height: 48; radius: 24
color: root.surface
border.width: 0
MouseArea { anchors.fill: parent; onPressed: root.startSystemMove() }
@@ -631,8 +631,8 @@ ApplicationWindow {
ink: root.queueOpen ? root.accent : root.ink; hoverFill: root.hoverFill
onClicked: root.queueOpen = !root.queueOpen
}
- IconButton { visible: !native.hyprland; x: 256; y: 4; glyphName: "minus"; tip: "Minimize"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: root.showMinimized() }
- IconButton { visible: !native.hyprland; x: 300; y: 4; glyphName: "close"; tip: "Close Spun"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: Qt.quit() }
+ IconButton { visible: !platformNative.hyprland; x: 256; y: 4; glyphName: "minus"; tip: "Minimize"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: root.showMinimized() }
+ IconButton { visible: !platformNative.hyprland; x: 300; y: 4; glyphName: "close"; tip: "Close Spun"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: Qt.quit() }
}
Item {
@@ -1096,7 +1096,7 @@ ApplicationWindow {
// The presenter has already installed the new outgoing image.
// Stop the old sequence without releasing that new image.
discSwap.stop(); root.resetSwap()
- if (!root.animate || root.discFlipped || !root.visible || !native.exposed) { presentation.releaseOutgoing(); return }
+ if (!root.animate || root.discFlipped || !root.visible || !platformNative.exposed) { presentation.releaseOutgoing(); return }
scrubber.cancelScrub(); root.outgoingAngle = root.spinAngle; root.outgoingCassetteLeftAngle = root.cassetteLeftAngle; root.outgoingCassetteRightAngle = root.cassetteRightAngle
root.swapOffset = 440; root.outgoingOffset = 0; root.outgoingOpacity = 1; root.incomingOpacity = 0
root.packageOpacity = root.bodyVisible ? 1 : 0
@@ -2171,7 +2171,7 @@ ApplicationWindow {
}
}
}
- 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: "blurToggle"; app: root; width: parent.width; visible: platformNative.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 }
diff --git a/qml/Tonearm.qml b/qml/Tonearm.qml
index 8c54617..304a586 100644
--- a/qml/Tonearm.qml
+++ b/qml/Tonearm.qml
@@ -6,7 +6,7 @@ Item {
objectName: "vinylTonearm"
required property var app
property alias pointerInput: needleHit
- readonly property bool motion: app.animate && visible && app.visible && native.exposed
+ readonly property bool motion: app.animate && visible && app.visible && platformNative.exposed
readonly property bool engaged: visible && app.deckPlayer.count > 0 && ((app.deckPlayer.playing && !app.swapRunning) || landing || app.seekPreviewActive)
readonly property bool canSeek: visible && app.deckPlayer.duration > 0 && (!app.useCider || (app.ciderService.canSeek && !app.listeningService.busy))
property bool dragging: false
@@ -219,7 +219,7 @@ Item {
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.rawAngle += delta * ((mouse.modifiers & Qt.ShiftModifier) ? 0.1 : 1)
arm.lastPointerAngle=pointer
arm.dragAngle = Math.max(-8, Math.min(38, arm.rawAngle))
}
diff --git a/src/main.cpp b/src/main.cpp
index 6207cf2..9a180f3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1637,7 +1637,7 @@ int main(int argc, char **argv) {
engine.rootContext()->setContextProperty("player", &player);
engine.rootContext()->setContextProperty("theme", &theme);
engine.rootContext()->setContextProperty("typography", &typography);
- engine.rootContext()->setContextProperty("native", &native);
+ engine.rootContext()->setContextProperty("platformNative", &native);
engine.rootContext()->setContextProperty("lyrics", &lyrics);
engine.rootContext()->setContextProperty("presentation", &presentation);
engine.rootContext()->setContextProperty("tapeSound", &tapeSound);