1 /***************************************************************************
4 begin : Wed Dec 17 2003
5 copyright : (C) 2003 by Jason Wood
6 email : jasonwood@blueyonder.co.uk
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
25 class QRegExpValidator;
28 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.
35 enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
37 explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond = 25);
40 * Set the current timecode format; this is the output format for this timecode.
42 void setFormat(double framesPerSecond, Formats format = HH_MM_SS_FF);
44 Formats format() const {
50 /** Returns the timecode for a given time */
51 QString getDisplayTimecode(const GenTime & time, bool frameDisplay) const;
52 QString getTimecode(const GenTime & time) const;
53 int getDisplayFrameCount(const QString duration, bool frameDisplay) const;
54 int getFrameCount(const QString duration) const;
55 static QString getEasyTimecode(const GenTime & time, const double &fps);
56 static QString getStringTimecode(int frames, const double &fps);
57 const QString getDisplayTimecodeFromFrames(int frames, bool frameDisplay) const;
58 const QString getTimecodeFromFrames(int frames) const;
61 const QValidator *validator() const;
62 QString reformatSeparators(QString duration) const;
66 bool m_dropFrameTimecode;
67 int m_displayedFramesPerSecond;
70 int m_framesPer10Minutes;
71 QRegExpValidator *m_validator;
73 const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
74 const QString getTimecodeHH_MM_SS_FF(int frames) const;
76 const QString getTimecodeHH_MM_SS_HH(const GenTime & time) const;
77 const QString getTimecodeFrames(const GenTime & time) const;
78 const QString getTimecodeSeconds(const GenTime & time) const;
79 const QString getTimecodeDropFrame(const GenTime & time) const;
80 const QString getTimecodeDropFrame(int framenumber) const;