Skip to content

Commit

Permalink
Use Qt layouts for mixer channels (#6591)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sakertooth and michaelgregorius authored Dec 30, 2023
1 parent 4e63f60 commit 6b21dc7
Show file tree
Hide file tree
Showing 59 changed files with 1,249 additions and 1,325 deletions.
26 changes: 13 additions & 13 deletions data/locale/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain
</message>
</context>
<context>
<name>MixerLine</name>
<name>MixerChannelView</name>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="86"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="86"/>
<source>Channel send amount</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="242"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="242"/>
<source>Move &amp;left</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="243"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="243"/>
<source>Move &amp;right</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="245"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="245"/>
<source>Rename &amp;channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="250"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="250"/>
<source>R&amp;emove channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="253"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="253"/>
<source>Remove &amp;unused channels</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="255"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="255"/>
<source>Set channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="256"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="256"/>
<source>Remove channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="257"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="257"/>
<source>Pick random channel color</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>MixerLineLcdSpinBox</name>
<name>MixerChannelLcdSpinBox</name>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>Assign to:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>New Mixer Channel</source>
<translation type="unfinished"/>
</message>
Expand Down
22 changes: 11 additions & 11 deletions data/locale/bs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2698,14 +2698,14 @@ Please make sure you have write-permission to the file and the directory contain
</message>
</context>
<context>
<name>MixerLine</name>
<name>MixerChannelView</name>
<message>
<location filename="src/gui/MixerLine.cpp" line="71"/>
<location filename="src/gui/MixerChannelView.cpp" line="71"/>
<source>Channel send amount</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="85"/>
<location filename="src/gui/MixerChannelView.cpp" line="85"/>
<source>The Mixer channel receives input from one or more instrument tracks.
It in turn can be routed to multiple other mixer channels. LMMS automatically takes care of preventing infinite loops for you and doesn't allow making a connection that would result in an infinite loop.

Expand All @@ -2716,27 +2716,27 @@ You can remove and move mixer channels in the context menu, which is accessed by
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="213"/>
<location filename="src/gui/MixerChannelView.cpp" line="213"/>
<source>Move &amp;left</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="214"/>
<location filename="src/gui/MixerChannelView.cpp" line="214"/>
<source>Move &amp;right</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="216"/>
<location filename="src/gui/MixerChannelView.cpp" line="216"/>
<source>Rename &amp;channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="221"/>
<location filename="src/gui/MixerChannelView.cpp" line="221"/>
<source>R&amp;emove channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="226"/>
<location filename="src/gui/MixerChannelView.cpp" line="226"/>
<source>Remove &amp;unused channels</source>
<translation type="unfinished"/>
</message>
Expand Down Expand Up @@ -2789,12 +2789,12 @@ You can remove and move mixer channels in the context menu, which is accessed by
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="241"/>
<location filename="src/gui/MixerChannelView.cpp" line="241"/>
<source>Rename mixer channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="src/gui/MixerLine.cpp" line="242"/>
<location filename="src/gui/MixerChannelView.cpp" line="242"/>
<source>Enter the new name for this mixer channel</source>
<translation type="unfinished"/>
</message>
Expand Down Expand Up @@ -9752,7 +9752,7 @@ Please make sure you have read-permission to the file and the directory containi
</message>
</context>
<context>
<name>MixerLineLcdSpinBox</name>
<name>MixerChannelLcdSpinBox</name>
<message>
<location filename="src/tracks/InstrumentTrack.cpp" line="1246"/>
<source>Assign to:</source>
Expand Down
26 changes: 13 additions & 13 deletions data/locale/ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain
</message>
</context>
<context>
<name>MixerLine</name>
<name>MixerChannelView</name>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="86"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="86"/>
<source>Channel send amount</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="242"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="242"/>
<source>Move &amp;left</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="243"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="243"/>
<source>Move &amp;right</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="245"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="245"/>
<source>Rename &amp;channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="250"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="250"/>
<source>R&amp;emove channel</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="253"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="253"/>
<source>Remove &amp;unused channels</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="255"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="255"/>
<source>Set channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="256"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="256"/>
<source>Remove channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="257"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="257"/>
<source>Pick random channel color</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>MixerLineLcdSpinBox</name>
<name>MixerChannelLcdSpinBox</name>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>Assign to:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>New mixer Channel</source>
<translation type="unfinished"/>
</message>
Expand Down
26 changes: 13 additions & 13 deletions data/locale/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5334,62 +5334,62 @@ Ověřte si prosím, zda máte povolen zápis do souboru a do složky, ve které
</message>
</context>
<context>
<name>MixerLine</name>
<name>MixerChannelView</name>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="86"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="86"/>
<source>Channel send amount</source>
<translation>Množství odeslaného kanálu</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="242"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="242"/>
<source>Move &amp;left</source>
<translation>Přesunout do&amp;leva</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="243"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="243"/>
<source>Move &amp;right</source>
<translation>Přesun dop&amp;rava</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="245"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="245"/>
<source>Rename &amp;channel</source>
<translation>Přejmenovat &amp;kanál</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="250"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="250"/>
<source>R&amp;emove channel</source>
<translation>Př&amp;esunout kanál</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="253"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="253"/>
<source>Remove &amp;unused channels</source>
<translation>Odstranit nepo&amp;užívané kanály</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="255"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="255"/>
<source>Set channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="256"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="256"/>
<source>Remove channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="257"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="257"/>
<source>Pick random channel color</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>MixerLineLcdSpinBox</name>
<name>MixerChannelLcdSpinBox</name>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>Assign to:</source>
<translation>Přiřadit k:</translation>
</message>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>New mixer Channel</source>
<translation>Nový efektový kanál</translation>
</message>
Expand Down
26 changes: 13 additions & 13 deletions data/locale/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain
</message>
</context>
<context>
<name>MixerLine</name>
<name>MixerChannelView</name>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="86"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="86"/>
<source>Channel send amount</source>
<translation>Kanal Sendemenge</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="242"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="242"/>
<source>Move &amp;left</source>
<translation>Nach &amp;links verschieben</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="243"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="243"/>
<source>Move &amp;right</source>
<translation>Nach &amp;rechts verschieben</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="245"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="245"/>
<source>Rename &amp;channel</source>
<translation>&amp;Kanal umbenennen</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="250"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="250"/>
<source>R&amp;emove channel</source>
<translation>Kanal &amp;Entfernen</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="253"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="253"/>
<source>Remove &amp;unused channels</source>
<translation>Entferne &amp;unbenutzte Kanäle</translation>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="255"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="255"/>
<source>Set channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="256"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="256"/>
<source>Remove channel color</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../../src/gui/MixerLine.cpp" line="257"/>
<location filename="../../src/gui/MixerChannelView.cpp" line="257"/>
<source>Pick random channel color</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>MixerLineLcdSpinBox</name>
<name>MixerChannelLcdSpinBox</name>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>Assign to:</source>
<translation>Weise hinzu:</translation>
</message>
<message>
<location filename="../../src/gui/widgets/MixerLineLcdSpinBox.cpp" line="58"/>
<location filename="../../src/gui/widgets/MixerChannelLcdSpinBox.cpp" line="58"/>
<source>New mixer Channel</source>
<translation>Neuer FX-Kanal</translation>
</message>
Expand Down
Loading

0 comments on commit 6b21dc7

Please sign in to comment.