Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
3b5b1d4f
Commit
3b5b1d4f
authored
Jan 15, 2021
by
Jean-Baptiste Mardelle
Browse files
Update render target when saving project under a new name.
related to
#607
parent
ed5c91d5
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/dialogs/renderwidget.cpp
View file @
3b5b1d4f
...
...
@@ -1926,7 +1926,7 @@ QUrl RenderWidget::filenameWithExtension(QUrl url, const QString &extension)
}
QString
ext
;
if
(
extension
.
at
(
0
)
==
'.'
)
{
if
(
extension
.
startsWith
(
QLatin1Char
(
'.'
)
))
{
ext
=
extension
;
}
else
{
ext
=
'.'
+
extension
;
...
...
@@ -1988,15 +1988,6 @@ void RenderWidget::refreshParams()
}
QUrl
url
=
filenameWithExtension
(
m_view
.
out_file
->
url
(),
extension
);
m_view
.
out_file
->
setUrl
(
url
);
// if (!url.isEmpty()) {
// QString path = url.path();
// int pos = path.lastIndexOf('.') + 1;
// if (pos == 0) path.append('.' + extension);
// else path = path.left(pos) + extension;
// m_view.out_file->setUrl(QUrl(path));
// } else {
// m_view.out_file->setUrl(QUrl(QDir::homePath() + QStringLiteral("/untitled.") + extension));
// }
m_view
.
out_file
->
setFilter
(
"*."
+
extension
);
QString
edit
=
item
->
data
(
0
,
EditableRole
).
toString
();
if
(
edit
.
isEmpty
()
||
!
edit
.
endsWith
(
QLatin1String
(
"customprofiles.xml"
)))
{
...
...
@@ -3192,3 +3183,23 @@ void RenderWidget::prepareMenu(const QPoint &pos)
menu
.
exec
(
m_view
.
running_jobs
->
mapToGlobal
(
pos
));
}
void
RenderWidget
::
resetRenderPath
(
const
QString
&
path
)
{
QTreeWidgetItem
*
item
=
m_view
.
formats
->
currentItem
();
QString
extension
;
if
(
item
&&
item
->
parent
())
{
// categories have no parent
extension
=
item
->
data
(
0
,
ExtensionRole
).
toString
();
}
else
{
extension
=
m_view
.
out_file
->
url
().
toLocalFile
().
section
(
QLatin1Char
(
'.'
),
-
1
);
}
QString
fileName
=
QDir
(
pCore
->
currentDoc
()
->
projectDataFolder
()).
absoluteFilePath
(
path
+
extension
);
QString
url
=
filenameWithExtension
(
QUrl
::
fromLocalFile
(
fileName
),
extension
).
toLocalFile
();
if
(
QFileInfo
(
url
).
isRelative
())
{
url
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
}
m_view
.
out_file
->
setUrl
(
QUrl
::
fromLocalFile
(
url
));
QMap
<
QString
,
QString
>
renderProps
;
renderProps
.
insert
(
QStringLiteral
(
"renderurl"
),
url
);
emit
selectedRenderProfile
(
renderProps
);
}
src/dialogs/renderwidget.h
View file @
3b5b1d4f
...
...
@@ -125,9 +125,9 @@ public:
void
focusFirstVisibleItem
(
const
QString
&
profile
=
QString
());
void
setRenderJob
(
const
QString
&
dest
,
int
progress
=
0
,
int
frame
=
0
);
void
setRenderStatus
(
const
QString
&
dest
,
int
status
,
const
QString
&
error
);
void
updateDocumentPath
();
void
reloadProfiles
();
void
setRenderProfile
(
const
QMap
<
QString
,
QString
>
&
props
);
void
updateDocumentPath
();
int
waitingJobsCount
()
const
;
QString
getFreeScriptName
(
const
QUrl
&
projectName
=
QUrl
(),
const
QString
&
prefix
=
QString
());
bool
startWaitingRenderJobs
();
...
...
@@ -155,6 +155,9 @@ public slots:
void
slotPrepareExport
(
bool
scriptExport
=
false
,
const
QString
&
scriptPath
=
QString
());
void
adjustViewToProfile
();
void
reloadGuides
();
/** @brief Adjust render file name to current project name. */
void
resetRenderPath
(
const
QString
&
path
);
private
slots
:
void
slotUpdateButtons
(
const
QUrl
&
url
);
...
...
src/mainwindow.cpp
View file @
3b5b1d4f
...
...
@@ -988,7 +988,7 @@ void MainWindow::createSplitOverlay(std::shared_ptr<Mlt::Filter> filter)
getMainTimeline
()
->
controller
()
->
createSplitOverlay
(
m_assetPanel
->
effectStackOwner
().
second
,
filter
);
m_projectMonitor
->
activateSplit
();
}
else
{
pCore
->
displayMessage
(
i18n
(
"Select a clip to compare effect"
),
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"Select a clip to compare effect"
),
Error
Message
);
}
}
...
...
@@ -2078,6 +2078,7 @@ void MainWindow::slotRenderProject()
connect
(
m_renderWidget
,
&
RenderWidget
::
abortProcess
,
this
,
&
MainWindow
::
abortRenderJob
);
connect
(
m_renderWidget
,
&
RenderWidget
::
openDvdWizard
,
this
,
&
MainWindow
::
slotDvdWizard
);
connect
(
this
,
&
MainWindow
::
updateRenderWidgetProfile
,
m_renderWidget
,
&
RenderWidget
::
adjustViewToProfile
);
connect
(
this
,
&
MainWindow
::
updateProjectPath
,
m_renderWidget
,
&
RenderWidget
::
resetRenderPath
);
m_renderWidget
->
setGuides
(
project
->
getGuideModel
());
m_renderWidget
->
updateDocumentPath
();
m_renderWidget
->
setRenderProfile
(
project
->
getRenderProperties
());
...
...
@@ -2776,7 +2777,7 @@ void MainWindow::slotInsertClipInsert()
const
QString
&
binId
=
m_clipMonitor
->
activeClipId
();
if
(
binId
.
isEmpty
())
{
// No clip in monitor
pCore
->
displayMessage
(
i18n
(
"No clip selected in project bin"
),
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"No clip selected in project bin"
),
Error
Message
);
return
;
}
getMainTimeline
()
->
controller
()
->
insertZone
(
binId
,
m_clipMonitor
->
getZoneInfo
(),
false
);
...
...
@@ -2934,10 +2935,10 @@ void MainWindow::addEffect(const QString &effectId)
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
addAsset
(
effectData
);
}
else
if
(
m_assetPanel
->
effectStackOwner
().
first
==
ObjectType
::
TimelineTrack
||
m_assetPanel
->
effectStackOwner
().
first
==
ObjectType
::
BinClip
||
m_assetPanel
->
effectStackOwner
().
first
==
ObjectType
::
Master
)
{
if
(
!
m_assetPanel
->
addEffect
(
effectId
))
{
pCore
->
displayMessage
(
i18n
(
"Cannot add effect to clip"
),
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"Cannot add effect to clip"
),
Error
Message
);
}
}
else
{
pCore
->
displayMessage
(
i18n
(
"Select an item to add effect"
),
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"Select an item to add effect"
),
Error
Message
);
}
}
...
...
@@ -4290,7 +4291,7 @@ void MainWindow::slotImportSubtitle()
void
MainWindow
::
slotExportSubtitle
()
{
if
(
pCore
->
getSubtitleModel
()
==
nullptr
)
{
pCore
->
displayMessage
(
i18n
(
"No subtitles in current project"
),
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"No subtitles in current project"
),
Error
Message
);
return
;
}
getCurrentTimeline
()
->
controller
()
->
exportSubtitle
();
...
...
src/mainwindow.h
View file @
3b5b1d4f
...
...
@@ -541,6 +541,7 @@ signals:
/** @brief Enable or disable the undo stack. For example undo/redo should not be enabled when dragging a clip in timeline or we risk corruption. */
void
enableUndo
(
bool
enable
);
bool
focusTimeline
(
bool
focus
,
bool
highlight
);
void
updateProjectPath
(
const
QString
&
path
);
};
#endif
src/project/projectmanager.cpp
View file @
3b5b1d4f
...
...
@@ -299,6 +299,10 @@ bool ProjectManager::saveFileAs(const QString &outputFileName, bool saveACopy)
{
pCore
->
monitorManager
()
->
pauseActiveMonitor
();
// Sync document properties
if
(
!
saveACopy
&&
outputFileName
!=
m_project
->
url
().
toLocalFile
())
{
// Project filename changed
pCore
->
window
()
->
updateProjectPath
(
outputFileName
);
}
prepareSave
();
QString
saveFolder
=
QFileInfo
(
outputFileName
).
absolutePath
();
m_project
->
updateSubtitle
(
outputFileName
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment