From 75a2ba86eeb3cb6f870526e459e9ac773c92dfc5 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sat, 3 Apr 2021 15:21:06 +0200 Subject: [PATCH] Remove quick reply feature Unfortunately I couldn't find any way to make it work while also making scroll works correctly. The container is now using item delegate and by testing on my laptop touch pad it seems to scroll well. Probably worth revising at some point but at least it makes neochat usable. --- .../Component/Timeline/TextDelegate.qml | 6 +- .../Component/Timeline/TimelineContainer.qml | 60 ++++++------------- imports/NeoChat/Page/RoomPage.qml | 41 ++++++------- 3 files changed, 36 insertions(+), 71 deletions(-) diff --git a/imports/NeoChat/Component/Timeline/TextDelegate.qml b/imports/NeoChat/Component/Timeline/TextDelegate.qml index 9c79348b0..3983b135a 100644 --- a/imports/NeoChat/Component/Timeline/TextDelegate.qml +++ b/imports/NeoChat/Component/Timeline/TextDelegate.qml @@ -40,7 +40,7 @@ a{ } .user-pill{} -" + (isEmote ? "* " + author.displayName + " " : "") + display + (isEdited ? (" " + i18n("(edited)") + "") : "") +" + (isEmote ? "* " + author.displayName + " " : "") + model.display + (isEdited ? (" " + i18n("(edited)") + "") : "") color: Kirigami.Theme.textColor font.pointSize: isEmoji.test(display) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize @@ -49,9 +49,7 @@ a{ wrapMode: Text.WordWrap textFormat: Text.RichText - onLinkActivated: { - applicationWindow().handleLink(link, currentRoom) - } + onLinkActivated: applicationWindow().handleLink(link, currentRoom) MouseArea { anchors.fill: parent diff --git a/imports/NeoChat/Component/Timeline/TimelineContainer.qml b/imports/NeoChat/Component/Timeline/TimelineContainer.qml index 02c431ebd..1828d577f 100644 --- a/imports/NeoChat/Component/Timeline/TimelineContainer.qml +++ b/imports/NeoChat/Component/Timeline/TimelineContainer.qml @@ -15,7 +15,7 @@ import NeoChat.Setting 1.0 import NeoChat.Component 1.0 import NeoChat.Dialog 1.0 -Item { +QQC2.ItemDelegate { default property alias innerObject : column.children readonly property bool sentByMe: author.isLocalUser readonly property bool darkBackground: !sentByMe @@ -34,10 +34,13 @@ Item { signal openExternally() signal replyClicked(string eventID) - property alias hovered: controlContainer.hovered + topPadding: 0 + bottomPadding: 0 + + property alias hoveredBubble: controlContainer.hovered //height: mainColumn.childrenRect.height + (readMarker ? Kirigami.Units.smallSpacing : 0) - height: mainColumn.implicitHeight + (readMarker ? Kirigami.Units.smallSpacing : 0) + //height: mainColumn.implicitHeight + (readMarker ? Kirigami.Units.smallSpacing : 0) property int hoverComponentX: column.width - hoverComponent.childWidth + Kirigami.Units.largeSpacing property int hoverComponentY: -Kirigami.Units.largeSpacing - hoverComponent.childHeight * 1.5 @@ -70,30 +73,8 @@ Item { }; } - DragHandler { - enabled: Kirigami.Settings.isMobile - yAxis.enabled: false - xAxis.enabled: true - xAxis.maximum: 0 - xAxis.minimum: -Kirigami.Units.gridUnit * 4 - onActiveChanged: { - applicationWindow().pageStack.interactive = true; - if (!active && parent.x < -Kirigami.Units.gridUnit * 3) { - replyToMessage(author, message, eventId) - } - parent.x = 0; - } - } - - onXChanged: if (x !== 0) { - applicationWindow().pageStack.interactive = false; - } else { - applicationWindow().pageStack.interactive = true; - } - - ColumnLayout { + contentItem: ColumnLayout { id: mainColumn - width: parent.width spacing: 0 SectionDelegate { @@ -221,28 +202,21 @@ Item { Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing * 2 Layout.topMargin: active ? Kirigami.Units.smallSpacing : 0 + //Layout.bottomMargin: readMarker ? Kirigami.Units.smallSpacing : 0 active: eventType !== "state" && eventType !== "notice" && reaction != undefined && reaction.length > 0 visible: active sourceComponent: ReactionDelegate { } } } - Kirigami.Icon { - id: replyButton - visible: parent.x < - Kirigami.Units.gridUnit * 1 - opacity: -(parent.x + Kirigami.Units.gridUnit) / Kirigami.Units.gridUnit / 3 - anchors.left: parent.right - anchors.top: parent.top - source: "mail-replied-symbolic" - } - - Rectangle { - width: parent.width * 0.9 - x: parent.width * 0.05 - height: Kirigami.Units.smallSpacing / 2 - anchors.top: mainColumn.bottom - anchors.topMargin: Kirigami.Units.smallSpacing - visible: readMarker - color: Kirigami.Theme.positiveTextColor + background: Item { + Rectangle { + width: parent.width * 0.9 + x: parent.width * 0.05 + height: Kirigami.Units.smallSpacing / 2 + anchors.bottom: parent.bottom + visible: readMarker + color: Kirigami.Theme.positiveTextColor + } } } diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 440a41cee..3513e8b3d 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -355,7 +355,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "emote" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing + width: messageListView.width isLoaded: timelineDelegateChooser.delegateLoaded isEmote: true onReplyClicked: goToEvent(eventID) @@ -370,11 +370,11 @@ Kirigami.ScrollablePage { Layout.bottomMargin: Kirigami.Units.largeSpacing * 2 TapHandler { acceptedButtons: Qt.RightButton - onTapped: openMessageContext(author, display, eventId, toolTip) + onTapped: openMessageContext(author, model.display, eventId, toolTip) } TapHandler { acceptedButtons: Qt.LeftButton - onLongPressed: openMessageContext(author, display, eventId, toolTip) + onLongPressed: openMessageContext(author, model.display, eventId, toolTip) } } } @@ -383,9 +383,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "message" delegate: TimelineContainer { - id: timeline - width: messageListView.width - Kirigami.Units.largeSpacing - + width: messageListView.width isLoaded: timelineDelegateChooser.delegateLoaded onReplyClicked: goToEvent(eventID) @@ -398,11 +396,11 @@ Kirigami.ScrollablePage { Layout.leftMargin: Kirigami.Units.largeSpacing TapHandler { acceptedButtons: Qt.RightButton - onTapped: openMessageContext(author, display, eventId, toolTip) + onTapped: openMessageContext(author, model.display, eventId, toolTip) } TapHandler { acceptedButtons: Qt.LeftButton - onLongPressed: openMessageContext(author, display, eventId, toolTip) + onLongPressed: openMessageContext(author, model.display, eventId, toolTip) } } } @@ -411,7 +409,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "notice" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing + width: messageListView.width isLoaded: timelineDelegateChooser.delegateLoaded onReplyClicked: goToEvent(eventID) @@ -428,8 +426,6 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "image" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing - isLoaded: timelineDelegateChooser.delegateLoaded onReplyClicked: goToEvent(eventID) @@ -449,9 +445,8 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "sticker" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing - isLoaded: timelineDelegateChooser.delegateLoaded + width: messageListView.width onReplyClicked: goToEvent(eventID) hoverComponent: hoverActions @@ -469,8 +464,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "audio" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing - + width: messageListView.width hoverComponent: hoverActions isLoaded: timelineDelegateChooser.delegateLoaded @@ -480,11 +474,11 @@ Kirigami.ScrollablePage { Layout.fillWidth: true TapHandler { acceptedButtons: Qt.RightButton - onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } TapHandler { acceptedButtons: Qt.LeftButton - onLongPressed: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onLongPressed: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } } } @@ -493,8 +487,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "video" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing - + width: messageListView.width hoverComponent: hoverActions isLoaded: timelineDelegateChooser.delegateLoaded @@ -510,11 +503,11 @@ Kirigami.ScrollablePage { TapHandler { acceptedButtons: Qt.RightButton - onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } TapHandler { acceptedButtons: Qt.LeftButton - onLongPressed: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onLongPressed: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } } } @@ -523,7 +516,7 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "file" delegate: TimelineContainer { - width: messageListView.width - Kirigami.Units.largeSpacing + width: messageListView.width hoverComponent: hoverActions @@ -534,11 +527,11 @@ Kirigami.ScrollablePage { Layout.fillWidth: true TapHandler { acceptedButtons: Qt.RightButton - onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } TapHandler { acceptedButtons: Qt.LeftButton - onLongPressed: openFileContext(author, display, eventId, toolTip, progressInfo, parent) + onLongPressed: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent) } } }