success = m_document.setContent(&file, false, &errorMsg);
file.close();
KIO::NetAccess::removeTempFile(tmpFile);
+
if (!success) // It is corrupted
KMessageBox::error(parent, errorMsg);
else {
int KdenliveDoc::setSceneList()
{
- m_render->resetProfile();
+ m_render->resetProfile(KdenliveSettings::current_profile());
if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
// INVALID MLT Consumer, something is wrong
return -1;
m_documentProperties.remove("position");
// m_document xml is now useless, clear it
m_document.clear();
- checkProjectClips();
return 0;
}
-QDomDocument KdenliveDoc::createEmptyDocument(const int videotracks, const int audiotracks)
+QDomDocument KdenliveDoc::createEmptyDocument(int videotracks, int audiotracks)
{
- // Creating new document
- QDomDocument doc;
- QDomElement mlt = doc.createElement("mlt");
- doc.appendChild(mlt);
-
-
TrackInfo videoTrack;
videoTrack.type = VIDEOTRACK;
videoTrack.isMute = false;
audioTrack.isBlind = true;
audioTrack.isLocked = false;
+ m_tracksList.clear();
+
+ for (int i = 0; i < audiotracks; i++) {
+ m_tracksList.append(audioTrack);
+ }
+ for (int i = 0; i < videotracks; i++) {
+ m_tracksList.append(videoTrack);
+ }
+ return createEmptyDocument(m_tracksList);
+}
+
+QDomDocument KdenliveDoc::createEmptyDocument(QList <TrackInfo> tracks)
+{
+ // Creating new document
+ QDomDocument doc;
+ QDomElement mlt = doc.createElement("mlt");
+ doc.appendChild(mlt);
+
+
// Create black producer
// For some unknown reason, we have to build the black producer here and not in renderer.cpp, otherwise
// the composite transitions with the black track are corrupted.
playlist.appendChild(blank0);
// create playlists
- int total = audiotracks + videotracks + 1;
+ int total = tracks.count() + 1;
for (int i = 1; i < total; i++) {
QDomElement playlist = doc.createElement("playlist");
tractor.appendChild(track0);
// create audio tracks
- for (int i = 1; i < audiotracks + 1; i++) {
- QDomElement track = doc.createElement("track");
- track.setAttribute("producer", "playlist" + QString::number(i));
- track.setAttribute("hide", "video");
- tractor.appendChild(track);
- m_tracksList.append(audioTrack);
- }
-
- // create video tracks
- for (int i = audiotracks + 1; i < total; i++) {
+ for (int i = 1; i < total; i++) {
QDomElement track = doc.createElement("track");
track.setAttribute("producer", "playlist" + QString::number(i));
+ if (tracks.at(i - 1).type == AUDIOTRACK)
+ track.setAttribute("hide", "video");
+ else if (tracks.at(i - 1).isBlind)
+ track.setAttribute("hide", "video");
+ if (tracks.at(i - 1).isMute)
+ track.setAttribute("hide", "audio");
tractor.appendChild(track);
- m_tracksList.append(videoTrack);
}
for (int i = 2; i < total ; i++) {
return m_profile;
}
-void KdenliveDoc::setProfilePath(QString path)
+bool KdenliveDoc::setProfilePath(QString path)
{
if (path.isEmpty()) path = KdenliveSettings::default_profile();
if (path.isEmpty()) path = "dv_pal";
m_profile = ProfilesDialog::getVideoProfile(path);
+ bool current_fps = m_fps;
if (m_profile.path.isEmpty()) {
// Profile not found, use embedded profile
QDomElement profileInfo = m_document.elementsByTagName("profileinfo").at(0).toElement();
kDebug() << "Kdenlive document, init timecode from path: " << path << ", " << m_fps;
if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(m_fps, true);
else m_timecode.setFormat(m_fps);
+ return (current_fps != m_fps);
}
double KdenliveDoc::dar()
if (createClipItem) {
emit addProjectClip(clip);
- qApp->processEvents();
- m_render->getFileProperties(clip->toXML(), clip->getId(), true);
+ //qApp->processEvents();
}
}
}
}
-void KdenliveDoc::deleteProjectClip(QList <QString> ids)
+void KdenliveDoc::deleteProjectClip(QStringList ids)
{
for (int i = 0; i < ids.size(); ++i) {
emit deleteTimelineClip(ids.at(i));
- m_clipManager->slotDeleteClip(ids.at(i));
}
+ m_clipManager->slotDeleteClips(ids);
setModified(true);
}