diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-01-28 19:08:16 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-01-28 19:08:16 +0100 |
commit | 4951241d23a936d110df1694c884490a7ba92461 (patch) | |
tree | 83d80c0b7501ad211f7d12333860bdd49f9af2df /resources/qml/TimelineView.qml | |
parent | Improve styling of reply popup (diff) | |
download | nheko-4951241d23a936d110df1694c884490a7ba92461.tar.xz |
Simplify reply popup logic
Diffstat (limited to 'resources/qml/TimelineView.qml')
-rw-r--r-- | resources/qml/TimelineView.qml | 110 |
1 files changed, 34 insertions, 76 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 61094890..a5746703 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -192,7 +192,7 @@ Item { Rectangle { id: chatFooter - height: Math.max(Math.max(16, typingDisplay.height), replyPopup.height) + height: Math.max(16, aaaaa.height) anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom @@ -200,96 +200,54 @@ Item { color: colors.window - Text { + Column { + id: aaaaa anchors.left: parent.left anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.leftMargin: 10 - anchors.rightMargin: 10 - - id: typingDisplay - text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, chatFooter.color) : "" - textFormat: Text.RichText - color: colors.windowText - } - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - id: replyPopup + Text { + id: typingDisplay + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 10 + anchors.rightMargin: 10 - visible: timelineManager.replyingEvent && chat.model - width: parent.width - // Height of child, plus margins, plus border - height: replyContent.height + 10 - color: colors.dark + text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : "" + textFormat: Text.RichText + color: colors.windowText + } - RowLayout { - id: replyContent + Rectangle { anchors.left: parent.left anchors.right: parent.right - anchors.top: parent.top - anchors.margins: 10 - Column { - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - spacing: 4 - Rectangle { - width: parent.width - height: replyContainer.height - anchors.leftMargin: 10 - anchors.rightMargin: 10 - - Rectangle { - id: colorLine - height: replyContainer.height - width: 4 - color: chat.model ? chat.model.userColor(reply.modelData.userId, colors.window) : colors.window - } + id: replyPopup - Column { - id: replyContainer - anchors.left: colorLine.right - anchors.leftMargin: 4 - width: parent.width - 8 - - Text { - id: userName - text: chat.model ? chat.model.escapeEmoji(reply.modelData.userName) : "" - color: chat.model ? chat.model.userColor(reply.modelData.userId, colors.windowText) : colors.windowText - textFormat: Text.RichText - - MouseArea { - anchors.fill: parent - onClicked: chat.model.openUserProfile(reply.modelData.userId) - cursorShape: Qt.PointingHandCursor - } - } - - MessageDelegate { - id: reply - width: parent.width - modelData: chat.model ? chat.model.getDump(timelineManager.replyingEvent) : {} - } - } + visible: timelineManager.replyingEvent && chat.model + // Height of child, plus margins, plus border + height: replyPreview.height + 10 + color: colors.dark - color: { var col = chat.model ? chat.model.userColor(reply.modelData.userId, colors.window) : colors.window; col.a = 0.2; return col } - MouseArea { - anchors.fill: parent - onClicked: chat.positionViewAtIndex(chat.model.idToIndex(timelineManager.replyingEvent), ListView.Contain) - cursorShape: Qt.PointingHandCursor - } - } + Reply { + id: replyPreview + + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: closeReplyButton.left + anchors.bottom: parent.bottom + + modelData: chat.model ? chat.model.getDump(timelineManager.replyingEvent) : {} + userColor: chat.model ? chat.model.userColor(modelData.userId, colors.window) : colors.window } + ImageButton { - Layout.alignment: Qt.AlignRight | Qt.AlignTop - Layout.preferredHeight: 16 id: closeReplyButton + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.top: replyPreview.top + image: ":/icons/icons/ui/remove-symbol.png" ToolTip { visible: closeReplyButton.hovered |