X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Ftimecode.cpp;h=d36b0f2148a0c32f2914fe01a54cb605d9bf9e22;hb=56aee6aedeeed3efd10ada8fe3c229eddc01ef05;hp=ca51d7cf54422505429ad2620da7a09eb3f90c6a;hpb=9b0e3f1ec9306890b887c815322443672aba00c5;p=kdenlive diff --git a/src/timecode.cpp b/src/timecode.cpp index ca51d7cf..d36b0f21 100644 --- a/src/timecode.cpp +++ b/src/timecode.cpp @@ -82,7 +82,7 @@ return frameNumber; #include -#include +#include #include "timecode.h" @@ -117,7 +117,7 @@ bool Timecode::df() const return m_dropFrameTimecode; } -const QString Timecode::mask(GenTime t) const +const QString Timecode::mask(const GenTime& t) const { if (t < GenTime()) { if (m_dropFrameTimecode) return "#99:99:99,99"; @@ -210,7 +210,7 @@ const QString Timecode::getTimecodeFromFrames(int frames) const //static -QString Timecode::getStringTimecode(int frames, const double &fps) +QString Timecode::getStringTimecode(int frames, const double &fps, bool showFrames) { // Returns the timecode in an hh:mm:ss format @@ -221,6 +221,7 @@ QString Timecode::getStringTimecode(int frames, const double &fps) } int seconds = (int)(frames / fps); + int frms = frames % (int) (fps + 0.5); int minutes = seconds / 60; seconds = seconds % 60; int hours = minutes / 60; @@ -233,6 +234,10 @@ QString Timecode::getStringTimecode(int frames, const double &fps) text.append(QString::number(minutes).rightJustified(2, '0', false)); text.append(':'); text.append(QString::number(seconds).rightJustified(2, '0', false)); + if (showFrames) { + text.append('.'); + text.append(QString::number(frms).rightJustified(2, '0', false)); + } return text; }