Cleanup leftover issues from moving ReplyComponent away from GridLayout

Cleanup leftover issues from moving ReplyComponent away from GridLayout.
- Remove leftover GridLayout properties or references to them or convert as required
- Remove unneeded Item wrapper
This commit is contained in:
James Graham
2023-12-23 11:37:01 +00:00
parent 134f1d2ae5
commit 4e141e05f0

View File

@@ -20,7 +20,7 @@ import org.kde.neochat
* show in their original form and are instead visualised with a MIME type delegate * show in their original form and are instead visualised with a MIME type delegate
* e.g. Videos. * e.g. Videos.
*/ */
Item { RowLayout {
id: root id: root
/** /**
@@ -75,82 +75,73 @@ Item {
*/ */
signal replyClicked() signal replyClicked()
implicitWidth: mainLayout.implicitWidth spacing: Kirigami.Units.largeSpacing
implicitHeight: mainLayout.implicitHeight
RowLayout { Rectangle {
id: mainLayout id: verticalBorder
anchors.fill: parent Layout.fillHeight: true
spacing: Kirigami.Units.largeSpacing
Rectangle { implicitWidth: Kirigami.Units.smallSpacing
id: verticalBorder color: root.author.color
}
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
Layout.fillHeight: true RowLayout {
Layout.rowSpan: 2 spacing: Kirigami.Units.largeSpacing
implicitWidth: Kirigami.Units.smallSpacing KirigamiComponents.Avatar {
color: root.author.color id: replyAvatar
}
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
RowLayout { implicitWidth: Kirigami.Units.iconSizes.small
spacing: Kirigami.Units.largeSpacing implicitHeight: Kirigami.Units.iconSizes.small
KirigamiComponents.Avatar { source: root.author.avatarSource
id: replyAvatar name: root.author.displayName
color: root.author.color
implicitWidth: Kirigami.Units.iconSizes.small
implicitHeight: Kirigami.Units.iconSizes.small
source: root.author.avatarSource
name: root.author.displayName
color: root.author.color
}
QQC2.Label {
id: replyName
Layout.fillWidth: true
color: root.author.color
text: root.author.displayName
elide: Text.ElideRight
}
} }
Loader { QQC2.Label {
id: loader id: replyName
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumHeight: loader.item && (root.type == DelegateType.Image || root.type == DelegateType.Sticker) ? loader.item.height : loader.item.implicitHeight
Layout.columnSpan: 2
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;
} }
} }
} }
HoverHandler { }
cursorShape: Qt.PointingHandCursor HoverHandler {
} cursorShape: Qt.PointingHandCursor
TapHandler { }
acceptedButtons: Qt.LeftButton TapHandler {
onTapped: root.replyClicked() acceptedButtons: Qt.LeftButton
} onTapped: root.replyClicked()
} }
Component { Component {
@@ -176,13 +167,13 @@ Item {
width: mediaSizeHelper.currentSize.width width: mediaSizeHelper.currentSize.width
height: mediaSizeHelper.currentSize.height height: mediaSizeHelper.currentSize.height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: root.mediaInfo.source source: root?.mediaInfo.source ?? ""
MediaSizeHelper { MediaSizeHelper {
id: mediaSizeHelper id: mediaSizeHelper
contentMaxWidth: root.contentMaxWidth - verticalBorder.width - mainLayout.columnSpacing contentMaxWidth: root.contentMaxWidth - verticalBorder.width - root.spacing
mediaWidth: root.mediaInfo.width mediaWidth: root?.mediaInfo.width ?? -1
mediaHeight: root.mediaInfo.height mediaHeight: root?.mediaInfo.height ?? -1
} }
} }
} }