Fix keyframe editing

svn path=/trunk/kdenlive/; revision=4299
parent 591eb366
......@@ -122,6 +122,7 @@ void EffectStackEdit::updateParameter(const QString &name, const QString &value)
void EffectStackEdit::transferParamDesc(const QDomElement d, int in, int out)
{
clearAllItems();
if (m_keyframeEditor) delete m_keyframeEditor;
m_keyframeEditor = NULL;
m_params = d;
m_in = in;
......@@ -425,8 +426,8 @@ void EffectStackEdit::collectAllParameters()
else if (type == "position") paramName.append("position");
else if (type == "geometry") paramName.append("geometry");
else if (type == "keyframe") paramName.append("keyframe");
if (!m_valueItems.contains(paramName)) {
// kDebug() << "// Param: " << paramName << " NOT FOUND";
if (type != "simplekeyframe" && !m_valueItems.contains(paramName)) {
kDebug() << "// Param: " << paramName << " NOT FOUND";
continue;
}
......@@ -490,8 +491,12 @@ void EffectStackEdit::collectAllParameters()
else info.end = RIGHT;
info.endTransparency = wp->end_transp->value();
setValue = getWipeString(info);
} else if ((type == "simplekeyframe" || type == "keyframe") && m_keyframeEditor) {
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);
}
if (!setValue.isNull()) {
pa.attributes().namedItem("value").setNodeValue(setValue);
}
......@@ -540,5 +545,6 @@ void EffectStackEdit::clearAllItems()
delete child;
if (wid) delete wid;
}
m_keyframeEditor = NULL;
blockSignals(false);
}
......@@ -36,7 +36,7 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, int minVal
{
kDebug() << " / / / /MODIFIED KFR: " << m_active_keyframe;
setupUi(this);
m_params.append(e);
m_params.append(e.cloneNode().toElement());
keyframe_list->setFont(KGlobalSettings::generalFont());
keyframe_seek->setChecked(KdenliveSettings::keyframeseek());
connect(keyframe_seek, SIGNAL(stateChanged(int)), this, SLOT(slotSetSeeking(int)));
......@@ -82,7 +82,7 @@ KeyframeEdit::~KeyframeEdit()
void KeyframeEdit::addParameter(QDomElement e)
{
keyframe_list->blockSignals(true);
m_params.append(e);
m_params.append(e.cloneNode().toElement());
QDomNode na = e.firstChildElement("name");
QString paramName = i18n(na.toElement().text().toUtf8().data());
int columnId = keyframe_list->columnCount();
......@@ -158,7 +158,7 @@ void KeyframeEdit::setupParam()
if (first) keyframe_list->setCurrentItem(first);*/
keyframe_list->blockSignals(false);
//keyframe_list->setCurrentCell(0, 0);
//slotAdjustKeyframeInfo();
slotAdjustKeyframeInfo(false);
button_delete->setEnabled(keyframe_list->rowCount() > 1);
}
......@@ -296,6 +296,17 @@ void KeyframeEdit::generateAllParams()
emit parameterChanged();
}
const QString KeyframeEdit::getValue(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());
kDebug() << paramName << " == " << name;
if (paramName == name) return m_params.at(col).attribute("keyframes");
}
return QString();
}
void KeyframeEdit::slotAdjustKeyframeInfo(bool seek)
{
QTableWidgetItem *item = keyframe_list->currentItem();
......
......@@ -79,6 +79,7 @@ public:
virtual ~KeyframeEdit();
void setupParam();
void addParameter(QDomElement e);
const QString getValue(const QString &name);
private:
QList <QDomElement> m_params;
......@@ -88,7 +89,7 @@ private:
int m_maxVal;
Timecode m_timecode;
int m_previousPos;
KeyItemDelegate *m_delegate;
//KeyItemDelegate *m_delegate;
void generateAllParams();
QGridLayout *m_slidersLayout;
int m_active_keyframe;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment