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
a570f04c
Commit
a570f04c
authored
Nov 09, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix audio mix duration / position incorrect in mix widget
Related to
#796
parent
dac7f278
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/assets/model/assetparametermodel.cpp
View file @
a570f04c
...
...
@@ -18,6 +18,8 @@
#include
<effects/effectsrepository.hpp>
#define DEBUG_LOCALE false
static
QVector
<
int
>
bypassRoles
=
{
AssetParameterModel
::
InRole
,
AssetParameterModel
::
OutRole
,
AssetParameterModel
::
ParentInRole
,
AssetParameterModel
::
ParentDurationRole
,
AssetParameterModel
::
ParentPositionRole
,
AssetParameterModel
::
HideKeyframesFirstRole
};
AssetParameterModel
::
AssetParameterModel
(
std
::
unique_ptr
<
Mlt
::
Properties
>
asset
,
const
QDomElement
&
assetXml
,
const
QString
&
assetId
,
ObjectId
ownerId
,
const
QString
&
originalDecimalPoint
,
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
...
...
@@ -428,6 +430,29 @@ AssetParameterModel::~AssetParameterModel() = default;
QVariant
AssetParameterModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
bypassRoles
.
contains
(
role
))
{
switch
(
role
)
{
case
InRole
:
return
m_asset
->
get_int
(
"in"
);
case
OutRole
:
return
m_asset
->
get_int
(
"out"
);
case
ParentInRole
:
return
pCore
->
getItemIn
(
m_ownerId
);
case
ParentDurationRole
:
if
(
m_asset
->
get_int
(
"kdenlive:force_in_out"
)
==
1
)
{
// Zone effect, return effect length
return
m_asset
->
get_int
(
"out"
)
-
m_asset
->
get_int
(
"in"
);
}
return
pCore
->
getItemDuration
(
m_ownerId
);
case
ParentPositionRole
:
return
pCore
->
getItemPosition
(
m_ownerId
);
case
HideKeyframesFirstRole
:
return
m_hideKeyframesByDefault
;
default:
qDebug
()
<<
"WARNING; UNHANDLED DATA: "
<<
role
;
return
QVariant
();
}
}
if
(
index
.
row
()
<
0
||
index
.
row
()
>=
m_rows
.
size
()
||
!
index
.
isValid
())
{
return
QVariant
();
}
...
...
@@ -450,22 +475,6 @@ QVariant AssetParameterModel::data(const QModelIndex &index, int role) const
}
return
comment
;
}
case
InRole
:
return
m_asset
->
get_int
(
"in"
);
case
OutRole
:
return
m_asset
->
get_int
(
"out"
);
case
ParentInRole
:
return
pCore
->
getItemIn
(
m_ownerId
);
case
ParentDurationRole
:
if
(
m_asset
->
get_int
(
"kdenlive:force_in_out"
)
==
1
)
{
// Zone effect, return effect length
return
m_asset
->
get_int
(
"out"
)
-
m_asset
->
get_int
(
"in"
);
}
return
pCore
->
getItemDuration
(
m_ownerId
);
case
ParentPositionRole
:
return
pCore
->
getItemPosition
(
m_ownerId
);
case
HideKeyframesFirstRole
:
return
m_hideKeyframesByDefault
;
case
MinRole
:
return
parseAttribute
(
m_ownerId
,
QStringLiteral
(
"min"
),
element
);
case
MaxRole
:
...
...
src/transitions/view/mixstackview.cpp
View file @
a570f04c
...
...
@@ -76,14 +76,13 @@ void MixStackView::setModel(const std::shared_ptr<AssetParameterModel> &model, Q
emit
initKeyframeView
(
true
);
pCore
->
getMonitor
(
m_model
->
monitorId
)
->
slotShowEffectScene
(
needsMonitorEffectScene
());
if
(
m_model
->
rowCount
()
>
0
)
{
const
QSignalBlocker
bk0
(
m_duration
);
const
QSignalBlocker
bk1
(
m_position
);
int
duration
=
m_model
->
data
(
m_model
->
index
(
0
,
0
),
AssetParameterModel
::
ParentDurationRole
).
toInt
();
m_duration
->
setValue
(
duration
);
m_position
->
setValue
(
duration
-
pCore
->
getMixCutPos
(
stackOwner
().
second
));
connect
(
m_model
.
get
(),
&
AssetParameterModel
::
dataChanged
,
this
,
&
MixStackView
::
durationChanged
);
}
const
QSignalBlocker
bk0
(
m_duration
);
const
QSignalBlocker
bk1
(
m_position
);
int
duration
=
m_model
->
data
(
m_model
->
index
(
0
,
0
),
AssetParameterModel
::
ParentDurationRole
).
toInt
();
m_duration
->
setValue
(
duration
);
m_position
->
setValue
(
duration
-
pCore
->
getMixCutPos
(
stackOwner
().
second
));
connect
(
m_model
.
get
(),
&
AssetParameterModel
::
dataChanged
,
this
,
&
MixStackView
::
durationChanged
);
// The layout is handled by AssetParameterView, so we can only add our custom stuff later here
m_lay
->
addLayout
(
m_durationLayout
);
m_lay
->
addLayout
(
m_positionLayout
);
...
...
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