From 2653784f820dfdf3520a9d0339498ac2e4b3b3e6 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Sun, 2 Aug 2015 21:53:46 +0200 Subject: [PATCH] QTime seems broken on Qt5. Alternative impl. --- src/video.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/video.cpp b/src/video.cpp index 41e8c01..3761c4d 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -473,8 +473,16 @@ QString Video::decryptSignature(const QString &s) { } QString Video::formattedDuration() const { - QString format = m_duration > 3600 ? "h:mm:ss" : "m:ss"; - return QTime().addSecs(m_duration).toString(format); + int duration = m_duration; + QString res; + int seconds = duration % 60; + duration /= 60; + int minutes = duration % 60; + duration /= 60; + int hours = duration % 24; + if (hours == 0) + return res.asprintf("%d:%02d", minutes, seconds); + return res.asprintf("%d:%02d:%02d", hours, minutes, seconds); } void Video::saveDefinitionForUrl(const QString& url, const VideoDefinition& definition) { -- 2.39.5