Show own events on right only under certain width

This commit is contained in:
miruka 2019-07-18 06:23:31 -04:00
parent 1fa8b70359
commit 67efde9116
5 changed files with 13 additions and 9 deletions

View File

@ -29,7 +29,7 @@
- "Rejoin" LeftBanner button if room is public - "Rejoin" LeftBanner button if room is public
- Daybreak color - Daybreak color
- Html links color - Html links color
- Don't put own messages to the right past certain width - Replies
- `pyotherside.atexit()` - `pyotherside.atexit()`
- Sidepane - Sidepane
- Header back button when reduced - Header back button when reduced
@ -65,7 +65,6 @@
- Auto-trust accounts within the same client - Auto-trust accounts within the same client
- Import/export keys - Import/export keys
- Uploads - Uploads
- QQuickImageProvider
- Read receipts - Read receipts
- Status message and presence - Status message and presence
- Links preview - Links preview
@ -87,7 +86,6 @@
- Room subtitle: show things like "*Image*" instead of blank, etc - Room subtitle: show things like "*Image*" instead of blank, etc
- Missing nio support - Missing nio support
- Handle TimeoutError for all kind of async requests (nio)
- MatrixRoom invited members list - MatrixRoom invited members list
- Invite events are missing their timestamps (needed for sorting) - Invite events are missing their timestamps (needed for sorting)
- Left room events after client reboot - Left room events after client reboot

View File

@ -9,7 +9,7 @@ import "../../utils.js" as Utils
Row { Row {
id: messageContent id: messageContent
spacing: theme.spacing / 2 spacing: theme.spacing / 2
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight layoutDirection: onRight ? Qt.RightToLeft : Qt.LeftToRight
HUserAvatar { HUserAvatar {
id: avatar id: avatar
@ -17,7 +17,7 @@ Row {
width: model.showNameLine ? 48 : 28 width: model.showNameLine ? 48 : 28
height: combine ? 1 : model.showNameLine ? 48 : 28 height: combine ? 1 : model.showNameLine ? 48 : 28
opacity: combine ? 0 : 1 opacity: combine ? 0 : 1
visible: ! isOwn visible: ! onRight
} }
Rectangle { Rectangle {
@ -42,7 +42,7 @@ Row {
HLabel { HLabel {
width: parent.width width: parent.width
height: model.showNameLine && ! isOwn && ! combine ? height: model.showNameLine && ! onRight && ! combine ?
implicitHeight : 0 implicitHeight : 0
visible: height > 0 visible: height > 0
@ -50,7 +50,7 @@ Row {
text: senderInfo.displayName || model.senderId text: senderInfo.displayName || model.senderId
color: Utils.nameColor(avatar.name) color: Utils.nameColor(avatar.name)
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: isOwn ? Text.AlignRight : Text.AlignLeft horizontalAlignment: onRight ? Text.AlignRight : Text.AlignLeft
leftPadding: horizontalPadding leftPadding: horizontalPadding
rightPadding: horizontalPadding rightPadding: horizontalPadding

View File

@ -27,6 +27,7 @@ Column {
Component.onCompleted: senderInfo = users.find(model.senderId) Component.onCompleted: senderInfo = users.find(model.senderId)
readonly property bool isOwn: chatPage.userId === model.senderId readonly property bool isOwn: chatPage.userId === model.senderId
readonly property bool onRight: eventList.ownEventsOnRight && isOwn
readonly property bool isFirstEvent: model.eventType == "RoomCreateEvent" readonly property bool isFirstEvent: model.eventType == "RoomCreateEvent"
@ -62,7 +63,7 @@ Column {
if (nextDelegate) { nextDelegate.reloadPreviousItem() } if (nextDelegate) { nextDelegate.reloadPreviousItem() }
} }
width: parent.width width: eventList.width
topPadding: topPadding:
isFirstEvent ? 0 : isFirstEvent ? 0 :
@ -77,6 +78,7 @@ Column {
} }
EventContent { EventContent {
anchors.right: isOwn ? parent.right : undefined anchors.left: parent.left
anchors.right: onRight ? parent.right : undefined
} }
} }

View File

@ -23,6 +23,9 @@ HRectangle {
} }
} }
property bool ownEventsOnRight:
width < theme.chat.eventList.ownEventsOnRightUnderWidth
delegate: EventDelegate {} delegate: EventDelegate {}
anchors.fill: parent anchors.fill: parent

View File

@ -108,6 +108,7 @@ QtObject {
} }
property QtObject eventList: QtObject { property QtObject eventList: QtObject {
property int ownEventsOnRightUnderWidth: 768
property color background: "transparent" property color background: "transparent"
} }