Use alternate color for mixer channels and make levels font more visible.

Related to #590
parent 34be1b01
......@@ -104,7 +104,7 @@ void AudioLevelWidget::drawBackground(int channels)
}
QRect rect(m_offset, 0, newSize.width(), newSize.height());
QPainter p(&m_pixmap);
p.setOpacity(isEnabled() ? 0.4 : 0.2);
p.setOpacity(isEnabled() ? 0.8 : 0.4);
p.setFont(font());
p.fillRect(rect, QBrush(gradient));
......
......@@ -66,7 +66,7 @@ MixerManager::MixerManager(QWidget *parent)
m_channelsLayout = new QHBoxLayout;
m_channelsLayout->setContentsMargins(0, 0, 0, 0);
m_masterBox->setContentsMargins(0, 0, 0, 0);
m_channelsLayout->setSpacing(0);
m_channelsLayout->setSpacing(4);
channelsBoxContainer->setLayout(m_channelsLayout);
m_channelsLayout->addStretch(10);
m_line = new QFrame(this);
......@@ -83,7 +83,7 @@ void MixerManager::registerTrack(int tid, std::shared_ptr<Mlt::Tractor> service,
// Track already registered
return;
}
std::shared_ptr<MixerWidget> mixer(new MixerWidget(tid, service, trackTag, this));
std::shared_ptr<MixerWidget> mixer(new MixerWidget(m_mixers.size(), tid, service, trackTag, this));
connect(mixer.get(), &MixerWidget::muteTrack, [&](int id, bool mute) {
m_model->setTrackProperty(id, "hide", mute ? QStringLiteral("1") : QStringLiteral("3"));
});
......@@ -122,7 +122,7 @@ void MixerManager::registerTrack(int tid, std::shared_ptr<Mlt::Tractor> service,
});
m_mixers[tid] = mixer;
m_channelsLayout->insertWidget(0, mixer.get());
m_recommandedWidth = mixer->minimumWidth() * (qMin(2, int(m_mixers.size())));
m_recommandedWidth = (mixer->minimumWidth() + 4) * (qMin(2, int(m_mixers.size())));
m_channelsBox->setMinimumWidth(m_recommandedWidth);
}
......@@ -163,7 +163,7 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
// delete previous master mixer
m_masterBox->removeWidget(m_masterMixer.get());
}
m_masterMixer.reset(new MixerWidget(-1, service, i18n("Master"), this));
m_masterMixer.reset(new MixerWidget(m_mixers.size(), -1, service, i18n("Master"), this));
connect(m_masterMixer.get(), &MixerWidget::muteTrack, [&](int /*id*/, bool mute) {
m_model->tractor()->set("hide", mute ? 3 : 1);
});
......
......@@ -94,7 +94,7 @@ void MixerWidget::property_changed( mlt_service , MixerWidget *widget, char *nam
}
}
MixerWidget::MixerWidget(int tid, std::shared_ptr<Mlt::Tractor> service, const QString &trackTag, MixerManager *parent)
MixerWidget::MixerWidget(int ix, 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(int tid, std::shared_ptr<Mlt::Tractor> service, const Q
, m_listener(nullptr)
, m_recording(false)
{
buildUI(service.get(), trackTag);
buildUI(ix, service.get(), trackTag);
}
MixerWidget::MixerWidget(int tid, Mlt::Tractor *service, const QString &trackTag, MixerManager *parent)
MixerWidget::MixerWidget(int ix, int tid, Mlt::Tractor *service, const QString &trackTag, MixerManager *parent)
: QWidget(parent)
, m_manager(parent)
, m_tid(tid)
......@@ -127,7 +127,7 @@ MixerWidget::MixerWidget(int tid, Mlt::Tractor *service, const QString &trackTag
, m_listener(nullptr)
, m_recording(false)
{
buildUI(service, trackTag);
buildUI(ix, service, trackTag);
}
MixerWidget::~MixerWidget()
......@@ -137,13 +137,15 @@ MixerWidget::~MixerWidget()
}
}
void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
void MixerWidget::buildUI(int ix, 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(ix %2 == 0 ? QPalette::AlternateBase : QPalette::Base);
// Build volume widget
m_volumeSlider = new QSlider(Qt::Vertical, this);
......
......@@ -50,10 +50,10 @@ class MixerWidget : public QWidget
Q_OBJECT
public:
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);
MixerWidget(int ix, int tid, std::shared_ptr<Mlt::Tractor> service, const QString &trackTag, MixerManager *parent = nullptr);
MixerWidget(int ix, int tid, Mlt::Tractor *service, const QString &trackTag, MixerManager *parent = nullptr);
virtual ~MixerWidget();
void buildUI(Mlt::Tractor *service, const QString &trackTag);
void buildUI(int ix, 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 */
......
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