Reply Refactor

The aim here is to tidy up the reply component and make it so it sizes automatically without any need to manually set widths or heights. This is achieved by putting the layout in a grid layout. The implicitwidth and height variables are also simplified meaning that the margins are no longer prone to being slightly off because the calculation didn't add up the margins and spacing right.

Also added here is a mime component which is used to provide a nicer representation for files, videos and audio in the reply because trying to put the full component in wouldn't look good.

This also fixes the situation in right to left mode where the layout now mirror properly and everything sits where it should.

New reply elements
![image](/uploads/bfdc81040b3477b064fe8a06d30bdb6e/image.png)
This commit is contained in:
James Graham
2022-10-11 20:36:15 +00:00
parent d97448eb07
commit d2888bc479
7 changed files with 162 additions and 82 deletions

View File

@@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
RowLayout {
property alias mimeIconSource: icon.source
property alias label: nameLabel.text
property alias subLabel: subLabel.text
spacing: Kirigami.Units.largeSpacing
Kirigami.Icon {
id: icon
fallback: "unknown"
}
ColumnLayout {
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
spacing: 0
QQC2.Label {
id: nameLabel
Layout.fillWidth: true
Layout.alignment: subLabel.visible ? Qt.AlignLeft | Qt.AlignBottom : Qt.AlignLeft | Qt.AlignVCenter
elide: Text.ElideRight
}
QQC2.Label {
id: subLabel
Layout.fillWidth: true
elide: Text.ElideRight
visible: text.length > 0
opacity: 0.7
}
}
}