2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
2019-12-18 04:53:08 -04:00
|
|
|
import "../../../Base"
|
2020-03-06 08:40:48 -04:00
|
|
|
import "../../.."
|
2020-07-08 11:33:05 -04:00
|
|
|
import "MemberView"
|
2019-05-12 13:17:42 -04:00
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
MultiviewPane {
|
2019-12-10 14:57:54 -04:00
|
|
|
id: roomPane
|
2020-07-12 00:25:57 -04:00
|
|
|
|
|
|
|
readonly property QtObject accountModel:
|
|
|
|
ModelStore.get("accounts").find(chat.roomInfo.for_account)
|
|
|
|
|
|
|
|
function toggleFocus() {
|
|
|
|
if (roomPane.activeFocus) {
|
|
|
|
if (roomPane.collapse) roomPane.close()
|
|
|
|
pageLoader.takeFocus()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-07-14 16:47:04 -04:00
|
|
|
roomPane.forceCollapse = false
|
2020-07-12 00:25:57 -04:00
|
|
|
roomPane.open()
|
|
|
|
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-10 16:29:49 -04:00
|
|
|
saveName: "roomPane"
|
2019-12-09 05:25:31 -04:00
|
|
|
edge: Qt.RightEdge
|
2019-12-21 12:46:47 -04:00
|
|
|
|
2020-03-19 00:13:19 -04:00
|
|
|
defaultSize:
|
|
|
|
(buttonRepeater.count - (roomPane.collapse ? 0 : 1)) * buttonWidth
|
|
|
|
|
|
|
|
buttonWidth:
|
|
|
|
buttonRepeater.count >= 1 ? buttonRepeater.itemAt(1).implicitWidth : 0
|
|
|
|
|
2020-07-14 03:00:10 -04:00
|
|
|
requireDefaultSize:
|
2020-07-14 03:14:05 -04:00
|
|
|
swipeView.currentIndex !== 0 ||
|
|
|
|
swipeView.currentItem.viewDepth > 1 ||
|
|
|
|
swipeView.currentItem.filterField.activeFocus
|
2020-07-14 03:00:10 -04:00
|
|
|
|
2020-03-13 01:09:04 -04:00
|
|
|
buttonsBackgroundColor: theme.chat.roomPane.topBar.background
|
|
|
|
background: Rectangle { color: theme.chat.roomPane.background }
|
2019-12-21 12:46:47 -04:00
|
|
|
|
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
buttonRepeater.model: [
|
2020-03-17 18:48:26 -04:00
|
|
|
"back", "members", "files", "notifications", "history", "settings"
|
2020-03-06 08:40:48 -04:00
|
|
|
]
|
2019-07-12 18:15:06 -04:00
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
buttonRepeater.delegate: HButton {
|
2020-03-17 18:48:26 -04:00
|
|
|
visible: width > 0
|
|
|
|
width: modelData === "back" && ! roomPane.collapse ? 0 : implicitWidth
|
2020-03-06 08:40:48 -04:00
|
|
|
height: theme.baseElementsHeight
|
2020-03-17 18:48:26 -04:00
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
backgroundColor: "transparent"
|
2020-03-17 18:48:26 -04:00
|
|
|
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))
|
2019-12-15 13:04:51 -04:00
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
autoExclusive: true
|
2020-03-17 18:48:26 -04:00
|
|
|
checked: swipeView.currentIndex === 0 && index === 1 ||
|
|
|
|
swipeView.currentIndex === 1 && index === 5
|
2019-07-12 18:15:06 -04:00
|
|
|
|
2020-03-17 18:48:26 -04:00
|
|
|
enabled: ["back", "members", "settings"].includes(modelData)
|
2019-12-09 05:25:31 -04:00
|
|
|
|
2020-03-17 18:48:26 -04:00
|
|
|
onClicked:
|
2020-07-14 16:47:04 -04:00
|
|
|
modelData === "back" ?
|
|
|
|
roomPane.toggleFocus() :
|
|
|
|
|
|
|
|
(modelData === "members" && swipeView.currentIndex === 0) ||
|
|
|
|
(modelData === "settings" && swipeView.currentIndex === 1) ?
|
|
|
|
roomPane.forceCollapse = true :
|
|
|
|
|
|
|
|
modelData === "members" ?
|
|
|
|
swipeView.currentIndex = 0 :
|
|
|
|
|
2020-03-21 15:02:37 -04:00
|
|
|
swipeView.currentIndex = 1
|
2020-03-17 18:48:26 -04:00
|
|
|
|
|
|
|
Behavior on width {
|
|
|
|
enabled: modelData === "back"
|
|
|
|
HNumberAnimation {}
|
|
|
|
}
|
2019-05-12 13:17:42 -04:00
|
|
|
}
|
2020-03-06 08:40:48 -04:00
|
|
|
|
2020-03-17 17:14:47 -04:00
|
|
|
Connections {
|
|
|
|
target: swipeView
|
|
|
|
|
2020-06-22 14:11:56 -04:00
|
|
|
function onCurrentItemChanged() {
|
2020-03-17 17:14:47 -04:00
|
|
|
swipeView.currentItem.keybindFocusItem.forceActiveFocus()
|
2020-06-22 14:11:56 -04:00
|
|
|
}
|
2020-03-17 17:14:47 -04:00
|
|
|
}
|
|
|
|
|
2020-03-06 08:40:48 -04:00
|
|
|
MemberView {}
|
2020-07-09 17:06:14 -03:00
|
|
|
SettingsView {
|
|
|
|
enabled: accountModel.presence !== "offline"
|
|
|
|
}
|
2020-03-28 07:18:00 -04:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.toggleFocusRoomPane
|
2020-05-14 02:14:54 -04:00
|
|
|
onActivated: roomPane.toggleFocus()
|
2020-03-28 07:18:00 -04:00
|
|
|
}
|
2020-07-14 16:51:01 -04:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.toggleHideRoomPane
|
|
|
|
onActivated: roomPane.forceCollapse = ! roomPane.forceCollapse
|
|
|
|
}
|
2019-05-12 13:17:42 -04:00
|
|
|
}
|