Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
Kdenlive
Commits
0dc470b4
Commit
0dc470b4
authored
Mar 01, 2018
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix qml scene display/connect when switching effect selection
parent
188fb319
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
121 additions
and
70 deletions
+121
-70
src/assets/model/assetparametermodel.cpp
src/assets/model/assetparametermodel.cpp
+10
-2
src/assets/model/assetparametermodel.hpp
src/assets/model/assetparametermodel.hpp
+1
-0
src/assets/view/assetparameterview.cpp
src/assets/view/assetparameterview.cpp
+19
-6
src/assets/view/assetparameterview.hpp
src/assets/view/assetparameterview.hpp
+2
-4
src/assets/view/widgets/abstractparamwidget.hpp
src/assets/view/widgets/abstractparamwidget.hpp
+5
-0
src/assets/view/widgets/geometryeditwidget.cpp
src/assets/view/widgets/geometryeditwidget.cpp
+23
-13
src/assets/view/widgets/geometryeditwidget.hpp
src/assets/view/widgets/geometryeditwidget.hpp
+4
-5
src/assets/view/widgets/keyframewidget.cpp
src/assets/view/widgets/keyframewidget.cpp
+27
-10
src/assets/view/widgets/keyframewidget.hpp
src/assets/view/widgets/keyframewidget.hpp
+7
-4
src/effects/effectstack/model/effectstackmodel.cpp
src/effects/effectstack/model/effectstackmodel.cpp
+4
-4
src/effects/effectstack/view/collapsibleeffectview.cpp
src/effects/effectstack/view/collapsibleeffectview.cpp
+1
-1
src/effectstack/parametercontainer.cpp
src/effectstack/parametercontainer.cpp
+1
-1
src/widgets/geometrywidget.cpp
src/widgets/geometrywidget.cpp
+16
-19
src/widgets/geometrywidget.h
src/widgets/geometrywidget.h
+1
-1
No files found.
src/assets/model/assetparametermodel.cpp
View file @
0dc470b4
...
...
@@ -127,7 +127,6 @@ void AssetParameterModel::prepareKeyframes()
void
AssetParameterModel
::
setParameter
(
const
QString
&
name
,
const
int
value
,
bool
update
)
{
Q_ASSERT
(
m_asset
->
is_valid
());
m_asset
->
set
(
name
.
toLatin1
().
constData
(),
value
);
if
(
m_fixedParams
.
count
(
name
)
==
0
)
{
m_params
[
name
].
value
=
value
;
...
...
@@ -144,6 +143,9 @@ void AssetParameterModel::setParameter(const QString &name, const int value, boo
}
m_asset
->
set
(
"effect"
,
effectParam
.
join
(
QLatin1Char
(
' '
)).
toUtf8
().
constData
());
emit
replugEffect
(
shared_from_this
());
}
else
if
(
m_assetId
==
QLatin1String
(
"autotrack_rectangle"
)
||
m_assetId
.
startsWith
(
QStringLiteral
(
"ladspa"
)))
{
// these effects don't understand param change and need to be rebuild
emit
replugEffect
(
shared_from_this
());
}
else
{
emit
modelChanged
();
}
...
...
@@ -187,6 +189,9 @@ void AssetParameterModel::setParameter(const QString &name, const QString &value
}
m_asset
->
set
(
"effect"
,
effectParam
.
join
(
QLatin1Char
(
' '
)).
toUtf8
().
constData
());
emit
replugEffect
(
shared_from_this
());
}
else
if
(
m_assetId
==
QLatin1String
(
"autotrack_rectangle"
)
||
m_assetId
.
startsWith
(
QStringLiteral
(
"ladspa"
)))
{
// these effects don't understand param change and need to be rebuild
emit
replugEffect
(
shared_from_this
());
}
else
{
emit
modelChanged
();
}
...
...
@@ -215,7 +220,10 @@ void AssetParameterModel::setParameter(const QString &name, double &value)
}
m_asset
->
set
(
"effect"
,
effectParam
.
join
(
QLatin1Char
(
' '
)).
toUtf8
().
constData
());
emit
replugEffect
(
shared_from_this
());
}
else
{
}
else
if
(
m_assetId
==
QLatin1String
(
"autotrack_rectangle"
)
||
m_assetId
.
startsWith
(
QStringLiteral
(
"ladspa"
)))
{
// these effects don't understand param change and need to be rebuild
emit
replugEffect
(
shared_from_this
());
}
else
{
emit
modelChanged
();
}
pCore
->
refreshProjectItem
(
m_ownerId
);
...
...
src/assets/model/assetparametermodel.hpp
View file @
0dc470b4
...
...
@@ -171,6 +171,7 @@ protected:
signals:
void
modelChanged
();
void
replugEffect
(
std
::
shared_ptr
<
AssetParameterModel
>
asset
);
void
rebuildEffect
(
std
::
shared_ptr
<
AssetParameterModel
>
asset
);
};
#endif
src/assets/view/assetparameterview.cpp
View file @
0dc470b4
...
...
@@ -70,10 +70,8 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
m_mainKeyframeWidget
->
addParameter
(
index
);
}
else
{
auto
w
=
AbstractParamWidget
::
construct
(
model
,
index
,
range
,
frameSize
,
this
);
/*if (type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim || type == ParamType::AnimatedRect) {
animWidget = static_cast<AnimationWidget *>(w);
}*/
if
(
type
==
ParamType
::
KeyframeParam
||
type
==
ParamType
::
AnimatedRect
)
{
connect
(
this
,
&
AssetParameterView
::
initKeyframeView
,
w
,
&
AbstractParamWidget
::
slotInitMonitor
);
if
(
type
==
ParamType
::
KeyframeParam
||
type
==
ParamType
::
AnimatedRect
)
{
m_mainKeyframeWidget
=
static_cast
<
KeyframeWidget
*>
(
w
);
}
connect
(
w
,
&
AbstractParamWidget
::
valueChanged
,
this
,
&
AssetParameterView
::
commitChanges
);
...
...
@@ -195,13 +193,28 @@ MonitorSceneType AssetParameterView::needsMonitorEffectScene() const
if
(
m_mainKeyframeWidget
)
{
return
MonitorSceneGeometry
;
}
for
(
int
i
=
0
;
i
<
m_model
->
rowCount
();
++
i
)
{
QModelIndex
index
=
m_model
->
index
(
i
,
0
);
auto
type
=
m_model
->
data
(
index
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
Geometry
)
{
return
MonitorSceneGeometry
;
}
}
return
MonitorSceneDefault
;
}
void
AssetParameterView
::
initKeyframeView
()
/*
void AssetParameterView::initKeyframeView()
{
if (m_mainKeyframeWidget) {
m_mainKeyframeWidget->initMonitor();
} else {
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex index = m_model->index(i, 0);
auto type = m_model->data(index, AssetParameterModel::TypeRole).value<ParamType>();
if (type == ParamType::Geometry) {
return MonitorSceneGeometry;
}
}
}
}
}*/
src/assets/view/assetparameterview.hpp
View file @
0dc470b4
...
...
@@ -59,12 +59,9 @@ public:
/** The parent clip in/out points changed, update effects */
void
setRange
(
QPair
<
int
,
int
>
range
);
/** Returns the type of monitor overlay required by this effect */
MonitorSceneType
needsMonitorEffectScene
()
const
;
/** Make sure the monitor displays correct info depending on current position */
void
initKeyframeView
();
protected:
/** @brief This is a handler for the dataChanged slot of the model.
...
...
@@ -89,6 +86,7 @@ private slots:
signals:
void
seekToPos
(
int
);
void
initKeyframeView
(
bool
active
);
};
#endif
src/assets/view/widgets/abstractparamwidget.hpp
View file @
0dc470b4
...
...
@@ -63,6 +63,7 @@ signals:
void
disableCurrentFilter
(
bool
);
void
seekToPos
(
int
);
public
slots
:
/** @brief Toggle the comments on or off
*/
...
...
@@ -76,6 +77,10 @@ public slots:
*/
virtual
void
slotSetRange
(
QPair
<
int
,
int
>
range
)
=
0
;
/** @brief intialize qml keyframe view after creating it
*/
virtual
void
slotInitMonitor
(
bool
/*active*/
)
{}
protected:
std
::
shared_ptr
<
AssetParameterModel
>
m_model
;
QPersistentModelIndex
m_index
;
...
...
src/assets/view/widgets/geometryeditwidget.cpp
View file @
0dc470b4
...
...
@@ -27,6 +27,7 @@
#include "widgets/geometrywidget.h"
#include "monitor/monitormanager.h"
#include "assets/model/assetparametermodel.hpp"
#include <mlt++/MltGeometry.h>
#include <QHBoxLayout>
#include <QLabel>
...
...
@@ -34,28 +35,28 @@
GeometryEditWidget
::
GeometryEditWidget
(
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QModelIndex
index
,
QPair
<
int
,
int
>
range
,
QSize
frameSize
,
QWidget
*
parent
)
:
AbstractParamWidget
(
std
::
move
(
model
),
index
,
parent
)
,
m_monitor
(
pCore
->
getMonitor
(
m_model
->
monitorId
))
,
m_range
(
range
)
{
auto
*
layout
=
new
QVBoxLayout
(
this
);
QString
comment
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
CommentRole
).
toString
();
const
QString
value
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
().
simplified
();
Mlt
::
Geometry
geometry
(
value
.
toUtf8
().
data
(),
m_range
.
second
,
frameSize
.
width
(),
frameSize
.
height
());
Mlt
::
GeometryItem
item
;
QRect
rect
;
QStringList
vals
=
value
.
split
(
QLatin1Char
(
' '
));
if
(
vals
.
count
()
>=
4
)
{
rect
=
QRect
(
vals
.
at
(
0
).
toInt
(),
vals
.
at
(
1
).
toInt
(),
vals
.
at
(
2
).
toInt
(),
vals
.
at
(
3
).
toInt
());
if
(
geometry
.
fetch
(
&
item
,
0
)
==
0
)
{
rect
=
QRect
(
item
.
x
(),
item
.
y
(),
item
.
w
(),
item
.
h
());
}
else
{
// Cannot read value, use random default
rect
=
QRect
(
50
,
50
,
200
,
200
);
}
m_geom
=
new
GeometryWidget
(
m_monitor
,
range
,
rect
,
frameSize
,
false
,
this
);
Monitor
*
monitor
=
pCore
->
getMonitor
(
m_model
->
monitorId
);
m_geom
=
new
GeometryWidget
(
monitor
,
range
,
rect
,
frameSize
,
false
,
m_model
->
data
(
m_index
,
AssetParameterModel
::
OpacityRole
).
toBool
(),
this
);
m_geom
->
setSizePolicy
(
QSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Preferred
));
connect
(
m_monitor
,
&
Monitor
::
seekPosition
,
this
,
&
GeometryEditWidget
::
monitorSeek
,
Qt
::
UniqueConnection
);
/*QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QLabel *label = new QLabel(name, this);
layout->addWidget(label);*/
layout
->
addWidget
(
m_geom
);
// emit the signal of the base class when appropriate
connect
(
this
->
m_geom
,
&
GeometryWidget
::
valueChanged
,
[
this
](
const
QString
val
)
{
emit
AbstractParamWidget
::
valueChanged
(
m_index
,
val
,
true
);
});
connect
(
this
->
m_geom
,
&
GeometryWidget
::
valueChanged
,
[
this
](
const
QString
val
)
{
emit
valueChanged
(
m_index
,
val
,
true
);
});
setToolTip
(
comment
);
}
...
...
@@ -94,10 +95,19 @@ void GeometryEditWidget::monitorSeek(int pos)
// Update monitor scene for geometry params
if
(
pos
>=
m_range
.
first
&&
pos
<
m_range
.
second
)
{
m_geom
->
connectMonitor
(
true
);
m_monitor
->
setEffectKeyframe
(
true
);
}
else
{
m_geom
->
connectMonitor
(
false
);
m_monitor
->
setEffectKeyframe
(
false
);
}
}
void
GeometryEditWidget
::
slotInitMonitor
(
bool
active
)
{
m_geom
->
connectMonitor
(
active
);
Monitor
*
monitor
=
pCore
->
getMonitor
(
m_model
->
monitorId
);
if
(
active
)
{
monitor
->
setEffectKeyframe
(
true
);
connect
(
monitor
,
&
Monitor
::
seekPosition
,
this
,
&
GeometryEditWidget
::
monitorSeek
,
Qt
::
UniqueConnection
);
}
else
{
disconnect
(
monitor
,
&
Monitor
::
seekPosition
,
this
,
&
GeometryEditWidget
::
monitorSeek
);
}
}
src/assets/view/widgets/geometryeditwidget.hpp
View file @
0dc470b4
...
...
@@ -30,7 +30,6 @@
class
QSlider
;
class
GeometryWidget
;
class
Monitor
;
/*@brief This class is used to display a parameter with time value */
class
GeometryEditWidget
:
public
AbstractParamWidget
...
...
@@ -55,17 +54,17 @@ public slots:
*/
void
slotSetRange
(
QPair
<
int
,
int
>
)
override
;
/** @brief intialize qml overlay
*/
void
slotInitMonitor
(
bool
active
)
override
;
private
slots
:
/** @brief monitor seek pos changed. */
void
monitorSeek
(
int
pos
);
private:
GeometryWidget
*
m_geom
;
Monitor
*
m_monitor
;
QPair
<
int
,
int
>
m_range
;
signals:
void
valueChanged
();
};
#endif
src/assets/view/widgets/keyframewidget.cpp
View file @
0dc470b4
...
...
@@ -102,12 +102,10 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
connect
(
m_keyframeview
,
&
KeyframeView
::
seekToPos
,
[
&
](
int
p
)
{
slotSetPosition
(
p
,
true
);
});
connect
(
m_keyframeview
,
&
KeyframeView
::
atKeyframe
,
this
,
&
KeyframeWidget
::
slotAtKeyframe
);
connect
(
m_keyframeview
,
&
KeyframeView
::
modified
,
this
,
&
KeyframeWidget
::
slotRefreshParams
);
connect
(
this
,
&
KeyframeWidget
::
initMonitor
,
m_keyframeview
,
&
KeyframeView
::
initKeyframePos
);
connect
(
m_buttonAddDelete
,
&
QAbstractButton
::
pressed
,
m_keyframeview
,
&
KeyframeView
::
slotAddRemove
);
connect
(
m_buttonPrevious
,
&
QAbstractButton
::
pressed
,
m_keyframeview
,
&
KeyframeView
::
slotGoToPrev
);
connect
(
m_buttonNext
,
&
QAbstractButton
::
pressed
,
m_keyframeview
,
&
KeyframeView
::
slotGoToNext
);
connect
(
monitor
,
&
Monitor
::
seekPosition
,
this
,
&
KeyframeWidget
::
monitorSeek
,
Qt
::
UniqueConnection
);
addParameter
(
index
);
}
...
...
@@ -125,13 +123,7 @@ void KeyframeWidget::monitorSeek(int pos)
int
in
=
pCore
->
getItemPosition
(
m_model
->
getOwnerId
());
int
out
=
in
+
pCore
->
getItemDuration
(
m_model
->
getOwnerId
());
m_buttonAddDelete
->
setEnabled
(
pos
-
in
>
0
);
for
(
const
auto
&
w
:
m_parameters
)
{
ParamType
type
=
m_model
->
data
(
w
.
first
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
AnimatedRect
)
{
((
GeometryWidget
*
)
w
.
second
)
->
connectMonitor
(
pos
>=
in
&&
pos
<
out
);
break
;
}
}
connectMonitor
(
pos
>=
in
&&
pos
<
out
);
int
framePos
=
qBound
(
in
,
pos
,
out
)
-
in
;
m_keyframeview
->
slotSetPosition
(
framePos
);
m_time
->
setValue
(
framePos
);
...
...
@@ -260,7 +252,7 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
if
(
vals
.
count
()
>=
4
)
{
rect
=
QRect
(
vals
.
at
(
0
).
toInt
(),
vals
.
at
(
1
).
toInt
(),
vals
.
at
(
2
).
toInt
(),
vals
.
at
(
3
).
toInt
());
}
GeometryWidget
*
geomWidget
=
new
GeometryWidget
(
pCore
->
getMonitor
(
m_model
->
monitorId
),
range
,
rect
,
frameSize
,
false
,
this
);
GeometryWidget
*
geomWidget
=
new
GeometryWidget
(
pCore
->
getMonitor
(
m_model
->
monitorId
),
range
,
rect
,
frameSize
,
false
,
m_model
->
data
(
m_index
,
AssetParameterModel
::
OpacityRole
).
toBool
(),
this
);
connect
(
geomWidget
,
&
GeometryWidget
::
valueChanged
,
[
this
,
index
](
const
QString
v
)
{
m_keyframes
->
updateKeyframe
(
GenTime
(
getPosition
(),
pCore
->
getCurrentFps
()),
QVariant
(
v
),
index
);
});
paramWidget
=
geomWidget
;
...
...
@@ -282,3 +274,28 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
m_lay
->
addWidget
(
paramWidget
);
}
}
void
KeyframeWidget
::
slotInitMonitor
(
bool
active
)
{
if
(
m_keyframeview
)
{
m_keyframeview
->
initKeyframePos
();
}
Monitor
*
monitor
=
pCore
->
getMonitor
(
m_model
->
monitorId
);
connectMonitor
(
active
);
if
(
active
)
{
connect
(
monitor
,
&
Monitor
::
seekPosition
,
this
,
&
KeyframeWidget
::
monitorSeek
,
Qt
::
UniqueConnection
);
}
else
{
disconnect
(
monitor
,
&
Monitor
::
seekPosition
,
this
,
&
KeyframeWidget
::
monitorSeek
);
}
}
void
KeyframeWidget
::
connectMonitor
(
bool
active
)
{
for
(
const
auto
&
w
:
m_parameters
)
{
ParamType
type
=
m_model
->
data
(
w
.
first
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
AnimatedRect
)
{
((
GeometryWidget
*
)
w
.
second
)
->
connectMonitor
(
active
);
break
;
}
}
}
src/assets/view/widgets/keyframewidget.hpp
View file @
0dc470b4
...
...
@@ -51,8 +51,13 @@ public:
void
updateTimecodeFormat
();
public
slots
:
void
slotSetRange
(
QPair
<
int
,
int
>
range
)
override
;
void
slotRefresh
()
override
;
/** @brief intialize qml overlay
*/
void
slotInitMonitor
(
bool
active
)
override
;
public
slots
:
void
slotSetPosition
(
int
pos
=
-
1
,
bool
update
=
true
);
...
...
@@ -73,11 +78,9 @@ private:
QToolButton
*
m_buttonNext
;
KSelectAction
*
m_selectType
;
TimecodeDisplay
*
m_time
;
void
connectMonitor
(
bool
active
);
std
::
unordered_map
<
QPersistentModelIndex
,
QWidget
*>
m_parameters
;
signals:
void
initMonitor
();
};
#endif
src/effects/effectstack/model/effectstackmodel.cpp
View file @
0dc470b4
...
...
@@ -63,7 +63,7 @@ void EffectStackModel::loadEffects()
Fun
redo
=
addItem_lambda
(
effect
,
rootItem
->
getId
());
redo
();
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
}
}
else
{
qDebug
()
<<
"// CANNOT LOCK CLIP SEEVCE"
;
...
...
@@ -145,7 +145,7 @@ void EffectStackModel::copyEffect(std::shared_ptr<AbstractEffectItem> sourceItem
// TODO the parent should probably not always be the root
Fun
redo
=
addItem_lambda
(
effect
,
rootItem
->
getId
());
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
bool
res
=
redo
();
if
(
res
)
{
QString
effectName
=
EffectsRepository
::
get
()
->
getName
(
effectId
);
...
...
@@ -160,7 +160,7 @@ void EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
// TODO the parent should probably not always be the root
Fun
redo
=
addItem_lambda
(
effect
,
rootItem
->
getId
());
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
int
currentActive
=
getActiveEffect
();
if
(
makeCurrent
)
{
auto
srvPtr
=
m_service
.
lock
();
...
...
@@ -479,7 +479,7 @@ void EffectStackModel::importEffects(std::shared_ptr<EffectStackModel> sourceSta
// TODO parent should not always be root
Fun
redo
=
addItem_lambda
(
clone
,
rootItem
->
getId
());
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
redo
();
}
}
...
...
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
0dc470b4
...
...
@@ -302,8 +302,8 @@ void CollapsibleEffectView::slotActivateEffect(QModelIndex ix)
decoframe
->
setStyleSheet
(
decoframe
->
styleSheet
());
if
(
active
)
{
pCore
->
getMonitor
(
m_model
->
monitorId
)
->
slotShowEffectScene
(
needsMonitorEffectScene
());
m_view
->
initKeyframeView
();
}
m_view
->
initKeyframeView
(
active
);
}
void
CollapsibleEffectView
::
mousePressEvent
(
QMouseEvent
*
e
)
...
...
src/effectstack/parametercontainer.cpp
View file @
0dc470b4
...
...
@@ -334,7 +334,7 @@ ParameterContainer::ParameterContainer(const QDomElement &effect, const ItemInfo
useOffset
=
true
;
}
m_geometryWidget
=
new
GeometryWidget
(
m_metaInfo
,
info
.
startPos
.
frames
(
KdenliveSettings
::
project_fps
()),
effect
.
hasAttribute
(
QStringLiteral
(
"showrotation"
)),
useOffset
,
parent
);
effect
.
hasAttribute
(
QStringLiteral
(
"showrotation"
)),
useOffset
,
false
,
parent
);
if
(
m_conditionParameter
&&
pa
.
hasAttribute
(
QStringLiteral
(
"conditional"
)))
{
m_geometryWidget
->
setEnabled
(
false
);
m_conditionalWidgets
<<
m_geometryWidget
;
...
...
src/widgets/geometrywidget.cpp
View file @
0dc470b4
...
...
@@ -29,12 +29,13 @@
#include <QGridLayout>
#include <KLocalizedString>
GeometryWidget
::
GeometryWidget
(
Monitor
*
monitor
,
QPair
<
int
,
int
>
range
,
const
QRect
&
rect
,
const
QSize
frameSize
,
bool
useRatioLock
,
QWidget
*
parent
)
GeometryWidget
::
GeometryWidget
(
Monitor
*
monitor
,
QPair
<
int
,
int
>
range
,
const
QRect
&
rect
,
const
QSize
frameSize
,
bool
useRatioLock
,
bool
useOpacity
,
QWidget
*
parent
)
:
QWidget
(
parent
)
,
m_min
(
range
.
first
)
,
m_max
(
range
.
second
)
,
m_active
(
false
)
,
m_monitor
(
monitor
)
,
m_opacity
(
nullptr
)
{
Q_UNUSED
(
useRatioLock
)
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Maximum
);
...
...
@@ -83,9 +84,11 @@ GeometryWidget::GeometryWidget(Monitor *monitor, QPair<int, int> range, const QR
connect
(
m_spinSize
,
&
DragValue
::
valueChanged
,
this
,
&
GeometryWidget
::
slotResize
);
horLayout2
->
addWidget
(
m_spinSize
);
m_opacity
=
new
DragValue
(
i18n
(
"Opacity"
),
100
,
0
,
0
,
100
,
-
1
,
i18n
(
"%"
),
true
,
this
);
connect
(
m_opacity
,
&
DragValue
::
valueChanged
,
this
,
&
GeometryWidget
::
slotAdjustRectKeyframeValue
);
horLayout2
->
addWidget
(
m_opacity
);
if
(
useOpacity
)
{
m_opacity
=
new
DragValue
(
i18n
(
"Opacity"
),
100
,
0
,
0
,
100
,
-
1
,
i18n
(
"%"
),
true
,
this
);
connect
(
m_opacity
,
&
DragValue
::
valueChanged
,
this
,
&
GeometryWidget
::
slotAdjustRectKeyframeValue
);
horLayout2
->
addWidget
(
m_opacity
);
}
horLayout2
->
addStretch
(
10
);
// Build buttons
...
...
@@ -388,24 +391,29 @@ void GeometryWidget::setValue(const QRect r, double opacity)
m_spinY
->
blockSignals
(
true
);
m_spinWidth
->
blockSignals
(
true
);
m_spinHeight
->
blockSignals
(
true
);
m_opacity
->
blockSignals
(
true
);
m_spinX
->
setValue
(
r
.
x
());
m_spinY
->
setValue
(
r
.
y
());
m_spinWidth
->
setValue
(
r
.
width
());
m_spinHeight
->
setValue
(
r
.
height
());
m_opacity
->
setValue
((
int
)
(
opacity
*
100
));
if
(
m_opacity
)
{
m_opacity
->
blockSignals
(
true
);
m_opacity
->
setValue
((
int
)
(
opacity
*
100
));
m_opacity
->
blockSignals
(
false
);
}
m_spinX
->
blockSignals
(
false
);
m_spinY
->
blockSignals
(
false
);
m_spinWidth
->
blockSignals
(
false
);
m_spinHeight
->
blockSignals
(
false
);
m_opacity
->
blockSignals
(
false
);
m_monitor
->
setUpEffectGeometry
(
r
);
}
const
QString
GeometryWidget
::
getValue
()
const
{
return
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
m_spinX
->
value
()).
arg
(
m_spinY
->
value
()).
arg
(
m_spinWidth
->
value
()).
arg
(
m_spinHeight
->
value
()).
arg
(
m_opacity
->
isVisible
()
?
m_opacity
->
value
()
/
100.0
:
1
);
if
(
m_opacity
)
{
return
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
(
m_spinX
->
value
()).
arg
(
m_spinY
->
value
()).
arg
(
m_spinWidth
->
value
()).
arg
(
m_spinHeight
->
value
()).
arg
(
m_opacity
->
value
()
/
100.0
);
}
return
QStringLiteral
(
"%1 %2 %3 %4"
).
arg
(
m_spinX
->
value
()).
arg
(
m_spinY
->
value
()).
arg
(
m_spinWidth
->
value
()).
arg
(
m_spinHeight
->
value
());
}
void
GeometryWidget
::
connectMonitor
(
bool
activate
)
...
...
@@ -418,17 +426,6 @@ void GeometryWidget::connectMonitor(bool activate)
connect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
GeometryWidget
::
slotUpdateGeometryRect
,
Qt
::
UniqueConnection
);
QRect
rect
(
m_spinX
->
value
(),
m_spinY
->
value
(),
m_spinWidth
->
value
(),
m_spinHeight
->
value
());
m_monitor
->
setUpEffectGeometry
(
rect
);
/*double ratio = (double)m_spinWidth->value() / m_spinHeight->value();
if (m_sourceSize.width() != m_defaultSize.width() || m_sourceSize.height() != m_defaultSize.height()) {
// Source frame size different than project frame size, enable original size option accordingly
bool isOriginalSize =
qAbs((double)m_sourceSize.width() / m_sourceSize.height() - ratio) < qAbs((double)m_defaultSize.width() / m_defaultSize.height() - ratio);
if (isOriginalSize) {
m_originalSize->blockSignals(true);
m_originalSize->setChecked(true);
m_originalSize->blockSignals(false);
}
}*/
}
else
{
disconnect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
GeometryWidget
::
slotUpdateGeometryRect
);
}
...
...
src/widgets/geometrywidget.h
View file @
0dc470b4
...
...
@@ -48,7 +48,7 @@ public:
* @param frameSize The frame size of the original source video
* @param useRatioLock When true, width/height will keep the profile's aspect ratio on resize
*/
explicit
GeometryWidget
(
Monitor
*
monitor
,
QPair
<
int
,
int
>
range
,
const
QRect
&
rect
,
const
QSize
frameSize
,
bool
useRatioLock
,
QWidget
*
parent
=
nullptr
);
explicit
GeometryWidget
(
Monitor
*
monitor
,
QPair
<
int
,
int
>
range
,
const
QRect
&
rect
,
const
QSize
frameSize
,
bool
useRatioLock
,
bool
useOpacity
,
QWidget
*
parent
=
nullptr
);
void
setValue
(
const
QRect
r
,
double
opacity
=
1
);
void
connectMonitor
(
bool
activate
);
...
...
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