Skip to content
GitLab
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
3d47f235
Commit
3d47f235
authored
Mar 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Cleanup audiomixer (use line separators)
Related to
#590
parent
2824c27d
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/audiomixer/mixermanager.cpp
View file @
3d47f235
...
...
@@ -69,10 +69,6 @@ MixerManager::MixerManager(QWidget *parent)
m_channelsLayout
->
setSpacing
(
4
);
channelsBoxContainer
->
setLayout
(
m_channelsLayout
);
m_channelsLayout
->
addStretch
(
10
);
m_line
=
new
QFrame
(
this
);
m_line
->
setFrameShape
(
QFrame
::
VLine
);
m_line
->
setFrameShadow
(
QFrame
::
Sunken
);
m_box
->
addWidget
(
m_line
);
m_box
->
addLayout
(
m_masterBox
);
setLayout
(
m_box
);
}
...
...
@@ -83,7 +79,7 @@ void MixerManager::registerTrack(int tid, std::shared_ptr<Mlt::Tractor> service,
// Track already registered
return
;
}
std
::
shared_ptr
<
MixerWidget
>
mixer
(
new
MixerWidget
(
m_mixers
.
size
()
%
2
==
0
,
tid
,
service
,
trackTag
,
this
));
std
::
shared_ptr
<
MixerWidget
>
mixer
(
new
MixerWidget
(
tid
,
service
,
trackTag
,
this
));
connect
(
mixer
.
get
(),
&
MixerWidget
::
muteTrack
,
[
&
](
int
id
,
bool
mute
)
{
m_model
->
setTrackProperty
(
id
,
"hide"
,
mute
?
QStringLiteral
(
"1"
)
:
QStringLiteral
(
"3"
));
});
...
...
@@ -121,8 +117,12 @@ void MixerManager::registerTrack(int tid, std::shared_ptr<Mlt::Tractor> service,
}
});
m_mixers
[
tid
]
=
mixer
;
QFrame
*
line
=
new
QFrame
(
this
);
line
->
setFrameShape
(
QFrame
::
VLine
);
line
->
setFrameShadow
(
QFrame
::
Sunken
);
m_channelsLayout
->
insertWidget
(
0
,
line
);
m_channelsLayout
->
insertWidget
(
0
,
mixer
.
get
());
m_recommandedWidth
=
(
mixer
->
minimumWidth
()
+
4
)
*
(
qMin
(
2
,
int
(
m_mixers
.
size
())));
m_recommandedWidth
=
(
mixer
->
minimumWidth
()
+
12
+
line
->
minimumWidth
()
)
*
(
qMin
(
2
,
int
(
m_mixers
.
size
())));
m_channelsBox
->
setMinimumWidth
(
m_recommandedWidth
);
}
...
...
@@ -134,8 +134,11 @@ void MixerManager::deregisterTrack(int tid)
void
MixerManager
::
cleanup
()
{
for
(
auto
item
:
m_mixers
)
{
m_channelsLayout
->
removeWidget
(
item
.
second
.
get
());
while
(
QLayoutItem
*
item
=
m_channelsLayout
->
takeAt
(
0
))
{
if
(
QWidget
*
widget
=
item
->
widget
())
{
widget
->
deleteLater
();
}
delete
item
;
}
m_mixers
.
clear
();
if
(
m_masterMixer
)
{
...
...
@@ -163,7 +166,7 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
// delete previous master mixer
m_masterBox
->
removeWidget
(
m_masterMixer
.
get
());
}
m_masterMixer
.
reset
(
new
MixerWidget
(
m_mixers
.
size
()
%
2
==
0
,
-
1
,
service
,
i18n
(
"Master"
),
this
));
m_masterMixer
.
reset
(
new
MixerWidget
(
-
1
,
service
,
i18n
(
"Master"
),
this
));
connect
(
m_masterMixer
.
get
(),
&
MixerWidget
::
muteTrack
,
[
&
](
int
/*id*/
,
bool
mute
)
{
m_model
->
tractor
()
->
set
(
"hide"
,
mute
?
3
:
1
);
});
...
...
@@ -202,10 +205,10 @@ void MixerManager::collapseMixers()
if
(
KdenliveSettings
::
mixerCollapse
())
{
m_expandedWidth
=
width
();
m_channelsBox
->
setFixedWidth
(
0
);
m_line
->
setMaximumWidth
(
0
);
//
m_line->setMaximumWidth(0);
setFixedWidth
(
m_masterMixer
->
width
()
+
2
*
m_box
->
contentsMargins
().
left
());
}
else
{
m_line
->
setMaximumWidth
(
QWIDGETSIZE_MAX
);
//
m_line->setMaximumWidth(QWIDGETSIZE_MAX);
m_channelsBox
->
setMaximumWidth
(
QWIDGETSIZE_MAX
);
m_channelsBox
->
setMinimumWidth
(
m_recommandedWidth
);
setFixedWidth
(
m_expandedWidth
);
...
...
src/audiomixer/mixermanager.hpp
View file @
3d47f235
...
...
@@ -36,7 +36,6 @@ class MixerWidget;
class
QHBoxLayout
;
class
TimelineItemModel
;
class
QScrollArea
;
class
QFrame
;
class
MixerManager
:
public
QWidget
{
...
...
@@ -80,7 +79,6 @@ private:
QHBoxLayout
*
m_masterBox
;
QHBoxLayout
*
m_channelsLayout
;
QScrollArea
*
m_channelsBox
;
QFrame
*
m_line
;
int
m_lastFrame
;
bool
m_visibleMixerManager
;
int
m_expandedWidth
;
...
...
src/audiomixer/mixerwidget.cpp
View file @
3d47f235
...
...
@@ -94,7 +94,7 @@ void MixerWidget::property_changed( mlt_service , MixerWidget *widget, char *nam
}
}
MixerWidget
::
MixerWidget
(
bool
alternateBackground
,
int
tid
,
std
::
shared_ptr
<
Mlt
::
Tractor
>
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
)
MixerWidget
::
MixerWidget
(
int
tid
,
std
::
shared_ptr
<
Mlt
::
Tractor
>
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
)
:
QWidget
(
parent
)
,
m_manager
(
parent
)
,
m_tid
(
tid
)
...
...
@@ -109,10 +109,10 @@ MixerWidget::MixerWidget(bool alternateBackground, int tid, std::shared_ptr<Mlt:
,
m_listener
(
nullptr
)
,
m_recording
(
false
)
{
buildUI
(
alternateBackground
,
service
.
get
(),
trackTag
);
buildUI
(
service
.
get
(),
trackTag
);
}
MixerWidget
::
MixerWidget
(
bool
alternateBackground
,
int
tid
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
)
MixerWidget
::
MixerWidget
(
int
tid
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
)
:
QWidget
(
parent
)
,
m_manager
(
parent
)
,
m_tid
(
tid
)
...
...
@@ -127,7 +127,7 @@ MixerWidget::MixerWidget(bool alternateBackground, int tid, Mlt::Tractor *servic
,
m_listener
(
nullptr
)
,
m_recording
(
false
)
{
buildUI
(
alternateBackground
,
service
,
trackTag
);
buildUI
(
service
,
trackTag
);
}
MixerWidget
::~
MixerWidget
()
...
...
@@ -137,15 +137,13 @@ MixerWidget::~MixerWidget()
}
}
void
MixerWidget
::
buildUI
(
bool
alternateBackground
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
)
void
MixerWidget
::
buildUI
(
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
)
{
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
// Build audio meter widget
m_audioMeterWidget
.
reset
(
new
AudioLevelWidget
(
width
(),
this
));
// initialize for stereo display
m_audioMeterWidget
->
setAudioValues
({
-
100
,
-
100
});
setAutoFillBackground
(
true
);
setBackgroundRole
(
alternateBackground
?
QPalette
::
AlternateBase
:
QPalette
::
Base
);
// Build volume widget
m_volumeSlider
=
new
QSlider
(
Qt
::
Vertical
,
this
);
...
...
src/audiomixer/mixerwidget.hpp
View file @
3d47f235
...
...
@@ -50,10 +50,10 @@ class MixerWidget : public QWidget
Q_OBJECT
public:
MixerWidget
(
bool
alternateBackground
,
int
tid
,
std
::
shared_ptr
<
Mlt
::
Tractor
>
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
=
nullptr
);
MixerWidget
(
bool
alternateBackground
,
int
tid
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
=
nullptr
);
MixerWidget
(
int
tid
,
std
::
shared_ptr
<
Mlt
::
Tractor
>
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
=
nullptr
);
MixerWidget
(
int
tid
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
,
MixerManager
*
parent
=
nullptr
);
virtual
~
MixerWidget
();
void
buildUI
(
bool
alternateBackground
,
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
);
void
buildUI
(
Mlt
::
Tractor
*
service
,
const
QString
&
trackTag
);
/** @brief discard stored audio values and reset vu-meter to 0 if requested */
void
reset
();
/** @brief discard stored audio values */
...
...
Bruno Santos
@bsantos
mentioned in issue
#590 (closed)
·
Mar 23, 2020
mentioned in issue
#590 (closed)
mentioned in issue #590
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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