From af53c7b20378b9f1c2d18d4afb8b44c258b40955 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:25:48 +1000 Subject: media: display hh:mm:ss Closes #287 --- modules/dashboard/Media.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/dashboard/Media.qml b/modules/dashboard/Media.qml index a7cda85..ba0c8f3 100644 --- a/modules/dashboard/Media.qml +++ b/modules/dashboard/Media.qml @@ -26,7 +26,14 @@ Item { function lengthStr(length: int): string { if (length < 0) return "-1:-1"; - return `${Math.floor(length / 60)}:${Math.floor(length % 60).toString().padStart(2, "0")}`; + + const hours = Math.floor(length / 3600); + const mins = Math.floor((length % 3600) / 60); + const secs = Math.floor(length % 60).toString().padStart(2, "0"); + + if (hours > 0) + return `${hours}:${mins.toString().padStart(2, "0")}:${secs}`; + return `${mins}:${secs}`; } implicitWidth: cover.implicitWidth + Config.dashboard.sizes.mediaVisualiserSize * 2 + details.implicitWidth + details.anchors.leftMargin + bongocat.implicitWidth + bongocat.anchors.leftMargin * 2 + Appearance.padding.large * 2 -- cgit v1.2.3-freya