diff options
Diffstat (limited to 'helper.cpp')
-rw-r--r-- | helper.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -15,6 +15,8 @@ #include <QSettings> #include <QDir> +#include <stdio.h> + #include "helper.h" namespace Helper { @@ -147,6 +149,21 @@ namespace Helper { return qMakePair(programData.value("path").toString(), programData.value("args").toStringList()); } + QString durationFromSecs(qint64 secs){ + int minutes = secs / 60; + int hours = 0; + int seconds = 0; + if(minutes > 60){ + hours = minutes / 60; + minutes -= hours * 60; + } + seconds = secs - hours * 60 * 60 - minutes * 60; + seconds = (seconds > 60) ? 59 : seconds; + QByteArray retval(10, '\0'); + ::snprintf(retval.data(), 9, "%.2d:%.2d:%.2d", hours, minutes, seconds); + return retval; + } + bool StringListContains::operator()(const QString s, const QString &part) const { return s.contains(part); } |