Remove GridLayout ReplyComponent

Stop using GridLayout in ReplyComponent as they are notoriously terribleRemove
This commit is contained in:
James Graham
2023-11-02 17:04:18 +00:00
committed by Tobias Fella
parent 7e3db20229
commit 95cf23eb5b

View File

@@ -78,15 +78,10 @@ Item {
implicitWidth: mainLayout.implicitWidth implicitWidth: mainLayout.implicitWidth
implicitHeight: mainLayout.implicitHeight implicitHeight: mainLayout.implicitHeight
GridLayout { RowLayout {
id: mainLayout id: mainLayout
anchors.fill: parent anchors.fill: parent
implicitHeight: Math.max(replyAvatar.implicitHeight, replyName.implicitHeight) + loader.height spacing: Kirigami.Units.largeSpacing
rows: 2
columns: 3
rowSpacing: Kirigami.Units.smallSpacing
columnSpacing: Kirigami.Units.largeSpacing
Rectangle { Rectangle {
id: verticalBorder id: verticalBorder
@@ -97,47 +92,55 @@ Item {
implicitWidth: Kirigami.Units.smallSpacing implicitWidth: Kirigami.Units.smallSpacing
color: root.author.color color: root.author.color
} }
KirigamiComponents.Avatar { ColumnLayout {
id: replyAvatar spacing: Kirigami.Units.smallSpacing
implicitWidth: Kirigami.Units.iconSizes.small RowLayout {
implicitHeight: Kirigami.Units.iconSizes.small spacing: Kirigami.Units.largeSpacing
source: root.author.avatarSource KirigamiComponents.Avatar {
name: root.author.displayName id: replyAvatar
color: root.author.color
}
QQC2.Label {
id: replyName
Layout.fillWidth: true
color: root.author.color implicitWidth: Kirigami.Units.iconSizes.small
text: root.author.displayName implicitHeight: Kirigami.Units.iconSizes.small
elide: Text.ElideRight
}
Loader {
id: loader
Layout.fillWidth: true source: root.author.avatarSource
Layout.maximumHeight: loader.item && (root.type == DelegateType.Image || root.type == DelegateType.Sticker) ? loader.item.height : loader.item.implicitHeight name: root.author.displayName
Layout.columnSpan: 2 color: root.author.color
}
QQC2.Label {
id: replyName
Layout.fillWidth: true
sourceComponent: { color: root.author.color
switch (root.type) { text: root.author.displayName
case DelegateType.Image: elide: Text.ElideRight
case DelegateType.Sticker: }
return imageComponent; }
case DelegateType.Message: Loader {
case DelegateType.Notice: id: loader
return textComponent;
case DelegateType.File: Layout.fillWidth: true
case DelegateType.Video: Layout.maximumHeight: loader.item && (root.type == DelegateType.Image || root.type == DelegateType.Sticker) ? loader.item.height : loader.item.implicitHeight
case DelegateType.Audio: Layout.columnSpan: 2
return mimeComponent;
case DelegateType.Encrypted: sourceComponent: {
return encryptedComponent; switch (root.type) {
default: case DelegateType.Image:
return textComponent; case DelegateType.Sticker:
return imageComponent;
case DelegateType.Message:
case DelegateType.Notice:
return textComponent;
case DelegateType.File:
case DelegateType.Video:
case DelegateType.Audio:
return mimeComponent;
case DelegateType.Encrypted:
return encryptedComponent;
default:
return textComponent;
}
} }
} }
} }