Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

First step towards compatibility of older kdenlive project files

parent cf21817c
......@@ -1764,10 +1764,59 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
// rename main bin playlist
QDomNodeList playlists = m_doc.elementsByTagName(QStringLiteral("playlist"));
QDomElement playlist;
QDomNode mlt = m_doc.firstChildElement(QStringLiteral("mlt"));
QDomNode tractor = mlt.firstChildElement(QStringLiteral("tractor"));
// AV clips are not supported anymore. Check if we have some and add extra audio tracks if necessary
// Update the main bin name as well to be xml compliant
for (int i = 0; i < playlists.count(); i++) {
if ("id")) == QLatin1String("main bin")) {"id"), BinPlaylist::binPlaylistId);
} else {
const QString playlistName = QString("_%1").arg("id")));
QDomElement duplicate_playlist = m_doc.createElement(QStringLiteral("playlist"));
duplicate_playlist.setAttribute(QStringLiteral("id"), QString("%1_duplicate").arg(playlistName));
QDomElement pltype = m_doc.createElement(QStringLiteral("property"));
pltype.setAttribute(QStringLiteral("name"), QStringLiteral("kdenlive:audio_track"));
QDomText value1 = m_doc.createTextNode(QStringLiteral("1"));
QDomElement plname = m_doc.createElement(QStringLiteral("property"));
plname.setAttribute(QStringLiteral("name"), QStringLiteral("kdenlive:track_name"));
QDomText value = m_doc.createTextNode(i18n("extra audio"));
QDomNodeList producers =;
bool duplicationRequested = false;
qDebug()<<"// processing playlist: "<<"id"));
for (int j = 0; j < producers.count(); j++) {
if ( == QLatin1String("blank")) {
// blank, duplicate
} else if ("producer")).endsWith(playlistName)) {
// This is an AV clip
QDomNode prod =;
prod.toElement().setAttribute(QLatin1String("set.test_video"), QStringLiteral("1"));
duplicationRequested = true;
} else {
// no duplication needed, replace with blank
QDomElement duplicate = m_doc.createElement(QStringLiteral("blank"));
int in ="in")).toInt();
int out ="out")).toInt();
duplicate.setAttribute(QStringLiteral("length"), QString::number(out - in));
if (duplicationRequested) {
// Plant the playlist at the end
mlt.insertBefore(duplicate_playlist, tractor);
QDomNode lastTrack = tractor.firstChildElement(QStringLiteral("track"));
QDomElement duplicate = m_doc.createElement(QStringLiteral("track"));
duplicate.setAttribute(QStringLiteral("producer"), QString("%1_duplicate").arg(playlistName));
duplicate.setAttribute(QStringLiteral("hide"), QStringLiteral("video"));
tractor.insertAfter(duplicate, lastTrack);
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