From 603ff33ea68b7c9e06578adf96fb6d824aa465df Mon Sep 17 00:00:00 2001 From: targetakhil Date: Sun, 11 Apr 2021 20:01:49 +0530 Subject: added basic forwarding --- resources/qml/TimelineView.qml | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'resources') diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 481561d2..2b6a8f26 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -79,6 +79,78 @@ Page { } + Component { + id: forwardCompleter + + Popup { + id: forwardMessagePopup + x: 400 + y: 400 + + property var mid + + onOpened: { + completerPopup.open(); + roomTextInput.forceActiveFocus(); + } + + background: Rectangle { + border.color: "#444" + } + + function setMessageEventId(mid_in) { + mid = mid_in; + } + + MatrixTextField { + id: roomTextInput + + width: 100 + + color: colors.text + onTextEdited: { + completerPopup.completer.searchString = text; + } + Keys.onPressed: { + if (event.key == Qt.Key_Up && completerPopup.opened) { + event.accepted = true; + completerPopup.up(); + } else if (event.key == Qt.Key_Down && completerPopup.opened) { + event.accepted = true; + completerPopup.down(); + } else if (event.matches(StandardKey.InsertParagraphSeparator)) { + completerPopup.finishCompletion(); + event.accepted = true; + } + } + } + + Completer { + id: completerPopup + + y: 50 + width: 100 + completerName: "room" + avatarHeight: 24 + avatarWidth: 24 + bottomToTop: false + closePolicy: Popup.NoAutoClose + } + + Connections { + onCompletionSelected: { + TimelineManager.timeline.forwardMessage(messageContextMenu.eventId, id); + forwardMessagePopup.close(); + } + onCountChanged: { + if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count)) + completerPopup.currentIndex = 0; + } + target: completerPopup + } + } + } + Shortcut { sequence: "Ctrl+K" onActivated: { @@ -133,6 +205,15 @@ Page { onTriggered: TimelineManager.timeline.readReceiptsAction(messageContextMenu.eventId) } + Platform.MenuItem { + text: qsTr("Forward") + onTriggered: { + var forwardMess = forwardCompleter.createObject(timelineRoot); + forwardMess.open(); + forwardMess.setMessageEventId(messageContextMenu.eventId) + } + } + Platform.MenuItem { text: qsTr("Mark as read") } -- cgit 1.5.1 From ce8246238ecd16cd29d2d7af290d6f2f7cab5df3 Mon Sep 17 00:00:00 2001 From: targetakhil Date: Tue, 13 Apr 2021 22:31:49 +0530 Subject: Fix basic UI for forward completer --- resources/qml/ForwardCompleter.qml | 81 ++++++++++++++++++++++++++++++++++++++ resources/qml/TimelineView.qml | 71 ++------------------------------- resources/res.qrc | 1 + 3 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 resources/qml/ForwardCompleter.qml (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml new file mode 100644 index 00000000..2b5e6dfe --- /dev/null +++ b/resources/qml/ForwardCompleter.qml @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import im.nheko 1.0 + +Popup { + id: forwardMessagePopup + x: 400 + y: 400 + + width: 200 + + property var mid + + onOpened: { + completerPopup.open(); + roomTextInput.forceActiveFocus(); + } + + onClosed: { + completerPopup.close(); + } + + background: Rectangle { + border.color: "#444" + } + + function setMessageEventId(mid_in) { + mid = mid_in; + } + + MatrixTextField { + id: roomTextInput + + width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 + + color: colors.text + onTextEdited: { + completerPopup.completer.searchString = text; + } + Keys.onPressed: { + if (event.key == Qt.Key_Up && completerPopup.opened) { + event.accepted = true; + completerPopup.up(); + } else if (event.key == Qt.Key_Down && completerPopup.opened) { + event.accepted = true; + completerPopup.down(); + } else if (event.matches(StandardKey.InsertParagraphSeparator)) { + completerPopup.finishCompletion(); + event.accepted = true; + } + } + } + + Completer { + id: completerPopup + + y: roomTextInput.height + roomTextInput.bottomPadding + width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 + completerName: "room" + avatarHeight: 24 + avatarWidth: 24 + bottomToTop: false + closePolicy: Popup.NoAutoClose + } + + Connections { + onCompletionSelected: { + TimelineManager.timeline.forwardMessage(messageContextMenu.eventId, id); + forwardMessagePopup.close(); + } + onCountChanged: { + if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count)) + completerPopup.currentIndex = 0; + } + target: completerPopup + } +} \ No newline at end of file diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 2b6a8f26..6c75eb74 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -80,74 +80,9 @@ Page { } Component { - id: forwardCompleter + id: forwardCompleterComponent - Popup { - id: forwardMessagePopup - x: 400 - y: 400 - - property var mid - - onOpened: { - completerPopup.open(); - roomTextInput.forceActiveFocus(); - } - - background: Rectangle { - border.color: "#444" - } - - function setMessageEventId(mid_in) { - mid = mid_in; - } - - MatrixTextField { - id: roomTextInput - - width: 100 - - color: colors.text - onTextEdited: { - completerPopup.completer.searchString = text; - } - Keys.onPressed: { - if (event.key == Qt.Key_Up && completerPopup.opened) { - event.accepted = true; - completerPopup.up(); - } else if (event.key == Qt.Key_Down && completerPopup.opened) { - event.accepted = true; - completerPopup.down(); - } else if (event.matches(StandardKey.InsertParagraphSeparator)) { - completerPopup.finishCompletion(); - event.accepted = true; - } - } - } - - Completer { - id: completerPopup - - y: 50 - width: 100 - completerName: "room" - avatarHeight: 24 - avatarWidth: 24 - bottomToTop: false - closePolicy: Popup.NoAutoClose - } - - Connections { - onCompletionSelected: { - TimelineManager.timeline.forwardMessage(messageContextMenu.eventId, id); - forwardMessagePopup.close(); - } - onCountChanged: { - if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count)) - completerPopup.currentIndex = 0; - } - target: completerPopup - } + ForwardCompleter { } } @@ -208,7 +143,7 @@ Page { Platform.MenuItem { text: qsTr("Forward") onTriggered: { - var forwardMess = forwardCompleter.createObject(timelineRoot); + var forwardMess = forwardCompleterComponent.createObject(timelineRoot); forwardMess.open(); forwardMess.setMessageEventId(messageContextMenu.eventId) } diff --git a/resources/res.qrc b/resources/res.qrc index 328f65ca..304493b6 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -142,6 +142,7 @@ qml/TimelineRow.qml qml/TopBar.qml qml/QuickSwitcher.qml + qml/ForwardCompleter.qml qml/TypingIndicator.qml qml/RoomSettings.qml qml/emoji/EmojiButton.qml -- cgit 1.5.1 From 6893e3a8d5cd30fc3e29dbf9160f258cb86b0cf0 Mon Sep 17 00:00:00 2001 From: targetakhil Date: Thu, 15 Apr 2021 21:14:58 +0530 Subject: show forward menu item only for relevant events, changes to ui --- resources/qml/ForwardCompleter.qml | 24 ++++++++++++++++++------ resources/qml/TimelineView.qml | 3 ++- src/timeline/TimelineModel.cpp | 11 +++++++++++ src/timeline/TimelineModel.h | 1 + 4 files changed, 32 insertions(+), 7 deletions(-) (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 2b5e6dfe..22d6e5b0 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -2,16 +2,19 @@ // // SPDX-License-Identifier: GPL-3.0-or-later +import "./delegates/" import QtQuick 2.9 import QtQuick.Controls 2.3 import im.nheko 1.0 -Popup { +Dialog { id: forwardMessagePopup + title: qsTr("Forward Message") x: 400 y: 400 width: 200 + height: replyPreview.height + roomTextInput.height + completerPopup.height + implicitFooterHeight + implicitHeaderHeight property var mid @@ -24,19 +27,27 @@ Popup { completerPopup.close(); } - background: Rectangle { - border.color: "#444" - } - function setMessageEventId(mid_in) { mid = mid_in; } + Reply { + id: replyPreview + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { + } + userColor: TimelineManager.userColor(modelData.userId, colors.window) + } + MatrixTextField { id: roomTextInput width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 + anchors.top: replyPreview.bottom + color: colors.text onTextEdited: { completerPopup.completer.searchString = text; @@ -58,7 +69,8 @@ Popup { Completer { id: completerPopup - y: roomTextInput.height + roomTextInput.bottomPadding + y: replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding + width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 completerName: "room" avatarHeight: 24 diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 6c75eb74..e08c8a1e 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -141,11 +141,12 @@ Page { } Platform.MenuItem { + visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker || messageContextMenu.eventType == MtxEvent.TextMessage|| messageContextMenu.eventType == MtxEvent.LocationMessage || messageContextMenu.eventType == MtxEvent.EmoteMessage || messageContextMenu.eventType == MtxEvent.NoticeMessage text: qsTr("Forward") onTriggered: { var forwardMess = forwardCompleterComponent.createObject(timelineRoot); + forwardMess.setMessageEventId(messageContextMenu.eventId); forwardMess.open(); - forwardMess.setMessageEventId(messageContextMenu.eventId) } } diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index e3efe5ad..0edee4aa 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -832,6 +832,17 @@ TimelineModel::forwardMessage(QString eventId, QString roomId) emit forwardToRoom(e, roomId, cache::isRoomEncrypted(room_id_.toStdString())); } +QString +TimelineModel::messageContent(QString eventId) +{ + auto e = events.get(eventId.toStdString(), ""); + if (!e) + return ""; + + auto content = mtx::accessors::body(*e); + return QString::fromStdString(content); +} + void TimelineModel::viewDecryptedRawMessage(QString id) const { diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 3e6f6f15..c17280da 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -220,6 +220,7 @@ public: Q_INVOKABLE void viewRawMessage(QString id) const; Q_INVOKABLE void forwardMessage(QString eventId, QString roomId); + Q_INVOKABLE QString messageContent(QString eventId); Q_INVOKABLE void viewDecryptedRawMessage(QString id) const; Q_INVOKABLE void openUserProfile(QString userid, bool global = false); Q_INVOKABLE void openRoomSettings(); -- cgit 1.5.1 From dff5cfc3ba9592900cef5e612f6832258393d8ec Mon Sep 17 00:00:00 2001 From: targetakhil Date: Thu, 15 Apr 2021 22:21:25 +0530 Subject: Added overlay and UI changes --- resources/qml/ForwardCompleter.qml | 83 ++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 34 deletions(-) (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 22d6e5b0..4cc2e09d 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -7,14 +7,18 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import im.nheko 1.0 -Dialog { +Popup { id: forwardMessagePopup - title: qsTr("Forward Message") + palette: colors + parent: Overlay.overlay + modal: true x: 400 - y: 400 + y: 200 - width: 200 - height: replyPreview.height + roomTextInput.height + completerPopup.height + implicitFooterHeight + implicitHeaderHeight + width: implicitWidth >= 300 ? implicitWidth : 300 + height: implicitHeight + completerPopup.height + padding * 2 + leftPadding: 10 + rightPadding: 10 property var mid @@ -31,37 +35,43 @@ Dialog { mid = mid_in; } - Reply { - id: replyPreview - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { - } - userColor: TimelineManager.userColor(modelData.userId, colors.window) - } + Column { + id: forwardColumn + spacing: 5 - MatrixTextField { - id: roomTextInput + Label { + id: titleLabel + text: qsTr("Forward Message") + font.bold: true + bottomPadding: 10 + } - width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 + Reply { + id: replyPreview + modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { + } + userColor: TimelineManager.userColor(modelData.userId, colors.window) + } - anchors.top: replyPreview.bottom + MatrixTextField { + id: roomTextInput - color: colors.text - onTextEdited: { - completerPopup.completer.searchString = text; - } - Keys.onPressed: { - if (event.key == Qt.Key_Up && completerPopup.opened) { - event.accepted = true; - completerPopup.up(); - } else if (event.key == Qt.Key_Down && completerPopup.opened) { - event.accepted = true; - completerPopup.down(); - } else if (event.matches(StandardKey.InsertParagraphSeparator)) { - completerPopup.finishCompletion(); - event.accepted = true; + width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 + color: colors.text + onTextEdited: { + completerPopup.completer.searchString = text; + } + Keys.onPressed: { + if (event.key == Qt.Key_Up && completerPopup.opened) { + event.accepted = true; + completerPopup.up(); + } else if (event.key == Qt.Key_Down && completerPopup.opened) { + event.accepted = true; + completerPopup.down(); + } else if (event.matches(StandardKey.InsertParagraphSeparator)) { + completerPopup.finishCompletion(); + event.accepted = true; + } } } } @@ -69,10 +79,11 @@ Dialog { Completer { id: completerPopup - y: replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding - + y: titleLabel.height + replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding + forwardColumn.spacing * 3 width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2 completerName: "room" + fullWidth: true + centerRowContent: false avatarHeight: 24 avatarWidth: 24 bottomToTop: false @@ -90,4 +101,8 @@ Dialog { } target: completerPopup } + + Overlay.modal: Rectangle { + color: "#aa1E1E1E" + } } \ No newline at end of file -- cgit 1.5.1 From 99340047026b6980c14f83471dfa63369f8eae96 Mon Sep 17 00:00:00 2001 From: targetakhil Date: Thu, 15 Apr 2021 22:32:37 +0530 Subject: remove unused function and set position to center of timeline view --- resources/qml/ForwardCompleter.qml | 10 +++++++--- src/timeline/TimelineModel.cpp | 11 ----------- src/timeline/TimelineModel.h | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 4cc2e09d..f85362c1 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -9,11 +9,12 @@ import im.nheko 1.0 Popup { id: forwardMessagePopup + + x: Math.round(parent.width / 2 - width / 2) + y: Math.round(parent.height / 2 - height / 2) + modal: true palette: colors parent: Overlay.overlay - modal: true - x: 400 - y: 200 width: implicitWidth >= 300 ? implicitWidth : 300 height: implicitHeight + completerPopup.height + padding * 2 @@ -37,10 +38,12 @@ Popup { Column { id: forwardColumn + spacing: 5 Label { id: titleLabel + text: qsTr("Forward Message") font.bold: true bottomPadding: 10 @@ -48,6 +51,7 @@ Popup { Reply { id: replyPreview + modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : { } userColor: TimelineManager.userColor(modelData.userId, colors.window) diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 0edee4aa..e3efe5ad 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -832,17 +832,6 @@ TimelineModel::forwardMessage(QString eventId, QString roomId) emit forwardToRoom(e, roomId, cache::isRoomEncrypted(room_id_.toStdString())); } -QString -TimelineModel::messageContent(QString eventId) -{ - auto e = events.get(eventId.toStdString(), ""); - if (!e) - return ""; - - auto content = mtx::accessors::body(*e); - return QString::fromStdString(content); -} - void TimelineModel::viewDecryptedRawMessage(QString id) const { diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index c17280da..3e6f6f15 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -220,7 +220,6 @@ public: Q_INVOKABLE void viewRawMessage(QString id) const; Q_INVOKABLE void forwardMessage(QString eventId, QString roomId); - Q_INVOKABLE QString messageContent(QString eventId); Q_INVOKABLE void viewDecryptedRawMessage(QString id) const; Q_INVOKABLE void openUserProfile(QString userid, bool global = false); Q_INVOKABLE void openRoomSettings(); -- cgit 1.5.1 From 65d85768d0fbdcfbfa273c1676d3649157af8589 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 27 Apr 2021 11:08:21 +0200 Subject: Clean up design a bit --- resources/qml/ForwardCompleter.qml | 26 ++++++++++++++------------ resources/qml/TimelineView.qml | 3 ++- resources/qml/TopBar.qml | 4 ++-- 3 files changed, 18 insertions(+), 15 deletions(-) (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index f85362c1..6dbd8926 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -10,32 +10,30 @@ import im.nheko 1.0 Popup { id: forwardMessagePopup + property var mid + + function setMessageEventId(mid_in) { + mid = mid_in; + } + x: Math.round(parent.width / 2 - width / 2) y: Math.round(parent.height / 2 - height / 2) modal: true palette: colors parent: Overlay.overlay - - width: implicitWidth >= 300 ? implicitWidth : 300 + width: implicitWidth >= (timelineRoot.width * 0.8) ? implicitWidth : (timelineRoot.width * 0.8) height: implicitHeight + completerPopup.height + padding * 2 leftPadding: 10 rightPadding: 10 - - property var mid - + background: null onOpened: { completerPopup.open(); roomTextInput.forceActiveFocus(); } - onClosed: { completerPopup.close(); } - function setMessageEventId(mid_in) { - mid = mid_in; - } - Column { id: forwardColumn @@ -47,6 +45,7 @@ Popup { text: qsTr("Forward Message") font.bold: true bottomPadding: 10 + color: colors.text } Reply { @@ -78,6 +77,7 @@ Popup { } } } + } Completer { @@ -102,11 +102,13 @@ Popup { onCountChanged: { if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count)) completerPopup.currentIndex = 0; + } target: completerPopup } Overlay.modal: Rectangle { - color: "#aa1E1E1E" + color: Qt.rgba(colors.window.r, colors.window.g, colors.window.b, 0.75) } -} \ No newline at end of file + +} diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 7cf029e1..81ca7705 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -76,6 +76,7 @@ Page { ForwardCompleter { } + } Shortcut { @@ -133,7 +134,7 @@ Page { } Platform.MenuItem { - visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker || messageContextMenu.eventType == MtxEvent.TextMessage|| messageContextMenu.eventType == MtxEvent.LocationMessage || messageContextMenu.eventType == MtxEvent.EmoteMessage || messageContextMenu.eventType == MtxEvent.NoticeMessage + visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker || messageContextMenu.eventType == MtxEvent.TextMessage || messageContextMenu.eventType == MtxEvent.LocationMessage || messageContextMenu.eventType == MtxEvent.EmoteMessage || messageContextMenu.eventType == MtxEvent.NoticeMessage text: qsTr("Forward") onTriggered: { var forwardMess = forwardCompleterComponent.createObject(timelineRoot); diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index f5c5c84a..858652c2 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -72,8 +72,8 @@ Rectangle { font.pointSize: fontMetrics.font.pointSize * 1.1 text: room ? room.roomName : qsTr("No room selected") maximumLineCount: 1 - elide: Text.ElideRight - textFormat: Text.RichText + elide: Text.ElideRight + textFormat: Text.RichText } MatrixText { -- cgit 1.5.1 From 2b253ead9e9cf0dc3ab49b2ef2be43c199fd312a Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 27 Apr 2021 11:33:46 +0200 Subject: Make forward messages a bit more readable --- resources/qml/ForwardCompleter.qml | 7 +++-- src/timeline/TimelineViewManager.cpp | 51 +++++++++++++++++++++++++++++++++++- src/timeline/TimelineViewManager.h | 48 --------------------------------- 3 files changed, 55 insertions(+), 51 deletions(-) (limited to 'resources') diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 6dbd8926..c544378b 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -25,7 +25,10 @@ Popup { height: implicitHeight + completerPopup.height + padding * 2 leftPadding: 10 rightPadding: 10 - background: null + background: Rectangle { + color: colors.window + } + onOpened: { completerPopup.open(); roomTextInput.forceActiveFocus(); @@ -108,7 +111,7 @@ Popup { } Overlay.modal: Rectangle { - color: Qt.rgba(colors.window.r, colors.window.g, colors.window.b, 0.75) + color: Qt.rgba(colors.window.r, colors.window.g, colors.window.b, 0.7) } } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 518ccaf1..9d12825f 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -18,6 +18,7 @@ #include "CompletionProxyModel.h" #include "DelegateChooser.h" #include "DeviceVerificationFlow.h" +#include "EventAccessors.h" #include "Logging.h" #include "MainWindow.h" #include "MatrixClient.h" @@ -36,6 +37,54 @@ Q_DECLARE_METATYPE(std::vector) namespace msgs = mtx::events::msg; +namespace { +template class Op, class... Args> +using is_detected = typename nheko::detail::detector::value_t; + +template +using file_t = decltype(Content::file); + +template +using url_t = decltype(Content::url); + +template +using body_t = decltype(Content::body); + +template +using formatted_body_t = decltype(Content::formatted_body); + +template +static constexpr bool +messageWithFileAndUrl(const mtx::events::Event &) +{ + return is_detected::value && is_detected::value; +} + +template +static constexpr void +removeReplyFallback(mtx::events::Event &e) +{ + if constexpr (is_detected::value) { + if constexpr (std::is_same_v, + std::remove_cv_t>) { + if (e.content.body) { + e.content.body = utils::stripReplyFromBody(e.content.body); + } + } else if constexpr (std::is_same_v>) { + e.content.body = utils::stripReplyFromBody(e.content.body); + } + } + + if constexpr (is_detected::value) { + if (e.content.format == "org.matrix.custom.html") { + e.content.formatted_body = + utils::stripReplyFromFormattedBody(e.content.formatted_body); + } + } +} +} + void TimelineViewManager::updateEncryptedDescriptions() { @@ -694,4 +743,4 @@ TimelineViewManager::forwardMessageToRoom(mtx::events::collections::TimelineEven } }, *e); -} \ No newline at end of file +} diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 809b286e..9703ee56 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -16,7 +16,6 @@ #include "Cache.h" #include "CallManager.h" -#include "EventAccessors.h" #include "Logging.h" #include "TimelineModel.h" #include "Utils.h" @@ -152,53 +151,6 @@ public slots: private slots: void openImageOverlayInternal(QString eventId, QImage img); -private: - template class Op, class... Args> - using is_detected = - typename nheko::detail::detector::value_t; - - template - using file_t = decltype(Content::file); - - template - using url_t = decltype(Content::url); - - template - using body_t = decltype(Content::body); - - template - using formatted_body_t = decltype(Content::formatted_body); - - template - static constexpr bool messageWithFileAndUrl(const mtx::events::Event &) - { - return is_detected::value && is_detected::value; - } - - template - static constexpr void removeReplyFallback(mtx::events::Event &e) - { - if constexpr (is_detected::value) { - if constexpr (std::is_same_v, - std::remove_cv_t>) { - if (e.content.body) { - e.content.body = utils::stripReplyFromBody(e.content.body); - } - } else if constexpr (std::is_same_v< - std::string, - std::remove_cv_t>) { - e.content.body = utils::stripReplyFromBody(e.content.body); - } - } - - if constexpr (is_detected::value) { - if (e.content.format == "org.matrix.custom.html") { - e.content.formatted_body = - utils::stripReplyFromFormattedBody(e.content.formatted_body); - } - } - } - private: #ifdef USE_QUICK_VIEW QQuickView *view; -- cgit 1.5.1