]> git.sesse.net Git - kdenlive/blobdiff - src/keyframeedit.h
const'ref. Fix indent
[kdenlive] / src / keyframeedit.h
index 0aa620d26a9427f961870fae895fd7328d5d732e..a0ba5dc9ea139df9cf974c48d3557269fb9b9857 100644 (file)
@@ -25,6 +25,7 @@
 #include <QAbstractItemView>
 #include <QSpinBox>
 
+class PositionEdit;
 
 #include "ui_keyframeeditor_ui.h"
 #include "definitions.h"
@@ -34,7 +35,8 @@ class KeyItemDelegate: public QItemDelegate
 {
     Q_OBJECT
 public:
-    KeyItemDelegate(int min, int max, QAbstractItemView* parent = 0): QItemDelegate(parent), m_min(min), m_max(max) {
+    KeyItemDelegate(int min, int max, QAbstractItemView* parent = 0)
+        : QItemDelegate(parent), m_min(min), m_max(max) {
     }
 
     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
@@ -43,7 +45,9 @@ public:
             connect(spin, SIGNAL(valueChanged(int)), this, SLOT(commitEditorData()));
             connect(spin, SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor()));
             return spin;
-        } else return QItemDelegate::createEditor(parent, option, index);
+        } else {
+            return QItemDelegate::createEditor(parent, option, index);
+        }
     }
 
 
@@ -52,7 +56,9 @@ public:
             QSpinBox *spin = qobject_cast< QSpinBox* >(editor);
             spin->setRange(m_min, m_max);
             spin->setValue(index.model()->data(index).toInt());
-        } else QItemDelegate::setEditorData(editor, index);
+        } else {
+            QItemDelegate::setEditorData(editor, index);
+        }
     }
 
 private slots:
@@ -75,34 +81,68 @@ class KeyframeEdit : public QWidget, public Ui::KeyframeEditor_UI
 {
     Q_OBJECT
 public:
-    explicit KeyframeEdit(QDomElement e, int maxFrame, int minVal, int maxVal, Timecode tc, const QString paramName = QString(), QWidget* parent = 0);
+    explicit KeyframeEdit(const QDomElement &e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent = 0);
     virtual ~KeyframeEdit();
-    void setupParam(QDomElement e = QDomElement());
+    virtual void addParameter(const QDomElement &e, int activeKeyframe = -1);
+    const QString getValue(const QString &name);
+    /** @brief Updates the timecode display according to settings (frame number or hh:mm:ss:ff) */
+    void updateTimecodeFormat();
 
-private:
-    QDomElement m_param;
-    int m_max;
-    int m_minVal;
-    int m_maxVal;
-    Timecode m_timecode;
-    int m_previousPos;
-    KeyItemDelegate *m_delegate;
+    /** @brief Returns true if the parameter @param name should be shown on the clip in timeline. */
+    bool isVisibleParam(const QString &name);
+
+    /** @brief Makes the first parameter visible in timeline if no parameter is selected. */
+    void checkVisibleParam();
 
 public slots:
 
+    void slotUpdateRange(int inPoint, int outPoint);
+
+protected:
+    /** @brief Gets the position of a keyframe from the table.
+     * @param row Row of the keyframe in the table */
+    int getPos(int row);
+    /** @brief Converts a frame value to timecode considering the frames vs. HH:MM:SS:FF setting.
+     * @return timecode */
+    QString getPosString(int pos);
+
+    void generateAllParams();
+
+    int m_min;
+    int m_max;
+
+protected slots:
+    void slotAdjustKeyframeInfo(bool seek = true);
+
+private:
+    QList <QDomElement> m_params;
+    Timecode m_timecode;
+    QGridLayout *m_slidersLayout;
+    PositionEdit *m_position;
 
 private slots:
     void slotDeleteKeyframe();
     void slotAddKeyframe();
-    void slotGenerateParams(QTreeWidgetItem *item = NULL, int column = -1);
-    void slotAdjustKeyframeInfo();
+    void slotGenerateParams(int row, int column);
     void slotAdjustKeyframePos(int value);
-    void slotAdjustKeyframeValue(int value);
-    void slotSaveCurrentParam(QTreeWidgetItem *item, int column);
+    void slotAdjustKeyframeValue(double value);
+    /** @brief Turns the seek to keyframe position setting on/off.
+    * @param seek true = seeking on */
+    void slotSetSeeking(bool seek);
+
+    /** @brief Shows the keyframe table and adds a second keyframe. */
+    void slotKeyframeMode();
+
+    /** @brief Resets all parameters of the selected keyframe to their default values. */
+    void slotResetKeyframe();
+
+    /** @brief Makes the parameter at column @param id the visible (in timeline) one. */
+    void slotUpdateVisibleParameter(int id, bool update = true);
 
 signals:
     void parameterChanged();
     void seekToPos(int);
+    void showComments(bool show);
 };
 
 #endif