]> git.sesse.net Git - kdenlive/blobdiff - src/keyframeedit.cpp
Add an fps counter for debugging.
[kdenlive] / src / keyframeedit.cpp
index ed8e1e97e432b0d883364f10bedf065eed619f12..85965c343cbcef5a7094b1a624db12839eb46ad8 100644 (file)
@@ -16,7 +16,7 @@
  ***************************************************************************/
 
 #include "keyframeedit.h"
-#include "doubleparameterwidget.h"
+#include "widgets/doubleparameterwidget.h"
 #include "positionedit.h"
 #include "kdenlivesettings.h"
 
 
 #include <QHeaderView>
 
-KeyframeEdit::KeyframeEdit(const QDomElement &e, int minFrame, int maxFrame, Timecode tc, int activeKeyframe, QWidget* parent) :
-        QWidget(parent),
-        m_min(minFrame),
-        m_max(maxFrame),
-        m_timecode(tc)
+KeyframeEdit::KeyframeEdit(const QDomElement &e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent) :
+    QWidget(parent),
+    m_min(minFrame),
+    m_max(maxFrame),
+    m_timecode(tc)
 {
     setupUi(this);
     if (m_max == -1) {
@@ -99,7 +99,7 @@ KeyframeEdit::~KeyframeEdit()
     }
 }
 
-void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
+void KeyframeEdit::addParameter(const QDomElement &e, int activeKeyframe)
 {
     keyframe_list->blockSignals(true);
     m_params.append(e.cloneNode().toElement());
@@ -116,8 +116,8 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
     keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName));
 
     DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0,
-            m_params.at(columnId).attribute("min").toDouble(), m_params.at(columnId).attribute("max").toDouble(),
-            m_params.at(columnId).attribute("default").toDouble(), comment, columnId, m_params.at(columnId).attribute("suffix"), m_params.at(columnId).attribute("decimals").toInt(), this);
+                                                                   m_params.at(columnId).attribute("min").toDouble(), m_params.at(columnId).attribute("max").toDouble(),
+                                                                   m_params.at(columnId).attribute("default").toDouble(), comment, columnId, m_params.at(columnId).attribute("suffix"), m_params.at(columnId).attribute("decimals").toInt(), this);
     connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotAdjustKeyframeValue(double)));
     connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
     connect(doubleparam, SIGNAL(setInTimeline(int)), this, SLOT(slotUpdateVisibleParameter(int)));
@@ -128,13 +128,13 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
 
     QStringList frames = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
     for (int i = 0; i < frames.count(); ++i) {
-        int frame = frames.at(i).section(':', 0, 0).toInt();
+        int frame = frames.at(i).section('=', 0, 0).toInt();
         bool found = false;
         int j;
         for (j = 0; j < keyframe_list->rowCount(); j++) {
             int currentPos = getPos(j);
             if (frame == currentPos) {
-                keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+                keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1)));
                 found = true;
                 break;
             } else if (currentPos > frame) {
@@ -144,7 +144,7 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
         if (!found) {
             keyframe_list->insertRow(j);
             keyframe_list->setVerticalHeaderItem(j, new QTableWidgetItem(getPosString(frame)));
-            keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+            keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1)));
             keyframe_list->resizeRowToContents(j);
         }
         if ((activeKeyframe > -1) && (activeKeyframe == frame)) {
@@ -242,7 +242,7 @@ void KeyframeEdit::slotGenerateParams(int row, int column)
 
         for (int col = 0; col < keyframe_list->horizontalHeader()->count(); col++) {
             item = keyframe_list->item(row, col);
-           if (!item) continue;
+            if (!item) continue;
             int v = item->text().toInt();
             if (v >= m_params.at(col).attribute("max").toInt())
                 item->setText(m_params.at(col).attribute("max"));
@@ -251,7 +251,7 @@ void KeyframeEdit::slotGenerateParams(int row, int column)
             QString keyframes;
             for (int i = 0; i < keyframe_list->rowCount(); ++i) {
                 if (keyframe_list->item(i, col))
-                    keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, col)->text() + ';');
+                    keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, col)->text() + ';');
             }
             m_params[col].setAttribute("keyframes", keyframes);
         }
@@ -289,7 +289,7 @@ void KeyframeEdit::slotGenerateParams(int row, int column)
     QString keyframes;
     for (int i = 0; i < keyframe_list->rowCount(); ++i) {
         if (keyframe_list->item(i, column))
-            keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, column)->text() + ';');
+            keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, column)->text() + ';');
     }
     m_params[column].setAttribute("keyframes", keyframes);
     emit parameterChanged();
@@ -301,7 +301,7 @@ void KeyframeEdit::generateAllParams()
         QString keyframes;
         for (int i = 0; i < keyframe_list->rowCount(); ++i) {
             if (keyframe_list->item(i, col))
-                keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, col)->text() + ';');
+                keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, col)->text() + ';');
         }
         m_params[col].setAttribute("keyframes", keyframes);
     }
@@ -384,7 +384,7 @@ void KeyframeEdit::slotAdjustKeyframeValue(double value)
 int KeyframeEdit::getPos(int row)
 {
     if (!keyframe_list->verticalHeaderItem(row))
-       return 0;
+        return 0;
     if (KdenliveSettings::frametimecode())
         return keyframe_list->verticalHeaderItem(row)->text().toInt();
     else
@@ -436,7 +436,7 @@ void KeyframeEdit::slotResetKeyframe()
 void KeyframeEdit::slotUpdateVisibleParameter(int id, bool update)
 {
     for (int i = 0; i < m_params.count(); ++i) {
-        m_params[i].setAttribute("intimeline", (i == id ? "1" : "0"));        
+        m_params[i].setAttribute("intimeline", (i == id ? "1" : "0"));
     }
     for (int col = 0; col < keyframe_list->columnCount(); col++) {
         DoubleParameterWidget *doubleparam = static_cast <DoubleParameterWidget*>(m_slidersLayout->itemAtPosition(col, 0)->widget());