mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 20:18:53 +03:00
Reenable status part of timeline messages
This commit is contained in:
parent
aff58272c6
commit
1744f38e0f
2 changed files with 108 additions and 27 deletions
|
@ -69,21 +69,23 @@ Item {
|
||||||
|
|
||||||
required property var day
|
required property var day
|
||||||
required property bool isSender
|
required property bool isSender
|
||||||
//required property var previousMessageDay
|
|
||||||
//required property bool previousMessageIsStateEvent
|
|
||||||
//required property string previousMessageUserId
|
|
||||||
required property int index
|
required property int index
|
||||||
property var previousMessageDay: (index + 1) >= chat.count ? 0 : chat.model.dataByIndex(index + 1, Room.Day)
|
property var previousMessageDay: (index + 1) >= chat.count ? 0 : chat.model.dataByIndex(index + 1, Room.Day)
|
||||||
property bool previousMessageIsStateEvent: (index + 1) >= chat.count ? true : chat.model.dataByIndex(index + 1, Room.IsStateEvent)
|
property bool previousMessageIsStateEvent: (index + 1) >= chat.count ? true : chat.model.dataByIndex(index + 1, Room.IsStateEvent)
|
||||||
property string previousMessageUserId: (index + 1) >= chat.count ? "" : chat.model.dataByIndex(index + 1, Room.UserId)
|
property string previousMessageUserId: (index + 1) >= chat.count ? "" : chat.model.dataByIndex(index + 1, Room.UserId)
|
||||||
|
|
||||||
required property date timestamp
|
required property date timestamp
|
||||||
required property string userId
|
required property string userId
|
||||||
required property string userName
|
required property string userName
|
||||||
required property string threadId
|
required property string threadId
|
||||||
required property int userPowerlevel
|
required property int userPowerlevel
|
||||||
|
required property bool isEdited
|
||||||
|
required property bool isEncrypted
|
||||||
required property var reactions
|
required property var reactions
|
||||||
|
required property int status
|
||||||
|
required property int trustlevel
|
||||||
|
|
||||||
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) + (wrapper.threadId ? 6 : 0) // align bubble with section header
|
property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) // align bubble with section header
|
||||||
|
|
||||||
data: [
|
data: [
|
||||||
Loader {
|
Loader {
|
||||||
|
@ -107,16 +109,36 @@ Item {
|
||||||
visible: status == Loader.Ready
|
visible: status == Loader.Ready
|
||||||
z: 4
|
z: 4
|
||||||
},
|
},
|
||||||
GridLayout {
|
RowLayout {
|
||||||
id: gridContainer
|
id: gridContainer
|
||||||
|
|
||||||
width: wrapper.width
|
width: wrapper.width
|
||||||
y: section.visible && section.active ? section.y + section.height : 0
|
y: section.visible && section.active ? section.y + section.height : 0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.preferredWidth: wrapper.avatarMargin
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractButton {
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
|
ToolTip.text: qsTr("Part of a thread")
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
Layout.fillHeight: true
|
||||||
|
visible: wrapper.threadId
|
||||||
|
Layout.preferredWidth: 4
|
||||||
|
|
||||||
|
onClicked: room.thread = wrapper.threadId
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: threadLine
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
color: TimelineManager.userColor(wrapper.threadId, palette.base)
|
||||||
|
}
|
||||||
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: contentColumn
|
id: contentColumn
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: wrapper.avatarMargin // align bubble with section header
|
|
||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
id: replyRow
|
id: replyRow
|
||||||
|
@ -177,11 +199,81 @@ Item {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
color: 'yellow'
|
id: metadata
|
||||||
Layout.preferredWidth: 100
|
|
||||||
Layout.preferredHeight: 20
|
property int iconSize: Math.floor(fontMetrics.ascent * scaling)
|
||||||
|
property double scaling: Settings.bubbles ? 0.75 : 1
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop | Qt.AlignRight
|
||||||
|
Layout.preferredWidth: implicitWidth
|
||||||
|
spacing: 2
|
||||||
|
visible: !isStateEvent
|
||||||
|
|
||||||
|
StatusIndicator {
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
|
eventId: wrapper.eventId
|
||||||
|
height: parent.iconSize
|
||||||
|
status: wrapper.status
|
||||||
|
width: parent.iconSize
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
|
ToolTip.text: qsTr("Edited")
|
||||||
|
ToolTip.visible: editHovered.hovered
|
||||||
|
height: parent.iconSize
|
||||||
|
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((wrapper.eventId == room.edit) ? palette.highlight : palette.buttonText)
|
||||||
|
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
sourceSize.width: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
visible: wrapper.isEdited || wrapper.eventId == room.edit
|
||||||
|
width: parent.iconSize
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: editHovered
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImageButton {
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
|
ToolTip.text: qsTr("Part of a thread")
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
buttonTextColor: TimelineManager.userColor(wrapper.threadId, palette.base)
|
||||||
|
height: parent.iconSize
|
||||||
|
image: ":/icons/icons/ui/thread.svg"
|
||||||
|
visible: wrapper.threadId
|
||||||
|
width: parent.iconSize
|
||||||
|
|
||||||
|
onClicked: room.thread = threadId
|
||||||
|
}
|
||||||
|
EncryptionIndicator {
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
|
encrypted: wrapper.isEncrypted
|
||||||
|
height: parent.iconSize
|
||||||
|
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
sourceSize.width: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
trust: wrapper.trustlevel
|
||||||
|
visible: room.isEncrypted
|
||||||
|
width: parent.iconSize
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
id: ts
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
Layout.preferredWidth: implicitWidth
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
|
ToolTip.text: Qt.formatDateTime(wrapper.timestamp, Qt.DefaultLocaleLongDate)
|
||||||
|
ToolTip.visible: ma.hovered
|
||||||
|
color: palette.inactive.text
|
||||||
|
font.pointSize: fontMetrics.font.pointSize * parent.scaling
|
||||||
|
text: wrapper.timestamp.toLocaleTimeString(Locale.ShortFormat)
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: ma
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -214,13 +306,6 @@ Item {
|
||||||
top: reactionRow.bottom
|
top: reactionRow.bottom
|
||||||
topMargin: 5
|
topMargin: 5
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: Math.min(contentColumn.implicitWidth, contentColumn.width)
|
|
||||||
height: contentColumn.implicitHeight
|
|
||||||
color: "blue"
|
|
||||||
opacity: 0.2
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ AbstractButton {
|
||||||
userName: r.userName
|
userName: r.userName
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Row {
|
RowLayout {
|
||||||
id: metadata
|
id: metadata
|
||||||
|
|
||||||
property int iconSize: Math.floor(fontMetrics.ascent * scaling)
|
property int iconSize: Math.floor(fontMetrics.ascent * scaling)
|
||||||
|
@ -249,19 +249,17 @@ AbstractButton {
|
||||||
visible: !isStateEvent
|
visible: !isStateEvent
|
||||||
|
|
||||||
StatusIndicator {
|
StatusIndicator {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
anchors.verticalCenter: ts.verticalCenter
|
|
||||||
eventId: r.eventId
|
eventId: r.eventId
|
||||||
height: parent.iconSize
|
height: parent.iconSize
|
||||||
status: r.status
|
status: r.status
|
||||||
width: parent.iconSize
|
width: parent.iconSize
|
||||||
}
|
}
|
||||||
Image {
|
Image {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Edited")
|
ToolTip.text: qsTr("Edited")
|
||||||
ToolTip.visible: editHovered.hovered
|
ToolTip.visible: editHovered.hovered
|
||||||
anchors.verticalCenter: ts.verticalCenter
|
|
||||||
height: parent.iconSize
|
height: parent.iconSize
|
||||||
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == room.edit) ? palette.highlight : palette.buttonText)
|
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == room.edit) ? palette.highlight : palette.buttonText)
|
||||||
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
@ -275,11 +273,10 @@ AbstractButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImageButton {
|
ImageButton {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Part of a thread")
|
ToolTip.text: qsTr("Part of a thread")
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
anchors.verticalCenter: ts.verticalCenter
|
|
||||||
buttonTextColor: TimelineManager.userColor(threadId, palette.base)
|
buttonTextColor: TimelineManager.userColor(threadId, palette.base)
|
||||||
height: parent.iconSize
|
height: parent.iconSize
|
||||||
image: ":/icons/icons/ui/thread.svg"
|
image: ":/icons/icons/ui/thread.svg"
|
||||||
|
@ -289,8 +286,7 @@ AbstractButton {
|
||||||
onClicked: room.thread = threadId
|
onClicked: room.thread = threadId
|
||||||
}
|
}
|
||||||
EncryptionIndicator {
|
EncryptionIndicator {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
anchors.verticalCenter: ts.verticalCenter
|
|
||||||
encrypted: isEncrypted
|
encrypted: isEncrypted
|
||||||
height: parent.iconSize
|
height: parent.iconSize
|
||||||
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
sourceSize.height: parent.iconSize * Screen.devicePixelRatio
|
||||||
|
|
Loading…
Reference in a new issue