Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Qt layouts for mixer channels #6591

Merged
merged 48 commits into from
Dec 30, 2023

Conversation

sakertooth
Copy link
Contributor

@sakertooth sakertooth commented Dec 19, 2022

Absolute positioning in the mixer channels made it difficult to introduce any changes or additions to it, as the numbers that dictate such positions may be inaccurate or simply may not achieve the best organization of the child widgets. This PR simplifies this by using layouts from Qt, which handles this for us.

This PR also combines both lmms::gui::MixerView::MixerChannelView and lmms::gui::MixerLine into one entity, lmms::gui::MixerChannelView. This greatly simplifies adding widgets, such as knobs or labels, to the mixer channel view as everything is in one place.

The extra transparency was conflicting with the positioning of
the arrows in the layout
MixerChannelView is now a combination of the
MixerLine with the previous MixerChannelView
- Move MixerChannelView into src/gui
Change MixerView.h to use MixerChannelView rather than MixerLine
Also do some cleanup, such as removing an unused forward declaration
of QButtonGroup
+ Set height of sizeHint() using MIXER_CHANNEL_HEIGHT (287)
- Include MixerChannelView
Before, MixerChannelView was not inherited by QWidget,
meaning it could not have a parent and had to be deleted
when necessary. Since the MixerView owns the
new MixerChannelView, this is no longer necessary.
- Include MixerChannelView in MixerView
- Set the Qt::WA_StyledBackground attribute on
- Change nullptr to this for certain widgets
   - Some custom widgets may expect there to be a parent
- Add spacing in channel layout
- Increase size of mixer channel
- Rename states in SendReceiveState
- Make maxTextHeight constexpr in elideName
- Remove background changing on mouse press
(is now handled in paintEvent)
@sakertooth
Copy link
Contributor Author

I'd like to propose to fix the merge conflicts and to merge the changes (perhaps after some minor improvements). For reference here's how the mixer looks in this branch:

Feel free. This PR has been sitting here for some time. I kind of forgot about it sadly. I began working on a new audio routing system and need to fix some regressions from #6610 (as well as features like sample caching), so I probably wont have much time for this.

@michaelgregorius
Copy link
Contributor

Hi @sakertooth! How should we go on with this? I think we should not throw away the work that you have already done.

I have cloned your repository, checked out the branch and have a local branch of your branch that's merged with upstream's master. Shall I push it to your branch, i.e. to this PR? I yes, how does this work with regards to permissions, etc.?

@sakertooth
Copy link
Contributor Author

I have cloned your repository, checked out the branch and have a local branch of your branch that's merged with upstream's master. Shall I push it to your branch, i.e. to this PR? I yes, how does this work with regards to permissions, etc.?

Hello @michaelgregorius. Maintainers are allowed to edit this pull request, so in terms of permissions, you should be able to just push the changes to this branch.

Finxing the build mostly includes applying several of the changes that have been made to `MixerLine` in the meantime to `MixerChannelView`. The relevant commits are:
* Classier enums: f102777
* Keep master bus color on FX Mixer when switching project: 609c008
* Use std::optional for colour interfaces and storage: dc8c49a

Commit aa050ae also made changes to `MixerLine`. These have not been applied as they do not seem to be relevant to `MixerChannelView`.

`InstrumentTrackView` and `SampleTrackView` had references to `MixerLineLcdSpinBox`. These have been adjusted to `MixerChannelLcdSpinBox` in the header files and the implementation files.

Conflicts:
* include/MixerChannelLcdSpinBox.h
* include/MixerLine.h
* include/SampleTrackWindow.h
* src/gui/MixerLine.cpp
* src/gui/MixerView.cpp
* src/gui/SendButtonIndicator.cpp
@michaelgregorius
Copy link
Contributor

Thanks @sakertooth! It worked. I thought that my access key would only work when pushing to my own LMMS repository but it was also accepted when pushing into yours.

Move the solo and mute buttons closer to each other in the mixer channels.

Technically this is accomplished by putting them into their own layout with minimal margins and spacing.
@michaelgregorius
Copy link
Contributor

Hi @LMMS/developers! Does anyone want to review this? Any objections to the changes?

Here's a comparison of the mixer with layouts and without. The mixer with layouts now looks as follows:
MixerWithLayouts

Here's the mixer without layouts (master):
MixerWithoutLayouts

The new mixer does not look as crammed as before because there's a clearer separation between the elements. As mentioned before using layouts is the basis for many other improvements. It would for example be nice if the users could resize the mixer view, e.g. to show more effects or to have larger faders with a more detailed readout.

Another idea would be to enable users to resize the mixer strips horizontally so that there can be compact views like the current ones and detailed views. To could for example be implemented via the context menu.

include/SendButtonIndicator.h Outdated Show resolved Hide resolved
include/SendButtonIndicator.h Outdated Show resolved Hide resolved
src/gui/MixerChannelView.cpp Outdated Show resolved Hide resolved
src/gui/MixerChannelView.cpp Outdated Show resolved Hide resolved
src/gui/MixerChannelView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/SendButtonIndicator.cpp Outdated Show resolved Hide resolved
src/gui/instrument/InstrumentTrackWindow.cpp Outdated Show resolved Hide resolved
include/MixerChannelView.h Outdated Show resolved Hide resolved
Mostly whitespace and formatting changes: remove tabs, remove spaces in parameter lists, remove underscores from parameter names.

Some lines have been shortened by introducing intermediate variables, e.g. in `MixerChannelView`.

`MixerView` has many changes but only related to whitespace. Spaces have been introduced for if and for statements. Whitespace at round braces has been removed everywhere in the implementation file even if a line was not touched by the intial changes.

Remove duplicate forward declaration of `MixerChannelView`.
Make the parent `QWidget` the first parameter as it is a Qt convention. The default parameter had to be removed due to this.
Move the style of the `QGraphicsView` for the rename line edit from the code into the style sheets of the default and classic theme.
@michaelgregorius
Copy link
Contributor

Thanks for your code review @Veratil! I have incorporated all your suggestions with commits f32d9ce, 6950998 and 1d3ee18.

Copy link
Contributor

@Veratil Veratil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry a few more style fixups 😄

include/MixerChannelView.h Outdated Show resolved Hide resolved
include/SendButtonIndicator.h Outdated Show resolved Hide resolved
src/gui/MixerChannelView.cpp Outdated Show resolved Hide resolved
src/gui/MixerChannelView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/MixerView.cpp Outdated Show resolved Hide resolved
src/gui/SendButtonIndicator.cpp Outdated Show resolved Hide resolved
src/gui/SendButtonIndicator.cpp Outdated Show resolved Hide resolved
Fix spaces between types and references/pointers, e.g. use `const QBrush& c` instead of `const QBrush & c`.
Remove underscores from parameter names.
Remove spaces near parentheses.
Replace tabs with spaces.
Introduce intermediate variable to resolve "hanging" + operator.
Replace the connection for the periodic fader updates with one that uses function pointers instead of `SIGNAL` and `SLOT`.
@michaelgregorius
Copy link
Contributor

Sorry a few more style fixups 😄

All fixed with commit 92878ce. 😅

Copy link
Contributor

@Veratil Veratil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaelgregorius
Copy link
Contributor

@sakertooth, do you want to merge this? I guess you can give a better comprehensive overview of all the changes in your commits when the squash merge is done.

@sakertooth
Copy link
Contributor Author

@sakertooth, do you want to merge this? I guess you can give a better comprehensive overview of all the changes in your commits when the squash merge is done.

Merge away. Thanks for reviving this PR for me!

@michaelgregorius michaelgregorius merged commit 6b21dc7 into LMMS:master Dec 30, 2023
9 checks passed
@sakertooth sakertooth deleted the mixer-use-layouts branch December 30, 2023 16:56
@michaelgregorius
Copy link
Contributor

@sakertooth, do you want to merge this? I guess you can give a better comprehensive overview of all the changes in your commits when the squash merge is done.

Merge away. Thanks for reviving this PR for me!

Thanks and you're welcome! In the past I have started several attempts myself to use layouts in the mixer. So I am happy that it's finally done. 😃

sakertooth added a commit to sakertooth/lmms that referenced this pull request Jan 5, 2024
Use Qt layouts for the mixer channels. These changes will enable several other improvements, like for example making the mixer and faders resizable, adding peak indicators, etc.

This is a squash commit which consists of the following individual commits:

* Remove extra transparency in send/receive arrows
The extra transparency was conflicting with the positioning of
the arrows in the layout

* Begin reimplementing MixerChannelView

MixerChannelView is now a combination of the
MixerLine with the previous MixerChannelView

* Adjust SendButtonIndicator to use MixerChannelView

* Remove MixerLine
- Move MixerChannelView into src/gui

* Remove MixerView::MixerChannelView

* Remove header of MixerLine

* Change MixerView.h to use MixerChannelView
Change MixerView.h to use MixerChannelView rather than MixerLine
Also do some cleanup, such as removing an unused forward declaration
of QButtonGroup

* Create EffectRackView
+ Set height of sizeHint() using MIXER_CHANNEL_HEIGHT (287)

* Remove include of MixerLine
- Include MixerChannelView

* Phase 1: Adjust MixerView to use new MixerChannelView

* Move children wigets into header file

* Phase 2: Adjust MixerView to use new MixerChannelView

* Phase 3: Adjust MixerView to use new MixerChannelView

* Phase 4: Adjust MixerView to use new MixerChannelView

* Phase 5: Adjust MixerView to use new MixerChannelView

* Phase 5: Adjust MixerView to use new MixerChannelView

* Remove places where MixerChannelView is being deleted

Before, MixerChannelView was not inherited by QWidget,
meaning it could not have a parent and had to be deleted
when necessary. Since the MixerView owns the
new MixerChannelView, this is no longer necessary.

* Replace MixerLine with MixerChannelView
- Include MixerChannelView in MixerView

* Replace setCurrentMixerLine calls with setCurrentMixerChannel around codebase

* Add event handlers in MixerChannelView

* Implement MixerChannelView::eventFilter

* Update theme styles to use MixerChannelView

* Add QColor properties from style
- Set the Qt::WA_StyledBackground attribute on

* Add effect rack to rack layout when adding channel

* Set size for MixerChannelView
- Change nullptr to this for certain widgets
   - Some custom widgets may expect there to be a parent
- Add spacing in channel layout
- Increase size of mixer channel

* Retain size when widgets are hidden

* Implement paintEvent
- Rename states in SendReceiveState

* Implement send/receive arrow toggling
- Make maxTextHeight constexpr in elideName
- Remove background changing on mouse press
(is now handled in paintEvent)

* Implement renaming mixer channels

* Implement color functions

* Implement channel moving/removing functions

* Do some cleanup
Not sure if that connection with the mute model was needed, but removing
it did not seem to introduce any issues.

* Include cassert

* Replace references to MixerLine with MixerChannelView

* Reduce height
+ Make m_renameLineEdit transparent
+ Retain size when LCD is hidden
+ Remove stretch after renameLineEdit in layout

* Remove trailing whitespace

* Make m_renameLineEdit read only
+ Transpose m_renameLineEditView rectangle (with 5px offset)

* Set spacing in channel layout back to 0

* Remove sizeHint override and constant size

* Use sizeHint for mixerChannelSize
+ Leave auto fill background to false in MixerChannelView
+ Only set width for EffectRackView

* Set margins to 4 on all sides in MixerChannelView

* Move solo and mute closer to each other

Move the solo and mute buttons closer to each other in the mixer channels.

Technically this is accomplished by putting them into their own layout with minimal margins and spacing.

* Fixes for CodeFactor

* Code review changes

Mostly whitespace and formatting changes: remove tabs, remove spaces in parameter lists, remove underscores from parameter names.

Some lines have been shortened by introducing intermediate variables, e.g. in `MixerChannelView`.

`MixerView` has many changes but only related to whitespace. Spaces have been introduced for if and for statements. Whitespace at round braces has been removed everywhere in the implementation file even if a line was not touched by the intial changes.

Remove duplicate forward declaration of `MixerChannelView`.

* Adjust parameter order in MixerChannelView's constructor

Make the parent `QWidget` the first parameter as it is a Qt convention. The default parameter had to be removed due to this.

* Move styling of rename line edit into style sheets

Move the style of the `QGraphicsView` for the rename line edit from the code into the style sheets of the default and classic theme.

* More code review changes

Fix spaces between types and references/pointers, e.g. use `const QBrush& c` instead of `const QBrush & c`.
Remove underscores from parameter names.
Remove spaces near parentheses.
Replace tabs with spaces.
Introduce intermediate variable to resolve "hanging" + operator.
Replace the connection for the periodic fader updates with one that uses function pointers instead of `SIGNAL` and `SLOT`.

---------

Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants