diff options
Diffstat (limited to 'resources/qml/RoomList.qml')
-rw-r--r-- | resources/qml/RoomList.qml | 106 |
1 files changed, 62 insertions, 44 deletions
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index c82bc43a..4557b5a3 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -5,8 +5,6 @@ import "./components" import "./dialogs" import "./ui" -import Qt.labs.platform 1.1 as Platform -import QtQml import QtQuick import QtQuick.Controls import QtQuick.Layouts @@ -43,6 +41,8 @@ Page { id: buttonRow ImageButton { + id: startChatButton + Layout.fillWidth: true Layout.margins: Nheko.paddingMedium ToolTip.delay: Nheko.tooltipDelay @@ -53,17 +53,17 @@ Page { hoverEnabled: true image: ":/icons/icons/ui/add-square-button.svg" - onClicked: roomJoinCreateMenu.open(parent) + onClicked: roomJoinCreateMenu.popup(startChatButton) - Platform.Menu { + Menu { id: roomJoinCreateMenu - Platform.MenuItem { + MenuItem { text: qsTr("Join a room") onTriggered: Nheko.openJoinRoomDialog() } - Platform.MenuItem { + MenuItem { text: qsTr("Create a new room") onTriggered: { @@ -72,7 +72,7 @@ Page { timelineRoot.destroyOnClose(createRoom); } } - Platform.MenuItem { + MenuItem { text: qsTr("Start a direct chat") onTriggered: { @@ -81,7 +81,7 @@ Page { timelineRoot.destroyOnClose(createDirect); } } - Platform.MenuItem { + MenuItem { text: qsTr("Create a new community") onTriggered: { @@ -255,68 +255,72 @@ Page { Nheko.setStatusMessage(text); } } - Platform.Menu { + Menu { id: userInfoMenu - Platform.MenuItem { + MenuItem { text: qsTr("Profile settings") onTriggered: userInfoPanel.openUserProfile() } - Platform.MenuItem { + MenuItem { text: qsTr("Set status message") onTriggered: statusDialog.show() } - Platform.MenuSeparator { + MenuSeparator { } - Platform.MenuItemGroup { + ButtonGroup { id: onlineStateGroup } - Platform.MenuItem { + MenuItem { text: qsTr("Automatic online status") - group: onlineStateGroup + ButtonGroup.group: onlineStateGroup checkable: true checked: Settings.presence == Settings.AutomaticPresence onTriggered: if (checked) Settings.presence = Settings.AutomaticPresence } - Platform.MenuItem { + MenuItem { text: qsTr("Online") - group: onlineStateGroup + ButtonGroup.group: onlineStateGroup checkable: true checked: Settings.presence == Settings.Online onTriggered: if (checked) Settings.presence = Settings.Online } - Platform.MenuItem { + MenuItem { text: qsTr("Unavailable") - group: onlineStateGroup + ButtonGroup.group: onlineStateGroup checkable: true checked: Settings.presence == Settings.Unavailable onTriggered: if (checked) Settings.presence = Settings.Unavailable } - Platform.MenuItem { + MenuItem { text: qsTr("Offline") - group: onlineStateGroup + ButtonGroup.group: onlineStateGroup checkable: true checked: Settings.presence == Settings.Offline onTriggered: if (checked) Settings.presence = Settings.Offline } } TapHandler { + id: userTapHandler + acceptedButtons: Qt.LeftButton gesturePolicy: TapHandler.ReleaseWithinBounds margin: -Nheko.paddingSmall - onLongPressed: userInfoMenu.open() + onLongPressed: userInfoMenu.popup(userTapHandler) onSingleTapped: userInfoPanel.openUserProfile() } TapHandler { + id: userTapHandler2 + acceptedButtons: Qt.RightButton gesturePolicy: TapHandler.ReleaseWithinBounds margin: -Nheko.paddingSmall - onSingleTapped: userInfoMenu.open() + onSingleTapped: userInfoMenu.popup(userTapHandler2) } } Rectangle { @@ -477,6 +481,11 @@ Page { state: "normal" width: ListView.view.width - ((scrollbar.interactive && scrollbar.visible && scrollbar.parent) ? scrollbar.width : 0) + topInset: 0 + bottomInset: 0 + leftInset: 0 + rightInset: 0 + background: Rectangle { color: backgroundColor } @@ -520,7 +529,7 @@ Page { } onPressAndHold: { if (!isInvite) - roomContextMenu.show(roomId, tags); + roomContextMenu.show(roomItem, roomId, tags); } Ripple { @@ -533,13 +542,15 @@ Page { anchors.margins: 1 TapHandler { + id: roomItemTh + acceptedButtons: Qt.RightButton acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad gesturePolicy: TapHandler.ReleaseWithinBounds onSingleTapped: { if (!TimelineManager.isInvite) - roomContextMenu.show(roomId, tags); + roomContextMenu.show(roomItemTh, roomId, tags); } } } @@ -721,24 +732,31 @@ Page { } } } - Component { - id: nestedSpaceMenuLevel - - SpaceMenuLevel { - childMenu: rootSpaceMenu.childMenu - roomid: roomContextMenu.roomid - } - } - Platform.Menu { + Menu { id: roomContextMenu property string roomid property var tags - function show(roomid_, tags_) { + function show(parent, roomid_, tags_) { roomid = roomid_; tags = tags_; - open(); + popup(parent); + } + + Component.onCompleted: { + if (roomContextMenu.popupType != undefined) { + roomContextMenu.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0) + } + } + + Component { + id: nestedSpaceMenuLevel + + SpaceMenuLevel { + childMenu: rootSpaceMenu.childMenu + roomid: roomContextMenu.roomid + } } InputDialog { @@ -751,7 +769,7 @@ Page { Rooms.toggleTag(roomContextMenu.roomid, "u." + text, true); } } - Platform.MenuItem { + MenuItem { text: qsTr("Open separately") onTriggered: { @@ -763,27 +781,27 @@ Page { destroyOnClose(roomWindow); } } - Platform.MenuItem { + MenuItem { text: qsTr("Mark as read") onTriggered: Rooms.getRoomById(roomContextMenu.roomid).markRoomAsRead() } - Platform.MenuItem { + MenuItem { text: qsTr("Room settings") onTriggered: TimelineManager.openRoomSettings(roomContextMenu.roomid) } - Platform.MenuItem { + MenuItem { text: qsTr("Leave room") onTriggered: TimelineManager.openLeaveRoomDialog(roomContextMenu.roomid) } - Platform.MenuItem { + MenuItem { text: qsTr("Copy room link") onTriggered: Rooms.copyLink(roomContextMenu.roomid) } - Platform.Menu { + Menu { id: tagsMenu title: qsTr("Tag room as:") @@ -791,7 +809,7 @@ Page { Instantiator { model: Communities.tagsWithDefault - delegate: Platform.MenuItem { + delegate: MenuItem { property string t: modelData checkable: true @@ -815,7 +833,7 @@ Page { onObjectAdded: (index, object) => tagsMenu.insertItem(index, object) onObjectRemoved: (index, object) => tagsMenu.removeItem(object) } - Platform.MenuItem { + MenuItem { text: qsTr("Create new tag...") onTriggered: newTag.show() |