Simplify reply popup logic
This commit is contained in:
parent
c2e0aee193
commit
4951241d23
@ -22,53 +22,10 @@ RowLayout {
|
||||
spacing: 4
|
||||
|
||||
// fancy reply, if this is a reply
|
||||
Rectangle {
|
||||
Reply {
|
||||
visible: model.replyTo
|
||||
width: parent.width
|
||||
height: replyContainer.height
|
||||
|
||||
Rectangle {
|
||||
id: colorLine
|
||||
height: replyContainer.height
|
||||
width: 4
|
||||
color: chat.model.userColor(reply.modelData.userId, colors.window)
|
||||
}
|
||||
|
||||
Column {
|
||||
id: replyContainer
|
||||
anchors.left: colorLine.right
|
||||
anchors.leftMargin: 4
|
||||
width: parent.width - 8
|
||||
|
||||
|
||||
Text {
|
||||
id: userName
|
||||
text: chat.model.escapeEmoji(reply.modelData.userName)
|
||||
color: chat.model.userColor(reply.modelData.userId, colors.window)
|
||||
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.getDump(model.replyTo)
|
||||
}
|
||||
}
|
||||
|
||||
color: { var col = chat.model.userColor(reply.modelData.userId, colors.window); col.a = 0.2; return col }
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: chat.positionViewAtIndex(chat.model.idToIndex(model.replyTo), ListView.Contain)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
userColor: chat.model.userColor(modelData.userId, colors.window)
|
||||
}
|
||||
|
||||
// actual message content
|
||||
|
@ -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,15 +200,19 @@ Item {
|
||||
|
||||
color: colors.window
|
||||
|
||||
Text {
|
||||
Column {
|
||||
id: aaaaa
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Text {
|
||||
id: typingDisplay
|
||||
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) : ""
|
||||
text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : ""
|
||||
textFormat: Text.RichText
|
||||
color: colors.windowText
|
||||
}
|
||||
@ -216,80 +220,34 @@ Item {
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
id: replyPopup
|
||||
|
||||
visible: timelineManager.replyingEvent && chat.model
|
||||
width: parent.width
|
||||
// Height of child, plus margins, plus border
|
||||
height: replyContent.height + 10
|
||||
height: replyPreview.height + 10
|
||||
color: colors.dark
|
||||
|
||||
RowLayout {
|
||||
id: replyContent
|
||||
|
||||
Reply {
|
||||
id: replyPreview
|
||||
|
||||
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
|
||||
anchors.right: closeReplyButton.left
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Rectangle {
|
||||
id: colorLine
|
||||
height: replyContainer.height
|
||||
width: 4
|
||||
color: chat.model ? chat.model.userColor(reply.modelData.userId, colors.window) : colors.window
|
||||
}
|
||||
|
||||
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) : {}
|
||||
}
|
||||
userColor: chat.model ? chat.model.userColor(modelData.userId, colors.window) : colors.window
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
|
57
resources/qml/delegates/Reply.qml
Normal file
57
resources/qml/delegates/Reply.qml
Normal file
@ -0,0 +1,57 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
Rectangle {
|
||||
id: replyComponent
|
||||
|
||||
property alias modelData: reply.modelData
|
||||
property color userColor: "red"
|
||||
|
||||
width: parent.width
|
||||
height: replyContainer.height
|
||||
|
||||
Rectangle {
|
||||
id: colorLine
|
||||
|
||||
anchors.top: replyContainer.top
|
||||
anchors.bottom: replyContainer.bottom
|
||||
width: 4
|
||||
|
||||
color: chat.model ? chat.model.userColor(reply.modelData.userId, colors.window) : colors.window
|
||||
}
|
||||
|
||||
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: replyComponent.userColor
|
||||
textFormat: Text.RichText
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: chat.model.openUserProfile(reply.modelData.userId)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
|
||||
MessageDelegate {
|
||||
id: reply
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
color: Qt.rgba(userColor.r, userColor.g, userColor.b, 0.2)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: chat.positionViewAtIndex(chat.model.idToIndex(timelineManager.replyingEvent), ListView.Contain)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
@ -123,5 +123,6 @@
|
||||
<file>qml/delegates/FileMessage.qml</file>
|
||||
<file>qml/delegates/Pill.qml</file>
|
||||
<file>qml/delegates/Placeholder.qml</file>
|
||||
<file>qml/delegates/Reply.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user