Skip to content

armgit / Spun

Public Imported from GitHub
0

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

Polish dialogs, control states and keyboard feedback

yappologistic4f5b22a5c383
diff --git a/qml/FontPicker.qml b/qml/FontPicker.qml
index 17fb017..ffa125d 100644
--- a/qml/FontPicker.qml
+++ b/qml/FontPicker.qml
@@ -27,7 +27,8 @@ Popup {
onAboutToShow: { typography.loadFamilies(); search.text = ""; fonts.currentIndex = -1 }
onOpened: search.forceActiveFocus()
contentItem: Item {
- SpunText { x: 12; y: 10; text: "Font"; color: picker.app.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
+ Accessible.role: Accessible.Dialog; Accessible.name: "Font"
+ SpunText { x: 12; y: 6; text: "Font"; color: picker.app.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
IconButton { objectName: "closeFontPicker"; anchors.right: parent.right; glyphName: "close"; tip: "Close font picker"; ink: picker.app.ink; onClicked: picker.close() }
SpunSearchField {
id: search
diff --git a/qml/IconButton.qml b/qml/IconButton.qml
index 8d4b7cc..fb87ab5 100644
--- a/qml/IconButton.qml
+++ b/qml/IconButton.qml
@@ -21,7 +21,7 @@ AbstractButton {
background: Rectangle {
SpunSpring { id: cornerMotion; targetValue: Math.min(control.width, control.height) * (control.down ? .35 : .5) }
radius: cornerMotion.value
- color: control.fill
+ color: control.enabled ? control.fill : control.fill.a > 0 ? Qt.alpha(theme.colors.text, SpunStyle.disabledContainerOpacity) : "transparent"
Rectangle {
anchors.fill: parent; radius: parent.radius; color: SpunStyle.selected
opacity: control.selected && control.fill.a === 0 ? 1 : 0
@@ -34,7 +34,7 @@ AbstractButton {
contentItem: Item {
SpunSpring { id: pressMotion; targetValue: control.down && control.motionEnabled ? .95 : 1; epsilon: .002 }
scale: pressMotion.value
- Glyph { anchors.centerIn: parent; width: control.glyphSize; height: width; name: control.glyphName; ink: control.ink; opacity: control.enabled ? 1 : SpunStyle.disabledOpacity }
+ Glyph { anchors.centerIn: parent; width: control.glyphSize; height: width; name: control.glyphName; ink: control.enabled ? control.ink : theme.colors.text; opacity: control.enabled ? 1 : SpunStyle.disabledOpacity }
}
}
diff --git a/qml/Main.qml b/qml/Main.qml
index cee2845..bca0e83 100644
--- a/qml/Main.qml
+++ b/qml/Main.qml
@@ -191,7 +191,7 @@ ApplicationWindow {
property real libraryDragY: 0
property real libraryDragX: 0
function beginLibraryDrag(tracks) {
- noticeTimer.stop(); libraryDragTracks = tracks; libraryDragging = true; queueOpen = true
+ actionNotice.dismiss(); libraryDragTracks = tracks; libraryDragging = true; queueOpen = true
contentItem.forceActiveFocus()
}
function updateLibraryDrag(x, y) {
@@ -383,6 +383,7 @@ ApplicationWindow {
MouseArea { anchors.fill: parent; onPressed: root.startSystemMove() }
}
+ Shortcut { sequence: "Alt+G"; enabled: actionNotice.shown && actionNotice.canUndo && !root.menuOpen; onActivated: noticeUndo.forceActiveFocus(Qt.ShortcutFocusReason) }
Shortcut { sequence: "Ctrl+K"; enabled: !root.menuOpen || quickJump.visible; onActivated: quickJump.visible ? quickJump.close() : root.openQuickJump() }
Shortcut { sequence: "Space"; enabled: !(root.activeFocusItem instanceof AbstractButton) && !(root.useCider && root.queueOpen && trackList.activeFocus) && !(root.libraryOpen && musicBrowser.item && musicBrowser.item.trackListFocused) && !root.editingText && !root.menuOpen; onActivated: root.useCider ? root.ciderService.toggle() : player.count ? player.toggle() : files.open() }
Shortcut { sequence: "Ctrl+V"; enabled: !root.editingText && !root.menuOpen; onActivated: root.openMusicLink("", true) }
@@ -1409,6 +1410,7 @@ ApplicationWindow {
}
ConnectionButton {
objectName: "authorizeCiderButton"
+ filled: !connectionForm.service.authorizing
text: connectionForm.service.authorizing ? "Cancel" : "Connect to Cider"
onClicked: { if(connectionForm.service.authorizing) connectionForm.service.cancelAuthorization(); else connectionForm.service.authorize() }
}
@@ -1524,8 +1526,11 @@ ApplicationWindow {
Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }
enter: SpunPopupEnter {}
exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
+ onOpened: if (contentItem.item) contentItem.item.focusCancel()
contentItem: Loader { active: cleanupPopup.visible; sourceComponent: Item {
- SpunText { text: cleanupPopup.preview.mode === "selection" ? "Remove selected songs?" : cleanupPopup.preview.mode === "duplicates" ? "Remove duplicates?" : "Clear upcoming?"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
+ Accessible.role: Accessible.Dialog; Accessible.name: "Queue cleanup"
+ function focusCancel() { cancelCleanup.forceActiveFocus(Qt.TabFocusReason) }
+ SpunText { text: cleanupPopup.preview.mode === "selection" ? "Remove selected songs?" : cleanupPopup.preview.mode === "duplicates" ? "Remove duplicates?" : "Clear upcoming?"; color: root.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
SpunText {
y: 34; width: parent.width; height: 48; wrapMode: Text.WordWrap
text: cleanupPopup.stale ? "The queue changed. Close and preview again." : !(cleanupPopup.preview.rows || []).length ? (cleanupPopup.preview.mode === "duplicates" ? "No upcoming duplicates." : "No upcoming songs.") : (cleanupPopup.preview.rows || []).length + " to remove. Keeps the current song and history."
@@ -1540,7 +1545,7 @@ ApplicationWindow {
TrackContent { anchors.fill: parent; app: root; leadingInset: 0; trailingInset: 4; title: modelData.title; subtitle: modelData.artist; artwork: modelData.artwork || ""; fallback: "disc" }
}
}
- SpunButton { objectName: "cancelCleanup"; x: parent.width - 184; y: parent.height - 40; width: 80; text: "Cancel"; onClicked: cleanupPopup.close() }
+ SpunButton { id: cancelCleanup; objectName: "cancelCleanup"; x: parent.width - 184; y: parent.height - 40; width: 80; text: "Cancel"; onClicked: cleanupPopup.close() }
SpunButton { objectName: "confirmCleanup"; x: parent.width - width; y: parent.height - 40; width: 96; text: "Remove"; tonal: true; enabled: !cleanupPopup.stale && root.queueControlsReady && (cleanupPopup.preview.rows || []).length > 0; onClicked: { if (cleanupPopup.preview.mode === "selection") root.ciderService.editQueueSelection(cleanupPopup.preview.indices, "remove", cleanupPopup.preview.revision); else root.ciderService.cleanQueue(cleanupPopup.preview.mode, cleanupPopup.preview.revision); cleanupPopup.close() } }
} }
}
@@ -1551,6 +1556,7 @@ ApplicationWindow {
id: savedQueueMenu; parent: jewelCase; x: 30; y: 64; width: 264; padding: 8; popupType: Popup.Item
background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.popupRadius }
enter: SpunPopupEnter {}
+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
SettingsAction { objectName: "saveQueueAction"; text: "Save queue"; glyphName: "plus"; enabled: root.ciderService.queueReady && !root.ciderService.queueBusy && root.ciderService.queue.length > 0; onTriggered: saveQueuePopup.open() }
SettingsAction { objectName: "recoverSessionAction"; visible: root.useCider && !!root.listeningService.session.trackCount; text: "Recover session…"; glyphName: "refresh"; enabled: !root.listeningService.busy; onTriggered: root.showRecovery() }
SettingsAction { objectName: "savedQueuesAction"; text: "Saved queues"; glyphName: "queue"; onTriggered: root.openSavedQueues() }
@@ -1563,29 +1569,36 @@ 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.layoutWidth - width) / 2; y: 220; width: 330; height: 200; padding: 24
+ x: (root.layoutWidth - width) / 2; y: (root.layoutHeight - height) / 2; width: 360; height: 216; padding: 24
background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }
Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }
enter: SpunPopupEnter {}
+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
contentItem: Loader { active: saveQueuePopup.visible; sourceComponent: Item {
+ Accessible.role: Accessible.Dialog; Accessible.name: saveQueuePopup.renameTarget.id ? "Rename saved queue" : "Save queue"
Component.onCompleted: Qt.callLater(function() { savedQueueName.forceActiveFocus(); if(saveQueuePopup.renameTarget.id)savedQueueName.selectAll() })
- SpunText { text: saveQueuePopup.renameTarget.id ? "Rename saved queue" : "Save queue"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
- SpunText { y: 30; text: saveQueuePopup.renameTarget.id ? "Saved locally in Spun" : "Current and upcoming tracks"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }
- SpunSearchField { id: savedQueueName; objectName: "savedQueueName"; app: root; searchIcon: false; rightPadding: 16; Accessible.name: "Queue name"; y: 58; width: parent.width; height: 40; placeholderText: "Queue name"; text: saveQueuePopup.renameTarget.title || ""; maximumLength: 80; onAccepted: if(text.trim().length)saveQueuePopup.submit(text) }
- SpunButton { objectName: "cancelSaveQueue"; x: parent.width - 168; y: 110; width: 80; text: "Cancel"; onClicked: saveQueuePopup.close() }
- SpunButton { objectName: "confirmSaveQueue"; x: parent.width - width; y: 110; width: 80; text: "Save"; tonal: true; enabled: savedQueueName.text.trim().length > 0; onClicked: saveQueuePopup.submit(savedQueueName.text) }
+ SpunText { text: saveQueuePopup.renameTarget.id ? "Rename saved queue" : "Save queue"; color: root.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
+ SpunText { y: 36; text: saveQueuePopup.renameTarget.id ? "Saved locally in Spun" : "Current and upcoming tracks"; color: root.mutedInk; font.pixelSize: SpunStyle.caption }
+ SpunSearchField { id: savedQueueName; objectName: "savedQueueName"; app: root; searchIcon: false; rightPadding: 16; Accessible.name: "Queue name"; y: 64; width: parent.width; height: 40; placeholderText: "Queue name"; text: saveQueuePopup.renameTarget.title || ""; maximumLength: 80; onAccepted: if(text.trim().length)saveQueuePopup.submit(text) }
+ SpunButton { objectName: "cancelSaveQueue"; x: parent.width - 184; y: parent.height - 40; width: 88; text: "Cancel"; onClicked: saveQueuePopup.close() }
+ SpunButton { objectName: "confirmSaveQueue"; x: parent.width - width; y: parent.height - 40; width: 88; text: saveQueuePopup.renameTarget.id ? "Rename" : "Save"; tonal: true; enabled: savedQueueName.text.trim().length > 0; onClicked: saveQueuePopup.submit(savedQueueName.text) }
} }
}
Popup {
- id: deleteQueuePopup; focus: true; modal: true; popupType: Popup.Item; property string queueId: ""; property var service: library
- x: (root.layoutWidth - width) / 2; y: 240; width: 330; height: 132; padding: 24
+ id: deleteQueuePopup; objectName: "deleteQueuePopup"; focus: true; modal: true; popupType: Popup.Item; property string queueId: ""; property var service: library
+ x: (root.layoutWidth - width) / 2; y: (root.layoutHeight - height) / 2; width: 360; height: 196; padding: 24
background: Rectangle { color: SpunStyle.popup; radius: SpunStyle.dialogRadius }
Overlay.modal: Rectangle { color: Qt.alpha("black", .32) }
enter: SpunPopupEnter {}
+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
+ onOpened: if (contentItem.item) contentItem.item.focusCancel()
contentItem: Loader { active: deleteQueuePopup.visible; sourceComponent: Item {
- SpunText { text: "Delete saved queue?"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
- SpunButton { x: parent.width - 176; y: 42; width: 80; text: "Cancel"; onClicked: deleteQueuePopup.close() }
- SpunButton { objectName: "confirmDeleteQueue"; x: parent.width - width; y: 42; width: 88; text: "Delete"; tonal: true; onClicked: { deleteQueuePopup.service.deleteSavedQueue(deleteQueuePopup.queueId);deleteQueuePopup.close() } }
+ Accessible.role: Accessible.Dialog; Accessible.name: "Delete saved queue"
+ function focusCancel() { cancelDelete.forceActiveFocus(Qt.TabFocusReason) }
+ SpunText { text: "Delete saved queue?"; color: root.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
+ SpunText { y: 40; width: parent.width; text: "Removes this saved queue from Spun. Music and the current Cider queue are kept."; wrapMode: Text.WordWrap; color: root.mutedInk; font.pixelSize: SpunStyle.body }
+ SpunButton { id: cancelDelete; objectName: "cancelDeleteQueue"; x: parent.width - 184; y: parent.height - 40; width: 88; text: "Cancel"; onClicked: deleteQueuePopup.close() }
+ SpunButton { objectName: "confirmDeleteQueue"; x: parent.width - width; y: parent.height - 40; width: 88; text: "Delete"; tonal: true; onClicked: { deleteQueuePopup.service.deleteSavedQueue(deleteQueuePopup.queueId);deleteQueuePopup.close() } }
} }
}
Menu {
@@ -1640,13 +1653,13 @@ ApplicationWindow {
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 } }
+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
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 }
+ SpunText { width: parent.width-48; text: root.deckPlayer.album || root.deckPlayer.title; elide: Text.ElideRight; color: root.ink; font.pixelSize: SpunStyle.title }
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
@@ -1664,7 +1677,7 @@ ApplicationWindow {
enter: SpunPopupEnter {}
exit: Transition { NumberAnimation { property: "opacity"; from: 1; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
contentItem: Loader { active: qualityPopup.visible; sourceComponent: Item {
- SpunText { text: "Audio quality"; color: root.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
+ SpunText { text: "Audio quality"; color: root.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
IconButton { x: parent.width - width; y: -8; glyphName: "close"; tip: "Close"; ink: root.mutedInk; onClicked: qualityPopup.close() }
SpunText { objectName: "audioQualityText"; y: 42; width: parent.width; text: root.ciderService.qualityBusy ? "Checking…" : root.ciderService.audioQuality; color: root.ink; font.pixelSize: SpunStyle.body; wrapMode: Text.WordWrap }
IconButton { x: parent.width - width; y: 96; glyphName: "refresh"; tip: "Refresh quality"; ink: root.accent; enabled: !root.ciderService.qualityBusy; onClicked: root.ciderService.refreshAudioQuality() }
@@ -1678,12 +1691,13 @@ ApplicationWindow {
padding: 24; modal: true; dim: false; focus: true; popupType: Popup.Item
background: Rectangle { radius: SpunStyle.popupRadius; color: SpunStyle.popup }
enter: SpunPopupEnter {}
- exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit } }
+ exit: Transition { NumberAnimation { property: "opacity"; to: 0; duration: SpunStyle.exit; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
onOpened: if (contentItem.item) contentItem.item.focusCancel()
onClosed: root.listeningService.cancelRecovery()
contentItem: Loader { active: recoveryPopup.visible; sourceComponent: Item {
+ Accessible.role: Accessible.Dialog; Accessible.name: "Recover session"
function focusCancel() { recoveryCancel.forceActiveFocus() }
- SpunText { text: "Recover session"; font.pixelSize: SpunStyle.heading; color: root.ink }
+ SpunText { text: "Recover session"; font.pixelSize: SpunStyle.title; color: root.ink }
SpunText {
y: 38; width: parent.width; height: 112; wrapMode: Text.WordWrap; maximumLineCount: 5; elide: Text.ElideRight
font.pixelSize: SpunStyle.body; color: root.mutedInk
@@ -1697,7 +1711,7 @@ ApplicationWindow {
} }
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() }
+ 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 ? 8000 : 4000; actionNotice.show() }
Connections {
target: root.ciderService
function onApiFeedback(message, error) { root.notifyAction(message,error) }
@@ -1710,29 +1724,54 @@ ApplicationWindow {
}
Connections {
target: root.savedService
- function onSavedEditCommitted() { actionNotice.savedUndo = true; noticeTimer.interval = 8000; noticeTimer.restart() }
+ function onSavedEditCommitted() { actionNotice.savedUndo = true; actionNotice.show() }
}
- Timer { id: noticeTimer }
+ Timer { id: noticeTimer; objectName: "noticeTimer"; onTriggered: actionNotice.dismiss() }
Rectangle {
id: actionNotice
objectName: "actionNotice"
property string text: ""
+ property bool shown: false
+ property Item returnFocus: null
+ readonly property bool interacting: noticeHover.hovered || noticeUndo.activeFocus || noticeDismiss.activeFocus
+ function syncTimeout() {
+ if (!shown || canUndo || interacting) noticeTimer.stop()
+ else noticeTimer.restart()
+ }
+ function show() { if (!noticeUndo.activeFocus && !noticeDismiss.activeFocus) returnFocus = root.activeFocusItem; shown = true; syncTimeout(); Accessible.announce(text, Accessible.Polite) }
+ function dismiss() {
+ const restore = noticeUndo.activeFocus || noticeDismiss.activeFocus
+ shown = false; noticeTimer.stop()
+ if (restore) {
+ if (returnFocus && returnFocus.visible && returnFocus.enabled) returnFocus.forceActiveFocus(Qt.BacktabFocusReason)
+ else menuButton.forceActiveFocus(Qt.BacktabFocusReason)
+ }
+ }
+ onInteractingChanged: syncTimeout()
+ onCanUndoChanged: syncTimeout()
+ Accessible.role: Accessible.StaticText; Accessible.name: text
property bool failed: false
property bool undo: false
property bool savedUndo: false
readonly property bool canUndo: savedUndo ? root.savedService.canUndoSavedQueue : undo && root.ciderService.canUndoQueue
- visible: noticeTimer.running && (!root.miniMode || failed)
+ visible: (shown || opacity > 0) && (!root.miniMode || failed)
+ opacity: shown && (!root.miniMode || failed) ? 1 : 0
+ enabled: shown && (!root.miniMode || failed)
+ Behavior on opacity { NumberAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
+ HoverHandler { id: noticeHover }
+ Keys.onShortcutOverride: event => { if (event.key === Qt.Key_Escape) event.accepted = true }
+ Keys.onEscapePressed: dismiss()
onVisibleChanged: Qt.callLater(root.updateMask)
z: 30; x: root.miniMode ? 12 : deck.x; y: root.miniMode ? 234 : deck.y + deck.height + 8; width: root.miniMode ? 276 : deck.width; height: root.miniMode ? 56 : 40; radius: SpunStyle.rowRadius
color: root.surface
SpunText { x: 12; y: 2; width: noticeDismiss.x - x - 8 - (actionNotice.canUndo ? 80 : 0); height: parent.height - 4; text: actionNotice.text; color: actionNotice.failed ? theme.colors.error : root.ink; font.pixelSize: SpunStyle.body; wrapMode: Text.WordWrap; elide: Text.ElideRight; verticalAlignment: Text.AlignVCenter }
SpunButton {
- objectName: "undoQueueButton"; visible: actionNotice.canUndo
+ id: noticeUndo; objectName: "undoQueueButton"; visible: actionNotice.canUndo
x: noticeDismiss.x - width - 8; anchors.verticalCenter: parent.verticalCenter; width: 72; height: 40; enabled: actionNotice.savedUndo || root.queueControlsReady
text: "Undo"
- onClicked: { noticeTimer.stop(); if(actionNotice.savedUndo)root.savedService.undoSavedQueue();else root.ciderService.undoQueueRemoval() }
+ onClicked: { actionNotice.dismiss(); if(actionNotice.savedUndo)root.savedService.undoSavedQueue();else root.ciderService.undoQueueRemoval() }
}
- IconButton { id: noticeDismiss; objectName: "dismissActionNotice"; anchors.right: parent.right; anchors.rightMargin: 4; anchors.verticalCenter: parent.verticalCenter; glyphName: "close"; tip: "Dismiss"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: noticeTimer.stop() }
+ IconButton { id: noticeDismiss; objectName: "dismissActionNotice"; anchors.right: parent.right; anchors.rightMargin: 4; anchors.verticalCenter: parent.verticalCenter; glyphName: "close"; tip: "Dismiss"; ink: root.mutedInk; hoverFill: root.hoverFill; onClicked: actionNotice.dismiss() }
}
component SettingsAction: MenuEntry { app: root }
component SettingsGap: MenuSeparator {
@@ -1786,10 +1825,11 @@ ApplicationWindow {
contentItem: Loader {
active: preferences.visible
sourceComponent: Item {
+ Accessible.role: Accessible.Dialog; Accessible.name: "Preferences"
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 }
+ SpunText { x: 12; y: 6; text: "Preferences"; color: root.ink; font.pixelSize: SpunStyle.title; 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
@@ -1885,7 +1925,7 @@ ApplicationWindow {
SpunButton {
required property real modelData
objectName: "uiScale" + Math.round(modelData*100)
- width: (parent.width-16)/5; height: 40
+ width: (parent.width-16)/5; height: 40; horizontalPadding: 8
text: Math.round(modelData*100)+"%"; tonal: Math.abs(typography.uiScale-modelData)<.001
Accessible.name: "Interface size " + text
Accessible.role: Accessible.RadioButton; Accessible.checked: tonal
@@ -2035,7 +2075,7 @@ ApplicationWindow {
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 }
+ SpunText { text: "Keyboard shortcuts"; color: root.ink; font.pixelSize: SpunStyle.title; 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"
@@ -2062,7 +2102,7 @@ ApplicationWindow {
["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"]
+ ["Alt + G", "Focus Undo notice"], ["Esc", "Back / close"], ["F1", "Keyboard shortcuts"]
]
Item {
required property var modelData
diff --git a/qml/PreferenceSwitch.qml b/qml/PreferenceSwitch.qml
index d04d937..0f9306a 100644
--- a/qml/PreferenceSwitch.qml
+++ b/qml/PreferenceSwitch.qml
@@ -4,7 +4,8 @@ Switch {
id: control
required property var app
property string glyphName: ""
- implicitHeight: 48
+ implicitHeight: Math.max(48, preferenceLabel.implicitHeight + 16)
+ hoverEnabled: true; focusPolicy: Qt.StrongFocus
padding: 0; spacing: 0
font.family: SpunStyle.family; font.pixelSize: SpunStyle.body
Accessible.name: text
@@ -30,11 +31,12 @@ Switch {
x: thumbPosition.value - width / 2; anchors.verticalCenter: parent.verticalCenter
width: thumbSize.value; height: width; radius: width / 2
color: control.checked ? theme.colors.onAccent : control.app.mutedInk
+ Behavior on color { ColorAnimation { duration: SpunStyle.feedback; easing.type: Easing.BezierSpline; easing.bezierCurve: SpunStyle.effectsCurve } }
}
}
contentItem: Item {
opacity: control.enabled ? 1 : SpunStyle.disabledOpacity
Glyph { x: 12; anchors.verticalCenter: parent.verticalCenter; name: control.glyphName; ink: control.app.mutedInk }
- SpunText { x: 44; width: control.width - x - 76; anchors.verticalCenter: parent.verticalCenter; text: control.text; font: control.font; color: control.app.ink; elide: Text.ElideRight }
+ SpunText { id: preferenceLabel; objectName: "preferenceLabel"; x: 44; width: control.width - x - 76; anchors.verticalCenter: parent.verticalCenter; text: control.text; font: control.font; color: control.app.ink; wrapMode: Text.WordWrap }
}
}
diff --git a/qml/QuickJump.qml b/qml/QuickJump.qml
index e9f5986..21dc420 100644
--- a/qml/QuickJump.qml
+++ b/qml/QuickJump.qml
@@ -78,8 +78,9 @@ Popup {
contentItem: Loader {
active: jump.visible
sourceComponent: Item {
+ Accessible.role: Accessible.Dialog; Accessible.name: "Quick jump"
Component.onCompleted: Qt.callLater(function() { search.forceActiveFocus() })
- SpunText { text: "Quick jump"; color: jump.app.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
+ SpunText { text: "Quick jump"; color: jump.app.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Medium }
IconButton { x: parent.width - 36; y: -8; width: 36; height: 36; glyphName: "close"; tip: "Close · Esc"; ink: jump.app.mutedInk; onClicked: jump.close() }
SpunSearchField {
id: search; objectName: "quickJumpSearch"; app: jump.app
diff --git a/qml/SavedQueuePicker.qml b/qml/SavedQueuePicker.qml
index 953fde4..6088fde 100644
--- a/qml/SavedQueuePicker.qml
+++ b/qml/SavedQueuePicker.qml
@@ -41,9 +41,10 @@ Popup {
contentItem: Loader {
active: picker.visible
sourceComponent: Item {
+ Accessible.role: Accessible.Dialog; Accessible.name: "Add to saved queue"
function focusFirst() { closePicker.forceActiveFocus(Qt.TabFocusReason) }
IconButton { id: closePicker; objectName: "closeSavedQueuePicker"; x: parent.width - 40; y: -8; glyphName: "close"; tip: "Close"; ink: picker.app.mutedInk; onClicked: picker.close() }
- SpunText { text: "Add to saved queue"; color: picker.app.ink; font.pixelSize: SpunStyle.heading; font.weight: Font.Medium }
+ SpunText { width: parent.width - 44; elide: Text.ElideRight; text: "Add to saved queue"; color: picker.app.ink; font.pixelSize: SpunStyle.title; font.weight: Font.Normal }
SpunText { y: 30; text: picker.tracks.length + (picker.tracks.length === 1 ? " song selected" : " songs selected"); color: picker.app.mutedInk; font.pixelSize: SpunStyle.caption }
ListView {
id: choices; objectName: "savedQueueChoices"
diff --git a/qml/SpunButton.qml b/qml/SpunButton.qml
index d2dd60e..6a1082b 100644
--- a/qml/SpunButton.qml
+++ b/qml/SpunButton.qml
@@ -4,6 +4,7 @@ import QtQuick.Controls
Button {
id: control
property bool tonal: false
+ property bool filled: false
implicitWidth: Math.max(64, contentItem.implicitWidth + 32)
implicitHeight: SpunStyle.target
horizontalPadding: 16
@@ -13,18 +14,18 @@ Button {
contentItem: SpunText {
text: control.text
font.pixelSize: SpunStyle.body; font.weight: Font.Medium
- color: theme.colors.accent
+ color: !control.enabled ? theme.colors.text : control.filled ? theme.colors.onAccent : theme.colors.accent
+ elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
opacity: control.enabled ? 1 : SpunStyle.disabledOpacity
}
background: Rectangle {
SpunSpring { id: corner; targetValue: control.down ? 12 * theme.radius : control.height / 2 * theme.radius }
radius: corner.value
- color: control.tonal ? SpunStyle.selected : "transparent"
- opacity: control.enabled ? 1 : SpunStyle.disabledOpacity
+ color: !control.enabled && (control.tonal || control.filled) ? Qt.alpha(theme.colors.text, SpunStyle.disabledContainerOpacity) : control.filled ? theme.colors.accent : control.tonal ? SpunStyle.selected : "transparent"
border.width: control.visualFocus ? 2 : 0; border.color: theme.colors.accent
SpunStateLayer {
- anchors.fill: parent; radius: parent.radius; color: theme.colors.accent
+ anchors.fill: parent; radius: parent.radius; color: control.filled ? theme.colors.onAccent : theme.colors.accent
enabled: control.enabled; hovered: control.hovered; pressed: control.down; focused: control.visualFocus
}
}
diff --git a/qml/SpunStyle.qml b/qml/SpunStyle.qml
index 058e5c9..4b2697b 100644
--- a/qml/SpunStyle.qml
+++ b/qml/SpunStyle.qml
@@ -21,6 +21,7 @@ QtObject {
readonly property real panelRadius: 28 * theme.radius
readonly property real dialogRadius: 28 * theme.radius
readonly property real disabledOpacity: .38
+ readonly property real disabledContainerOpacity: .12
readonly property real hoverOpacity: .08
readonly property real focusOpacity: .10
readonly property real pressOpacity: .10
diff --git a/src/librarytest.cpp b/src/librarytest.cpp
index f1f79c4..a201d82 100644
--- a/src/librarytest.cpp
+++ b/src/librarytest.cpp
@@ -897,6 +897,8 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &ca
auto *cancelSave=find(window->contentItem(),"cancelSaveQueue");
auto *saveDialog=window->findChild<QObject *>("saveQueuePopup");
check(saveAction&&cancelSave&&saveDialog&&saveDialog->property("modal").toBool()&&saveAction->y()==cancelSave->y()&&cancelSave->x()+cancelSave->width()<saveAction->x(),"Save dialog is modal with aligned, separated Cancel and Save actions");
+ check(saveAction->property("text").toString()=="Rename","rename dialog names its confirmation action correctly");
+ check(qAbs(saveDialog->property("y").toReal()+saveDialog->property("height").toReal()/2-window->property("layoutHeight").toReal()/2)<1,"save and rename dialogs align to the logical window center");
const auto dialogSize=window->size();
const bool dialogLibraryOpen=window->property("libraryOpen").toBool(),dialogQueueOpen=window->property("queueOpen").toBool();
testKeyClick(window,Qt::Key_M,Qt::ControlModifier);
@@ -921,7 +923,11 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &ca
if(!captures.isEmpty())window->grabWindow().save(captures+"/17-edited-queue.png");
click("libraryActions0");click("savedTrackRemove");check(browser.items().size()==1&&browser.collection()["trackCount"]==1,"saved song menu removes the song and updates its count");
check(edits==beforeSavedUiWrites&&plays==beforeSavedUiPlays,"saved queue UI editing leaves Cider playback and queue untouched");
- click("collectionActions");if(!captures.isEmpty())window->grabWindow().save(captures+"/12-saved-queue-menu.png");click("deleteSavedQueueAction");QTest::qWait(150);click("confirmDeleteQueue");
+ click("collectionActions");if(!captures.isEmpty())window->grabWindow().save(captures+"/12-saved-queue-menu.png");click("deleteSavedQueueAction");QTest::qWait(250);
+ auto *deleteCancel=find(window->contentItem(),"cancelDeleteQueue");
+ check(deleteCancel&&deleteCancel->hasActiveFocus(),"delete confirmation initially focuses Cancel");
+ if(!captures.isEmpty())window->grabWindow().save(captures+"/26-delete-queue.png");
+ click("confirmDeleteQueue");
check(browser.items().isEmpty()&&browser.collection().isEmpty(),"saved queue deletion requires confirmation and returns to the list");
fixtureQueue={QJsonObject{{"track",resource("123","songs","First Light")}}};fixturePosition=0;cider.refreshQueue();wait([&]{return !cider.queueBusy();});
auto *savePopup=window->findChild<QObject *>("saveQueuePopup");check(savePopup!=nullptr,"save queue dialog exists");
@@ -1099,6 +1105,10 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &ca
auto *qualityPopup=window->findChild<QObject *>("audioQualityPopup");check(qualityPopup&&qualityPopup->property("visible").toBool(),"audio quality opens in a themed popup");if(qualityPopup)QMetaObject::invokeMethod(qualityPopup,"close");
window->setProperty("queueOpen",true);syncQueue();cider.removeQueue(1,cider.queueRevision());wait([&]{return !cider.controlBusy()&&!cider.queueBusy();});QTest::qWait(200);
auto *undoButton=find(window->contentItem(),"undoQueueButton");check(undoButton&&undoButton->isVisible(),"confirmed removal exposes the Undo action");
+ auto *feedbackTimer=window->findChild<QObject *>("noticeTimer");
+ check(feedbackTimer&&!feedbackTimer->property("running").toBool(),"actionable Undo feedback does not auto-dismiss");
+ testKeyClick(window,Qt::Key_G,Qt::AltModifier);
+ check(undoButton->hasActiveFocus(),"Alt+G reaches Undo without opening another panel");
if(!captures.isEmpty())window->grabWindow().save(captures+"/13-undo.png");
if(undoButton&&undoButton->isVisible()){click("undoQueueButton");check(wait([&]{return !cider.controlBusy()&&!cider.queueBusy();})&&!cider.canUndoQueue(),"Undo button restores the removed item");}
fixtureQueue={queueTrack("History"),queueTrack("Current"),queueTrack("Upcoming"),queueTrack("Current"),queueTrack("Upcoming")};fixturePosition=1;syncQueue();QTest::qWait(100);
@@ -1106,6 +1116,7 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &ca
click("savedQueueMenuButton");click("deduplicateQueueAction");
auto *cleanupPopup=window->findChild<QObject *>("cleanupPopup");
check(cleanupPopup&&cleanupPopup->property("visible").toBool()&&cleanupPopup->property("preview").toMap()["rows"].toList().size()==2&&queueWrites==beforePreviewUi,"queue menu opens a read-only duplicate preview");
+ check(wait([&]{return find(window->contentItem(),"cancelCleanup")->hasActiveFocus();}),"cleanup confirmation initially focuses Cancel");
if(!captures.isEmpty())window->grabWindow().save(captures+"/16-cleanup-preview.png");
click("cancelCleanup");check(!cleanupPopup->property("visible").toBool()&&queueWrites==beforePreviewUi,"Cancel leaves the Cider queue untouched");
click("savedQueueMenuButton");click("deduplicateQueueAction");
@@ -1395,10 +1406,11 @@ int exerciseLibrary(QQuickWindow *window, const QString &temp, const QString &ca
listeningState.addBookmark();wait([&]{return !listeningState.busy();});check(listeningState.bookmarks().size()==1,"repeated bookmark action deduplicates the same moment");
{Listening restored(&cider);check(restored.bookmarks()==listeningState.bookmarks(),"bookmarks survive a fresh backend instance");}
QFile listeningFile(temp+"/listening.json");check(listeningFile.exists()&&!(listeningFile.permissions()&(QFileDevice::ReadGroup|QFileDevice::ReadOther)),"listening references are stored with private permissions");
- listeningState.playBookmark(bookmarkKey);check(wait([&]{return !listeningState.busy();})&&listeningState.error().isEmpty()&&snapshotPosition==12.345&&seekWrites==1,"bookmark playback verifies the song, seeks, and reads back its position");
+ listeningState.playBookmark(bookmarkKey);check(wait([&]{return !listeningState.busy()&&!cider.controlBusy()&&!cider.queueBusy();})&&listeningState.error().isEmpty()&&snapshotPosition==12.345&&seekWrites==1,"bookmark playback verifies the song, seeks, and reads back its position");
wrongSong=true;const int beforeWrongSeek=seekWrites;listeningState.playBookmark(bookmarkKey);
+ check(listeningState.busy(),"bookmark mismatch check starts after the previous readback settles");
check(wait([&]{return !listeningState.busy();})&&!listeningState.error().isEmpty()&&seekWrites==beforeWrongSeek,"bookmark never seeks when Cider reports a different song");wrongSong=false;
- ignoreSeek=true;listeningState.playBookmark(bookmarkKey);check(wait([&]{return !listeningState.busy();})&&!listeningState.error().isEmpty(),"an acknowledged but ineffective seek is reported honestly");ignoreSeek=false;
+ ignoreSeek=true;listeningState.playBookmark(bookmarkKey);check(listeningState.busy(),"bookmark seek-error check starts a fresh playback operation");check(wait([&]{return !listeningState.busy()&&!cider.controlBusy()&&!cider.queueBusy();})&&!listeningState.error().isEmpty(),"an acknowledged but ineffective seek is reported honestly");ignoreSeek=false;
snapshotFailure=true;listeningState.addBookmark();check(wait([&]{return !listeningState.busy();})&&listeningState.bookmarks().size()==1,"failed playback snapshot cannot create an invalid bookmark");snapshotFailure=false;
snapshotId="b";snapshotPosition=12.345;fixtureQueue={queueTrack("a"),queueTrack("b"),queueTrack("c")};fixturePosition=1;syncQueue();
listeningState.setRememberSession(true);check(wait([&]{return listeningState.session()["trackCount"].toInt()==2;}),"optional checkpoint saves the current and upcoming songs without history");
diff --git a/src/main.cpp b/src/main.cpp
index 087d241..d2a02e6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -578,6 +578,13 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *
auto *motionSwitch=findItem(window->contentItem(),"motionToggle");
if (motionSwitch) {
motionSwitch->forceActiveFocus(Qt::TabFocusReason);
+ const auto switchText=motionSwitch->property("text").toString();
+ motionSwitch->setProperty("text", "Remember the current Cider listening session");QTest::qWait(30);
+ auto *switchLabel=findItem(motionSwitch,"preferenceLabel");
+ check(switchLabel&&switchLabel->property("lineCount").toInt()>1
+ &&motionSwitch->height()>=switchLabel->implicitHeight()+16,
+ "long preference labels wrap and expand their row without clipping");
+ motionSwitch->setProperty("text",switchText);QTest::qWait(30);
const bool priorMotion=player.motion();
testKeyClick(window,Qt::Key_Space);
check(player.motion()!=priorMotion,"Preferences switch toggles its setting with Space");
@@ -603,6 +610,13 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *
"keyboard selection applies the installed font and closes the picker");
check(window->property("font").value<QFont>().family() == chosen && songTitle->property("font").value<QFont>().family() == chosen,
"font choice updates the window and inherited song typography immediately");
+ bool scaleLabelsFit=true;
+ for(const auto *name:{"uiScale85","uiScale100","uiScale115","uiScale125","uiScale150"}) {
+ auto *choice=findItem(window->contentItem(),QString::fromLatin1(name));
+ auto *label=choice?choice->property("contentItem").value<QQuickItem *>():nullptr;
+ scaleLabelsFit &= label&&label->implicitWidth()<=label->width()+.1;
+ }
+ check(scaleLabelsFit,"every interface-size percentage is visible in full");
capture("00-font-preferences");
{ Typography restored(temp + "/player.ini"); check(restored.selectedFamily() == chosen && restored.family() == chosen, "font choice survives relaunch"); }
check(!type->select("spun-font-that-does-not-exist") && type->selectedFamily() == chosen, "invalid font choices cannot replace the active font");
@@ -693,6 +707,25 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *
check(hoverLayer->opacity() < .001 && hoverLayer->property("color").value<QColor>() == ink,
"rapid hover reversals settle without changing the hover hue");
} else check(false, "hover state layer exists");
+ {
+ auto *notice=findItem(window->contentItem(),"actionNotice");
+ auto *timer=window->findChild<QObject *>("noticeTimer");
+ hoverButton->forceActiveFocus(Qt::TabFocusReason);
+ QMetaObject::invokeMethod(window,"notifyAction",Q_ARG(QVariant,QString("Ready to listen")),Q_ARG(QVariant,false));
+ QTest::qWait(200);
+ check(notice&&notice->isVisible()&&hoverButton->hasActiveFocus(),"feedback appears without stealing keyboard focus");
+ check(timer&&timer->property("interval").toInt()==4000,"ordinary feedback allows four seconds to read");
+ capture("26-feedback");
+ timer->setProperty("interval",100);
+ QTest::mouseMove(window,notice->mapToScene(QPointF(80,20)).toPoint());QTest::qWait(200);
+ check(notice->property("shown").toBool()&&!timer->property("running").toBool(),"hovering feedback pauses automatic dismissal");
+ QTest::mouseMove(window,QPoint(15,15));QTest::qWait(350);
+ check(!notice->isVisible(),"feedback fades out after the pointer leaves and timeout finishes");
+ QMetaObject::invokeMethod(window,"notifyAction",Q_ARG(QVariant,QString("Ready to listen")),Q_ARG(QVariant,false));QTest::qWait(200);
+ auto *dismiss=findItem(window->contentItem(),"dismissActionNotice");dismiss->forceActiveFocus(Qt::TabFocusReason);
+ testKeyClick(window,Qt::Key_Escape);QTest::qWait(200);
+ check(!notice->isVisible()&&hoverButton->hasActiveFocus(),"Escape dismisses focused feedback and restores the previous control");
+ }
capture("01-empty");
window->contentItem()->forceActiveFocus(); testKeyClick(window,Qt::Key_F1); QTest::qWait(250);
auto *shortcuts=window->findChild<QObject *>("shortcutsPopup");
@@ -709,7 +742,7 @@ static int exercise(Player &player, Theme &theme, Lyrics &lyrics, QQuickWindow *
for(auto *child:item->childItems())collectHelp(child);
};
collectHelp(window->contentItem());
- bool aligned=helpKeys.size()==20&&helpActions.size()==20;
+ bool aligned=helpKeys.size()==21&&helpActions.size()==21;
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;