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
018fcf2a
Commit
018fcf2a
authored
Sep 06, 2019
by
Jean-Baptiste Mardelle
Browse files
Cleanup stabilize presets and job cancelation
parent
5767bbf2
Pipeline
#7473
passed with stage
in 19 minutes and 51 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/assets/model/assetparametermodel.cpp
View file @
018fcf2a
...
...
@@ -689,6 +689,7 @@ void AssetParameterModel::deletePreset(const QString &presetFile, const QString
if
(
!
loadFile
.
open
(
QIODevice
::
WriteOnly
))
{
// TODO: error message
}
//TODO: delete file if there are no more presets in it
loadFile
.
write
(
QJsonDocument
(
array
).
toJson
());
}
...
...
src/assets/view/assetparameterview.cpp
View file @
018fcf2a
...
...
@@ -302,13 +302,20 @@ void AssetParameterView::slotDeletePreset()
if
(
!
ac
)
{
return
;
}
slotDeletePreset
(
ac
->
data
().
toString
());
}
void
AssetParameterView
::
slotDeletePreset
(
const
QString
&
presetName
)
{
if
(
presetName
.
isEmpty
())
{
return
;
}
QDir
dir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
)
+
QStringLiteral
(
"/effects/presets/"
));
if
(
!
dir
.
exists
())
{
dir
.
mkpath
(
QStringLiteral
(
"."
));
if
(
dir
.
exists
())
{
const
QString
presetFile
=
dir
.
absoluteFilePath
(
QString
(
"%1.json"
).
arg
(
m_model
->
getAssetId
()));
m_model
->
deletePreset
(
presetFile
,
presetName
);
emit
updatePresets
();
}
const
QString
presetFile
=
dir
.
absoluteFilePath
(
QString
(
"%1.json"
).
arg
(
m_model
->
getAssetId
()));
m_model
->
deletePreset
(
presetFile
,
ac
->
data
().
toString
());
emit
updatePresets
();
}
void
AssetParameterView
::
slotUpdatePreset
()
...
...
src/assets/view/assetparameterview.hpp
View file @
018fcf2a
...
...
@@ -77,6 +77,7 @@ public slots:
void
slotLoadPreset
();
void
slotUpdatePreset
();
void
slotDeletePreset
();
void
slotDeletePreset
(
const
QString
&
presetName
);
protected:
/** @brief This is a handler for the dataChanged slot of the model.
...
...
src/jobs/jobmanager.cpp
View file @
018fcf2a
...
...
@@ -42,7 +42,7 @@ JobManager::JobManager(QObject *parent)
JobManager
::~
JobManager
()
{
slotCancelJobs
();
//
slotCancelJobs();
}
int
JobManager
::
getBlockingJobId
(
const
QString
&
id
,
AbstractClipJob
::
JOBTYPE
type
)
...
...
src/jobs/meltjob.cpp
View file @
018fcf2a
...
...
@@ -247,6 +247,10 @@ bool MeltJob::startJob()
}
m_showFrameEvent
.
reset
(
m_consumer
->
listen
(
"consumer-frame-render"
,
this
,
(
mlt_listener
)
consumer_frame_render
));
m_producer
->
set_speed
(
1
);
connect
(
this
,
&
MeltJob
::
jobCanceled
,
[
&
]
()
{
m_consumer
->
stop
();
return
false
;
});
m_consumer
->
run
();
/*
...
...
src/project/clipstabilize.cpp
View file @
018fcf2a
...
...
@@ -72,16 +72,19 @@ ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterN
m_assetModel
.
reset
(
new
AssetParameterModel
(
std
::
move
(
prop
),
xml
,
m_filtername
,
{
ObjectType
::
NoItem
,
-
1
}));
QDir
dir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
)
+
QStringLiteral
(
"/effects/presets/"
));
const
QString
presetFile
=
dir
.
absoluteFilePath
(
QString
(
"%1.json"
).
arg
(
m_assetModel
->
getAssetId
()));
const
QVector
<
QPair
<
QString
,
QVariant
>>
params
=
m_assetModel
->
loadPreset
(
presetFile
,
QStringLiteral
(
"
l
astsetting"
));
const
QVector
<
QPair
<
QString
,
QVariant
>>
params
=
m_assetModel
->
loadPreset
(
presetFile
,
i18n
(
"
L
ast
setting"
));
if
(
!
params
.
isEmpty
())
{
m_assetModel
->
setParameters
(
params
);
}
m_view
->
setModel
(
m_assetModel
,
QSize
(
1920
,
1080
));
m_vbox
->
addWidget
(
m_view
.
get
());
// Presets
preset_button
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"adjustlevels"
)));
preset_button
->
setMenu
(
m_view
->
presetMenu
());
preset_button
->
setToolTip
(
i18n
(
"Presets"
));
}
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
Ok
),
&
QPushButton
::
clicked
,
this
,
&
ClipStabilize
::
slotValidate
);
connect
(
button_reset
,
&
QPushButton
::
clicked
,
this
,
&
ClipStabilize
::
resetValues
);
adjustSize
();
}
...
...
@@ -159,23 +162,7 @@ void ClipStabilize::slotValidate()
}
}
}
QDir
dir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
)
+
QStringLiteral
(
"/effects/presets/"
));
if
(
!
dir
.
exists
())
{
dir
.
mkpath
(
QStringLiteral
(
"."
));
}
const
QString
presetFile
=
dir
.
absoluteFilePath
(
QString
(
"%1.json"
).
arg
(
m_assetModel
->
getAssetId
()));
m_assetModel
->
savePreset
(
presetFile
,
QStringLiteral
(
"lastsetting"
));
m_view
->
slotSavePreset
(
i18n
(
"Last setting"
));
accept
();
}
void
ClipStabilize
::
resetValues
()
{
QDir
dir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
)
+
QStringLiteral
(
"/effects/presets/"
));
if
(
dir
.
exists
())
{
const
QString
presetFile
=
dir
.
absoluteFilePath
(
QString
(
"%1.json"
).
arg
(
m_assetModel
->
getAssetId
()));
m_assetModel
->
deletePreset
(
presetFile
,
QStringLiteral
(
"lastsetting"
));
}
m_view
->
resetValues
();
/*const QVector<QPair<QString, QVariant>> values = m_view->getDefaultValues();
m_assetModel->setParameters(values);*/
}
src/project/clipstabilize.h
View file @
018fcf2a
...
...
@@ -50,7 +50,6 @@ public:
QString
filterName
()
const
;
private
slots
:
void
slotValidate
();
void
resetValues
();
private:
QString
m_filtername
;
...
...
src/project/projectmanager.cpp
View file @
018fcf2a
...
...
@@ -239,6 +239,7 @@ bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
break
;
}
}
pCore
->
jobManager
()
->
slotCancelJobs
();
disconnect
(
pCore
->
window
()
->
getMainTimeline
()
->
controller
(),
&
TimelineController
::
durationChanged
,
this
,
&
ProjectManager
::
adjustProjectDuration
);
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
clipActions
.
clear
();
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
prepareClose
();
...
...
src/ui/clipstabilize_ui.ui
View file @
018fcf2a
...
...
@@ -14,10 +14,7 @@
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"1"
colspan=
"2"
>
<widget
class=
"KUrlRequester"
name=
"dest_url"
/>
</item>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<item
row=
"1"
column=
"0"
colspan=
"4"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
Options
</string>
...
...
@@ -31,13 +28,10 @@
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"3"
>
<widget
class=
"QWidget"
name=
"optionsbox"
native=
"true"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Maximum"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
<item
row=
"4"
column=
"0"
colspan=
"4"
>
<widget
class=
"QCheckBox"
name=
"auto_add"
>
<property
name=
"text"
>
<string>
Add clip to project
</string>
</property>
</widget>
</item>
...
...
@@ -54,14 +48,40 @@
</property>
</spacer>
</item>
<item
row=
"0"
column=
"2"
colspan=
"2"
>
<widget
class=
"KUrlRequester"
name=
"dest_url"
/>
</item>
<item
row=
"5"
column=
"3"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Abort|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"4"
>
<widget
class=
"QWidget"
name=
"optionsbox"
native=
"true"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Maximum"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"Q
Push
Button"
name=
"button
_reset
"
>
<widget
class=
"Q
Tool
Button"
name=
"
preset_
button"
>
<property
name=
"text"
>
<string>
Reset
</string>
<string>
...
</string>
</property>
<property
name=
"popupMode"
>
<enum>
QToolButton::InstantPopup
</enum>
</property>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
<item
row=
"5"
column=
"1"
colspan=
"2"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -74,23 +94,6 @@
</property>
</spacer>
</item>
<item
row=
"5"
column=
"2"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Abort|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"3"
>
<widget
class=
"QCheckBox"
name=
"auto_add"
>
<property
name=
"text"
>
<string>
Add clip to project
</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
...
...
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