Replace Global Menu
Remove the global menu and move explore and new chat/room buttons to new `ExploreComponent.qml`. This is designed to sit in the header of the `RoomListPage` and will only be visible when the room list is. The other settings have just been removed as they are covered by the `UserInfo` component and quick can be done form the decoration or system tray. When wide\  Collapsed mode\ 
This commit is contained in:
129
src/qml/Component/ExploreComponent.qml
Normal file
129
src/qml/Component/ExploreComponent.qml
Normal file
@@ -0,0 +1,129 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
QQC2.ToolBar {
|
||||
id: root
|
||||
|
||||
property var desiredWidth
|
||||
property bool collapsed: false
|
||||
|
||||
property Kirigami.Action exploreAction: Kirigami.Action {
|
||||
text: i18n("Explore rooms")
|
||||
icon.name: "compass"
|
||||
onTriggered: {
|
||||
applicationWindow().pushReplaceLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection})
|
||||
}
|
||||
}
|
||||
property Kirigami.Action chatAction: Kirigami.Action {
|
||||
text: i18n("Start a Chat")
|
||||
icon.name: "irc-join-channel"
|
||||
onTriggered: applicationWindow().pushReplaceLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection})
|
||||
}
|
||||
property Kirigami.Action roomAction: Kirigami.Action {
|
||||
text: i18n("Create a Room")
|
||||
icon.name: "irc-join-channel"
|
||||
onTriggered: {
|
||||
let dialog = createRoomDialog.createObject(root.overlay);
|
||||
dialog.open();
|
||||
}
|
||||
shortcut: StandardKey.New
|
||||
}
|
||||
|
||||
padding: 0
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
Kirigami.SearchField {
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
||||
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - row.spacing : -1
|
||||
visible: !root.collapsed
|
||||
onTextChanged: sortFilterRoomListModel.filterText = text
|
||||
KeyNavigation.tab: listView
|
||||
}
|
||||
QQC2.ToolButton {
|
||||
id: menuButton
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
checkable: true
|
||||
action: Kirigami.Action {
|
||||
text: i18n("Create rooms and chats")
|
||||
icon.name: "irc-join-channel"
|
||||
onTriggered: {
|
||||
if (Kirigami.isMobile) {
|
||||
let menu = mobileMenu.createObject();
|
||||
menu.open();
|
||||
} else {
|
||||
let menu = desktopMenu.createObject(menuButton, {y: menuButton.height});
|
||||
menu.closed.connect(menuButton.toggle)
|
||||
menu.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
QQC2.ToolTip {
|
||||
text: parent.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: desktopMenu
|
||||
QQC2.Menu {
|
||||
QQC2.MenuItem {
|
||||
action: exploreAction
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
action: chatAction
|
||||
}
|
||||
QQC2.MenuItem {
|
||||
action: roomAction
|
||||
}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: mobileMenu
|
||||
|
||||
Kirigami.OverlayDrawer {
|
||||
id: menuRoot
|
||||
edge: Qt.BottomEdge
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 0
|
||||
|
||||
Kirigami.ListSectionHeader {
|
||||
label: i18n("Create rooms and chats")
|
||||
}
|
||||
Kirigami.BasicListItem {
|
||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
||||
action: exploreAction
|
||||
onClicked: menuRoot.close()
|
||||
}
|
||||
Kirigami.BasicListItem {
|
||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
||||
action: chatAction
|
||||
onClicked: menuRoot.close()
|
||||
}
|
||||
Kirigami.BasicListItem {
|
||||
implicitHeight: Kirigami.Units.gridUnit * 3
|
||||
action: roomAction
|
||||
onClicked: menuRoot.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,8 +115,6 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
|
||||
title: i18n("Rooms")
|
||||
|
||||
property var enteredRoom
|
||||
property bool collapsedMode: Config.roomListPageWidth < applicationWindow().minPageWidth && applicationWindow().shouldUseSidebars
|
||||
|
||||
@@ -169,23 +167,10 @@ Kirigami.ScrollablePage {
|
||||
goToPreviousRoomFiltered((item) => (item.visible && item.hasUnread));
|
||||
}
|
||||
|
||||
titleDelegate: collapsedMode ? empty : searchField
|
||||
|
||||
Component {
|
||||
id: empty
|
||||
Item {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: searchField
|
||||
Kirigami.SearchField {
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
||||
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: sortFilterRoomListModel.filterText = text
|
||||
KeyNavigation.tab: listView
|
||||
}
|
||||
titleDelegate: ExploreComponent {
|
||||
Layout.fillWidth: true
|
||||
desiredWidth: page.width - Kirigami.Units.largeSpacing
|
||||
collapsed: collapsedMode
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
||||
@@ -229,58 +229,6 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
globalDrawer: Kirigami.GlobalDrawer {
|
||||
property bool hasLayer
|
||||
contentItem.implicitWidth: columnWidth
|
||||
isMenu: true
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Explore rooms")
|
||||
icon.name: "compass"
|
||||
onTriggered: pushReplaceLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection})
|
||||
enabled: pageStack.layers.depth === 1 && Controller.accountCount > 0
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Start a Chat")
|
||||
icon.name: "irc-join-channel"
|
||||
onTriggered: pushReplaceLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection})
|
||||
enabled: pageStack.layers.depth === 1 && Controller.accountCount > 0
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Create a Room")
|
||||
icon.name: "irc-join-channel"
|
||||
onTriggered: {
|
||||
let dialog = createRoomDialog.createObject(root.overlay);
|
||||
dialog.open();
|
||||
}
|
||||
shortcut: StandardKey.New
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.accountCount > 0
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Configure NeoChat...")
|
||||
icon.name: "settings-configure"
|
||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {}, {
|
||||
title: i18n("Configure")
|
||||
})
|
||||
enabled: pageStack.layers.depth === 1
|
||||
shortcut: StandardKey.Preferences
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Logout")
|
||||
icon.name: "list-remove-user"
|
||||
enabled: Controller.accountCount > 0
|
||||
onTriggered: confirmLogoutDialog.open()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Quit")
|
||||
icon.name: "gtk-quit"
|
||||
shortcut: StandardKey.Quit
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
ConfirmLogoutDialog {
|
||||
id: confirmLogoutDialog
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<file alias="TypingPane.qml">qml/Component/TypingPane.qml</file>
|
||||
<file alias="ShimmerGradient.qml">qml/Component/ShimmerGradient.qml</file>
|
||||
<file alias="QuickSwitcher.qml">qml/Component/QuickSwitcher.qml</file>
|
||||
<file alias="ExploreComponent.qml">qml/Component/ExploreComponent.qml</file>
|
||||
<file alias="ChatBox.qml">qml/Component/ChatBox/ChatBox.qml</file>
|
||||
<file alias="ChatBar.qml">qml/Component/ChatBox/ChatBar.qml</file>
|
||||
<file alias="AttachmentPane.qml">qml/Component/ChatBox/AttachmentPane.qml</file>
|
||||
|
||||
Reference in New Issue
Block a user