Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
Kdenlive
Commits
3282e56a
Commit
3282e56a
authored
Jun 06, 2019
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix profile change not applied if user doesn't want to save current project
BUG: 408372
parent
ae9a18e5
Pipeline
#4086
passed with stage
in 32 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
3 deletions
+35
-3
src/project/projectmanager.cpp
src/project/projectmanager.cpp
+35
-3
No files found.
src/project/projectmanager.cpp
View file @
3282e56a
...
...
@@ -926,6 +926,7 @@ void ProjectManager::saveWithUpdatedProfile(const QString &updatedProfile)
{
// First backup current project with fps appended
QString
message
;
bool
saveInTempFile
=
false
;
if
(
m_project
&&
m_project
->
isModified
())
{
switch
(
KMessageBox
::
warningYesNoCancel
(
pCore
->
window
(),
i18n
(
"The project <b>
\"
%1
\"
</b> has been changed.
\n
Do you want to save your changes?"
,
...
...
@@ -937,23 +938,54 @@ void ProjectManager::saveWithUpdatedProfile(const QString &updatedProfile)
return
;
}
break
;
default
:
case
KMessageBox
::
Cancel
:
pCore
->
displayBinMessage
(
i18n
(
"Project profile change aborted"
),
KMessageWidget
::
Information
);
return
;
break
;
default:
saveInTempFile
=
true
;
break
;
}
}
if
(
!
m_project
||
m_project
->
isModified
()
)
{
if
(
!
m_project
)
{
pCore
->
displayBinMessage
(
i18n
(
"Project profile change aborted"
),
KMessageWidget
::
Information
);
return
;
}
const
QString
currentFile
=
m_project
->
url
().
toLocalFile
();
QString
currentFile
=
m_project
->
url
().
toLocalFile
();
// Now update to new profile
auto
&
newProfile
=
ProfileRepository
::
get
()
->
getProfile
(
updatedProfile
);
QString
convertedFile
=
currentFile
.
section
(
QLatin1Char
(
'.'
),
0
,
-
2
);
convertedFile
.
append
(
QString
(
"-%1.kdenlive"
).
arg
((
int
)(
newProfile
->
fps
()
*
100
)));
QString
saveFolder
=
m_project
->
url
().
adjusted
(
QUrl
::
RemoveFilename
|
QUrl
::
StripTrailingSlash
).
toLocalFile
();
QTemporaryFile
tmpFile
(
saveFolder
+
"/kdenlive-XXXXXX.mlt"
);
if
(
saveInTempFile
)
{
// Save current playlist in tmp file
if
(
!
tmpFile
.
open
())
{
// Something went wrong
pCore
->
displayBinMessage
(
i18n
(
"Project profile change aborted"
),
KMessageWidget
::
Information
);
return
;
}
prepareSave
();
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
());
}
}
tmpFile
.
write
(
scene
.
toUtf8
());
if
(
tmpFile
.
error
()
!=
QFile
::
NoError
)
{
tmpFile
.
close
();
return
;
}
tmpFile
.
close
();
currentFile
=
tmpFile
.
fileName
();
// Don't ask again to save
m_project
->
setModified
(
false
);
}
QFile
f
(
currentFile
);
QDomDocument
doc
;
...
...
Write
Preview
Markdown
is supported
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