]> git.sesse.net Git - kdenlive/blobdiff - src/keyframeedit.cpp
Replace the keyframe table by the add keyframe button if all keyframes but one are...
[kdenlive] / src / keyframeedit.cpp
index 6085a27f554bae1da7c11b6e343b88fedf055a76..8266ae5161d21f5b32b271956df7fa94977de98e 100644 (file)
@@ -100,16 +100,23 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
 {
     keyframe_list->blockSignals(true);
     m_params.append(e.cloneNode().toElement());
+
     QDomNode na = e.firstChildElement("name");
     QString paramName = i18n(na.toElement().text().toUtf8().data());
+    QDomNode commentNode = e.firstChildElement("comment");
+    QString comment;
+    if (!commentNode.isNull())
+        comment = i18n(commentNode.toElement().text().toUtf8().data());
+
     int columnId = keyframe_list->columnCount();
     keyframe_list->insertColumn(columnId);
     keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName));
 
     DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0,
             m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(),
-            m_params.at(columnId).attribute("default").toInt(), m_params.at(columnId).attribute("suffix"), this);
+            m_params.at(columnId).attribute("default").toInt(), comment, m_params.at(columnId).attribute("suffix"), this);
     connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
+    connect(doubleparam, SIGNAL(showComment(const QString&)), this, SIGNAL(showComment(const QString&)));
     m_slidersLayout->addWidget(doubleparam, columnId, 0);
 
     QRadioButton *radio = new QRadioButton(this);
@@ -161,7 +168,12 @@ void KeyframeEdit::slotDeleteKeyframe()
     keyframe_list->setCurrentCell(row, col);
     keyframe_list->selectRow(row);
     generateAllParams();
-    button_delete->setEnabled(keyframe_list->rowCount() > 1);
+
+    bool disable = keyframe_list->rowCount() < 2;
+    button_delete->setEnabled(!disable);
+    disable &= getPos(0) == m_min;
+    widgetTable->setHidden(disable);
+    buttonKeyframes->setHidden(!disable);
 }
 
 void KeyframeEdit::slotAddKeyframe()