summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-12 19:32:54 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-12 19:32:54 (GMT)
commite97171d8d399574824a50fafd321b52b8a3d59f8 (patch)
treea202aa726439f741a43176c3c8770ceea32cdc97
parentf3002dd8d31de218d3f8797cfd8b93647760a9cb (diff)
Fix default path for titles
-rw-r--r--src/bin/bin.cpp11
-rw-r--r--src/bin/bin.h2
-rw-r--r--src/dialogs/clipcreationdialog.cpp6
-rw-r--r--src/doc/kdenlivedoc.cpp10
-rw-r--r--src/doc/kdenlivedoc.h6
-rw-r--r--src/mainwindow.cpp28
-rw-r--r--src/monitor/monitor.cpp2
-rw-r--r--src/monitor/monitormanager.cpp2
-rw-r--r--src/project/clipmanager.cpp7
-rw-r--r--src/project/clipmanager.h1
-rw-r--r--src/project/dialogs/projectsettings.cpp2
-rw-r--r--src/project/projectmanager.cpp6
-rw-r--r--src/titler/titlewidget.cpp2
13 files changed, 40 insertions, 45 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 92fed99..ba4256d 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -935,11 +935,6 @@ ProjectFolder *Bin::rootFolder()
return m_rootFolder;
}
-QString Bin::projectFolder() const
-{
- return m_doc->projectFolder();
-}
-
void Bin::setMonitor(Monitor *monitor)
{
m_monitor = monitor;
@@ -3004,7 +2999,7 @@ void Bin::slotLoadClipMarkers(const QString &id)
}
cbox->setCurrentIndex(KdenliveSettings::default_marker_type());
//TODO KF5 how to add custom cbox to Qfiledialog
- QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Load Clip Markers"), m_doc->projectFolder());
+ QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Load Clip Markers"), m_doc->projectDataFolder());
fd->setMimeTypeFilters(QStringList()<<QStringLiteral("text/plain"));
fd->setFileMode(QFileDialog::ExistingFile);
if (fd->exec() != QDialog::Accepted) return;
@@ -3086,7 +3081,7 @@ void Bin::slotSaveClipMarkers(const QString &id)
}
cbox->setCurrentIndex(0);
//TODO KF5 how to add custom cbox to Qfiledialog
- QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Save Clip Markers"), m_doc->projectFolder());
+ QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Save Clip Markers"), m_doc->projectDataFolder());
fd->setMimeTypeFilters(QStringList() << QStringLiteral("text/plain"));
fd->setFileMode(QFileDialog::AnyFile);
fd->setAcceptMode(QFileDialog::AcceptSave);
@@ -3161,7 +3156,7 @@ void Bin::slotGetCurrentProjectImage(bool request)
void Bin::showTitleWidget(ProjectClip *clip)
{
QString path = clip->getProducerProperty(QStringLiteral("resource"));
- QDir titleFolder(m_doc->projectFolder() + QStringLiteral("/titles"));
+ QDir titleFolder(m_doc->projectDataFolder() + QStringLiteral("/titles"));
titleFolder.mkpath(QStringLiteral("."));
TitleWidget dia_ui(QUrl(), m_doc->timecode(), titleFolder.absolutePath(), pCore->monitorManager()->projectMonitor()->render, pCore->window());
connect(&dia_ui, SIGNAL(requestBackgroundFrame(bool)), pCore->monitorManager()->projectMonitor(), SLOT(slotGetCurrentImage(bool)));
diff --git a/src/bin/bin.h b/src/bin/bin.h
index e2dcf86..5f033d5 100644
--- a/src/bin/bin.h
+++ b/src/bin/bin.h
@@ -495,8 +495,6 @@ public:
void editMasterEffect(ClipController *ctl);
/** @brief An effect setting was changed, update stack if displayed. */
void updateMasterEffect(ClipController *ctl);
- /** @brief Returns current project's folder for storing items. */
- QString projectFolder() const;
/** @brief Display a message about an operation in status bar. */
void emitMessage(const QString &, int, MessageType);
void rebuildMenu();
diff --git a/src/dialogs/clipcreationdialog.cpp b/src/dialogs/clipcreationdialog.cpp
index 6d8fef0..db4578d 100644
--- a/src/dialogs/clipcreationdialog.cpp
+++ b/src/dialogs/clipcreationdialog.cpp
@@ -263,7 +263,7 @@ void ClipCreationDialog::createSlideshowClip(KdenliveDoc *doc, QStringList group
void ClipCreationDialog::createTitleClip(KdenliveDoc *doc, QStringList groupInfo, QString templatePath, Bin *bin)
{
// Make sure the titles folder exists
- QDir dir(doc->projectFolder() + QStringLiteral("/titles"));
+ QDir dir(doc->projectDataFolder() + QStringLiteral("/titles"));
dir.mkpath(QStringLiteral("."));
QPointer<TitleWidget> dia_ui = new TitleWidget(QUrl::fromLocalFile(templatePath), doc->timecode(), dir.absolutePath(), doc->renderer(), bin);
QObject::connect(dia_ui, SIGNAL(requestBackgroundFrame(bool)), bin, SLOT(slotGetCurrentProjectImage(bool)));
@@ -297,7 +297,7 @@ void ClipCreationDialog::createTitleClip(KdenliveDoc *doc, QStringList groupInfo
void ClipCreationDialog::createTitleTemplateClip(KdenliveDoc *doc, QStringList groupInfo, Bin *bin)
{
- QPointer<TitleTemplateDialog> dia = new TitleTemplateDialog(doc->projectFolder(), QApplication::activeWindow());
+ QPointer<TitleTemplateDialog> dia = new TitleTemplateDialog(doc->projectDataFolder(), QApplication::activeWindow());
if (dia->exec() == QDialog::Accepted) {
QString textTemplate = dia->selectedTemplate();
@@ -455,7 +455,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
for (int i = 0; i < items.count() ; ++i) {
QDomElement content = items.item(i).toElement();
if (content.hasAttribute(QStringLiteral("base64"))) {
- QString titlesFolder = doc->projectFolder()+ QStringLiteral("/titles/");
+ QString titlesFolder = doc->projectDataFolder()+ QStringLiteral("/titles/");
QString path = TitleDocument::extractBase64Image(titlesFolder, content.attribute(QStringLiteral("base64")));
if (!path.isEmpty()) {
content.setAttribute(QStringLiteral("url"), path);
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index 4bf046f..8e89212 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -721,7 +721,7 @@ QString KdenliveDoc::groupsXml() const
return m_clipManager->groupsXml();
}
-QString KdenliveDoc::projectFolder() const
+QString KdenliveDoc::projectTempFolder() const
{
if (m_projectFolder.isEmpty()) {
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
@@ -729,6 +729,14 @@ QString KdenliveDoc::projectFolder() const
return m_projectFolder;
}
+QString KdenliveDoc::projectDataFolder() const
+{
+ if (m_projectFolder.isEmpty()) {
+ return KdenliveSettings::defaultprojectfolder();
+ }
+ return m_projectFolder;
+}
+
void KdenliveDoc::setProjectFolder(QUrl url)
{
if (url == QUrl::fromLocalFile(m_projectFolder)) return;
diff --git a/src/doc/kdenlivedoc.h b/src/doc/kdenlivedoc.h
index d2cc87c..a185340 100644
--- a/src/doc/kdenlivedoc.h
+++ b/src/doc/kdenlivedoc.h
@@ -108,8 +108,10 @@ public:
/** @brief Defines whether the document needs to be saved. */
bool isModified() const;
- /** @brief Returns the project folder, used to store project files. */
- QString projectFolder() const;
+ /** @brief Returns the project folder, used to store project temporary files. */
+ QString projectTempFolder() const;
+ /** @brief Returns the folder used to store project data files (titles, etc). */
+ QString projectDataFolder() const;
void setZoom(int horizontal, int vertical);
QPoint zoom() const;
double dar() const;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 10baf86..6acc708 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1639,7 +1639,7 @@ void MainWindow::slotEditProjectSettings()
KdenliveDoc *project = pCore->projectManager()->current();
QPoint p = pCore->projectManager()->currentTimeline()->getTracksCount();
- QPointer<ProjectSettings> w = new ProjectSettings(project, project->metadata(), pCore->projectManager()->currentTimeline()->projectView()->extractTransitionsLumas(), p.x(), p.y(), project->projectFolder(), true, !project->isModified(), this);
+ QPointer<ProjectSettings> w = new ProjectSettings(project, project->metadata(), pCore->projectManager()->currentTimeline()->projectView()->extractTransitionsLumas(), p.x(), p.y(), project->projectTempFolder(), true, !project->isModified(), this);
connect(w, SIGNAL(disableProxies()), this, SLOT(slotDisableProxies()));
connect(w, SIGNAL(disablePreview()), pCore->projectManager()->currentTimeline(), SLOT(invalidateRange()));
connect(w, SIGNAL(refreshProfiles()), this, SLOT(slotRefreshProfiles()));
@@ -1650,10 +1650,10 @@ void MainWindow::slotEditProjectSettings()
pCore->projectManager()->currentTimeline()->updatePreviewSettings(w->selectedPreview());
bool modified = false;
if (m_recMonitor) {
- m_recMonitor->slotUpdateCaptureFolder(project->projectFolder() + QDir::separator());
+ m_recMonitor->slotUpdateCaptureFolder(project->projectDataFolder() + QDir::separator());
}
if (m_renderWidget) {
- m_renderWidget->setDocumentPath(project->projectFolder() + QDir::separator());
+ m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
}
if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) {
slotSwitchVideoThumbs();
@@ -1703,16 +1703,16 @@ void MainWindow::slotEditProjectSettings()
if (newProjectFolder.isEmpty()) {
newProjectFolder = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
}
- if (newProjectFolder != project->projectFolder()) {
+ if (newProjectFolder != project->projectTempFolder()) {
KMessageBox::ButtonCode answer;
// Project folder changed:
if (project->isModified()) {
- answer = KMessageBox::warningContinueCancel(this, i18n("The current project has not been saved. This will first save the project, then move all temporary files from <b>%1</b> to <b>%2</b>, and the project file will be reloaded", project->projectFolder(), newProjectFolder));
+ answer = KMessageBox::warningContinueCancel(this, i18n("The current project has not been saved. This will first save the project, then move all temporary files from <b>%1</b> to <b>%2</b>, and the project file will be reloaded", project->projectTempFolder(), newProjectFolder));
if (answer == KMessageBox::Continue) {
pCore->projectManager()->saveFile();
}
} else {
- answer = KMessageBox::warningContinueCancel(this, i18n("This will move all temporary files from <b>%1</b> to <b>%2</b>, the project file will then be reloaded", project->projectFolder(), newProjectFolder));
+ answer = KMessageBox::warningContinueCancel(this, i18n("This will move all temporary files from <b>%1</b> to <b>%2</b>, the project file will then be reloaded", project->projectTempFolder(), newProjectFolder));
}
if (answer == KMessageBox::Continue) {
// Proceeed with move
@@ -1723,7 +1723,7 @@ void MainWindow::slotEditProjectSettings()
KMessageBox::sorry(this, i18n("Cannot perform operation, invalid document id: %1", documentId));
} else {
QDir newDir(newProjectFolder);
- QDir oldDir(project->projectFolder());
+ QDir oldDir(project->projectTempFolder());
if (newDir.exists(documentId)) {
KMessageBox::sorry(this, i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
} else {
@@ -1757,7 +1757,7 @@ void MainWindow::slotRenderProject()
KdenliveDoc *project = pCore->projectManager()->current();
if (!m_renderWidget) {
- QString projectfolder = project ? project->projectFolder() + QDir::separator() : KdenliveSettings::defaultprojectfolder();
+ QString projectfolder = project ? project->projectDataFolder() + QDir::separator() : KdenliveSettings::defaultprojectfolder();
MltVideoProfile profile;
if (project) {
profile = project->mltProfile();
@@ -1769,7 +1769,7 @@ void MainWindow::slotRenderProject()
connect(m_renderWidget, SIGNAL(openDvdWizard(QString)), this, SLOT(slotDvdWizard(QString)));
m_renderWidget->setProfile(project->mltProfile());
m_renderWidget->setGuides(pCore->projectManager()->currentTimeline()->projectView()->guidesData(), project->projectDuration());
- m_renderWidget->setDocumentPath(project->projectFolder() + QDir::separator());
+ m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
m_renderWidget->setRenderProfile(project->getRenderProperties());
}
if (m_compositeAction->currentAction())
@@ -1973,7 +1973,7 @@ void MainWindow::connectDocument()
slotCheckRenderStatus();
m_renderWidget->setProfile(project->mltProfile());
m_renderWidget->setGuides(pCore->projectManager()->currentTimeline()->projectView()->guidesData(), project->projectDuration());
- m_renderWidget->setDocumentPath(project->projectFolder() + QDir::separator());
+ m_renderWidget->setDocumentPath(project->projectDataFolder() + QDir::separator());
m_renderWidget->setRenderProfile(project->getRenderProperties());
}
m_zoomSlider->setValue(project->zoom().x());
@@ -1988,7 +1988,7 @@ void MainWindow::connectDocument()
pCore->monitorManager()->setDocument(project);
trackView->updateProfile(1.0);
if (m_recMonitor) {
- m_recMonitor->slotUpdateCaptureFolder(project->projectFolder() + QDir::separator());
+ m_recMonitor->slotUpdateCaptureFolder(project->projectDataFolder() + QDir::separator());
}
//Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
slotUpdateMousePosition(0);
@@ -2102,7 +2102,7 @@ void MainWindow::slotUpdateCaptureFolder()
{
if (m_recMonitor) {
if (pCore->projectManager()->current())
- m_recMonitor->slotUpdateCaptureFolder(pCore->projectManager()->current()->projectFolder() + QDir::separator());
+ m_recMonitor->slotUpdateCaptureFolder(pCore->projectManager()->current()->projectDataFolder() + QDir::separator());
else
m_recMonitor->slotUpdateCaptureFolder(KdenliveSettings::defaultprojectfolder());
}
@@ -2989,7 +2989,7 @@ void MainWindow::slotGetNewTitleStuff()
{
if (getNewStuff(QStringLiteral("kdenlive_titles.knsrc")) > 0) {
// get project title path
- QString titlePath = pCore->projectManager()->current()->projectFolder() + QStringLiteral("/titles/");
+ QString titlePath = pCore->projectManager()->current()->projectDataFolder() + QStringLiteral("/titles/");
TitleWidget::refreshTitleTemplates(titlePath);
}
}
@@ -3658,7 +3658,7 @@ void MainWindow::slotDownloadResources()
{
QString currentFolder;
if (pCore->projectManager()->current())
- currentFolder = pCore->projectManager()->current()->projectFolder();
+ currentFolder = pCore->projectManager()->current()->projectDataFolder();
else
currentFolder = KdenliveSettings::defaultprojectfolder();
ResourceWidget *d = new ResourceWidget(currentFolder);
diff --git a/src/monitor/monitor.cpp b/src/monitor/monitor.cpp
index 987e6ef..c10dd11 100644
--- a/src/monitor/monitor.cpp
+++ b/src/monitor/monitor.cpp
@@ -1381,7 +1381,7 @@ void Monitor::slotOpenDvdFile(const QString &file)
void Monitor::slotSaveZone()
{
- render->saveZone(pCore->projectManager()->current()->projectFolder(), m_ruler->zone());
+ render->saveZone(pCore->projectManager()->current()->projectDataFolder(), m_ruler->zone());
}
void Monitor::setCustomProfile(const QString &profile, const Timecode &tc)
diff --git a/src/monitor/monitormanager.cpp b/src/monitor/monitormanager.cpp
index 6a8a76f..7ba63c2 100644
--- a/src/monitor/monitormanager.cpp
+++ b/src/monitor/monitormanager.cpp
@@ -295,7 +295,7 @@ QString MonitorManager::getProjectFolder() const
//qDebug()<<" + + +NULL DOC!!";
return QString();
}
- return m_document->projectFolder() + QDir::separator();
+ return m_document->projectDataFolder() + QDir::separator();
}
BinController *MonitorManager::binController()
diff --git a/src/project/clipmanager.cpp b/src/project/clipmanager.cpp
index 5efc11b..591f294 100644
--- a/src/project/clipmanager.cpp
+++ b/src/project/clipmanager.cpp
@@ -289,13 +289,6 @@ void ClipManager::slotAddTextTemplateClip(QString titleName, const QUrl &path, c
m_doc->commandStack()->push(command);
}
-
-QString ClipManager::projectFolder() const
-{
- return m_doc->projectFolder();
-}
-
-
AbstractGroupItem *ClipManager::createGroup()
{
QMutexLocker lock(&m_groupsMutex);
diff --git a/src/project/clipmanager.h b/src/project/clipmanager.h
index 8327f19..ac81669 100644
--- a/src/project/clipmanager.h
+++ b/src/project/clipmanager.h
@@ -73,7 +73,6 @@ Q_OBJECT public:
void slotAddTextTemplateClip(QString titleName, const QUrl &path, const QString &group, const QString &groupId);
void doDeleteClips(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand, bool execute);
int lastClipId() const;
- QString projectFolder() const;
/** @brief Prepare deletion of clips and folders from the Bin. */
void deleteProjectItems(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand = NULL);
void clear();
diff --git a/src/project/dialogs/projectsettings.cpp b/src/project/dialogs/projectsettings.cpp
index 56fe594..d35189f 100644
--- a/src/project/dialogs/projectsettings.cpp
+++ b/src/project/dialogs/projectsettings.cpp
@@ -97,7 +97,7 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap <QString, QString> metad
if (!storageFolder.isEmpty()) {
custom_folder->setChecked(true);
}
- project_folder->setUrl(QUrl::fromLocalFile(doc->projectFolder()));
+ project_folder->setUrl(QUrl::fromLocalFile(doc->projectTempFolder()));
TemporaryData *cacheWidget = new TemporaryData(doc, true, this);
connect(cacheWidget, SIGNAL(disableProxies()), this, SIGNAL(disableProxies()));
connect(cacheWidget, SIGNAL(disablePreview()), this, SIGNAL(disablePreview()));
diff --git a/src/project/projectmanager.cpp b/src/project/projectmanager.cpp
index 3192c89..5cdbe1a 100644
--- a/src/project/projectmanager.cpp
+++ b/src/project/projectmanager.cpp
@@ -630,7 +630,7 @@ void ProjectManager::slotOpenBackup(const QUrl& url)
projectFolder = QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder());
projectFile = url;
} else {
- projectFolder = QUrl::fromLocalFile(m_project->projectFolder());
+ projectFolder = QUrl::fromLocalFile(m_project->projectTempFolder());
projectFile = m_project->url();
projectId = m_project->getDocumentProperty(QStringLiteral("documentid"));
}
@@ -809,11 +809,11 @@ void ProjectManager::slotMoveFinished(KJob *job)
QString newFolder = copyJob->destUrl().path();
// Check if project folder is inside document folder, in which case, paths will be relative
QDir projectDir(m_project->url().toString(QUrl::RemoveFilename | QUrl::RemoveScheme));
- QDir srcDir(m_project->projectFolder());
+ QDir srcDir(m_project->projectTempFolder());
if (srcDir.absolutePath().startsWith(projectDir.absolutePath())) {
m_replacementPattern.insert(QStringLiteral(">proxy/"), QStringLiteral(">") + newFolder + QStringLiteral("/proxy/"));
} else {
- m_replacementPattern.insert(m_project->projectFolder() + QStringLiteral("/proxy/"), newFolder + QStringLiteral("/proxy/"));
+ m_replacementPattern.insert(m_project->projectTempFolder() + QStringLiteral("/proxy/"), newFolder + QStringLiteral("/proxy/"));
}
m_project->setProjectFolder(QUrl::fromLocalFile(newFolder));
saveFile();
diff --git a/src/titler/titlewidget.cpp b/src/titler/titlewidget.cpp
index 3ca12c7..56879a9 100644
--- a/src/titler/titlewidget.cpp
+++ b/src/titler/titlewidget.cpp
@@ -1834,7 +1834,7 @@ void TitleWidget::itemRight()
void TitleWidget::loadTitle(QUrl url)
{
- if (!url.isValid()) url = QFileDialog::getOpenFileUrl(this, i18n("Load Title"), QUrl(m_projectTitlePath), i18n("Kdenlive title (*.kdenlivetitle)"));
+ if (!url.isValid()) url = QFileDialog::getOpenFileUrl(this, i18n("Load Title"), QUrl::fromLocalFile(m_projectTitlePath), i18n("Kdenlive title (*.kdenlivetitle)"));
if (url.isValid()) {
QList<QGraphicsItem *> items = m_scene->items();
items.removeAll(m_frameBorder);