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
3ed27aac
Commit
3ed27aac
authored
Sep 04, 2019
by
Jean-Baptiste Mardelle
Browse files
Deprecate videostab and videostab2, only keep vidstab filter.
Remember last settings and allow reset to default
parent
17a7e6f4
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/assets/view/assetparameterview.cpp
View file @
3ed27aac
...
...
@@ -141,7 +141,12 @@ void AssetParameterView::resetValues()
{
const
QVector
<
QPair
<
QString
,
QVariant
>>
values
=
getDefaultValues
();
auto
*
command
=
new
AssetUpdateCommand
(
m_model
,
values
);
pCore
->
pushUndo
(
command
);
if
(
m_model
->
getOwnerId
().
second
!=
-
1
)
{
pCore
->
pushUndo
(
command
);
}
else
{
command
->
redo
();
delete
command
;
}
// Unselect preset if any
QAction
*
ac
=
m_presetGroup
->
checkedAction
();
if
(
ac
)
{
...
...
src/jobs/stabilizejob.cpp
View file @
3ed27aac
...
...
@@ -76,7 +76,7 @@ void StabilizeJob::configureFilter()
// static
std
::
unordered_set
<
QString
>
StabilizeJob
::
supportedFilters
()
{
return
{
QLatin1String
(
"vidstab"
)
,
QLatin1String
(
"videostab2"
),
QLatin1String
(
"videostab"
)
};
return
{
QLatin1String
(
"vidstab"
)};
}
// static
...
...
@@ -84,7 +84,7 @@ int StabilizeJob::prepareJob(const std::shared_ptr<JobManager> &ptr, const std::
const
QString
&
filterName
)
{
Q_ASSERT
(
supportedFilters
().
count
(
filterName
)
>
0
);
if
(
filterName
==
QLatin1String
(
"vidstab"
)
||
filterName
==
QLatin1String
(
"videostab2"
)
||
filterName
==
QLatin1String
(
"videostab"
)
)
{
if
(
filterName
==
QLatin1String
(
"vidstab"
))
{
// vidstab
QScopedPointer
<
ClipStabilize
>
d
(
new
ClipStabilize
(
binIds
,
filterName
,
100000
));
if
(
d
->
exec
()
==
QDialog
::
Accepted
)
{
...
...
src/mainwindow.cpp
View file @
3ed27aac
...
...
@@ -3048,7 +3048,7 @@ void MainWindow::buildDynamicActions()
Mlt
::
Profile
profile
;
std
::
unique_ptr
<
Mlt
::
Filter
>
filter
;
for
(
const
QString
&
stab
:
{
QStringLiteral
(
"vidstab"
)
,
QStringLiteral
(
"videostab2"
),
QStringLiteral
(
"videostab"
)
})
{
for
(
const
QString
&
stab
:
{
QStringLiteral
(
"vidstab"
)})
{
filter
=
std
::
make_unique
<
Mlt
::
Filter
>
(
profile
,
stab
.
toUtf8
().
constData
());
if
((
filter
!=
nullptr
)
&&
filter
->
is_valid
())
{
QAction
*
action
=
new
QAction
(
i18n
(
"Stabilize (%1)"
,
stab
),
m_extraFactory
->
actionCollection
());
...
...
src/project/clipstabilize.cpp
View file @
3ed27aac
...
...
@@ -63,17 +63,25 @@ ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterN
dest_url
->
setUrl
(
QUrl
(
firstUrl
).
adjusted
(
QUrl
::
RemoveFilename
));
}
m_vbox
=
new
QVBoxLayout
(
optionsbox
);
if
(
m_filtername
==
QLatin1String
(
"vidstab"
)
||
m_filtername
==
QLatin1String
(
"videostab2"
))
{
AssetParameterView
*
view
=
new
AssetParameterView
(
this
);
if
(
m_filtername
==
QLatin1String
(
"vidstab"
))
{
m_view
.
reset
(
new
AssetParameterView
(
this
));
qDebug
()
<<
"// Fetching effect: "
<<
m_filtername
;
std
::
unique_ptr
<
Mlt
::
Filter
>
asset
=
EffectsRepository
::
get
()
->
getEffect
(
m_filtername
);
auto
prop
=
std
::
make_unique
<
Mlt
::
Properties
>
(
asset
->
get_properties
());
QDomElement
xml
=
EffectsRepository
::
get
()
->
getXml
(
m_filtername
);
m_assetModel
.
reset
(
new
AssetParameterModel
(
std
::
move
(
prop
),
xml
,
m_filtername
,
{
ObjectType
::
NoItem
,
-
1
}));
view
->
setModel
(
m_assetModel
,
QSize
(
1920
,
1080
));
m_vbox
->
addWidget
(
view
);
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
(
"lastsetting"
));
if
(
!
params
.
isEmpty
())
{
m_assetModel
->
setParameters
(
params
);
}
m_view
->
setModel
(
m_assetModel
,
QSize
(
1920
,
1080
));
m_vbox
->
addWidget
(
m_view
.
get
());
}
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
Ok
),
&
QPushButton
::
clicked
,
this
,
&
ClipStabilize
::
slotValidate
);
connect
(
button_reset
,
&
QPushButton
::
clicked
,
this
,
&
ClipStabilize
::
resetValues
);
adjustSize
();
}
...
...
@@ -151,5 +159,23 @@ 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"
));
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 @
3ed27aac
...
...
@@ -28,6 +28,7 @@
#include <unordered_map>
class
AssetParameterModel
;
class
AssetParameterView
;
class
ClipStabilize
:
public
QDialog
,
public
Ui
::
ClipStabilize_UI
{
...
...
@@ -49,13 +50,15 @@ public:
QString
filterName
()
const
;
private
slots
:
void
slotValidate
();
void
resetValues
();
private:
QString
m_filtername
;
std
::
vector
<
QString
>
m_binIds
;
QVBoxLayout
*
m_vbox
;
Timecode
m_tc
;
std
::
shared_ptr
<
AssetParameterModel
>
m_assetModel
;
std
::
shared_ptr
<
AssetParameterModel
>
m_assetModel
;
std
::
unique_ptr
<
AssetParameterView
>
m_view
;
signals:
void
addClip
(
const
QUrl
&
url
);
...
...
src/ui/clipstabilize_ui.ui
View file @
3ed27aac
...
...
@@ -6,21 +6,14 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
3
0
4
</width>
<height>
1
25
</height>
<width>
34
9
</width>
<height>
1
60
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_dest"
>
<property
name=
"text"
>
<string>
Destination
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
colspan=
"2"
>
<widget
class=
"KUrlRequester"
name=
"dest_url"
/>
</item>
...
...
@@ -31,6 +24,13 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_dest"
>
<property
name=
"text"
>
<string>
Destination
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"3"
>
<widget
class=
"QWidget"
name=
"optionsbox"
native=
"true"
>
<property
name=
"sizePolicy"
>
...
...
@@ -41,24 +41,27 @@
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"
2
"
>
<
widget
class=
"QDialogButtonBox"
name=
"buttonBox
"
>
<item
row=
"
3
"
column=
"
0
"
>
<
spacer
name=
"verticalSpacer
"
>
<property
name=
"orientation"
>
<enum>
Qt::
Horizont
al
</enum>
<enum>
Qt::
Vertic
al
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Abort|QDialogButtonBox::Ok
</set>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</
widget
>
</
spacer
>
</item>
<item
row=
"
4
"
column=
"0"
colspan=
"2"
>
<widget
class=
"Q
CheckBox"
name=
"auto_add
"
>
<item
row=
"
5
"
column=
"0"
>
<widget
class=
"Q
PushButton"
name=
"button_reset
"
>
<property
name=
"text"
>
<string>
Add clip to projec
t
</string>
<string>
Rese
t
</string>
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"
0"
colspan=
"2
"
>
<item
row=
"
5
"
column=
"
1
"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -71,18 +74,22 @@
</property>
</spacer>
</item>
<item
row=
"
3
"
column=
"
0
"
>
<
spacer
name=
"verticalSpacer
"
>
<item
row=
"
5
"
column=
"
2
"
>
<
widget
class=
"QDialogButtonBox"
name=
"buttonBox
"
>
<property
name=
"orientation"
>
<enum>
Qt::
Vertic
al
</enum>
<enum>
Qt::
Horizont
al
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Abort|QDialogButtonBox::Ok
</set>
</property>
</spacer>
</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>
...
...
@@ -91,6 +98,7 @@
<class>
KUrlRequester
</class>
<extends>
QFrame
</extends>
<header>
kurlrequester.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
...
...
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