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.
This commit is contained in:
Carl Schwan
2021-04-03 15:21:06 +02:00
parent 71d4b8763e
commit 75a2ba86ee
3 changed files with 36 additions and 71 deletions

View File

@@ -40,7 +40,7 @@ a{
} }
.user-pill{} .user-pill{}
</style>" + (isEmote ? "* <a href='https://matrix.to/#/" + author.id + "' style='color: " + author.color + "'>" + author.displayName + "</a> " : "") + display + (isEdited ? (" <span style=\"color: " + Kirigami.Theme.disabledTextColor + "\">" + i18n("(edited)") + "</span>") : "") </style>" + (isEmote ? "* <a href='https://matrix.to/#/" + author.id + "' style='color: " + author.color + "'>" + author.displayName + "</a> " : "") + model.display + (isEdited ? (" <span style=\"color: " + Kirigami.Theme.disabledTextColor + "\">" + i18n("(edited)") + "</span>") : "")
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
font.pointSize: isEmoji.test(display) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize font.pointSize: isEmoji.test(display) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize
@@ -49,9 +49,7 @@ a{
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
textFormat: Text.RichText textFormat: Text.RichText
onLinkActivated: { onLinkActivated: applicationWindow().handleLink(link, currentRoom)
applicationWindow().handleLink(link, currentRoom)
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

View File

@@ -15,7 +15,7 @@ import NeoChat.Setting 1.0
import NeoChat.Component 1.0 import NeoChat.Component 1.0
import NeoChat.Dialog 1.0 import NeoChat.Dialog 1.0
Item { QQC2.ItemDelegate {
default property alias innerObject : column.children default property alias innerObject : column.children
readonly property bool sentByMe: author.isLocalUser readonly property bool sentByMe: author.isLocalUser
readonly property bool darkBackground: !sentByMe readonly property bool darkBackground: !sentByMe
@@ -34,10 +34,13 @@ Item {
signal openExternally() signal openExternally()
signal replyClicked(string eventID) 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.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 hoverComponentX: column.width - hoverComponent.childWidth + Kirigami.Units.largeSpacing
property int hoverComponentY: -Kirigami.Units.largeSpacing - hoverComponent.childHeight * 1.5 property int hoverComponentY: -Kirigami.Units.largeSpacing - hoverComponent.childHeight * 1.5
@@ -70,30 +73,8 @@ Item {
}; };
} }
DragHandler { contentItem: ColumnLayout {
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 {
id: mainColumn id: mainColumn
width: parent.width
spacing: 0 spacing: 0
SectionDelegate { SectionDelegate {
@@ -221,28 +202,21 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing * 2 Layout.leftMargin: Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing * 2
Layout.topMargin: active ? Kirigami.Units.smallSpacing : 0 Layout.topMargin: active ? Kirigami.Units.smallSpacing : 0
//Layout.bottomMargin: readMarker ? Kirigami.Units.smallSpacing : 0
active: eventType !== "state" && eventType !== "notice" && reaction != undefined && reaction.length > 0 active: eventType !== "state" && eventType !== "notice" && reaction != undefined && reaction.length > 0
visible: active visible: active
sourceComponent: ReactionDelegate { } sourceComponent: ReactionDelegate { }
} }
} }
Kirigami.Icon { background: Item {
id: replyButton Rectangle {
visible: parent.x < - Kirigami.Units.gridUnit * 1 width: parent.width * 0.9
opacity: -(parent.x + Kirigami.Units.gridUnit) / Kirigami.Units.gridUnit / 3 x: parent.width * 0.05
anchors.left: parent.right height: Kirigami.Units.smallSpacing / 2
anchors.top: parent.top anchors.bottom: parent.bottom
source: "mail-replied-symbolic" visible: readMarker
} color: Kirigami.Theme.positiveTextColor
}
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
} }
} }

View File

@@ -355,7 +355,7 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "emote" roleValue: "emote"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing width: messageListView.width
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
isEmote: true isEmote: true
onReplyClicked: goToEvent(eventID) onReplyClicked: goToEvent(eventID)
@@ -370,11 +370,11 @@ Kirigami.ScrollablePage {
Layout.bottomMargin: Kirigami.Units.largeSpacing * 2 Layout.bottomMargin: Kirigami.Units.largeSpacing * 2
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: openMessageContext(author, display, eventId, toolTip) onTapped: openMessageContext(author, model.display, eventId, toolTip)
} }
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onLongPressed: openMessageContext(author, display, eventId, toolTip) onLongPressed: openMessageContext(author, model.display, eventId, toolTip)
} }
} }
} }
@@ -383,9 +383,7 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "message" roleValue: "message"
delegate: TimelineContainer { delegate: TimelineContainer {
id: timeline width: messageListView.width
width: messageListView.width - Kirigami.Units.largeSpacing
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
onReplyClicked: goToEvent(eventID) onReplyClicked: goToEvent(eventID)
@@ -398,11 +396,11 @@ Kirigami.ScrollablePage {
Layout.leftMargin: Kirigami.Units.largeSpacing Layout.leftMargin: Kirigami.Units.largeSpacing
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: openMessageContext(author, display, eventId, toolTip) onTapped: openMessageContext(author, model.display, eventId, toolTip)
} }
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onLongPressed: openMessageContext(author, display, eventId, toolTip) onLongPressed: openMessageContext(author, model.display, eventId, toolTip)
} }
} }
} }
@@ -411,7 +409,7 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "notice" roleValue: "notice"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing width: messageListView.width
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
onReplyClicked: goToEvent(eventID) onReplyClicked: goToEvent(eventID)
@@ -428,8 +426,6 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "image" roleValue: "image"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
onReplyClicked: goToEvent(eventID) onReplyClicked: goToEvent(eventID)
@@ -449,9 +445,8 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "sticker" roleValue: "sticker"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
width: messageListView.width
onReplyClicked: goToEvent(eventID) onReplyClicked: goToEvent(eventID)
hoverComponent: hoverActions hoverComponent: hoverActions
@@ -469,8 +464,7 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "audio" roleValue: "audio"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing width: messageListView.width
hoverComponent: hoverActions hoverComponent: hoverActions
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
@@ -480,11 +474,11 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true Layout.fillWidth: true
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent)
} }
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton 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 { DelegateChoice {
roleValue: "video" roleValue: "video"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing width: messageListView.width
hoverComponent: hoverActions hoverComponent: hoverActions
isLoaded: timelineDelegateChooser.delegateLoaded isLoaded: timelineDelegateChooser.delegateLoaded
@@ -510,11 +503,11 @@ Kirigami.ScrollablePage {
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent)
} }
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton 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 { DelegateChoice {
roleValue: "file" roleValue: "file"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width - Kirigami.Units.largeSpacing width: messageListView.width
hoverComponent: hoverActions hoverComponent: hoverActions
@@ -534,11 +527,11 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true Layout.fillWidth: true
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: openFileContext(author, display, eventId, toolTip, progressInfo, parent) onTapped: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent)
} }
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onLongPressed: openFileContext(author, display, eventId, toolTip, progressInfo, parent) onLongPressed: openFileContext(author, model.display, eventId, toolTip, progressInfo, parent)
} }
} }
} }