]> git.sesse.net Git - kdenlive/blobdiff - src/timecode.h
Improve the export audio automatic setting:
[kdenlive] / src / timecode.h
index e10ae4af767ba4a10b8c55408113678f6a55c24c..8521aa822f28d29970b58ee163e6d3f54e51def6 100644 (file)
 #ifndef TIMECODE_H
 #define TIMECODE_H
 
-#include <qstring.h>
+#include <QString>
 
 #include "gentime.h"
 
+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,16 +34,14 @@ class Timecode
 public:
     enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
 
-    explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond =
-                          25, bool dropFrame = false);
+    explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond = 25,
+                      bool dropFrame = false);
 
-    /** Set the current timecode format; this is the output format for this timecode. */
-    void setFormat(double framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {
-        m_displayedFramesPerSecond = (int)(framesPerSecond + 0.5);
-        m_dropFrame = dropFrame;
-        m_format = format;
-        m_realFps = framesPerSecond;
-    }
+    /**
+     * Set the current timecode format; this is the output format for this timecode.
+     */
+    void setFormat(double framesPerSecond, bool dropFrame = false,
+                   Formats format = HH_MM_SS_FF);
 
     Formats format() const {
         return m_format;
@@ -58,12 +59,16 @@ public:
     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;
     int m_displayedFramesPerSecond;
     double m_realFps;
+    QRegExpValidator *m_validator;
 
     const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
     const QString getTimecodeHH_MM_SS_FF(int frames) const;