]> git.sesse.net Git - kdenlive/commitdiff
Make the keyframe parameter which can be edited in timeline selectable
authorTill Theato <root@ttill.de>
Sun, 7 Nov 2010 16:25:07 +0000 (16:25 +0000)
committerTill Theato <root@ttill.de>
Sun, 7 Nov 2010 16:25:07 +0000 (16:25 +0000)
svn path=/trunk/kdenlive/; revision=5079

effects/frei0r_sopsat.xml
src/clipitem.cpp
src/effectstackedit.cpp
src/keyframeedit.cpp
src/keyframeedit.h

index 8b4cb23a9dc310666253defd33baa69a748c1ed6..92e03999717507c4ff1816b6194f30f9d5a46098 100644 (file)
@@ -42,7 +42,7 @@
                 <name>Power (Gamma) Alpha</name>
         </parameter>
 
-        <parameter type="simplekeyframe" name="saturation" default="100" min="0" max="500" factor="100">
+        <parameter type="simplekeyframe" name="saturation" default="100" min="0" max="500" factor="100" intimeline="1">
                 <name>Overall Saturation</name>
         </parameter>
 
index 41dea03345973e4a7264421b80821cab7e9cdfc1..e80e3fcd9a1d5c0fbc70f77ffbe34888b55a84c7 100644 (file)
@@ -389,7 +389,7 @@ void ClipItem::setKeyframes(const int ix, const QStringList keyframes)
     int keyframeParams = 0;
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
-        if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
+        if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") && e.attribute("intimeline") == "1") {
             e.setAttribute("keyframes", keyframes.at(keyframeParams));
             if (ix == m_selectedEffect && keyframeParams == 0) {
                 m_keyframes.clear();
@@ -425,7 +425,7 @@ void ClipItem::setSelectedEffect(const int ix)
         if (effect.attribute("disable") != "1")
             for (int i = 0; i < params.count(); i++) {
                 QDomElement e = params.item(i).toElement();
-                if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
+                if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") && e.attribute("intimeline") == "1") {
                     m_keyframes.clear();
                     m_visibleParam = i;
                     double max = e.attribute("max").toDouble();
@@ -1748,6 +1748,10 @@ void ClipItem::updateKeyframes(QDomElement effect)
     // parse keyframes
     QDomNodeList params = effect.elementsByTagName("parameter");
     QDomElement e = params.item(m_visibleParam).toElement();
+    if (e.attribute("intimeline") != "1") {
+        setSelectedEffect(m_selectedEffect);
+        return;
+    }
     const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
     foreach(const QString &str, keyframes) {
         int pos = str.section(':', 0, 0).toInt();
index bbb606ffde699c125a42a31b6c928a936f48c316..6c96d251f60e535dfca98574c132633405cd2a77 100644 (file)
@@ -671,10 +671,15 @@ void EffectStackEdit::collectAllParameters()
 
             setValue = getWipeString(info);
         } else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
+            QDomElement elem = pa.toElement();
             QString realName = i18n(na.toElement().text().toUtf8().data());
             QString val = m_keyframeEditor->getValue(realName);
-            //kDebug() << "SET VALUE: " << val;
-            namenode.item(i).toElement().setAttribute("keyframes", val);
+            elem.setAttribute("keyframes", val);
+
+            if (m_keyframeEditor->isVisibleParam(realName))
+                elem.setAttribute("intimeline", "1");
+            else if (elem.hasAttribute("intimeline"))
+                elem.removeAttribute("intimeline");
         } else if (type == "url") {
             KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
             setValue = req->url().path();
index 5354a2429febbe6e5abf30637a30f5a6d165be15..c65c6c31475639156814c1c917d351f30623f11b 100644 (file)
@@ -23,6 +23,8 @@
 #include <KGlobalSettings>
 
 #include <QHeaderView>
+#include <QButtonGroup>
+#include <QRadioButton>
 
 KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, Timecode tc, int activeKeyframe, QWidget* parent) :
         QWidget(parent),
@@ -49,6 +51,7 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, Timecode t
     connect(keyframe_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotAdjustKeyframeInfo()));
     connect(keyframe_list, SIGNAL(cellChanged(int, int)), this, SLOT(slotGenerateParams(int, int)));
 
+    m_showButtons = new QButtonGroup(this);
     m_slidersLayout = new QGridLayout(param_sliders);
     keyframe_list->setSelectionBehavior(QAbstractItemView::SelectRows);
     keyframe_list->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -61,6 +64,7 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, Timecode t
     connect(buttonKeyframes, SIGNAL(clicked()), this, SLOT(slotKeyframeMode()));
     connect(buttonResetKeyframe, SIGNAL(clicked()), this, SLOT(slotResetKeyframe()));
     connect(keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframePos(int)));
+    connect(m_showButtons, SIGNAL(buttonClicked(int)), this, SLOT(slotUpdateVisibleParameter(int)));
 
     //connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int)));
 
@@ -108,6 +112,12 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
     connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
     m_slidersLayout->addWidget(doubleparam, columnId, 0);
 
+    QRadioButton *radio = new QRadioButton(this);
+    m_showButtons->addButton(radio, columnId);
+    if (e.attribute("intimeline") == "1")
+        radio->setChecked(true);
+    m_slidersLayout->addWidget(radio, columnId, 1);
+
     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();
@@ -398,4 +408,22 @@ void KeyframeEdit::slotResetKeyframe()
     }
 }
 
+void KeyframeEdit::slotUpdateVisibleParameter(int id)
+{
+    for (int i = 0; i < m_params.count(); ++i)
+        m_params[i].setAttribute("intimeline", (i == id ? "1" : "0"));
+    emit parameterChanged();
+}
+
+bool KeyframeEdit::isVisibleParam(const QString& name)
+{
+    for (int col = 0; col < keyframe_list->columnCount(); ++col) {
+        QDomNode na = m_params.at(col).firstChildElement("name");
+        QString paramName = i18n(na.toElement().text().toUtf8().data());
+        if (paramName == name)
+            return m_params.at(col).attribute("intimeline") == "1";
+    }
+    return false;
+}
+
 #include "keyframeedit.moc"
index 8a02defcd7a4d6aea31a1a50a267d44f5c89e3f8..23115b36b090a202d335767a617c77cbe8f9af82 100644 (file)
@@ -25,6 +25,7 @@
 #include <QAbstractItemView>
 #include <QSpinBox>
 
+class QButtonGroup;
 
 #include "ui_keyframeeditor_ui.h"
 #include "definitions.h"
@@ -86,12 +87,16 @@ public:
     /** @brief Updates the timecode display according to settings (frame number or hh:mm:ss:ff) */
     void updateTimecodeFormat();
 
+    /** @brief Returns true if the parameter @param name should be shown on the clip in timeline. */
+    bool isVisibleParam(const QString &name);
+
 private:
     QList <QDomElement> m_params;
     int m_min;
     int m_max;
     Timecode m_timecode;
     QGridLayout *m_slidersLayout;
+    QButtonGroup *m_showButtons;
 
     void generateAllParams();
     /** @brief Gets the position of a keyframe from the table.
@@ -118,6 +123,9 @@ private slots:
     /** @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);
+
 signals:
     void parameterChanged();
     void seekToPos(int);