X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Ftimecode.cpp;h=08d524d13b274eabfa2bc52c8a39eb8e91b2a13d;hb=7cd7234fe261491efe2f9e55be980c326ee0a002;hp=ca51d7cf54422505429ad2620da7a09eb3f90c6a;hpb=7d708fd156c646b36c91cffaed60e5cf777f95d9;p=kdenlive diff --git a/src/timecode.cpp b/src/timecode.cpp index ca51d7cf..08d524d1 100644 --- a/src/timecode.cpp +++ b/src/timecode.cpp @@ -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; }