Restore autosave

parent 531b54de
......@@ -417,25 +417,20 @@ bool KdenliveDoc::autoGenerateImageProxy(int width) const
width > m_documentProperties.value(QStringLiteral("proxyimageminsize")).toInt();
}
void KdenliveDoc::slotAutoSave()
void KdenliveDoc::slotAutoSave(const QString &scene)
{
// TODO: re-enable when qml timeline is ready
return;
if (m_autosave != nullptr) {
if (!m_autosave->isOpen() && !m_autosave->open(QIODevice::ReadWrite)) {
// show error: could not open the autosave file
qCDebug(KDENLIVE_LOG) << "ERROR; CANNOT CREATE AUTOSAVE FILE";
}
// qCDebug(KDENLIVE_LOG) << "// AUTOSAVE FILE: " << m_autosave->fileName();
QDomDocument sceneList =
xmlSceneList(pCore->monitorManager()->projectMonitor()->sceneList(m_url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).toLocalFile()));
if (sceneList.isNull()) {
if (scene.isEmpty()) {
// Make sure we don't save if scenelist is corrupted
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot write to file %1, scene list is corrupted.", m_autosave->fileName()));
return;
}
m_autosave->resize(0);
m_autosave->write(sceneList.toString().toUtf8());
m_autosave->write(scene.toUtf8());
m_autosave->flush();
}
}
......
......@@ -208,7 +208,7 @@ public slots:
QUndoCommand *masterCommand = nullptr);
/** @brief Saves the current project at the autosave location.
* @description The autosave files are in ~/.kde/data/stalefiles/kdenlive/ */
void slotAutoSave();
void slotAutoSave(const QString &scene);
/** @brief Groups were changed, save to MLT. */
void groupsChanged(const QString &groups);
......
......@@ -672,8 +672,6 @@ KRecentFilesAction *ProjectManager::recentFilesAction()
void ProjectManager::slotStartAutoSave()
{
// TODO REFAC: port to new timeline
return;
if (m_lastSave.elapsed() > 300000) {
// If the project was not saved in the last 5 minute, force save
m_autoSaveTimer.stop();
......@@ -685,23 +683,18 @@ void ProjectManager::slotStartAutoSave()
void ProjectManager::slotAutoSave()
{
// TODO refac: repair this
/*
prepareSave();
bool multitrackEnabled = m_trackView->multitrackView;
if (multitrackEnabled) {
// Multitrack view was enabled, disable for auto save
m_trackView->slotMultitrackView(false);
}
m_trackView->connectOverlayTrack(false);
m_project->slotAutoSave();
m_trackView->connectOverlayTrack(true);
if (multitrackEnabled) {
// Multitrack view was enabled, re-enable for auto save
m_trackView->slotMultitrackView(true);
QString saveFolder = m_project->url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).toLocalFile();
QString scene = projectSceneList(saveFolder);
if (!m_replacementPattern.isEmpty()) {
QMapIterator<QString, QString> i(m_replacementPattern);
while (i.hasNext()) {
i.next();
scene.replace(i.key(), i.value());
}
}
m_project->slotAutoSave(scene);
m_lastSave.start();
*/
}
QString ProjectManager::projectSceneList(const QString &outputFolder)
......
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