Cleanup document loading, fix compatibility with older project files

parent 2fe1f2a4
......@@ -740,7 +740,7 @@ void Bin::setDocument(KdenliveDoc* project)
m_jobManager = new JobManager(this);
m_rootFolder = new ProjectFolder(this);
setEnabled(true);
connect(this, SIGNAL(producerReady(QString)), m_doc->renderer(), SLOT(slotProcessingDone(QString)));
connect(this, SIGNAL(producerReady(QString)), m_doc->renderer(), SLOT(slotProcessingDone(QString)), Qt::UniqueConnection);
connect(m_jobManager, SIGNAL(addClip(QString)), this, SLOT(slotAddUrl(QString)));
connect(m_proxyAction, SIGNAL(toggled(bool)), m_doc, SLOT(slotProxyCurrentItem(bool)));
connect(m_jobManager, SIGNAL(jobCount(int)), m_infoLabel, SLOT(slotSetJobCount(int)));
......
......@@ -57,7 +57,8 @@ ProjectClip::ProjectClip(const QString &id, QIcon thumb, ClipController *control
m_date = m_controller->date;
m_description = m_controller->description();
m_type = m_controller->clipType();
getFileHash();
// Make sure we have a hash for this clip
hash();
setParent(parent);
bin()->loadSubClips(id, m_controller->getPropertiesFromPrefix("kdenlive:clipzone."));
if (KdenliveSettings::audiothumbnails()) {
......@@ -291,7 +292,8 @@ void ProjectClip::setProducer(ClipController *controller, bool replaceProducer)
}
m_clipStatus = StatusReady;
bin()->emitItemUpdated(this);
getFileHash();
// Make sure we have a hash for this clip
hash();
createAudioThumbs();
}
......
......@@ -1081,6 +1081,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
for (int i = 0; i < entries.count(); i++) {
QDomElement entry = entries.at(i).toElement();
QString entryId = entry.attribute("producer");
if (entryId == "black") continue;
bool audioOnlyProducer = false;
if (trackRenaming.contains(entryId)) {
// rename
......@@ -1092,7 +1093,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
continue;
}
if (entryId.endsWith("_audio")) {
// Video only producers are not track aware
// Audio only producer
audioOnlyProducer = true;
entryId = entryId.section("_", 0, -2);
}
......@@ -1101,6 +1102,13 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
playlistForId.insert(entryId, entry.parentNode().toElement().attribute("id"));
continue;
}
if (entryId.startsWith("slowmotion:")) {
// Check broken slowmotion producers (they should not be track aware)
QString newId = "slowmotion:" + entryId.section(":", 1, 1).section("_", 0, 0) + ":" + entryId.section(":", 2);
trackRenaming.insert(entryId, newId);
entry.setAttribute("producer", newId);
continue;
}
QString track = entryId.section("_", 1, 1);
QString playlistId = entry.parentNode().toElement().attribute("id");
if (track == playlistId) continue;
......@@ -1134,6 +1142,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
for (int i = 0; i < producers.count(); ++i) {
QDomElement prod = producers.at(i).toElement();
QString id = prod.attribute("id");
if (id == "black") continue;
if (id.startsWith("slowmotion")) {
// No need to process slowmotion producers
QString slowmo = id.section(":", 1, 1).section("_", 0, 0);
......@@ -1172,26 +1181,13 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
if (id == prodId) {
// This is an original producer, move it to the main playlist
QDomElement entry = m_doc.createElement("entry");
entry.setAttribute("in", prod.attribute("in"));
entry.setAttribute("out", prod.attribute("out"));
entry.setAttribute("producer", id);
main_playlist.appendChild(entry);
QDomElement source = m_source_producers.value(id);
if (!source.isNull()) {
QString pxy = source.attribute("proxy");
if (pxy.length() > 1) {
EffectsList::setProperty(prod, "kdenlive:proxy", pxy);
EffectsList::setProperty(prod, "kdenlive:originalurl", source.attribute("resource"));
}
if (source.hasAttribute("file_hash")) {
EffectsList::setProperty(prod, "kdenlive:file_hash", source.attribute("file_hash"));
}
if (source.hasAttribute("file_size")) {
EffectsList::setProperty(prod, "kdenlive:file_size", source.attribute("file_size"));
}
if (source.hasAttribute("name")) {
EffectsList::setProperty(prod, "kdenlive:clipname", source.attribute("name"));
}
updateProducerInfo(prod, source);
entry.setAttribute("in", "0");
entry.setAttribute("out", QString::number(source.attribute("duration").toInt() - 1));
}
frag.appendChild(prod);
i--;
......@@ -1205,10 +1201,14 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
else if (id.endsWith("_video")) {
EffectsList::removeProperty(originalProd, "audio_index");
}
frag.appendChild(originalProd);
QDomElement source = m_source_producers.value(prodId);
QDomElement entry = m_doc.createElement("entry");
entry.setAttribute("in", prod.attribute("in"));
entry.setAttribute("out", prod.attribute("out"));
if (!source.isNull()) {
updateProducerInfo(originalProd, source);
entry.setAttribute("in", "0");
entry.setAttribute("out", QString::number(source.attribute("duration").toInt() - 1));
}
frag.appendChild(originalProd);
entry.setAttribute("producer", prodId);
main_playlist.appendChild(entry);
}
......@@ -1224,32 +1224,21 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomElement originalProd = prod.cloneNode().toElement();
originalProd.setTagName("producer");
EffectsList::setProperty(originalProd, "resource", originalProd.attribute("resource"));
QString pxy = originalProd.attribute("proxy");
if (pxy.length() > 1) {
EffectsList::setProperty(originalProd, "kdenlive:proxy", pxy);
EffectsList::setProperty(originalProd, "kdenlive:originalurl", originalProd.attribute("resource"));
}
if (originalProd.hasAttribute("file_hash")) {
EffectsList::setProperty(originalProd, "kdenlive:file_hash", originalProd.attribute("file_hash"));
}
if (originalProd.hasAttribute("file_size")) {
EffectsList::setProperty(originalProd, "kdenlive:file_size", originalProd.attribute("file_size"));
}
if (originalProd.hasAttribute("duration")) {
EffectsList::setProperty(originalProd, "length", originalProd.attribute("duration"));
}
if (originalProd.hasAttribute("name")) {
EffectsList::setProperty(originalProd, "kdenlive:clipname", originalProd.attribute("name"));
}
EffectsList::removeProperty(originalProd, "proxy");
EffectsList::removeProperty(originalProd, "type");
EffectsList::removeProperty(originalProd, "file_hash");
EffectsList::removeProperty(originalProd, "file_size");
EffectsList::removeProperty(originalProd, "frame_size");
EffectsList::removeProperty(originalProd, "proxy_out");
EffectsList::removeProperty(originalProd, "name");
int type = originalProd.attribute("type").toInt();
updateProducerInfo(originalProd, prod);
originalProd.removeAttribute("proxy");
originalProd.removeAttribute("type");
originalProd.removeAttribute("file_hash");
originalProd.removeAttribute("file_size");
originalProd.removeAttribute("frame_size");
originalProd.removeAttribute("proxy_out");
originalProd.removeAttribute("zone_out");
originalProd.removeAttribute("zone_in");
originalProd.removeAttribute("name");
originalProd.removeAttribute("type");
originalProd.removeAttribute("duration");
originalProd.removeAttribute("cutzones");
int type = prod.attribute("type").toInt();
QString mlt_service;
switch (type) {
case 4:
......@@ -1272,8 +1261,8 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
EffectsList::setProperty(originalProd, "mlt_service", mlt_service);
EffectsList::setProperty(originalProd, "mlt_type", "producer");
QDomElement entry = m_doc.createElement("entry");
entry.setAttribute("in", originalProd.attribute("in"));
entry.setAttribute("out", originalProd.attribute("out"));
entry.setAttribute("in", "0");
entry.setAttribute("out", QString::number(prod.attribute("duration").toInt() - 1));
entry.setAttribute("producer", id);
main_playlist.appendChild(entry);
frag.appendChild(originalProd);
......@@ -1281,13 +1270,9 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
}
}
// Set clip folders
for (int j = 0; j < kdenlive_producers.count(); j++) {
QDomElement prod = kdenlive_producers.at(j).toElement();
QString prodName = prod.attribute("name");
QString prodHash = prod.attribute("file_hash");
QString prodSize = prod.attribute("file_size");
QString id = prod.attribute("id");
QString folder = prod.attribute("groupid");
QDomNodeList mlt_producers = frag.childNodes();
......@@ -1303,30 +1288,6 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
prop.appendChild(val);
mltprod.appendChild(prop);
}
/*if (!prodName.isEmpty()) {
// Set clip name
QDomElement prop = m_doc.createElement("property");
prop.setAttribute("name", "kdenlive:clipname");
QDomText val = m_doc.createTextNode(prodName);
prop.appendChild(val);
mltprod.appendChild(prop);
}
if (!prodHash.isEmpty()) {
// Set clip name
QDomElement prop = m_doc.createElement("property");
prop.setAttribute("name", "kdenlive:file_hash");
QDomText val = m_doc.createTextNode(prodHash);
prop.appendChild(val);
mltprod.appendChild(prop);
}
if (!prodSize.isEmpty()) {
// Set clip name
QDomElement prop = m_doc.createElement("property");
prop.setAttribute("name", "kdenlive:file_size");
QDomText val = m_doc.createTextNode(prodSize);
prop.appendChild(val);
mltprod.appendChild(prop);
}*/
break;
}
}
......@@ -1375,6 +1336,10 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
}
frag.appendChild(main_playlist);
mlt.insertBefore(frag, firstProd);
// Remove deprecated Kdenlive extra info from xml doc before sending it to MLT
QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
if (!infoXml.isNull()) mlt.removeChild(infoXml);
}
if (version < 0.91) {
......@@ -1444,6 +1409,43 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
return true;
}
void DocumentValidator::updateProducerInfo(QDomElement prod, const QDomElement source)
{
QString pxy = source.attribute("proxy");
if (pxy.length() > 1) {
EffectsList::setProperty(prod, "kdenlive:proxy", pxy);
EffectsList::setProperty(prod, "kdenlive:originalurl", source.attribute("resource"));
}
if (source.hasAttribute("file_hash")) {
EffectsList::setProperty(prod, "kdenlive:file_hash", source.attribute("file_hash"));
}
if (source.hasAttribute("file_size")) {
EffectsList::setProperty(prod, "kdenlive:file_size", source.attribute("file_size"));
}
if (source.hasAttribute("name")) {
EffectsList::setProperty(prod, "kdenlive:clipname", source.attribute("name"));
}
if (source.hasAttribute("zone_out")) {
EffectsList::setProperty(prod, "kdenlive:zone_out", source.attribute("zone_out"));
}
if (source.hasAttribute("zone_in")) {
EffectsList::setProperty(prod, "kdenlive:zone_in", source.attribute("zone_in"));
}
if (source.hasAttribute("cutzones")) {
QString zoneData = source.attribute("cutzones");
QStringList zoneList = zoneData.split(";");
int ct = 1;
foreach (const QString data, zoneList) {
QString zoneName = data.section("-", 2);
if (zoneName.isEmpty()) {
zoneName = i18n("Zone %1", ct++);
}
EffectsList::setProperty(prod, "kdenlive:clipzone." + zoneName, data.section("-", 0, 0) + ";" + data.section("-", 1, 1));
}
}
}
QStringList DocumentValidator::getInfoFromEffectName(const QString &oldName)
{
QStringList info;
......@@ -1532,8 +1534,6 @@ QString DocumentValidator::colorToString(const QColor& c)
bool DocumentValidator::isProject() const
{
return m_doc.documentElement().tagName() == "mlt";
/*QDomNode infoXmlNode = m_doc.elementsByTagName("kdenlivedoc").at(0);
return !infoXmlNode.isNull();*/
}
bool DocumentValidator::isModified() const
......
......@@ -45,6 +45,8 @@ private:
bool m_modified;
/** @brief Upgrade from a previous Kdenlive document version. */
bool upgrade(double version, const double currentVersion);
/** @brief Pass producer properties from previous Kdenlive versions. */
void updateProducerInfo(QDomElement prod, const QDomElement source);
/** @brief Make sur we don't have orphaned producers (that are not in Bin). */
void checkOrphanedProducers();
QStringList getInfoFromEffectName(const QString &oldName);
......
......@@ -49,7 +49,6 @@
#include <KBookmarkManager>
#include <KBookmark>
#include <QProgressDialog>
#include <QCryptographicHash>
#include <QFile>
#include <QDebug>
......@@ -72,7 +71,7 @@
const double DOCUMENTVERSION = 0.91;
KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, NotesPlugin *notes, bool *openBackup, MainWindow *parent, QProgressDialog *progressDialog) :
KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, NotesPlugin *notes, bool *openBackup, MainWindow *parent) :
QObject(parent),
m_autosave(NULL),
m_url(url),
......@@ -227,77 +226,19 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
qDebug()<<" // / processing file validate ok";
parent->slotGotProgressInfo(i18n("Check missing clips"), 0);
qApp->processEvents();
success = checkDocumentClips();
DocumentChecker d(m_document);
success = !d.hasErrorInClips();
if (success) {
loadDocumentProperties();
if (m_document.documentElement().attribute("modified") == "1") setModified(true);
parent->slotGotProgressInfo(i18n("Loading"), 0);
QDomElement mlt = m_document.firstChildElement("mlt");
QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
QDomElement e;
QStringList expandedFolders;
QDomNodeList folders = m_document.elementsByTagName("folder");
for (int i = 0; i < folders.count(); ++i) {
e = folders.item(i).cloneNode().toElement();
if (e.hasAttribute("opened")) expandedFolders.append(e.attribute("id"));
//Deprecated
//m_clipManager->addFolder(e.attribute("id"), e.attribute("name"));
}
m_documentProperties["expandedfolders"] = expandedFolders.join(";");
QDomNodeList producers = m_document.elementsByTagName("producer");
const int max = producers.count();
if (!progressDialog) {
progressDialog = new QProgressDialog(parent);
progressDialog->setWindowTitle(i18n("Loading project"));
progressDialog->setLabelText(i18n("Adding clips"));
progressDialog->setCancelButton(0);
} else {
progressDialog->setLabelText(i18n("Adding clips"));
}
progressDialog->setMaximum(max);
progressDialog->show();
qApp->processEvents();
if (success) {
/*QDomElement markers = infoXml.firstChildElement("markers");
if (!markers.isNull()) {
QDomNodeList markerslist = markers.childNodes();
int maxchild = markerslist.count();
for (int k = 0; k < maxchild; ++k) {
e = markerslist.at(k).toElement();
if (e.tagName() == "marker") {
CommentedTime marker(GenTime(e.attribute("time").toDouble()), e.attribute("comment"), e.attribute("type").toInt());
ClipController *controller = getClipController(e.attribute("id"));
if (controller) controller->addSnapMarker(marker);
else qDebug()<< " / / Warning, missing clip: "<< e.attribute("id");
}
}
infoXml.removeChild(markers);
}
m_projectFolder = QUrl::fromLocalFile(infoXml.attribute("projectfolder"));*/
/*QDomElement docproperties = infoXml.firstChildElement("documentproperties");
QDomNamedNodeMap props = docproperties.attributes();
for (int i = 0; i < props.count(); ++i)
m_documentProperties.insert(props.item(i).nodeName(), props.item(i).nodeValue());
docproperties = infoXml.firstChildElement("documentmetadata");
props = docproperties.attributes();
for (int i = 0; i < props.count(); ++i)
m_documentMetadata.insert(props.item(i).nodeName(), props.item(i).nodeValue());
*/
if (validator.isModified()) setModified(true);
//qDebug() << "Reading file: " << url.path() << ", found clips: " << producers.count();
}
if (validator.isModified()) setModified(true);
}
}
}
}
}
}
// Something went wrong, or a new file was requested: create a new project
if (!success) {
m_url.clear();
......@@ -1179,43 +1120,6 @@ void KdenliveDoc::cacheImage(const QString &fileId, const QImage &img) const
img.save(QDir::cleanPath(m_projectFolder.path() +QDir::separator() + "thumbs/" + fileId + ".png"));
}
bool KdenliveDoc::checkDocumentClips()
{
DocumentChecker d(m_document);
return (d.hasErrorInClips() == false);
/* int clipType;
QDomElement e;
QString id;
QString resource;
QList <QDomElement> missingClips;
for (int i = 0; i < infoproducers.count(); ++i) {
e = infoproducers.item(i).toElement();
clipType = e.attribute("type").toInt();
if (clipType == COLOR) continue;
if (clipType == TEXT) {
//TODO: Check is clip template is missing (xmltemplate) or hash changed
continue;
}
id = e.attribute("id");
resource = e.attribute("resource");
if (clipType == SLIDESHOW) resource = QUrl(resource).directory();
if (!KIO::NetAccess::exists(QUrl(resource), KIO::NetAccess::SourceSide, 0)) {
// Missing clip found
missingClips.append(e);
} else {
// Check if the clip has changed
if (clipType != SLIDESHOW && e.hasAttribute("file_hash")) {
if (e.attribute("file_hash") != DocClipBase::getHash(e.attribute("resource")))
e.removeAttribute("file_hash");
}
}
}
if (missingClips.isEmpty()) return true;
DocumentChecker d(missingClips, m_document);
return (d.exec() == QDialog::Accepted);*/
}
void KdenliveDoc::setDocumentProperty(const QString &name, const QString &value)
{
m_documentProperties[name] = value;
......
......@@ -51,7 +51,6 @@ class ProjectClip;
class ClipController;
class QTextEdit;
class QProgressDialog;
class QUndoGroup;
class QTimer;
class QUndoStack;
......@@ -65,7 +64,7 @@ class KdenliveDoc: public QObject
Q_OBJECT
public:
KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, NotesPlugin *notes, bool *openBackup, MainWindow *parent = 0, QProgressDialog *progressDialog = 0);
KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, NotesPlugin *notes, bool *openBackup, MainWindow *parent = 0);
~KdenliveDoc();
QDomNodeList producersList();
double fps() const;
......@@ -185,13 +184,6 @@ private:
void setNewClipResource(const QString &id, const QString &path);
QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
void moveProjectData(const QUrl &url);
/**
* @brief check for issues with the clips in the project
* Instansiates DocumentChecker objects to do this task.
* @param infoproducers
* @return
*/
bool checkDocumentClips();
/** @brief Creates a new project. */
QDomDocument createEmptyDocument(int videotracks, int audiotracks);
......
......@@ -1466,6 +1466,7 @@ void MainWindow::slotCheckRenderStatus()
void MainWindow::setRenderingProgress(const QString &url, int progress)
{
qDebug()<<" / / /GOT RENDER PROGRESS: "<<progress;
if (m_renderWidget)
m_renderWidget->setRenderJob(url, progress);
}
......
......@@ -93,7 +93,8 @@ void BinController::initializeBin(Mlt::Playlist playlist)
// Fill Controller's list
m_binPlaylist = new Mlt::Playlist(playlist);
m_binPlaylist->set("id", kPlaylistTrackId);
for (int i = 0; i < m_binPlaylist->count(); i++) {
int max = m_binPlaylist->count();
for (int i = 0; i < max; i++) {
Mlt::Producer *producer = m_binPlaylist->get_clip(i);
if (producer->is_blank() || !producer->is_valid()) continue;
QString id = producer->parent().get("id");
......@@ -130,6 +131,7 @@ void BinController::initializeBin(Mlt::Playlist playlist)
m_clipList.insert(id, controller);
}
}
emit loadingBin(i + 1);
}
// Load markers
Mlt::Properties markerProperties;
......
......@@ -199,6 +199,8 @@ signals:
void updateTimelineProducer(const QString &);
/** @brief We want to replace a clip with another, but before we need to change clip producer id so that there is no interference*/
void prepareTimelineReplacement(const QString &);
/** @brief Indicate which clip we are loading */
void loadingBin(int);
};
#endif
......@@ -43,7 +43,8 @@ the Free Software Foundation, either version 3 of the License, or
ProjectManager::ProjectManager(QObject* parent) :
QObject(parent),
m_project(0),
m_trackView(0)
m_trackView(0),
m_progressDialog(NULL)
{
m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), pCore->window()->actionCollection());
m_fileRevert->setIcon(KoIconUtils::themedIcon("document-revert"));
......@@ -164,6 +165,7 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
bool ok;
pCore->bin()->setDocument(doc);
m_trackView = new Timeline(doc, pCore->window()->kdenliveCategoryMap.value("timeline")->actions(), &ok, pCore->window());
m_trackView->loadTimeline();
pCore->window()->m_timelineArea->addTab(m_trackView, QIcon::fromTheme("kdenlive"), doc->description());
m_project = doc;
if (!ok) {
......@@ -433,22 +435,18 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
delete pCore->window()->m_stopmotion;
pCore->window()->m_stopmotion = NULL;
}
QProgressDialog progressDialog(pCore->window());
progressDialog.setWindowTitle(i18n("Loading project"));
progressDialog.setCancelButton(0);
progressDialog.setMaximum(4);
progressDialog.setValue(0);
progressDialog.setLabelText(i18n("Loading clips"));
progressDialog.show();
if (m_progressDialog) {
delete m_progressDialog;
}
m_progressDialog = new QProgressDialog(pCore->window());
m_progressDialog->setWindowTitle(i18n("Loading project"));
m_progressDialog->setCancelButton(0);
m_progressDialog->setLabelText(i18n("Loading playlist"));
m_progressDialog->setMaximum(0);
m_progressDialog->show();
bool openBackup;
m_notesPlugin->clear();
KdenliveDoc *doc = new KdenliveDoc(stale ? QUrl::fromLocalFile(stale->fileName()) : url, QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()), pCore->window()->m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), pCore->monitorManager()->projectMonitor()->render, m_notesPlugin, &openBackup, pCore->window(), &progressDialog);
progressDialog.setLabelText(i18n("Loading thumbnails"));
progressDialog.setMaximum(4);
progressDialog.setValue(1);
progressDialog.repaint();
KdenliveDoc *doc = new KdenliveDoc(stale ? QUrl::fromLocalFile(stale->fileName()) : url, QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()), pCore->window()->m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), pCore->monitorManager()->projectMonitor()->render, m_notesPlugin, &openBackup, pCore->window());
if (stale == NULL) {
stale = new KAutoSaveFile(url, doc);
doc->m_autosave = stale;
......@@ -463,24 +461,22 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
doc->setModified(true);
stale->setParent(doc);
}
m_progressDialog->setLabelText(i18n("Loading clips"));
connect(doc, SIGNAL(progressInfo(QString,int)), pCore->window(), SLOT(slotGotProgressInfo(QString,int)));
pCore->bin()->setDocument(doc);
progressDialog.setLabelText(i18n("Loading timeline"));
progressDialog.setValue(2);
progressDialog.repaint();
bool ok;
m_progressDialog->setLabelText(i18n("Loading clips"));
m_trackView = new Timeline(doc, pCore->window()->kdenliveCategoryMap.value("timeline")->actions(), &ok, pCore->window());
connect(m_trackView, &Timeline::startLoadingBin, m_progressDialog, &QProgressDialog::setMaximum, Qt::DirectConnection);
connect(m_trackView, &Timeline::loadingBin, m_progressDialog, &QProgressDialog::setValue, Qt::DirectConnection);
m_trackView->loadTimeline();
m_trackView->loadGuides(pCore->binController()->takeGuidesData());
m_project = doc;
pCore->window()->connectDocument();
emit docOpened(m_project);
progressDialog.setLabelText(i18n("Setting monitor"));
progressDialog.setValue(3);
progressDialog.repaint();
pCore->window()->m_timelineArea->setCurrentIndex(pCore->window()->m_timelineArea->addTab(m_trackView, QIcon::fromTheme("kdenlive"), m_project->description()));
if (!ok) {
pCore->window()->m_timelineArea->setEnabled(false);
......@@ -494,11 +490,12 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
pCore->window()->slotGotProgressInfo(QString(), -1);
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_trackView->duration());
pCore->monitorManager()->projectMonitor()->slotZoneMoved(m_trackView->inPoint(), m_trackView->outPoint());
progressDialog.setValue(4);
if (openBackup) {
slotOpenBackup(url);
}
m_lastSave.start();
delete m_progressDialog;
m_progressDialog = NULL;
}
void ProjectManager::slotRevert()
......