Commit e97171d8 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix default path for titles

parent f3002dd8
......@@ -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)));
......
......@@ -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();
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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()
......
......@@ -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);
......
......@@ -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();
......
......@@ -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()));
......
......@@ -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();
......
......@@ -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);
......
Supports Markdown
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