Also add clickable timestamps to mobile player controls

This commit is contained in:
Bart De Vries 2023-01-25 10:52:17 +01:00
parent aa1363ccb8
commit a014f28ead
2 changed files with 19 additions and 4 deletions

View File

@ -441,7 +441,7 @@ FocusScope {
AudioManager.seek(link.split("://")[1]); AudioManager.seek(link.split("://")[1]);
} }
} else { } else {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@ -185,19 +185,31 @@ Kirigami.Page {
Controls.Label { Controls.Label {
id: text 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 verticalAlignment: Text.AlignTop
baseUrl: AudioManager.entry ? AudioManager.entry.baseUrl : "" baseUrl: AudioManager.entry ? AudioManager.entry.baseUrl : ""
textFormat: Text.RichText textFormat: Text.RichText
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onLinkActivated: Qt.openUrlExternally(link) onLinkHovered: {
Layout.fillWidth: true 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 { Item {
visible: chapterList.count === 0
Item { Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Kirigami.Units.largeSpacing * 2 anchors.leftMargin: Kirigami.Units.largeSpacing * 2
@ -261,6 +273,7 @@ Kirigami.Page {
Controls.ToolButton { Controls.ToolButton {
visible: AudioManager.entry visible: AudioManager.entry
checked: swipeView.currentIndex === 0
Layout.maximumHeight: parent.height Layout.maximumHeight: parent.height
Layout.preferredHeight: contextButtons.buttonSize Layout.preferredHeight: contextButtons.buttonSize
Layout.maximumWidth: height Layout.maximumWidth: height
@ -275,6 +288,7 @@ Kirigami.Page {
Controls.ToolButton { Controls.ToolButton {
visible: AudioManager.entry visible: AudioManager.entry
checked: swipeView.currentIndex === 1
Layout.maximumHeight: parent.height Layout.maximumHeight: parent.height
Layout.preferredHeight: contextButtons.buttonSize Layout.preferredHeight: contextButtons.buttonSize
Layout.maximumWidth: height Layout.maximumWidth: height
@ -289,6 +303,7 @@ Kirigami.Page {
Controls.ToolButton { Controls.ToolButton {
visible: AudioManager.entry && chapterList.count !== 0 visible: AudioManager.entry && chapterList.count !== 0
checked: swipeView.currentIndex === 2
Layout.maximumHeight: parent.height Layout.maximumHeight: parent.height
Layout.preferredHeight: contextButtons.buttonSize Layout.preferredHeight: contextButtons.buttonSize
Layout.maximumWidth: height Layout.maximumWidth: height