From 26587512556aed6bb5babc5a71640da9603555d5 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Sun, 7 Jan 2024 17:34:32 +0100 Subject: [PATCH] Fix mixer channel updates on solo/mute Fix the update of the mixer channels whenever a channel is soloed or muted. The solution is rather "brutal" as it updates all mixer channel views when one of the models changes. Introduce private helper method `MixerView::updateAllMixerChannels`. It calls the `update` method on each `MixerChannelView` so that they can get repainted. Call `updateAllMixerChannels` at the end of the existing method `toggledSolo`. Introduce a new method `MixerView::toggledMute` which is called whenever the mute model of a channel changes. It also updates all mixer channels. Fixes #7054. --- include/MixerView.h | 4 ++++ src/gui/MixerChannelView.cpp | 1 + src/gui/MixerView.cpp | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/include/MixerView.h b/include/MixerView.h index a47786481..bc99a3340 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -98,6 +98,10 @@ protected: private slots: void updateFaders(); void toggledSolo(); + void toggledMute(); + +private: + void updateAllMixerChannels(); private: QVector m_mixerChannelViews; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 0f8ccedea..cbd9019f1 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -104,6 +104,7 @@ namespace lmms::gui m_muteButton->setInactiveGraphic(embed::getIconPixmap("led_green")); m_muteButton->setCheckable(true); m_muteButton->setToolTip(tr("Mute this channel")); + connect(&mixerChannel->m_muteModel, &BoolModel::dataChanged, mixerView, &MixerView::toggledMute, Qt::DirectConnection); m_soloButton = new PixmapButton(this, tr("Solo")); m_soloButton->setModel(&mixerChannel->m_soloModel); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index a28ac7976..ea6a28948 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -283,6 +283,22 @@ void MixerView::loadSettings(const QDomElement& domElement) void MixerView::toggledSolo() { Engine::mixer()->toggledSolo(); + + updateAllMixerChannels(); +} + + +void MixerView::toggledMute() +{ + updateAllMixerChannels(); +} + +void MixerView::updateAllMixerChannels() +{ + for (int i = 0; i < m_mixerChannelViews.size(); ++i) + { + m_mixerChannelViews[i]->update(); + } }