Allow hiding room pane with lcick on current tab
This commit is contained in:
parent
c00e35a948
commit
e00832eea6
@ -8,7 +8,7 @@ Drawer {
|
|||||||
|
|
||||||
property string saveName: ""
|
property string saveName: ""
|
||||||
property var saveId: "ALL"
|
property var saveId: "ALL"
|
||||||
property var saveProperties: ["preferredSize"]
|
property var saveProperties: ["preferredSize", "forceCollapse"]
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -27,6 +27,9 @@ Drawer {
|
|||||||
property int snapAt: defaultSize
|
property int snapAt: defaultSize
|
||||||
property int snapZone: theme.spacing * 2
|
property int snapZone: theme.spacing * 2
|
||||||
|
|
||||||
|
property bool forceCollapse:
|
||||||
|
window.getState(this, "forceCollapse", false)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
property Item referenceSizeParent: parent
|
property Item referenceSizeParent: parent
|
||||||
@ -36,7 +39,8 @@ Drawer {
|
|||||||
window.settings.collapseSidePanesUnderWindowWidth * theme.uiScale
|
window.settings.collapseSidePanesUnderWindowWidth * theme.uiScale
|
||||||
|
|
||||||
property int peekSizeWhileCollapsed:
|
property int peekSizeWhileCollapsed:
|
||||||
horizontal ? referenceSizeParent.width : referenceSizeParent.height
|
(horizontal ? referenceSizeParent.width : referenceSizeParent.height) *
|
||||||
|
(forceCollapse && ! collapse ? 0.5 : 1)
|
||||||
|
|
||||||
property int resizeAreaSize: theme.spacing / 2
|
property int resizeAreaSize: theme.spacing / 2
|
||||||
|
|
||||||
@ -44,12 +48,12 @@ Drawer {
|
|||||||
requireDefaultSize ? defaultSize : minimumSize
|
requireDefaultSize ? defaultSize : minimumSize
|
||||||
|
|
||||||
readonly property int calculatedSizeNoRequiredMinimum:
|
readonly property int calculatedSizeNoRequiredMinimum:
|
||||||
collapse ?
|
collapse || forceCollapse ?
|
||||||
peekSizeWhileCollapsed :
|
peekSizeWhileCollapsed :
|
||||||
Math.max(minimumSize, Math.min(preferredSize, maximumSize))
|
Math.max(minimumSize, Math.min(preferredSize, maximumSize))
|
||||||
|
|
||||||
readonly property int calculatedSize:
|
readonly property int calculatedSize:
|
||||||
collapse ?
|
collapse || forceCollapse ?
|
||||||
peekSizeWhileCollapsed :
|
peekSizeWhileCollapsed :
|
||||||
Math.max(calculatedMinimumSize, Math.min(preferredSize, maximumSize))
|
Math.max(calculatedMinimumSize, Math.min(preferredSize, maximumSize))
|
||||||
|
|
||||||
@ -78,14 +82,16 @@ Drawer {
|
|||||||
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141
|
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141
|
||||||
// dragMargin: parent.width / 2
|
// dragMargin: parent.width / 2
|
||||||
|
|
||||||
interactive: collapse
|
interactive: collapse || forceCollapse
|
||||||
position: 1
|
position: 1
|
||||||
visible: ! collapse
|
visible: ! collapse && ! forceCollapse
|
||||||
modal: false
|
modal: false
|
||||||
closePolicy: Popup.NoAutoClose
|
closePolicy: Popup.NoAutoClose
|
||||||
|
|
||||||
background: Rectangle { id: bg; color: theme.colors.strongBackground }
|
background: Rectangle { id: bg; color: theme.colors.strongBackground }
|
||||||
|
|
||||||
|
onForceCollapseChanged: window.saveState(this)
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
enabled: horizontal && ! resizeMouseHandler.drag.active
|
enabled: horizontal && ! resizeMouseHandler.drag.active
|
||||||
NumberAnimation { duration: 100 }
|
NumberAnimation { duration: 100 }
|
||||||
|
@ -5,10 +5,15 @@ import QtQuick.Layouts 1.12
|
|||||||
import "../../Base"
|
import "../../Base"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
readonly property bool showPaneButtons: mainUI.mainPane.collapse
|
readonly property bool showLeftButton:
|
||||||
|
mainUI.mainPane.collapse || mainUI.mainPane.forceCollapse
|
||||||
|
|
||||||
|
readonly property bool showRightButton:
|
||||||
|
chat.roomPane &&
|
||||||
|
(chat.roomPane.collapse || chat.roomPane.forceCollapse)
|
||||||
|
|
||||||
readonly property bool center:
|
readonly property bool center:
|
||||||
showPaneButtons || window.settings.alwaysCenterRoomHeader
|
showLeftButton || window.settings.alwaysCenterRoomHeader
|
||||||
|
|
||||||
|
|
||||||
implicitHeight: theme.baseElementsHeight
|
implicitHeight: theme.baseElementsHeight
|
||||||
@ -21,7 +26,7 @@ Rectangle {
|
|||||||
|
|
||||||
// The layout overflows somehow when focusing the room pane and
|
// The layout overflows somehow when focusing the room pane and
|
||||||
// is visible behind it (with a transparent theme)
|
// is visible behind it (with a transparent theme)
|
||||||
opacity: showPaneButtons && chat.roomPane.visible ? 0 : 1
|
opacity: showRightButton && chat.roomPane.visible ? 0 : 1
|
||||||
|
|
||||||
Behavior on opacity { HNumberAnimation {} }
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
|
|
||||||
@ -35,7 +40,7 @@ Rectangle {
|
|||||||
|
|
||||||
onClicked: mainUI.mainPane.toggleFocus()
|
onClicked: mainUI.mainPane.toggleFocus()
|
||||||
|
|
||||||
Layout.preferredWidth: showPaneButtons ? avatar.width : 0
|
Layout.preferredWidth: showLeftButton ? avatar.width : 0
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
Behavior on Layout.preferredWidth { HNumberAnimation {} }
|
Behavior on Layout.preferredWidth { HNumberAnimation {} }
|
||||||
@ -68,7 +73,9 @@ Rectangle {
|
|||||||
Layout.preferredWidth: Math.min(
|
Layout.preferredWidth: Math.min(
|
||||||
implicitWidth,
|
implicitWidth,
|
||||||
row.width -
|
row.width -
|
||||||
row.spacing * (showPaneButtons ? 3 : 1) -
|
row.spacing +
|
||||||
|
(showLeftButton ? row.spacing : 0) +
|
||||||
|
(showRightButton ? row.spacing : 0) +
|
||||||
goToMainPaneButton.width -
|
goToMainPaneButton.width -
|
||||||
avatar.width -
|
avatar.width -
|
||||||
goToRoomPaneButton.width
|
goToRoomPaneButton.width
|
||||||
@ -92,7 +99,9 @@ Rectangle {
|
|||||||
Layout.preferredWidth: Math.min(
|
Layout.preferredWidth: Math.min(
|
||||||
implicitWidth,
|
implicitWidth,
|
||||||
row.width -
|
row.width -
|
||||||
row.spacing * (showPaneButtons ? 3 : 1) -
|
row.spacing +
|
||||||
|
(showLeftButton ? row.spacing : 0) +
|
||||||
|
(showRightButton ? row.spacing : 0) +
|
||||||
goToMainPaneButton.width -
|
goToMainPaneButton.width -
|
||||||
avatar.width -
|
avatar.width -
|
||||||
nameLabel.width -
|
nameLabel.width -
|
||||||
@ -161,14 +170,14 @@ Rectangle {
|
|||||||
HButton {
|
HButton {
|
||||||
id: goToRoomPaneButton
|
id: goToRoomPaneButton
|
||||||
padded: false
|
padded: false
|
||||||
visible: goToMainPaneButton.visible
|
visible: Layout.preferredWidth > 0
|
||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
icon.name: "go-to-room-pane"
|
icon.name: "go-to-room-pane"
|
||||||
toolTip.text: qsTr("Go to room pane")
|
toolTip.text: qsTr("Go to room pane")
|
||||||
|
|
||||||
onClicked: chat.roomPane.toggleFocus()
|
onClicked: chat.roomPane.toggleFocus()
|
||||||
|
|
||||||
Layout.preferredWidth: goToMainPaneButton.Layout.preferredWidth
|
Layout.preferredWidth: showRightButton ? avatar.width : 0
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ MultiviewPane {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
roomPane.forceCollapse = false
|
||||||
roomPane.open()
|
roomPane.open()
|
||||||
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
|
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
@ -67,8 +68,16 @@ MultiviewPane {
|
|||||||
enabled: ["back", "members", "settings"].includes(modelData)
|
enabled: ["back", "members", "settings"].includes(modelData)
|
||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
modelData === "back" ? roomPane.toggleFocus() :
|
modelData === "back" ?
|
||||||
modelData === "members" ? swipeView.currentIndex = 0 :
|
roomPane.toggleFocus() :
|
||||||
|
|
||||||
|
(modelData === "members" && swipeView.currentIndex === 0) ||
|
||||||
|
(modelData === "settings" && swipeView.currentIndex === 1) ?
|
||||||
|
roomPane.forceCollapse = true :
|
||||||
|
|
||||||
|
modelData === "members" ?
|
||||||
|
swipeView.currentIndex = 0 :
|
||||||
|
|
||||||
swipeView.currentIndex = 1
|
swipeView.currentIndex = 1
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
|
Loading…
Reference in New Issue
Block a user