Allow the delegate and bubble widths to grow when the ListView is very wide.

Disable user message on the right setting when in compact mode as it doesn't work anyway.
This commit is contained in:
James Graham
2022-07-03 14:26:08 +01:00
parent a96e8958c9
commit a7c137ca39
2 changed files with 7 additions and 5 deletions

View File

@@ -19,8 +19,11 @@ QQC2.ItemDelegate {
property bool isEmote: false property bool isEmote: false
property bool cardBackground: true property bool cardBackground: true
readonly property int bubbleMaxWidth: Kirigami.Units.gridUnit * 20 // The bubble and delegate widths are allowed to grow once the ListView gets beyond a certain size
readonly property int delegateMaxWidth: Config.compactLayout ? messageListView.width : Math.min(messageListView.width, Kirigami.Units.gridUnit * 40) // extraWidth defines this as the excess after a certain ListView width, capped to a max value
readonly property int extraWidth: Math.min((messageListView.width - Kirigami.Units.gridUnit * 40), Kirigami.Units.gridUnit * 20)
readonly property int bubbleMaxWidth: Kirigami.Units.gridUnit * 20 + extraWidth * 0.5
readonly property int delegateMaxWidth: Config.compactLayout ? messageListView.width : Math.min(messageListView.width, Kirigami.Units.gridUnit * 40 + extraWidth)
readonly property int contentMaxWidth: Config.compactLayout ? width - (Config.showAvatarInTimeline ? Kirigami.Units.gridUnit * 2 : 0) - Kirigami.Units.largeSpacing * 4 : Math.min(width - Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 6, bubbleMaxWidth) readonly property int contentMaxWidth: Config.compactLayout ? width - (Config.showAvatarInTimeline ? Kirigami.Units.gridUnit * 2 : 0) - Kirigami.Units.largeSpacing * 4 : Math.min(width - Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 6, bubbleMaxWidth)
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && property bool showUserMessageOnRight: Config.showLocalMessagesOnRight &&
@@ -38,6 +41,7 @@ QQC2.ItemDelegate {
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
width: delegateMaxWidth width: delegateMaxWidth
height: sectionDelegate.height + Math.max(model.showAuthor ? avatar.height : 0, bubble.implicitHeight) + loader.height + (showAuthor ? Kirigami.Units.largeSpacing : 0)
background: null background: null
property Item hoverComponent property Item hoverComponent
@@ -85,8 +89,6 @@ QQC2.ItemDelegate {
} }
] ]
height: sectionDelegate.height + Math.max(model.showAuthor ? avatar.height : 0, bubble.implicitHeight) + loader.height + (showAuthor ? Kirigami.Units.largeSpacing : 0)
SectionDelegate { SectionDelegate {
id: sectionDelegate id: sectionDelegate
width: parent.width width: parent.width

View File

@@ -245,7 +245,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("Show your messages on the right") text: i18n("Show your messages on the right")
checked: Config.showLocalMessagesOnRight checked: Config.showLocalMessagesOnRight
enabled: !Config.isShowLocalMessagesOnRightImmutable enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout
onToggled: { onToggled: {
Config.showLocalMessagesOnRight = checked Config.showLocalMessagesOnRight = checked
Config.save() Config.save()