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
|
||||
|
||||
- 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
|
||||
- refresh server list button
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ HRowLayout {
|
|||
|
||||
readonly property string senderText:
|
||||
hideNameLine ? "" : (
|
||||
`<${smallAvatar ? "span" : "div"} class='sender'>` +
|
||||
`<${compact ? "span" : "div"} class='sender'>` +
|
||||
utils.coloredNameHtml(model.sender_name, model.sender_id) +
|
||||
(smallAvatar ? ": " : "") +
|
||||
(smallAvatar ? "</span>" : "</div>")
|
||||
(compact ? ": " : "") +
|
||||
(compact ? "</span>" : "</div>")
|
||||
)
|
||||
property string contentText: utils.processedEventText(model)
|
||||
readonly property string timeText: utils.formatTime(model.date, false)
|
||||
|
@ -78,20 +78,16 @@ HRowLayout {
|
|||
|
||||
Item {
|
||||
id: avatarWrapper
|
||||
opacity: collapseAvatar ? 0 : 1
|
||||
visible: ! hideAvatar
|
||||
visible: ! onRight
|
||||
opacity: combine ? 0 : 1
|
||||
|
||||
Layout.minimumWidth:
|
||||
smallAvatar ?
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.preferredHeight: combine ? 1 : Layout.preferredWidth
|
||||
Layout.preferredWidth:
|
||||
compact ?
|
||||
theme.chat.message.collapsedAvatarSize :
|
||||
theme.chat.message.avatarSize
|
||||
|
||||
Layout.minimumHeight: collapseAvatar ? 1 : Layout.minimumWidth
|
||||
|
||||
Layout.maximumWidth: Layout.minimumWidth
|
||||
Layout.maximumHeight: Layout.minimumHeight
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
HUserAvatar {
|
||||
id: avatar
|
||||
clientUserId: chat.userId
|
||||
|
@ -99,8 +95,9 @@ HRowLayout {
|
|||
displayName: model.sender_name
|
||||
mxc: model.sender_avatar
|
||||
width: parent.width
|
||||
height: collapseAvatar ? 1 : parent.Layout.minimumWidth
|
||||
height: combine ? 1 : parent.Layout.preferredWidth
|
||||
radius: theme.chat.message.avatarRadius
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +135,7 @@ HRowLayout {
|
|||
|
||||
// Sender name & message body
|
||||
(
|
||||
smallAvatar && contentText.match(/^\s*<(p|h[1-6])>/) ?
|
||||
compact && contentText.match(/^\s*<(p|h[1-6])>/) ?
|
||||
contentText.replace(
|
||||
/(^\s*<(p|h[1-6])>)/, "$1" + senderText,
|
||||
) :
|
||||
|
|
|
@ -19,18 +19,16 @@ HColumnLayout {
|
|||
readonly property var nextModel: eventList.model.get(model.index - 1)
|
||||
readonly property QtObject currentModel: model
|
||||
|
||||
property bool checked: model.id in eventList.checked
|
||||
property bool compact: window.settings.compactMode
|
||||
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 compact: window.settings.compactMode
|
||||
readonly property bool checked: model.id in eventList.checked
|
||||
readonly property bool isOwn: chat.userId === model.sender_id
|
||||
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:
|
||||
model.event_type === "RoomMessageEmote" ||
|
||||
|
|
Loading…
Reference in New Issue
Block a user