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
12a396a2
Commit
12a396a2
authored
Mar 06, 2022
by
Julius Künzel
Browse files
Don't allow editing of current profile to prevent crashes
parent
43954201
Pipeline
#145938
passed with stage
in 6 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/dialogs/profilesdialog.cpp
View file @
12a396a2
...
...
@@ -27,7 +27,7 @@ ProfilesDialog::ProfilesDialog(const QString &profileDescription, QWidget *paren
ProfileRepository
::
get
()
->
refresh
();
m_view
.
setupUi
(
this
);
m_view
.
info_message
->
hid
e
();
showMessag
e
();
// Fill colorspace list (see mlt_profile.h)
m_view
.
colorspace
->
addItem
(
ProfileRepository
::
getColorspaceDescription
(
601
),
601
);
...
...
@@ -74,7 +74,7 @@ ProfilesDialog::ProfilesDialog(const QString &profilePath, bool, QWidget *parent
,
m_customProfilePath
(
profilePath
)
{
m_view
.
setupUi
(
this
);
m_view
.
info_message
->
hid
e
();
showMessag
e
();
// Fill colorspace list (see mlt_profile.h)
m_view
.
colorspace
->
addItem
(
ProfileRepository
::
getColorspaceDescription
(
601
),
601
);
...
...
@@ -103,12 +103,10 @@ void ProfilesDialog::slotAdjustWidth()
int
correctedWidth
=
val
+
(
val
%
2
);
if
(
val
==
correctedWidth
)
{
// Ok, no action required, width is a multiple of 2
m_view
.
info_message
->
animatedHid
e
();
showMessag
e
();
}
else
{
m_view
.
size_w
->
setValue
(
correctedWidth
);
m_view
.
info_message
->
setText
(
i18n
(
"Profile width must be a multiple of 2. It was adjusted to %1"
,
correctedWidth
));
m_view
.
info_message
->
setMessageType
(
KMessageWidget
::
Warning
);
m_view
.
info_message
->
animatedShow
();
showMessage
(
i18n
(
"Profile width must be a multiple of 2. It was adjusted to %1"
,
correctedWidth
));
}
}
...
...
@@ -120,12 +118,10 @@ void ProfilesDialog::slotAdjustHeight()
int
correctedHeight
=
val
+
(
val
%
2
);
if
(
val
==
correctedHeight
)
{
// Ok, no action required, height is a multiple of 2
m_view
.
info_message
->
animatedHid
e
();
showMessag
e
();
}
else
{
m_view
.
size_h
->
setValue
(
correctedHeight
);
m_view
.
info_message
->
setText
(
i18n
(
"Profile height must be a multiple of 2. It was adjusted to %1"
,
correctedHeight
));
m_view
.
info_message
->
setMessageType
(
KMessageWidget
::
Warning
);
m_view
.
info_message
->
animatedShow
();
showMessage
(
i18n
(
"Profile height must be a multiple of 2. It was adjusted to %1"
,
correctedHeight
));
}
}
...
...
@@ -218,9 +214,7 @@ void ProfilesDialog::slotCreateProfile()
void
ProfilesDialog
::
slotSetDefaultProfile
()
{
if
(
m_profileIsModified
)
{
m_view
.
info_message
->
setText
(
i18n
(
"Save your profile before setting it to default"
));
m_view
.
info_message
->
setMessageType
(
KMessageWidget
::
Warning
);
m_view
.
info_message
->
animatedShow
();
showMessage
(
i18n
(
"Save your profile before setting it to default"
));
return
;
}
int
ix
=
m_view
.
profiles_list
->
currentIndex
();
...
...
@@ -314,10 +308,13 @@ void ProfilesDialog::slotUpdateDisplay(QString currentProfilePath)
currentProfilePath
=
m_view
.
profiles_list
->
itemData
(
m_view
.
profiles_list
->
currentIndex
()).
toString
();
}
m_isCustomProfile
=
currentProfilePath
.
contains
(
QLatin1Char
(
'/'
));
// Don't allow editing of the current Project, since this produces crashes at the moment
bool
isCurrentlyUsed
=
pCore
->
getCurrentProfilePath
()
==
currentProfilePath
;
showMessage
(
isCurrentlyUsed
?
i18n
(
"The profile of the current project cannot be edited while the project is open."
)
:
QString
());
m_view
.
button_create
->
setEnabled
(
true
);
m_view
.
button_delete
->
setEnabled
(
m_isCustomProfile
);
m_view
.
properties
->
setEnabled
(
m_isCustomProfile
);
m_view
.
button_save
->
setEnabled
(
m_isCustomProfile
);
m_view
.
button_delete
->
setEnabled
(
m_isCustomProfile
&&
!
isCurrentlyUsed
);
m_view
.
properties
->
setEnabled
(
m_isCustomProfile
&&
!
isCurrentlyUsed
);
m_view
.
button_save
->
setEnabled
(
m_isCustomProfile
&&
!
isCurrentlyUsed
);
std
::
unique_ptr
<
ProfileModel
>
&
curProfile
=
ProfileRepository
::
get
()
->
getProfile
(
currentProfilePath
);
m_view
.
description
->
setText
(
curProfile
->
description
());
m_view
.
size_w
->
setValue
(
curProfile
->
width
());
...
...
@@ -348,3 +345,14 @@ bool ProfilesDialog::profileTreeChanged() const
{
return
m_profilesChanged
;
}
void
ProfilesDialog
::
showMessage
(
const
QString
&
text
,
KMessageWidget
::
MessageType
type
)
{
if
(
text
.
isEmpty
())
{
m_view
.
info_message
->
hide
();
}
else
{
m_view
.
info_message
->
setText
(
text
);
m_view
.
info_message
->
setMessageType
(
type
);
m_view
.
info_message
->
animatedShow
();
}
}
src/dialogs/profilesdialog.h
View file @
12a396a2
...
...
@@ -54,6 +54,7 @@ private:
void
saveProfile
(
const
QString
&
path
);
bool
askForSave
();
void
connectDialog
();
void
showMessage
(
const
QString
&
text
=
QString
(),
KMessageWidget
::
MessageType
type
=
KMessageWidget
::
Warning
);
};
#endif
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