moment/src/gui/Pages/Chat/RoomPane/RoomPane.qml

81 lines
2.2 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
2019-12-18 19:53:08 +11:00
import "../../../Base"
2020-03-06 23:40:48 +11:00
import "../../.."
2019-05-13 03:17:42 +10:00
2020-03-06 23:40:48 +11:00
MultiviewPane {
2019-12-11 05:57:54 +11:00
id: roomPane
saveName: "roomPane"
2019-12-09 20:25:31 +11:00
edge: Qt.RightEdge
2020-03-19 15:13:19 +11:00
defaultSize:
(buttonRepeater.count - (roomPane.collapse ? 0 : 1)) * buttonWidth
buttonWidth:
buttonRepeater.count >= 1 ? buttonRepeater.itemAt(1).implicitWidth : 0
2020-03-13 16:09:04 +11:00
buttonsBackgroundColor: theme.chat.roomPane.topBar.background
background: Rectangle { color: theme.chat.roomPane.background }
2020-03-06 23:40:48 +11:00
buttonRepeater.model: [
"back", "members", "files", "notifications", "history", "settings"
2020-03-06 23:40:48 +11:00
]
2020-03-06 23:40:48 +11:00
buttonRepeater.delegate: HButton {
visible: width > 0
width: modelData === "back" && ! roomPane.collapse ? 0 : implicitWidth
2020-03-06 23:40:48 +11:00
height: theme.baseElementsHeight
2020-03-06 23:40:48 +11:00
backgroundColor: "transparent"
icon.name:
modelData === "back" ?
"go-back-to-chat-from-room-pane" : "room-view-" + modelData
toolTip.text:
modelData === "back" ?
qsTr("Go back to chat") :
qsTr(modelData.charAt(0).toUpperCase() + modelData.slice(1))
2020-03-06 23:40:48 +11:00
autoExclusive: true
checked: swipeView.currentIndex === 0 && index === 1 ||
swipeView.currentIndex === 1 && index === 5
enabled: ["back", "members", "settings"].includes(modelData)
2019-12-09 20:25:31 +11:00
onClicked:
2020-03-22 06:02:37 +11:00
modelData === "back" ? roomPane.toggleFocus() :
modelData === "members" ? swipeView.currentIndex = 0 :
swipeView.currentIndex = 1
Behavior on width {
enabled: modelData === "back"
HNumberAnimation {}
}
2019-05-13 03:17:42 +10:00
}
2020-03-06 23:40:48 +11:00
function toggleFocus() {
if (swipeView.currentItem.keybindFocusItem.activeFocus) {
2020-03-18 07:52:14 +11:00
if (roomPane.collapse) roomPane.close()
pageLoader.takeFocus()
return
}
roomPane.open()
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
}
Connections {
target: swipeView
onCurrentItemChanged:
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
}
2020-03-06 23:40:48 +11:00
MemberView {}
SettingsView { fillAvailableHeight: true }
2019-05-13 03:17:42 +10:00
}