Some ui fixes for mixer and monitor audio thumb

parent 968e89a6
Pipeline #10029 passed with stage
in 27 minutes and 3 seconds
......@@ -22,6 +22,7 @@
#include "mixermanager.hpp"
#include "mixerwidget.hpp"
#include "timeline2/model/timelineitemmodel.hpp"
#include "kdenlivesettings.h"
#include "mlt++/MltService.h"
#include "mlt++/MltTractor.h"
......@@ -174,6 +175,7 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
}
connect(this, &MixerManager::updateLevels, m_masterMixer.get(), &MixerWidget::updateAudioLevel);
m_masterBox->addWidget(m_masterMixer.get());
collapseMixers();
}
void MixerManager::recordStateChanged(int tid, bool recording)
......@@ -183,31 +185,34 @@ void MixerManager::recordStateChanged(int tid, bool recording)
}
}
void MixerManager::connectMixer(bool doConnect)
void MixerManager::connectMixer(bool doConnect, bool channelsOnly)
{
m_connectedWidgets = doConnect;
for (auto item : m_mixers) {
item.second->connectMixer(m_connectedWidgets);
}
if (m_masterMixer != nullptr) {
if (!channelsOnly && m_masterMixer != nullptr) {
m_masterMixer->connectMixer(m_connectedWidgets);
}
}
void MixerManager::collapseMixers(bool collapse)
void MixerManager::collapseMixers()
{
if (collapse) {
if (KdenliveSettings::mixerCollapse()) {
m_expandedWidth = width();
m_channelsBox->setMaximumWidth(0);
m_channelsBox->setFixedWidth(0);
m_line->setMaximumWidth(0);
connectMixer(false, true);
setFixedWidth(m_masterMixer->width() + 2 * m_box->contentsMargins().left());
} else {
m_line->setMaximumWidth(QWIDGETSIZE_MAX);
m_channelsBox->setMaximumWidth(QWIDGETSIZE_MAX);
m_channelsBox->setMinimumWidth(m_masterMixer->width() + 2 * m_box->contentsMargins().left());
setMaximumWidth(QWIDGETSIZE_MAX);
if (m_expandedWidth > 0) {
setFixedWidth(m_expandedWidth);
}
connectMixer(true, true);
QTimer::singleShot(500, this, &MixerManager::resetSizePolicy);
}
}
......
......@@ -50,8 +50,8 @@ public:
void setModel(std::shared_ptr<TimelineItemModel> model);
void cleanup();
/** @brief Connect the mixer widgets to the correspondant filters */
void connectMixer(bool doConnect);
void collapseMixers(bool collapse);
void connectMixer(bool doConnect, bool channelsOnly = false);
void collapseMixers();
public slots:
void resetAudioValues();
......
......@@ -279,7 +279,8 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_collapse->setCheckable(true);
m_collapse->setAutoRaise(true);
connect(m_collapse, &QToolButton::clicked, [&]() {
m_manager->collapseMixers(m_collapse->isChecked());
KdenliveSettings::setMixerCollapse(m_collapse->isChecked());
m_manager->collapseMixers();
});
}
......
......@@ -810,6 +810,11 @@
<default>true</default>
</entry>
<entry name="mixerCollapse" type="Bool">
<label>Collapse audio mixer (only show master channel).</label>
<default>false</default>
</entry>
<entry name="producerslist" type="StringList">
<label>List of available MLT producers.</label>
<default></default>
......
......@@ -138,6 +138,8 @@ GLWidget::GLWidget(int id, QObject *parent)
connect(this, &QQuickWindow::sceneGraphInitialized, this, &GLWidget::initializeGL, Qt::DirectConnection);
connect(this, &QQuickWindow::beforeRendering, this, &GLWidget::paintGL, Qt::DirectConnection);
connect(this, &GLWidget::buildAudioThumb, this, &GLWidget::setAudioThumb);
registerTimelineItems();
m_proxy = new MonitorProxy(this);
connect(m_proxy, &MonitorProxy::seekRequestChanged, this, &GLWidget::requestSeek);
......@@ -1800,7 +1802,6 @@ void GLWidget::setAudioThumb(int channels, const QList <double>&audioCache)
}
painter.end();
}
audioThumbDisplay->setImage(img);
}
......
......@@ -189,6 +189,7 @@ signals:
void seekPosition(int);
void consumerPosition(int);
void activateMonitor();
void buildAudioThumb(int channels = 0, const QList <double>&audioCache = QList<double>());
protected:
Mlt::Filter *m_glslManager;
......
......@@ -1994,7 +1994,7 @@ void Monitor::slotEditInlineMarker()
void Monitor::prepareAudioThumb(int channels, const QList <double>&audioCache)
{
m_glMonitor->setAudioThumb(channels, audioCache);
m_glMonitor->buildAudioThumb(channels, audioCache);
}
void Monitor::slotSwitchAudioMonitor()
......
......@@ -42,6 +42,7 @@ MonitorProxy::MonitorProxy(GLWidget *parent)
, m_zoneIn(0)
, m_zoneOut(-1)
, m_hasAV(false)
, m_clipType(0)
{
}
......@@ -293,16 +294,18 @@ QString MonitorProxy::toTimecode(int frames) const
void MonitorProxy::setClipProperties(ClipType::ProducerType type, bool hasAV, const QString clipName)
{
if (m_hasAV != hasAV) {
if (hasAV != m_hasAV) {
m_hasAV = hasAV;
emit clipHasAVChanged();
}
if (clipName == clipName) {
if (clipName == m_clipName) {
m_clipName.clear();
emit clipNameChanged();
}
m_clipName = clipName;
emit clipNameChanged();
m_clipType = type;
emit clipTypeChanged();
if (type != m_clipType) {
m_clipType = type;
emit clipTypeChanged();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment