Auto-expand room pane to show settings/profiles

If the room pane is below the default width (by user resizing or because
of narrow window), go to the room settings or a member profile will
automatically expand it as needed.

The pane goes back to its previous size once the settings/profile is
left.

If the window is narrow enough that expanding the pane normally would
reduce the timeline's width past its minimum, the pane is shown as an
overlay instead.
This commit is contained in:
miruka 2020-07-14 03:00:10 -04:00
parent a44d683956
commit c018c04cab
5 changed files with 24 additions and 3 deletions

View File

@ -92,7 +92,6 @@
- Linkify URLs in topic text areas
- Expand the room pane if it's currently too small to show room settings
- Use a loader for items not in view for the `HTabContainer`'s `SwipeView`
- Make "Cancel" buttons consistent, and able to cancel running Backend

View File

@ -14,12 +14,21 @@ HDrawer {
property int buttonWidth:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
property bool requireDefaultSize: false
readonly property alias buttonRepeater: buttonRepeater
readonly property alias swipeView: swipeView
defaultSize: buttonRepeater.count * buttonWidth
minimumSize: buttonWidth
minimumSize: requireDefaultSize ? defaultSize : buttonWidth
Behavior on minimumSize {
HNumberAnimation {
overshoot: requireDefaultSize ? 1 : 4
factor: 0.75
}
}
HColumnLayout {
anchors.fill: parent

View File

@ -74,7 +74,15 @@ Item {
HLoader {
id: loader
anchors.rightMargin: ready ? roomPane.visibleSize : 0
anchors.rightMargin:
ready &&
! (
roomPane.requireDefaultSize &&
roomPane.minimumSize > roomPane.maximumSize
) ?
roomPane.visibleSize :
0
anchors.fill: parent
visible:
ready ? ! roomPane.hidden || anchors.rightMargin < width : true

View File

@ -10,6 +10,8 @@ HColumnLayout {
readonly property var modelSyncId:
[chat.userId, chat.roomId, "filtered_members"]
readonly property alias viewDepth: stackView.depth
HStackView {
id: stackView

View File

@ -32,6 +32,9 @@ MultiviewPane {
buttonWidth:
buttonRepeater.count >= 1 ? buttonRepeater.itemAt(1).implicitWidth : 0
requireDefaultSize:
swipeView.currentIndex !== 0 || swipeView.currentItem.viewDepth > 1
buttonsBackgroundColor: theme.chat.roomPane.topBar.background
background: Rectangle { color: theme.chat.roomPane.background }