Split RoomPane into Base/MultiviewPane

This commit is contained in:
miruka 2020-03-06 08:40:48 -04:00
parent 191e86530f
commit c49f9b98b2
2 changed files with 88 additions and 73 deletions

View File

@ -0,0 +1,65 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
HDrawer {
id: pane
defaultSize: buttonRepeater.summedImplicitWidth
minimumSize:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
background: HColumnLayout{
Rectangle {
color: buttonsBackgroundColor
Layout.fillWidth: true
Layout.preferredHeight: buttonFlow.height
Behavior on Layout.preferredHeight { HNumberAnimation {} }
}
Rectangle {
color: backgroundColor
Layout.fillWidth: true
Layout.fillHeight: true
}
}
property color buttonsBackgroundColor
property color backgroundColor
readonly property alias buttonRepeater: buttonRepeater
readonly property alias swipeView: swipeView
default property alias swipeViewData: swipeView.contentData
HColumnLayout {
anchors.fill: parent
HFlow {
id: buttonFlow
populate: null
Layout.fillWidth: true
HRepeater {
id: buttonRepeater
}
}
HSwipeView {
id: swipeView
clip: true
interactive: ! pane.collapsed
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}

View File

@ -1,58 +1,23 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../../Base"
import "../../.."
HDrawer {
MultiviewPane {
id: roomPane
saveName: "roomPane"
edge: Qt.RightEdge
defaultSize: buttonRepeater.summedImplicitWidth
minimumSize:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
background: HColumnLayout{
Rectangle {
color: theme.chat.roomPaneButtons.background
Layout.fillWidth: true
Layout.preferredHeight: buttonFlow.height
Behavior on Layout.preferredHeight { HNumberAnimation {} }
}
Rectangle {
color: theme.chat.roomPane.background
Layout.fillWidth: true
Layout.fillHeight: true
}
}
buttonsBackgroundColor: theme.chat.roomPaneButtons.background
backgroundColor: theme.chat.roomPane.background
readonly property alias buttonRepeater: buttonRepeater
readonly property alias swipeView: swipeView
HColumnLayout {
anchors.fill: parent
HFlow {
id: buttonFlow
populate: null
Layout.fillWidth: true
HRepeater {
id: buttonRepeater
model: [
buttonRepeater.model: [
"members", "files", "notifications", "history", "settings"
]
HButton {
buttonRepeater.delegate: HButton {
height: theme.baseElementsHeight
backgroundColor: "transparent"
icon.name: "room-view-" + modelData
@ -68,22 +33,7 @@ HDrawer {
onClicked: swipeView.currentIndex = Math.min(index, 1)
}
}
}
HSwipeView {
id: swipeView
clip: true
interactive: ! roomPane.collapsed
saveName: "roomPaneView"
saveId: chat.roomId
Layout.fillWidth: true
Layout.fillHeight: true
MemberView {}
SettingsView { fillAvailableHeight: true }
}
}
}