From a014f28eadbb2db8660cfa24e80887c1b6251e24 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Wed, 25 Jan 2023 10:52:17 +0100 Subject: [PATCH] Also add clickable timestamps to mobile player controls --- src/qml/Desktop/DesktopPlayerControls.qml | 2 +- src/qml/Mobile/MobilePlayerControls.qml | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/qml/Desktop/DesktopPlayerControls.qml b/src/qml/Desktop/DesktopPlayerControls.qml index ccb7a3c8..8498bee1 100644 --- a/src/qml/Desktop/DesktopPlayerControls.qml +++ b/src/qml/Desktop/DesktopPlayerControls.qml @@ -441,7 +441,7 @@ FocusScope { AudioManager.seek(link.split("://")[1]); } } else { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } diff --git a/src/qml/Mobile/MobilePlayerControls.qml b/src/qml/Mobile/MobilePlayerControls.qml index fcc78794..91234c8c 100644 --- a/src/qml/Mobile/MobilePlayerControls.qml +++ b/src/qml/Mobile/MobilePlayerControls.qml @@ -185,19 +185,31 @@ Kirigami.Page { Controls.Label { id: text - text: AudioManager.entry ? AudioManager.entry.content : i18n("No Track Loaded") + Layout.fillWidth: true + text: AudioManager.entry ? AudioManager.entry.adjustedContent(width, font.pixelSize) : i18n("No Track Loaded") verticalAlignment: Text.AlignTop baseUrl: AudioManager.entry ? AudioManager.entry.baseUrl : "" textFormat: Text.RichText wrapMode: Text.WordWrap - onLinkActivated: Qt.openUrlExternally(link) - Layout.fillWidth: true + onLinkHovered: { + cursorShape: Qt.PointingHandCursor; + } + onLinkActivated: { + if (link.split("://")[0] === "timestamp") { + if (AudioManager.entry && AudioManager.entry.enclosure) { + AudioManager.seek(link.split("://")[1]); + } + } else { + Qt.openUrlExternally(link); + } + } } } } } Item { + visible: chapterList.count === 0 Item { anchors.fill: parent anchors.leftMargin: Kirigami.Units.largeSpacing * 2 @@ -261,6 +273,7 @@ Kirigami.Page { Controls.ToolButton { visible: AudioManager.entry + checked: swipeView.currentIndex === 0 Layout.maximumHeight: parent.height Layout.preferredHeight: contextButtons.buttonSize Layout.maximumWidth: height @@ -275,6 +288,7 @@ Kirigami.Page { Controls.ToolButton { visible: AudioManager.entry + checked: swipeView.currentIndex === 1 Layout.maximumHeight: parent.height Layout.preferredHeight: contextButtons.buttonSize Layout.maximumWidth: height @@ -289,6 +303,7 @@ Kirigami.Page { Controls.ToolButton { visible: AudioManager.entry && chapterList.count !== 0 + checked: swipeView.currentIndex === 2 Layout.maximumHeight: parent.height Layout.preferredHeight: contextButtons.buttonSize Layout.maximumWidth: height