EventDelegate/Content property usage improvements
- Remove pointless confusing aliases for avatar properties (smallAvatar, collapseAvatar, etc) - Make some EventDelegate properties readonly as they should be - Use Layout.preferredWidth/Height for avatarWrapper instead of both minimum and maximum W/H
This commit is contained in:
parent
107eddaa5c
commit
27c3d08031
7
TODO.md
7
TODO.md
|
@ -1,5 +1,12 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- room A-Z sorting
|
||||||
|
- force reload theme ui background
|
||||||
|
- move uiScale to settings.json
|
||||||
|
- up/down doesn't work in the middle of a @word for which autocompletion isn't
|
||||||
|
open because no matches
|
||||||
|
- filter > enter > room list is always scrolled to top
|
||||||
|
- change profile → post in room → message shows as old profile
|
||||||
- session list: prevent tab-focusing the delegates
|
- session list: prevent tab-focusing the delegates
|
||||||
- refresh server list button
|
- refresh server list button
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ HRowLayout {
|
||||||
|
|
||||||
readonly property string senderText:
|
readonly property string senderText:
|
||||||
hideNameLine ? "" : (
|
hideNameLine ? "" : (
|
||||||
`<${smallAvatar ? "span" : "div"} class='sender'>` +
|
`<${compact ? "span" : "div"} class='sender'>` +
|
||||||
utils.coloredNameHtml(model.sender_name, model.sender_id) +
|
utils.coloredNameHtml(model.sender_name, model.sender_id) +
|
||||||
(smallAvatar ? ": " : "") +
|
(compact ? ": " : "") +
|
||||||
(smallAvatar ? "</span>" : "</div>")
|
(compact ? "</span>" : "</div>")
|
||||||
)
|
)
|
||||||
property string contentText: utils.processedEventText(model)
|
property string contentText: utils.processedEventText(model)
|
||||||
readonly property string timeText: utils.formatTime(model.date, false)
|
readonly property string timeText: utils.formatTime(model.date, false)
|
||||||
|
@ -78,20 +78,16 @@ HRowLayout {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: avatarWrapper
|
id: avatarWrapper
|
||||||
opacity: collapseAvatar ? 0 : 1
|
visible: ! onRight
|
||||||
visible: ! hideAvatar
|
opacity: combine ? 0 : 1
|
||||||
|
|
||||||
Layout.minimumWidth:
|
Layout.alignment: Qt.AlignTop
|
||||||
smallAvatar ?
|
Layout.preferredHeight: combine ? 1 : Layout.preferredWidth
|
||||||
|
Layout.preferredWidth:
|
||||||
|
compact ?
|
||||||
theme.chat.message.collapsedAvatarSize :
|
theme.chat.message.collapsedAvatarSize :
|
||||||
theme.chat.message.avatarSize
|
theme.chat.message.avatarSize
|
||||||
|
|
||||||
Layout.minimumHeight: collapseAvatar ? 1 : Layout.minimumWidth
|
|
||||||
|
|
||||||
Layout.maximumWidth: Layout.minimumWidth
|
|
||||||
Layout.maximumHeight: Layout.minimumHeight
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
HUserAvatar {
|
HUserAvatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
clientUserId: chat.userId
|
clientUserId: chat.userId
|
||||||
|
@ -99,8 +95,9 @@ HRowLayout {
|
||||||
displayName: model.sender_name
|
displayName: model.sender_name
|
||||||
mxc: model.sender_avatar
|
mxc: model.sender_avatar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: collapseAvatar ? 1 : parent.Layout.minimumWidth
|
height: combine ? 1 : parent.Layout.preferredWidth
|
||||||
radius: theme.chat.message.avatarRadius
|
radius: theme.chat.message.avatarRadius
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +135,7 @@ HRowLayout {
|
||||||
|
|
||||||
// Sender name & message body
|
// Sender name & message body
|
||||||
(
|
(
|
||||||
smallAvatar && contentText.match(/^\s*<(p|h[1-6])>/) ?
|
compact && contentText.match(/^\s*<(p|h[1-6])>/) ?
|
||||||
contentText.replace(
|
contentText.replace(
|
||||||
/(^\s*<(p|h[1-6])>)/, "$1" + senderText,
|
/(^\s*<(p|h[1-6])>)/, "$1" + senderText,
|
||||||
) :
|
) :
|
||||||
|
|
|
@ -19,18 +19,16 @@ HColumnLayout {
|
||||||
readonly property var nextModel: eventList.model.get(model.index - 1)
|
readonly property var nextModel: eventList.model.get(model.index - 1)
|
||||||
readonly property QtObject currentModel: model
|
readonly property QtObject currentModel: model
|
||||||
|
|
||||||
property bool checked: model.id in eventList.checked
|
readonly property bool compact: window.settings.compactMode
|
||||||
property bool compact: window.settings.compactMode
|
readonly property bool checked: model.id in eventList.checked
|
||||||
property bool isOwn: chat.userId === model.sender_id
|
readonly property bool isOwn: chat.userId === model.sender_id
|
||||||
property bool onRight: ! eventList.ownEventsOnLeft && isOwn
|
|
||||||
property bool combine: eventList.canCombine(previousModel, model)
|
|
||||||
property bool talkBreak: eventList.canTalkBreak(previousModel, model)
|
|
||||||
property bool dayBreak: eventList.canDayBreak(previousModel, model)
|
|
||||||
|
|
||||||
readonly property bool smallAvatar: compact
|
|
||||||
readonly property bool collapseAvatar: combine
|
|
||||||
readonly property bool hideAvatar: onRight
|
|
||||||
readonly property bool isRedacted: model.event_type === "RedactedEvent"
|
readonly property bool isRedacted: model.event_type === "RedactedEvent"
|
||||||
|
readonly property bool onRight: ! eventList.ownEventsOnLeft && isOwn
|
||||||
|
readonly property bool combine: eventList.canCombine(previousModel, model)
|
||||||
|
readonly property bool talkBreak:
|
||||||
|
eventList.canTalkBreak(previousModel, model)
|
||||||
|
readonly property bool dayBreak:
|
||||||
|
eventList.canDayBreak(previousModel, model)
|
||||||
|
|
||||||
readonly property bool hideNameLine:
|
readonly property bool hideNameLine:
|
||||||
model.event_type === "RoomMessageEmote" ||
|
model.event_type === "RoomMessageEmote" ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user