Support user messages on the right even when wide

Limit maximum delegate width to ensure that the gap between user and non-user messages isn't too large
This commit is contained in:
James Graham
2022-07-03 13:14:08 +01:00
parent c3ee277ede
commit 7dc951d2cd
7 changed files with 3 additions and 11 deletions

View File

@@ -17,7 +17,6 @@ import NeoChat.Menu.Timeline 1.0
TimelineContainer {
id: audioDelegate
width: ListView.view.width
onReplyClicked: ListView.view.goToEvent(eventID)
hoverComponent: hoverActions
innerObject: Control {

View File

@@ -10,7 +10,6 @@ import org.kde.neochat 1.0
TimelineContainer {
id: encryptedDelegate
width: ListView.view.width
innerObject: TextEdit {
text: i18n("This message is encrypted and the sender has not shared the key with this device.")

View File

@@ -15,7 +15,6 @@ import NeoChat.Menu.Timeline 1.0
TimelineContainer {
id: fileDelegate
width: ListView.view.width
onReplyClicked: ListView.view.goToEvent(eventID)
hoverComponent: hoverActions

View File

@@ -15,8 +15,6 @@ import NeoChat.Menu.Timeline 1.0
TimelineContainer {
id: imageDelegate
width: ListView.view.width
onReplyClicked: ListView.view.goToEvent(eventID)
hoverComponent: hoverActions

View File

@@ -13,7 +13,6 @@ import org.kde.neochat 1.0
TimelineContainer {
id: messageDelegate
width: ListView.view.width
property bool isEmote: false
onReplyClicked: ListView.view.goToEvent(eventID)

View File

@@ -19,12 +19,11 @@ QQC2.ItemDelegate {
property bool isEmote: false
property bool cardBackground: true
readonly property int delegateMaxWidth: Math.min(messageListView.width, Kirigami.Units.gridUnit * 40)
readonly property int bubbleMaxWidth: Config.compactLayout && !Config.showAvatarInTimeline ? width - Kirigami.Units.largeSpacing * 4 : (Config.compactLayout ? width - Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 4 : Math.min(width - Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 6, Kirigami.Units.gridUnit * 20))
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight &&
model.author.isLocalUser &&
!applicationWindow().wideScreen &&
!Config.compactLayout
model.author.isLocalUser && !Config.compactLayout
signal openExternally()
signal replyClicked(string eventID)
@@ -37,6 +36,7 @@ QQC2.ItemDelegate {
topPadding: 0
bottomPadding: 0
width: delegateMaxWidth
background: null
property Item hoverComponent

View File

@@ -17,8 +17,6 @@ import NeoChat.Menu.Timeline 1.0
TimelineContainer {
id: videoDelegate
width: ListView.view.width
onReplyClicked: ListView.view.goToEvent(eventID)
hoverComponent: hoverActions