Cleanup & fix compile warning in recent audiomixer change

parent 0555567c
......@@ -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(m_mixers.size(), tid, service, trackTag, this));
std::shared_ptr<MixerWidget> mixer(new MixerWidget(m_mixers.size() % 2 == 0, tid, service, trackTag, this));
connect(mixer.get(), &MixerWidget::muteTrack, [&](int id, bool mute) {
m_model->setTrackProperty(id, "hide", mute ? QStringLiteral("1") : QStringLiteral("3"));
});
......@@ -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(m_mixers.size(), -1, service, i18n("Master"), this));
m_masterMixer.reset(new MixerWidget(m_mixers.size() % 2 == 0, -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 ix, int tid, std::shared_ptr<Mlt::Tractor> service, const QString &trackTag, MixerManager *parent)
MixerWidget::MixerWidget(bool alternateBackground, 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 ix, int tid, std::shared_ptr<Mlt::Tractor> service,
, m_listener(nullptr)
, m_recording(false)
{
buildUI(ix, service.get(), trackTag);
buildUI(alternateBackground, service.get(), trackTag);
}
MixerWidget::MixerWidget(int ix, int tid, Mlt::Tractor *service, const QString &trackTag, MixerManager *parent)
MixerWidget::MixerWidget(bool alternateBackground, 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 ix, int tid, Mlt::Tractor *service, const QString &
, m_listener(nullptr)
, m_recording(false)
{
buildUI(ix, service, trackTag);
buildUI(alternateBackground, service, trackTag);
}
MixerWidget::~MixerWidget()
......@@ -137,7 +137,7 @@ MixerWidget::~MixerWidget()
}
}
void MixerWidget::buildUI(int ix, Mlt::Tractor *service, const QString &trackTag)
void MixerWidget::buildUI(bool alternateBackground, Mlt::Tractor *service, const QString &trackTag)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
// Build audio meter widget
......@@ -145,7 +145,7 @@ void MixerWidget::buildUI(int ix, Mlt::Tractor *service, const QString &trackTag
// initialize for stereo display
m_audioMeterWidget->setAudioValues({-100, -100});
setAutoFillBackground(true);
setBackgroundRole(ix %2 == 0 ? QPalette::AlternateBase : QPalette::Base);
setBackgroundRole(alternateBackground ? 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 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);
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);
virtual ~MixerWidget();
void buildUI(int ix, Mlt::Tractor *service, const QString &trackTag);
void buildUI(bool alternateBackground, 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