From 4c4bcb0989d9e2d3029e677b0f2e6a661bcba3b3 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 24 May 2020 17:40:30 +1000 Subject: [PATCH] moved simple ms to hh:mm:ss function to timecodefunctions --- app/common/timecodefunctions.cpp | 13 +++++++++++++ app/common/timecodefunctions.h | 2 ++ app/dialog/export/export.cpp | 13 ------------- app/dialog/export/export.h | 2 -- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/common/timecodefunctions.cpp b/app/common/timecodefunctions.cpp index 031b1478b..952601832 100644 --- a/app/common/timecodefunctions.cpp +++ b/app/common/timecodefunctions.cpp @@ -256,6 +256,19 @@ bool Timecode::TimebaseIsDropFrame(const rational &timebase) return (timebase.numerator() == 1001); } +QString Timecode::TimeToString(int64_t ms) +{ + int64_t total_seconds = ms / 1000; + int64_t ss = total_seconds % 60; + int64_t mm = (total_seconds / 60) % 60; + int64_t hh = total_seconds / 3600; + + return QStringLiteral("%1:%2:%3") + .arg(hh, 2, 10, QChar('0')) + .arg(mm, 2, 10, QChar('0')) + .arg(ss, 2, 10, QChar('0')); +} + int64_t Timecode::time_to_timestamp(const rational &time, const rational &timebase) { return time_to_timestamp(time.toDouble(), timebase); diff --git a/app/common/timecodefunctions.h b/app/common/timecodefunctions.h index e0e4dcf91..afaa263f3 100644 --- a/app/common/timecodefunctions.h +++ b/app/common/timecodefunctions.h @@ -68,6 +68,8 @@ public: static bool TimebaseIsDropFrame(const rational& timebase); + static QString TimeToString(int64_t ms); + }; OLIVE_NAMESPACE_EXIT diff --git a/app/dialog/export/export.cpp b/app/dialog/export/export.cpp index 1ec4d81d6..411337e33 100644 --- a/app/dialog/export/export.cpp +++ b/app/dialog/export/export.cpp @@ -474,19 +474,6 @@ ExportParams ExportDialog::GenerateParams() const return params; } -QString ExportDialog::TimeToString(int64_t ms) -{ - int64_t total_seconds = ms / 1000; - int64_t ss = total_seconds % 60; - int64_t mm = (total_seconds / 60) % 60; - int64_t hh = total_seconds / 3600; - - return QStringLiteral("%1:%2:%3") - .arg(hh, 2, 10, QChar('0')) - .arg(mm, 2, 10, QChar('0')) - .arg(ss, 2, 10, QChar('0')); -} - void ExportDialog::UpdateViewerDimensions() { preview_viewer_->SetOverrideSize(static_cast(video_tab_->width_slider()->GetValue()), diff --git a/app/dialog/export/export.h b/app/dialog/export/export.h index 6823cc06f..60a301af4 100644 --- a/app/dialog/export/export.h +++ b/app/dialog/export/export.h @@ -53,8 +53,6 @@ private: ExportParams GenerateParams() const; - static QString TimeToString(int64_t ms); - ViewerOutput* viewer_node_; ExportFormat::Format previously_selected_format_;