Backport:

FIx transitions broken when openin doc in non english locale:
http://kdenlive.org/mantis/view.php?id=1450

svn path=/branches/release-0_7_7/kdenlive/; revision=4333
parent 94654e4e
......@@ -344,32 +344,32 @@ void TrackView::parseDocument(QDomDocument doc)
QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service, transitionId).cloneNode().toElement();
for (int k = 0; k < transitionparams.count(); k++) {
p = transitionparams.item(k).toElement();
if (!p.isNull()) {
QString paramName = p.attribute("name");
QString paramValue = p.text();
QDomNodeList params = base.elementsByTagName("parameter");
if (paramName != "a_track" && paramName != "b_track") for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull() && e.attribute("tag") == paramName) {
if (e.attribute("type") == "double") {
QString factor = e.attribute("factor", "1");
if (factor != "1") {
double fact;
if (factor.startsWith('%')) {
fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
} else fact = factor.toDouble();
double val = paramValue.toDouble() * fact;
paramValue = QString::number(val);
p = transitionparams.item(k).toElement();
if (!p.isNull()) {
QString paramName = p.attribute("name");
QString paramValue = p.text();
QDomNodeList params = base.elementsByTagName("parameter");
if (paramName != "a_track" && paramName != "b_track") for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull() && e.attribute("tag") == paramName) {
if (e.attribute("type") == "double") {
QString factor = e.attribute("factor", "1");
if (factor != "1") {
double fact;
if (factor.startsWith('%')) {
fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
} else fact = factor.toDouble();
double val = paramValue.toDouble() * fact;
paramValue = QString::number(val);
}
}
e.setAttribute("value", paramValue);
break;
}
e.setAttribute("value", paramValue);
break;
}
}
}
}
}
/*QDomDocument doc;
doc.appendChild(doc.importNode(base, true));
......
......@@ -92,14 +92,16 @@ Transition *Transition::clone()
return tr;
}
QString Transition::transitionName() const
QString Transition::transitionTag() const
{
return m_name;
return m_parameters.attribute("tag");
}
QString Transition::transitionTag() const
QStringList Transition::transitionInfo() const
{
return m_parameters.attribute("tag");
QStringList info;
info << m_name << m_parameters.attribute("tag") << m_parameters.attribute("id");
return info;
}
bool Transition::isAutomatic() const
......
......@@ -54,8 +54,8 @@ public:
bool hasClip(const ClipItem * clip) const;
bool belongsToClip(const ClipItem * clip) const;
bool invertedTransition() const;
QString transitionName() const;
QString transitionTag() const;
QStringList transitionInfo() const;
OPERATIONTYPE operationMode(QPointF pos);
//const QMap < QString, QString > transitionParameters() const;
void setTransitionParameters(const QDomElement params);
......
......@@ -42,7 +42,7 @@ TransitionSettings::TransitionSettings(QWidget* parent) :
connect(m_effectEdit, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
setEnabled(false);
QMap<QString, QStringList> transitionsList;
QList<QStringList> transitionsList;
int max = MainWindow::transitions.effectNames().count();
QStringList transitionInfo;
int ix = 0;
......@@ -50,11 +50,13 @@ TransitionSettings::TransitionSettings(QWidget* parent) :
for (; ix < max; ix++) {
transitionInfo = MainWindow::transitions.effectIdInfo(ix);
transitionInfo << QString::number(ix);
transitionsList.insert(transitionInfo.at(0).toLower(), transitionInfo);
transitionsList.append(transitionInfo);
}
ix = 0;
foreach(const QStringList &value, transitionsList) {
transitionList->addItem(value.at(0));
QStringList data = value;
if (!data.isEmpty()) data.removeLast();
transitionList->addItem(value.at(0), data);
transitionList->setItemData(ix, MainWindow::transitions.getInfoFromIndex(value.last().toInt()), Qt::ToolTipRole);
ix++;
}
......@@ -150,7 +152,7 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, int nextTrack
if (!t->forcedTrack()) transitionTrack->setCurrentIndex(0);
else transitionTrack->setCurrentIndex(m_tracksCount + 1 - t->transitionEndTrack());
transitionTrack->blockSignals(false);
int ix = transitionList->findText(t->transitionName(), Qt::MatchExactly);
int ix = transitionList->findData(t->transitionInfo(), Qt::UserRole, Qt::MatchExactly);
m_usedTransition = t;
if (ix != -1) {
transitionList->blockSignals(true);
......
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