From 5a03ce4e954fb5f87f344f650c6f4351bb3342e4 Mon Sep 17 00:00:00 2001 From: Oliver Beard Date: Thu, 19 Sep 2024 22:47:50 +0100 Subject: [PATCH] qml/RoomDrawer: Add & fix separators A separator has been added to the drawer view's left side, and the position of the NavigationTabBar has been set so it correctly draws the separator at the top and not the bottom. --- src/qml/RoomDrawer.qml | 132 ++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/src/qml/RoomDrawer.qml b/src/qml/RoomDrawer.qml index 2c2df0d8a..a7ef6843f 100644 --- a/src/qml/RoomDrawer.qml +++ b/src/qml/RoomDrawer.qml @@ -81,83 +81,93 @@ Kirigami.OverlayDrawer { id: loader active: root.drawerOpen - sourceComponent: ColumnLayout { + sourceComponent: RowLayout { spacing: 0 - Component.onCompleted: infoAction.toggle() + Kirigami.Separator { + Layout.fillHeight: true + } - QQC2.ToolBar { - Layout.fillWidth: true + ColumnLayout { + spacing: 0 - Layout.preferredHeight: pageStack.globalToolBar.preferredHeight + Component.onCompleted: infoAction.toggle() - contentItem: RowLayout { - Kirigami.Heading { - Layout.fillWidth: true - text: drawerItemLoader.item ? drawerItemLoader.item.title : "" - } + QQC2.ToolBar { + Layout.fillWidth: true - QQC2.ToolButton { - id: settingsButton + Layout.preferredHeight: pageStack.globalToolBar.preferredHeight - display: QQC2.AbstractButton.IconOnly - text: i18nc("@action:button", "Room settings") - icon.name: 'settings-configure-symbolic' + contentItem: RowLayout { + Kirigami.Heading { + Layout.fillWidth: true + text: drawerItemLoader.item ? drawerItemLoader.item.title : "" + } - QQC2.ToolTip.text: text - QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay - QQC2.ToolTip.visible: hovered + QQC2.ToolButton { + id: settingsButton - onClicked: { - RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Room); + display: QQC2.AbstractButton.IconOnly + text: i18nc("@action:button", "Room settings") + icon.name: 'settings-configure-symbolic' + + QQC2.ToolTip.text: text + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + QQC2.ToolTip.visible: hovered + + onClicked: { + RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Room); + } } } } - } - Loader { - id: drawerItemLoader - Layout.fillWidth: true - Layout.fillHeight: true - sourceComponent: roomInformation - } - - Component { - id: roomInformation - RoomInformation { - room: root.room - connection: root.connection + Loader { + id: drawerItemLoader + Layout.fillWidth: true + Layout.fillHeight: true + sourceComponent: roomInformation } - } - Component { - id: roomMedia - RoomMedia { - currentRoom: root.room - connection: root.connection - } - } - - Kirigami.NavigationTabBar { - id: navigationBar - Layout.fillWidth: true - visible: !root.room.isSpace - Kirigami.Theme.colorSet: Kirigami.Theme.Window - Kirigami.Theme.inherit: false - - actions: [ - Kirigami.Action { - id: infoAction - text: i18n("Information") - icon.name: "documentinfo" - onTriggered: drawerItemLoader.sourceComponent = roomInformation - }, - Kirigami.Action { - text: i18n("Media") - icon.name: "mail-attachment-symbollic" - onTriggered: drawerItemLoader.sourceComponent = roomMedia + Component { + id: roomInformation + RoomInformation { + room: root.room + connection: root.connection } - ] + } + + Component { + id: roomMedia + RoomMedia { + currentRoom: root.room + connection: root.connection + } + } + + Kirigami.NavigationTabBar { + id: navigationBar + Layout.fillWidth: true + visible: !root.room.isSpace + Kirigami.Theme.colorSet: Kirigami.Theme.Window + Kirigami.Theme.inherit: false + + position: QQC2.ToolBar.Footer + + actions: [ + Kirigami.Action { + id: infoAction + text: i18n("Information") + icon.name: "documentinfo" + onTriggered: drawerItemLoader.sourceComponent = roomInformation + }, + Kirigami.Action { + text: i18n("Media") + icon.name: "mail-attachment-symbollic" + onTriggered: drawerItemLoader.sourceComponent = roomMedia + } + ] + } } } }