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.
This commit is contained in:
Michael Gregorius
2024-01-07 17:34:32 +01:00
parent 1eff322c2a
commit 2658751255
3 changed files with 21 additions and 0 deletions

View File

@@ -98,6 +98,10 @@ protected:
private slots:
void updateFaders();
void toggledSolo();
void toggledMute();
private:
void updateAllMixerChannels();
private:
QVector<MixerChannelView*> m_mixerChannelViews;

View File

@@ -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);

View File

@@ -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();
}
}