X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Ftimecode.h;h=e1ae7cbf40ddc60d1091c1b20bc6d92b4da575ca;hb=875720c9414fb6170be525d47758df800c1a96fd;hp=28ccb625d4e8de961a9a20c07dace76c994cba2a;hpb=bf1704e07d8b63c2d249a9a575e7f0b329b235ba;p=kdenlive diff --git a/src/timecode.h b/src/timecode.h index 28ccb625..e1ae7cbf 100644 --- a/src/timecode.h +++ b/src/timecode.h @@ -17,9 +17,12 @@ #ifndef TIMECODE_H #define TIMECODE_H +#include + #include "gentime.h" -#include +class QValidator; +class QRegExpValidator; /** Handles the conversion of a GenTime into a nicely formatted string, taking into account things such as drop frame if necessary. Handles multiple formats, such as HH:MM:SS:FF, HH:MM:SS:F, All Frames, All Seconds, etc. @@ -31,15 +34,12 @@ class Timecode public: enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds }; - explicit Timecode(Formats format = HH_MM_SS_FF, int framesPerSecond = - 25, bool dropFrame = false); + explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond = 25); - /** Set the current timecode format; this is the output format for this timecode. */ - void setFormat(int framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) { - m_displayedFramesPerSecond = framesPerSecond; - m_dropFrame = dropFrame; - m_format = format; - } + /** + * Set the current timecode format; this is the output format for this timecode. + */ + void setFormat(double framesPerSecond, Formats format = HH_MM_SS_FF); Formats format() const { return m_format; @@ -48,24 +48,36 @@ public: ~Timecode(); /** Returns the timecode for a given time */ - QString getTimecode(const GenTime & time, double fps) const; - int getFrameCount(const QString duration, double fps) const; + QString getDisplayTimecode(const GenTime & time, bool frameDisplay) const; + QString getTimecode(const GenTime & time) const; + int getDisplayFrameCount(const QString duration, bool frameDisplay) const; + int getFrameCount(const QString duration) const; static QString getEasyTimecode(const GenTime & time, const double &fps); static QString getStringTimecode(int frames, const double &fps); - QString getTimecodeFromFrames(int frames) const; - int fps() const; + const QString getDisplayTimecodeFromFrames(int frames, bool frameDisplay) const; + const QString getTimecodeFromFrames(int frames) const; + double fps() const; + bool df() const; + const QValidator *validator() const; + QString reformatSeparators(QString duration) const; private: Formats m_format; - bool m_dropFrame; + bool m_dropFrameTimecode; int m_displayedFramesPerSecond; + double m_realFps; + double m_dropFrames; + int m_framesPer10Minutes; + QRegExpValidator *m_validator; + + const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const; + const QString getTimecodeHH_MM_SS_FF(int frames) const; - QString getTimecodeHH_MM_SS_FF(const GenTime & time, double fps) const; - QString getTimecodeHH_MM_SS_FF(int frames) const; - QString getTimecodeHH_MM_SS_HH(const GenTime & time) const; - QString getTimecodeFrames(const GenTime & time, double fps) const; - QString getTimecodeSeconds(const GenTime & time) const; - QString getTimecodeDropFrame(const GenTime & time, double fps) const; + const QString getTimecodeHH_MM_SS_HH(const GenTime & time) const; + const QString getTimecodeFrames(const GenTime & time) const; + const QString getTimecodeSeconds(const GenTime & time) const; + const QString getTimecodeDropFrame(const GenTime & time) const; + const QString getTimecodeDropFrame(int framenumber) const; }; #endif