}
return s;
}
+
+QString DataUtils::formatDuration(uint secs) {
+ uint d = secs;
+ QString res;
+ uint seconds = d % 60;
+ d /= 60;
+ uint minutes = d % 60;
+ d /= 60;
+ uint hours = d % 24;
+ if (hours == 0)
+ return res.sprintf("%d:%02d", minutes, seconds);
+ return res.sprintf("%d:%02d:%02d", hours, minutes, seconds);
+}
static QString systemRegioneCode();
static uint parseIsoPeriod(const QString &isoPeriod);
static QString formatDateTime(const QDateTime &dt);
+ static QString formatDuration(uint secs);
private:
DataUtils() { }
#include "jsfunctions.h"
#include "temporary.h"
#include "compatibility/qurlqueryhelper.h"
+#include "datautils.h"
namespace The {
NetworkAccess* http();
}
QString Video::formattedDuration() const {
- 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.sprintf("%d:%02d", minutes, seconds);
- return res.sprintf("%d:%02d:%02d", hours, minutes, seconds);
+ return DataUtils::formatDuration(m_duration);
}
void Video::saveDefinitionForUrl(const QString& url, const VideoDefinition& definition) {