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
41c63e46
Commit
41c63e46
authored
May 02, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refresh clip properties panel when switching audio stream from monitor and reverse
parent
36b0928a
Pipeline
#19343
passed with stage
in 9 minutes and 41 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
24 deletions
+70
-24
src/bin/bin.cpp
src/bin/bin.cpp
+7
-0
src/bin/bin.h
src/bin/bin.h
+2
-0
src/bin/projectclip.cpp
src/bin/projectclip.cpp
+12
-5
src/mltcontroller/clippropertiescontroller.cpp
src/mltcontroller/clippropertiescontroller.cpp
+24
-14
src/mltcontroller/clippropertiescontroller.h
src/mltcontroller/clippropertiescontroller.h
+2
-0
src/monitor/monitor.cpp
src/monitor/monitor.cpp
+21
-3
src/monitor/monitor.h
src/monitor/monitor.h
+1
-0
src/titler/titlewidget.cpp
src/titler/titlewidget.cpp
+1
-2
No files found.
src/bin/bin.cpp
View file @
41c63e46
...
...
@@ -2389,6 +2389,13 @@ void Bin::reloadMonitorIfActive(const QString &id)
}
}
void
Bin
::
reloadMonitorStreamIfActive
(
const
QString
&
id
)
{
if
(
m_monitor
->
activeClipId
()
==
id
)
{
m_monitor
->
reloadActiveStream
();
}
}
QStringList
Bin
::
getBinFolderClipIds
(
const
QString
&
id
)
const
{
QStringList
ids
;
...
...
src/bin/bin.h
View file @
41c63e46
...
...
@@ -219,6 +219,8 @@ public:
/** @brief refresh monitor (if clip changed) */
void
reloadMonitorIfActive
(
const
QString
&
id
);
/** @brief refresh monitor stream selector */
void
reloadMonitorStreamIfActive
(
const
QString
&
id
);
void
doMoveClip
(
const
QString
&
id
,
const
QString
&
newParentId
);
void
doMoveFolder
(
const
QString
&
id
,
const
QString
&
newParentId
);
...
...
src/bin/projectclip.cpp
View file @
41c63e46
...
...
@@ -1062,10 +1062,7 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
updateTimelineClips
({
TimelineModel
::
NameRole
});
}
}
if
(
refreshPanel
)
{
// Some of the clip properties have changed through a command, update properties panel
emit
refreshPropertiesPanel
();
}
bool
audioStreamChanged
=
properties
.
contains
(
QStringLiteral
(
"audio_index"
));
if
(
reload
)
{
// producer has changed, refresh monitor and thumbnail
if
(
hasProxy
())
{
...
...
@@ -1073,7 +1070,6 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
setProducerProperty
(
QStringLiteral
(
"_overwriteproxy"
),
1
);
pCore
->
jobManager
()
->
startJob
<
ProxyJob
>
({
clipId
()},
-
1
,
QString
());
}
else
{
bool
audioStreamChanged
=
properties
.
contains
(
QStringLiteral
(
"audio_index"
));
reloadProducer
(
refreshOnly
,
audioStreamChanged
,
audioStreamChanged
||
(
!
refreshOnly
&&
!
properties
.
contains
(
QStringLiteral
(
"kdenlive:proxy"
))));
}
if
(
refreshOnly
)
{
...
...
@@ -1084,6 +1080,17 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
if
(
!
updateRoles
.
isEmpty
())
{
updateTimelineClips
(
updateRoles
);
}
}
else
{
if
(
audioStreamChanged
)
{
discardAudioThumb
();
pCore
->
bin
()
->
reloadMonitorStreamIfActive
(
clipId
());
pCore
->
jobManager
()
->
startJob
<
AudioThumbJob
>
({
clipId
()},
-
1
,
QString
());
refreshPanel
=
true
;
}
}
if
(
refreshPanel
)
{
// Some of the clip properties have changed through a command, update properties panel
emit
refreshPropertiesPanel
();
}
if
(
!
passProperties
.
isEmpty
()
&&
(
!
reload
||
refreshOnly
))
{
for
(
auto
&
p
:
m_audioProducers
)
{
...
...
src/mltcontroller/clippropertiescontroller.cpp
View file @
41c63e46
...
...
@@ -166,6 +166,7 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
,
m_id
(
controller
->
binId
())
,
m_type
(
controller
->
clipType
())
,
m_properties
(
new
Mlt
::
Properties
(
controller
->
properties
()))
,
m_audioStream
(
nullptr
)
,
m_textEdit
(
nullptr
)
{
m_controller
->
mirrorOriginalProperties
(
m_sourceProperties
);
...
...
@@ -612,42 +613,42 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
tbv
->
setAutoRaise
(
true
);
hlay
->
addWidget
(
tbv
);
hlay
->
addWidget
(
new
QLabel
(
i18n
(
"Audio stream"
)));
auto
*
audioStream
=
new
QComboBox
(
this
);
m_
audioStream
=
new
QComboBox
(
this
);
QMapIterator
<
int
,
QString
>
i
(
audioStreamsInfo
);
while
(
i
.
hasNext
())
{
i
.
next
();
audioStream
->
addItem
(
QString
(
"%1: %2"
).
arg
(
i
.
key
()).
arg
(
i
.
value
()),
i
.
key
());
m_
audioStream
->
addItem
(
QString
(
"%1: %2"
).
arg
(
i
.
key
()).
arg
(
i
.
value
()),
i
.
key
());
}
if
(
audioStream
->
count
()
>
1
)
{
audioStream
->
addItem
(
i18n
(
"Merge all streams"
),
INT_MAX
);
if
(
m_
audioStream
->
count
()
>
1
)
{
m_
audioStream
->
addItem
(
i18n
(
"Merge all streams"
),
INT_MAX
);
}
if
(
!
vix
.
isEmpty
()
&&
vix
.
toInt
()
!=
-
1
)
{
audioStream
->
setCurrentIndex
(
audioStream
->
findData
(
QVariant
(
vix
)));
m_
audioStream
->
setCurrentIndex
(
m_
audioStream
->
findData
(
QVariant
(
vix
)));
}
ac
->
setActive
(
vix
.
toInt
()
==
-
1
);
audioStream
->
setEnabled
(
vix
.
toInt
()
>
-
1
);
audioStream
->
setVisible
(
audioStreamsInfo
.
size
()
>
0
);
connect
(
ac
,
&
KDualAction
::
activeChanged
,
[
this
,
audioStream
](
bool
activated
)
{
m_
audioStream
->
setEnabled
(
vix
.
toInt
()
>
-
1
);
m_
audioStream
->
setVisible
(
audioStreamsInfo
.
size
()
>
0
);
connect
(
ac
,
&
KDualAction
::
activeChanged
,
[
this
](
bool
activated
)
{
QMap
<
QString
,
QString
>
properties
;
int
vindx
=
-
1
;
if
(
activated
)
{
audioStream
->
setEnabled
(
false
);
m_
audioStream
->
setEnabled
(
false
);
}
else
{
audioStream
->
setEnabled
(
true
);
vindx
=
audioStream
->
currentData
().
toInt
();
m_
audioStream
->
setEnabled
(
true
);
vindx
=
m_
audioStream
->
currentData
().
toInt
();
}
properties
.
insert
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
vindx
));
properties
.
insert
(
QStringLiteral
(
"set.test_audio"
),
vindx
>
-
1
?
QStringLiteral
(
"0"
)
:
QStringLiteral
(
"1"
));
emit
updateClipProperties
(
m_id
,
m_originalProperties
,
properties
);
m_originalProperties
=
properties
;
});
QObject
::
connect
(
audioStream
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
[
this
,
audioStream
]()
{
QObject
::
connect
(
m_
audioStream
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
[
this
]()
{
QMap
<
QString
,
QString
>
properties
;
properties
.
insert
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
audioStream
->
currentData
().
toInt
()));
properties
.
insert
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
m_
audioStream
->
currentData
().
toInt
()));
emit
updateClipProperties
(
m_id
,
m_originalProperties
,
properties
);
m_originalProperties
=
properties
;
});
hlay
->
addWidget
(
audioStream
);
hlay
->
addWidget
(
m_
audioStream
);
vbox
->
addLayout
(
hlay
);
// Audio sync
...
...
@@ -777,6 +778,15 @@ void ClipPropertiesController::slotReloadProperties()
m_originalProperties
.
insert
(
QStringLiteral
(
"kdenlive:proxy"
),
proxy
);
emit
proxyModified
(
proxy
);
}
if
(
m_audioStream
&&
m_audioStream
->
isEnabled
())
{
int
audio_ix
=
m_properties
->
get_int
(
"audio_index"
);
if
(
audio_ix
!=
m_originalProperties
.
value
(
QStringLiteral
(
"audio_index"
)).
toInt
())
{
QSignalBlocker
bk
(
m_audioStream
);
m_originalProperties
.
insert
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
audio_ix
));
// update combo
m_audioStream
->
setCurrentIndex
(
m_audioStream
->
findData
(
audio_ix
));
}
}
break
;
}
default:
...
...
src/mltcontroller/clippropertiescontroller.h
View file @
41c63e46
...
...
@@ -34,6 +34,7 @@ class ClipController;
class
QMimeData
;
class
QTextEdit
;
class
QLabel
;
class
QComboBox
;
class
AnalysisTree
:
public
QTreeWidget
{
...
...
@@ -107,6 +108,7 @@ private:
QWidget
*
m_markersPage
;
QWidget
*
m_metaPage
;
QWidget
*
m_analysisPage
;
QComboBox
*
m_audioStream
;
QTreeView
*
m_markerTree
;
AnalysisTree
*
m_analysisTree
;
QTextEdit
*
m_textEdit
;
...
...
src/monitor/monitor.cpp
View file @
41c63e46
...
...
@@ -1445,9 +1445,11 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
ac
->
setChecked
(
true
);
}
m_audioChannelsGroup
->
addAction
(
ac
);
connect
(
m_audioChannelsGroup
,
&
QActionGroup
::
triggered
,
[
controller
]
(
QAction
*
ac
)
{
int
selectedStream
=
ac
->
data
().
toInt
();
controller
->
setProducerProperty
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
selectedStream
));
connect
(
m_audioChannelsGroup
,
&
QActionGroup
::
triggered
,
[
controller
]
(
QAction
*
act
)
{
int
selectedStream
=
act
->
data
().
toInt
();
QMap
<
QString
,
QString
>
props
;
props
.
insert
(
QStringLiteral
(
"audio_index"
),
QString
::
number
(
selectedStream
));
controller
->
setProperties
(
props
,
true
);
});
m_audioChannels
->
menuAction
()
->
setVisible
(
true
);
}
else
{
...
...
@@ -1508,6 +1510,22 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
checkOverlay
();
}
void
Monitor
::
reloadActiveStream
()
{
if
(
m_controller
)
{
int
activeStream
=
m_controller
->
getProducerIntProperty
(
QLatin1String
(
"audio_index"
));
QList
<
QAction
*>
actions
=
m_audioChannels
->
actions
();
QSignalBlocker
bk
(
m_audioChannelsGroup
);
for
(
QAction
*
ac
:
actions
)
{
if
(
ac
->
data
().
toInt
()
==
activeStream
)
{
ac
->
setChecked
(
true
);
break
;
}
}
}
}
const
QString
Monitor
::
activeClipId
()
{
if
(
m_controller
)
{
...
...
src/monitor/monitor.h
View file @
41c63e46
...
...
@@ -157,6 +157,7 @@ public:
void
updateMultiTrackView
(
int
tid
);
/** @brief Returns true if monitor is currently fullscreen */
bool
monitorIsFullScreen
()
const
;
void
reloadActiveStream
();
protected:
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
...
...
src/titler/titlewidget.cpp
View file @
41c63e46
...
...
@@ -1240,7 +1240,6 @@ void TitleWidget::slotValueChanged(int type)
double
length
;
// Scaling factor
double
scale
=
1
;
double
scalex
=
t
.
scalex
;
double
scaley
=
t
.
scaley
;
...
...
@@ -2934,7 +2933,7 @@ void TitleWidget::prepareTools(QGraphicsItem *referenceItem)
enableToolbars
(
TITLE_IMAGE
);
QSignalBlocker
bk
(
preserveAspectRatio
);
Transform
t
=
m_transformations
.
value
(
referenceItem
);
preserveAspectRatio
->
setChecked
(
t
.
scalex
==
t
.
scaley
);
preserveAspectRatio
->
setChecked
(
qFuzzyCompare
(
t
.
scalex
,
t
.
scaley
)
)
;
}
else
{
showToolbars
(
TITLE_SELECT
);
...
...
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