From e490ef953f22e753f631719b7e2624ff3e146812 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 14 Mar 2021 22:22:52 +0100 Subject: [PATCH 1/2] Use native menus --- resources/qml/TimelineRow.qml | 4 ++-- resources/qml/TimelineView.qml | 44 ++++++++++++++++++---------------- resources/qml/TopBar.qml | 27 ++++++++++----------- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 0f815f6f..a66b994a 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -28,11 +28,11 @@ Item { TapHandler { acceptedButtons: Qt.RightButton - onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, row) + onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable) } TapHandler { - onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable, row) + onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable) onDoubleTapped: chat.model.reply = model.id } diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 02f6d5f4..5732dc73 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -6,6 +6,7 @@ import "./delegates" import "./device-verification" import "./emoji" import "./voip" +import Qt.labs.platform 1.1 as Platform import QtGraphicalEffects 1.0 import QtQuick 2.9 import QtQuick.Controls 2.3 @@ -89,7 +90,7 @@ Page { } } - Menu { + Platform.Menu { id: messageContextMenu property string eventId @@ -102,67 +103,68 @@ Page { eventType = eventType_; isEncrypted = isEncrypted_; isEditable = isEditable_; - popup(showAt_); + if (showAt_) + open(showAt_); + else + open(); } - modal: true - - MenuItem { + Platform.MenuItem { text: qsTr("React") - onClicked: emojiPopup.show(messageContextMenu.parent, function(emoji) { + onTriggered: emojiPopup.show(messageContextMenu.parent, function(emoji) { TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji); }) } - MenuItem { + Platform.MenuItem { text: qsTr("Reply") - onClicked: TimelineManager.timeline.replyAction(messageContextMenu.eventId) + onTriggered: TimelineManager.timeline.replyAction(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { visible: messageContextMenu.isEditable - height: visible ? implicitHeight : 0 + enabled: visible text: qsTr("Edit") - onClicked: TimelineManager.timeline.editAction(messageContextMenu.eventId) + onTriggered: TimelineManager.timeline.editAction(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { text: qsTr("Read receipts") onTriggered: TimelineManager.timeline.readReceiptsAction(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { text: qsTr("Mark as read") } - MenuItem { + Platform.MenuItem { text: qsTr("View raw message") onTriggered: TimelineManager.timeline.viewRawMessage(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { // TODO(Nico): Fix this still being iterated over, when using keyboard to select options visible: messageContextMenu.isEncrypted - height: visible ? implicitHeight : 0 + enabled: visible text: qsTr("View decrypted raw message") onTriggered: TimelineManager.timeline.viewDecryptedRawMessage(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { text: qsTr("Remove message") onTriggered: TimelineManager.timeline.redactEvent(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker - height: visible ? implicitHeight : 0 + enabled: visible text: qsTr("Save as") onTriggered: TimelineManager.timeline.saveMedia(messageContextMenu.eventId) } - MenuItem { + Platform.MenuItem { visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker - height: visible ? implicitHeight : 0 + enabled: visible text: qsTr("Open in external program") onTriggered: TimelineManager.timeline.openMedia(messageContextMenu.eventId) } diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index 444a4572..048a76a1 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -2,8 +2,9 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.9 -import QtQuick.Controls 2.3 +import Qt.labs.platform 1.1 as Platform +import QtQuick 2.12 +import QtQuick.Controls 2.12 import QtQuick.Layouts 1.2 import im.nheko 1.0 @@ -17,9 +18,8 @@ Rectangle { z: 3 color: colors.window - MouseArea { - anchors.fill: parent - onClicked: TimelineManager.timeline.openRoomSettings() + TapHandler { + onSingleTapped: TimelineManager.timeline.openRoomSettings() } GridLayout { @@ -70,9 +70,8 @@ Rectangle { maximumLineCount: 1 elide: Text.ElideRight - MouseArea { - anchors.fill: parent - onClicked: TimelineManager.timeline.openRoomSettings() + TapHandler { + onSingleTapped: TimelineManager.timeline.openRoomSettings() } } @@ -96,27 +95,27 @@ Rectangle { image: ":/icons/icons/ui/vertical-ellipsis.png" ToolTip.visible: hovered ToolTip.text: qsTr("Room options") - onClicked: roomOptionsMenu.popup(roomOptionsButton) + onClicked: roomOptionsMenu.open(roomOptionsButton) - Menu { + Platform.Menu { id: roomOptionsMenu - MenuItem { + Platform.MenuItem { text: qsTr("Invite users") onTriggered: TimelineManager.openInviteUsersDialog() } - MenuItem { + Platform.MenuItem { text: qsTr("Members") onTriggered: TimelineManager.openMemberListDialog() } - MenuItem { + Platform.MenuItem { text: qsTr("Leave room") onTriggered: TimelineManager.openLeaveRoomDialog() } - MenuItem { + Platform.MenuItem { text: qsTr("Settings") onTriggered: TimelineManager.timeline.openRoomSettings() } From e438fc1068ea64147e05929d60de80d9f10ce054 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 14 Mar 2021 23:23:37 +0100 Subject: [PATCH 2/2] Shorten hunter dir path --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0da894fd..4d23338d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ environment: cache: - - c:\hunter\ + - c:\h\ - build\_deps -> appveyor.yml build: @@ -47,7 +47,7 @@ build_script: # Build nheko - cmake -G "Visual Studio 16 2019" -A x64 -H. -Bbuild - -DHUNTER_ROOT="C:\hunter" + -DHUNTER_ROOT="C:\h" -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release