-
-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mixer channel updates on solo/mute (#7055)
* 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. * Improve mixer channel update for mute events Improve the mixer channel update for mute events by not delegating to `MixerView` like for the solo case. Instead the `MixerChannelView` now has its own `toggledMute` slot which simply updates the widget on changes to the mute model. Also fix `MixerChannelView::setChannelIndex` by disconnecting from the signals of the previous mixer channel and connecting to the signals for the new one. Remove `toggledMute` from `MixerView`. The solo implementation is kept as is because it also triggers changes to the core model. So the chain seems to be: * Solo button clicked in mixer channel view * Button changes solo model * Solo model signals to mixer view which was connected via the mixer channel view * Mixer view performs changes in the other core models * All mixer channels are updated. Are better chain would first update the core models and then update the GUI from the changes: * Solo button clicked in mixer channel view * Button changes solo model * Solo model signals to core mixer, i.e. not a view! * Mixer view performs changes in the other core models * Changed models emit signal to GUI elements * Revert "Improve mixer channel update for mute events" This reverts commit ede6596. * Add comment After the revert done with commit the code is more consistent again but not in a good way. Hence a comment is added which indicates that an inprovement is needed. * Abstract mixer retrieval Abstract the retrieval of the mixer behind the new method `getMixer`. This is done in preparation for some dependency injection so that the `MixerView` does not have to ask the `Engine` for the mixer but gets it injected, a.k.a. the "Hollywood principle": "Don't call us, we'll call you." It's called `getMixer` and not just mixer because it allows for locale variables to be called `mixer` without confusing it with the method. * Let MixerView connect directly to models Let the `MixerView` connect directly to the solo and mute models it is connected with. Remove the connections that are made in `MixerChannelView` which acted as a proxy which only complicated things. Add `connectToSoloAndMute` which connects the `MixerView` to the solo and mute models of a given channel. Call it whenever a new channel is created. Add `disconnectFromSoloAndMute` which disconnects the `MixerView` from the solo and mute models of a given channel. Call it when a channel is deleted. * Code cleanup Cleanup code related to the creation of the master channel view. * Inject the Mixer into the MixerView Inject the `Mixer` into the `MixerView` via the constructor. This makes it more explicit that the `Mixer` is the model of the view. It also implements the "Dependency Inversion Principle" in that the `MIxerView` does not have to ask the `Engine` for the `Mixer` anymore. The current changes should be safe in that the `Mixer` instance is static and does not change. * Fix connections on song load Disconnect and reconnect in `MixerView::refreshDisplay` which is called when a song is loaded.
- Loading branch information
1 parent
5fdf611
commit 629ba03
Showing
4 changed files
with
87 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters