From: Till Theato Date: Sun, 7 Nov 2010 16:25:07 +0000 (+0000) Subject: Make the keyframe parameter which can be edited in timeline selectable X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9eb4f43c51f57626d38b3448b042c07471d36ed4;p=kdenlive Make the keyframe parameter which can be edited in timeline selectable svn path=/trunk/kdenlive/; revision=5079 --- diff --git a/effects/frei0r_sopsat.xml b/effects/frei0r_sopsat.xml index 8b4cb23a..92e03999 100644 --- a/effects/frei0r_sopsat.xml +++ b/effects/frei0r_sopsat.xml @@ -42,7 +42,7 @@ Power (Gamma) Alpha - + Overall Saturation diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 41dea033..e80e3fcd 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -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(); diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index bbb606ff..6c96d251 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -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(); diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index 5354a242..c65c6c31 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -23,6 +23,8 @@ #include #include +#include +#include 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" diff --git a/src/keyframeedit.h b/src/keyframeedit.h index 8a02defc..23115b36 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -25,6 +25,7 @@ #include #include +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 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);