Remove the three item hamburger menu, re-distribute remaining items
There are only three, somewhat odd menu items remaining in this menu. (Two if you don't have a camera.) * Find your Friends, which is already accessible in a few other places and currently has dubious utility. * Create a Room, which also is barely used and can be combined with the Create Space button in the space drawer. * Scan a QR code, which can be placed in the account menu. I know this isn't the most ideal place, but I can't think of anything better at the moment.
This commit is contained in:
@@ -5,6 +5,7 @@ pragma ComponentBehavior: Bound
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
|
import QtMultimedia
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.components as KirigamiComponents
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||||
@@ -18,6 +19,10 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
required property Kirigami.ApplicationWindow window
|
required property Kirigami.ApplicationWindow window
|
||||||
|
|
||||||
|
data: MediaDevices {
|
||||||
|
id: devices
|
||||||
|
}
|
||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18nc("@action:button", "Show QR Code")
|
text: i18nc("@action:button", "Show QR Code")
|
||||||
icon.name: "view-barcode-qr-symbolic"
|
icon.name: "view-barcode-qr-symbolic"
|
||||||
@@ -32,6 +37,17 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18nc("@action:inmenu", "Scan a QR Code")
|
||||||
|
icon.name: "document-scan-symbolic"
|
||||||
|
visible: devices.videoInputs.length > 0
|
||||||
|
onTriggered: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), {
|
||||||
|
connection: root.connection
|
||||||
|
}, {
|
||||||
|
title: i18nc("@title", "Scan a QR Code")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18nc("@action:inmenu", "Switch Account")
|
text: i18nc("@action:inmenu", "Switch Account")
|
||||||
icon.name: "system-switch-user"
|
icon.name: "system-switch-user"
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ import org.kde.neochat
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var desiredWidth
|
|
||||||
property bool collapsed: false
|
property bool collapsed: false
|
||||||
required property NeoChatConnection connection
|
|
||||||
|
|
||||||
signal search
|
signal search
|
||||||
|
|
||||||
@@ -26,10 +24,6 @@ RowLayout {
|
|||||||
*/
|
*/
|
||||||
signal textChanged(string newText)
|
signal textChanged(string newText)
|
||||||
|
|
||||||
MediaDevices {
|
|
||||||
id: devices
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !root.collapsed
|
visible: !root.collapsed
|
||||||
@@ -51,78 +45,4 @@ RowLayout {
|
|||||||
QQC2.ToolTip.text: text
|
QQC2.ToolTip.text: text
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.ToolButton {
|
|
||||||
id: menuButton
|
|
||||||
|
|
||||||
property QQC2.Menu menuItem: null
|
|
||||||
|
|
||||||
function openMenu(): void {
|
|
||||||
if (!menuItem || !menuItem.visible) {
|
|
||||||
menuItem = menu.createObject(menuButton) as QQC2.Menu;
|
|
||||||
menuItem.closed.connect(menuButton.toggle);
|
|
||||||
menuItem.open();
|
|
||||||
} else {
|
|
||||||
menuItem.dismiss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Accessible.role: Accessible.ButtonMenu
|
|
||||||
display: QQC2.AbstractButton.IconOnly
|
|
||||||
down: pressed || menuItem?.visible
|
|
||||||
text: i18nc("@action:button", "Show Menu")
|
|
||||||
icon.name: "application-menu-symbolic"
|
|
||||||
|
|
||||||
onPressed: openMenu()
|
|
||||||
Keys.onReturnPressed: openMenu()
|
|
||||||
Keys.onEnterPressed: openMenu()
|
|
||||||
Accessible.onPressAction: openMenu()
|
|
||||||
|
|
||||||
QQC2.ToolTip.visible: hovered && !menuItem?.visible
|
|
||||||
QQC2.ToolTip.text: text
|
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: menu
|
|
||||||
QQC2.Menu {
|
|
||||||
y: menuButton.height
|
|
||||||
|
|
||||||
QQC2.MenuItem {
|
|
||||||
text: i18n("Find your friends")
|
|
||||||
icon.name: "list-add-user"
|
|
||||||
onTriggered: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
|
||||||
connection: root.connection
|
|
||||||
}, {
|
|
||||||
title: i18nc("@title", "Find your friends")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.MenuItem {
|
|
||||||
text: i18n("Create a Room")
|
|
||||||
icon.name: "system-users-symbolic"
|
|
||||||
onTriggered: {
|
|
||||||
(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog').createObject(root, {
|
|
||||||
connection: root.connection
|
|
||||||
}) as CreateRoomDialog).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Action {
|
|
||||||
shortcut: StandardKey.New
|
|
||||||
onTriggered: parent.trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.MenuItem {
|
|
||||||
text: i18n("Scan a QR Code")
|
|
||||||
icon.name: "view-barcode-qr"
|
|
||||||
visible: devices.videoInputs.length > 0
|
|
||||||
onTriggered: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), {
|
|
||||||
connection: root.connection
|
|
||||||
}, {
|
|
||||||
title: i18nc("@title", "Scan a QR Code")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,9 +270,7 @@ Kirigami.Page {
|
|||||||
Component {
|
Component {
|
||||||
id: exploreComponent
|
id: exploreComponent
|
||||||
ExploreComponent {
|
ExploreComponent {
|
||||||
desiredWidth: root.width - Kirigami.Units.largeSpacing
|
|
||||||
collapsed: root.collapsed
|
collapsed: root.collapsed
|
||||||
connection: root.connection
|
|
||||||
|
|
||||||
onSearch: root.search()
|
onSearch: root.search()
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import QtQuick.Controls as QQC2
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
@@ -263,21 +264,46 @@ QQC2.Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AvatarTabButton {
|
AvatarTabButton {
|
||||||
|
id: createNewButton
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: width - Kirigami.Units.smallSpacing
|
Layout.preferredHeight: width - Kirigami.Units.smallSpacing
|
||||||
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
text: i18n("Create a space")
|
text: i18nc("@action:button Create a new room or space", "Create")
|
||||||
contentItem: Kirigami.Icon {
|
contentItem: Kirigami.Icon {
|
||||||
source: "list-add"
|
source: "list-add"
|
||||||
}
|
}
|
||||||
|
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
|
down: menu.opened
|
||||||
|
|
||||||
onSelected: {
|
onSelected: menu.popup(root.QQC2.Overlay.overlay, createNewButton.mapToGlobal(Qt.point(createNewButton.width, 0)))
|
||||||
(Qt.createComponent('org.kde.neochat', 'CreateSpaceDialog').createObject(root, {
|
|
||||||
connection: root.connection
|
KirigamiComponents.ConvergentContextMenu {
|
||||||
}) as CreateSpaceDialog).open();
|
id: menu
|
||||||
|
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18nc("@action:button Create a new room", "New Room…")
|
||||||
|
icon.name: "list-add-symbolic"
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog').createObject(root, {
|
||||||
|
connection: root.connection
|
||||||
|
}) as CreateRoomDialog).open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18nc("@action:button Create a new room", "New Space…")
|
||||||
|
icon.name: "list-add-symbolic"
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
(Qt.createComponent('org.kde.neochat', 'CreateSpaceDialog').createObject(root, {
|
||||||
|
connection: root.connection
|
||||||
|
}) as CreateSpaceDialog).open();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user