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 cardBackground: true
readonly property int bubbleMaxWidth: Kirigami.Units.gridUnit * 20
readonly property int delegateMaxWidth: Config.compactLayout ? messageListView.width : Math.min(messageListView.width, Kirigami.Units.gridUnit * 40)
// The bubble and delegate widths are allowed to grow once the ListView gets beyond a certain size
// 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)
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight &&
@@ -38,6 +41,7 @@ QQC2.ItemDelegate {
topPadding: 0
bottomPadding: 0
width: delegateMaxWidth
height: sectionDelegate.height + Math.max(model.showAuthor ? avatar.height : 0, bubble.implicitHeight) + loader.height + (showAuthor ? Kirigami.Units.largeSpacing : 0)
background: null
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 {
id: sectionDelegate
width: parent.width

View File

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