[panel] Rework quicksettings panel logic
The quicksettings panel logic is currently quite complicated, and can be very hard to maintain. It also is a bit finicky with visual bugs likely due to imprecise x/y positioning (as you're swiping down the panel, you can notice that the indicators row is jittering). Some refactoring and reimplementation can help improve performance and make the code much more maintainable for the future as well.
Feature-set:
- Pinned row of quick settings (without labels, so that we can fit more)
- Full view of quick settings, and ability to swipe through pages of quick settings (likely can fit less on each row than on pinned view)
- Full view on the bottom contains the brightness slider
- In widescreen, the entire panel should come down in one stroke
- Two stages of opening for narrow screens: Closed <-> Pinned, Pinned <-> Fully open
- All of the panel content should be moving up/down in the Closed <-> Pinned stage
- All of the panel content should not be moving (basically anchored) during Pinned <-> Fully open
- Background panel rectangle should be moving upwards/downwards during Closed <-> Pinned
- Background panel rectangle should either be expanding downwards, or moving upwards/downwards during Pinned <-> Fully open
- The panel content should be clipped by the bottom edge of the background panel rectangle
- Possibly: space for a settings button for opening a settings menu to customize the containment
Implementation:
I think it's worth looking at lomiri's panel implementation, as it's quite performant: https://github.com/ubports/unity8/tree/xenial/qml/Panel
They seem to be entirely relying on a drag handle though (whereas we have the entire panel that can be dragged from), which does make implementation simpler:
https://github.com/ubports/unity8/blob/xenial/qml/Panel/PanelMenu.qml
Ideas?
-
Swiping gestures and targets all implemented with MouseArea
-
Calculate flick velocity and animate them ourselves
- This allows us to address one issue with the current implementation: we only animate the panel once it stops moving, which looks a bit strange. Ideally we should calculate a velocity that always smoothly allows the panel to close/open, without a stage where it stops -> and then causes animation to snap position
-
All quicksettings, indicators positioning should be based off of height of the background panel
-
The quicksettings grid possibly could avoid all of the strange behaviour in attempting to center itself by anchoring to the panel's horizontal center
- Calculations will still be needed in determining the widths of delegates so that on the pinned row, edge margins and spacing between delegates are still consistent
-
If it's possible, find a way to avoid needing to open a window for the quicksettings so that we don't have KWin fading animations as it's closing (and might improve opening performance too, as it currently jumps)
CC: @mart