mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Variable width bubbles (still has binding loop)
This commit is contained in:
parent
e290f9938a
commit
5db7ec7f03
4 changed files with 15 additions and 7 deletions
|
@ -78,7 +78,9 @@ Item {
|
||||||
anchors.rightMargin: 1
|
anchors.rightMargin: 1
|
||||||
anchors.leftMargin: Nheko.avatarSize + 12 // align bubble with section header
|
anchors.leftMargin: Nheko.avatarSize + 12 // align bubble with section header
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
//anchors.right: parent.right
|
||||||
|
property int maxWidth: parent.width-anchors.leftMargin-anchors.rightMargin
|
||||||
|
width: Math.min(maxWidth,msg.implicitWidth)
|
||||||
height: msg.height
|
height: msg.height
|
||||||
topInset: -4
|
topInset: -4
|
||||||
bottomInset: -4
|
bottomInset: -4
|
||||||
|
@ -100,7 +102,7 @@ Item {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
top: parent.top
|
top: parent.top
|
||||||
}
|
}
|
||||||
property bool narrowLayout: (row.width < 350) && Settings.bubbles
|
property bool narrowLayout: (r.width < 500) && Settings.bubbles
|
||||||
rowSpacing: 0
|
rowSpacing: 0
|
||||||
columnSpacing: 2
|
columnSpacing: 2
|
||||||
columns: narrowLayout? 1 : 2
|
columns: narrowLayout? 1 : 2
|
||||||
|
@ -174,18 +176,21 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: metadata
|
||||||
Layout.column: msg.narrowLayout? 0 : 1
|
Layout.column: msg.narrowLayout? 0 : 1
|
||||||
Layout.row: msg.narrowLayout? 2 : 0
|
Layout.row: msg.narrowLayout? 2 : 0
|
||||||
Layout.rowSpan: msg.narrowLayout? 1 : 2
|
Layout.rowSpan: msg.narrowLayout? 1 : 2
|
||||||
Layout.bottomMargin: msg.narrowLayout? -4 : 0
|
Layout.bottomMargin: msg.narrowLayout? -4 : 0
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignRight
|
Layout.alignment: Qt.AlignTop | Qt.AlignRight
|
||||||
|
Layout.preferredWidth: implicitWidth
|
||||||
visible: !isStateEvent
|
visible: !isStateEvent
|
||||||
|
|
||||||
property double scaling: msg.narrowLayout? 0.75 : 1
|
property double scaling: msg.narrowLayout? 0.75 : 1
|
||||||
|
|
||||||
StatusIndicator {
|
StatusIndicator {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16*parent.scaling
|
Layout.preferredHeight: 16*parent.scaling
|
||||||
width: 16*parent.scaling
|
Layout.preferredWidth: 16*parent.scaling
|
||||||
status: r.status
|
status: r.status
|
||||||
eventId: r.eventId
|
eventId: r.eventId
|
||||||
}
|
}
|
||||||
|
@ -195,8 +200,6 @@ Item {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16*parent.scaling
|
Layout.preferredHeight: 16*parent.scaling
|
||||||
Layout.preferredWidth: 16*parent.scaling
|
Layout.preferredWidth: 16*parent.scaling
|
||||||
height: 16*parent.scaling
|
|
||||||
width: 16*parent.scaling
|
|
||||||
sourceSize.width: 16 * Screen.devicePixelRatio*parent.scaling
|
sourceSize.width: 16 * Screen.devicePixelRatio*parent.scaling
|
||||||
sourceSize.height: 16 * Screen.devicePixelRatio*parent.scaling
|
sourceSize.height: 16 * Screen.devicePixelRatio*parent.scaling
|
||||||
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
|
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
|
||||||
|
@ -217,12 +220,14 @@ Item {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16*parent.scaling
|
Layout.preferredHeight: 16*parent.scaling
|
||||||
Layout.preferredWidth: 16*parent.scaling
|
Layout.preferredWidth: 16*parent.scaling
|
||||||
|
sourceSize.width: 16 * Screen.devicePixelRatio*parent.scaling
|
||||||
|
sourceSize.height: 16 * Screen.devicePixelRatio*parent.scaling
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
Layout.preferredWidth: implicitWidth
|
||||||
text: timestamp.toLocaleTimeString(Locale.ShortFormat)
|
text: timestamp.toLocaleTimeString(Locale.ShortFormat)
|
||||||
width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth)
|
|
||||||
color: Nheko.inactiveColors.text
|
color: Nheko.inactiveColors.text
|
||||||
ToolTip.visible: ma.hovered
|
ToolTip.visible: ma.hovered
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
|
|
|
@ -17,6 +17,7 @@ Rectangle {
|
||||||
|
|
||||||
radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium
|
radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
implicitWidth: encryptedText.implicitWidth+24+Nheko.paddingMedium*3 // Column doesn't provide a useful implicitWidth, should be replaced by ColumnLayout
|
||||||
height: contents.implicitHeight + Nheko.paddingMedium * 2
|
height: contents.implicitHeight + Nheko.paddingMedium * 2
|
||||||
color: Nheko.colors.alternateBase
|
color: Nheko.colors.alternateBase
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
|
id: encryptedText
|
||||||
text: {
|
text: {
|
||||||
switch (encryptionError) {
|
switch (encryptionError) {
|
||||||
case Olm.MissingSession:
|
case Olm.MissingSession:
|
||||||
|
|
|
@ -13,7 +13,7 @@ Item {
|
||||||
|
|
||||||
required property bool isReply
|
required property bool isReply
|
||||||
property alias child: chooser.child
|
property alias child: chooser.child
|
||||||
property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width
|
implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width
|
||||||
required property double proportionalHeight
|
required property double proportionalHeight
|
||||||
required property int type
|
required property int type
|
||||||
required property string typeString
|
required property string typeString
|
||||||
|
|
|
@ -38,6 +38,7 @@ Item {
|
||||||
|
|
||||||
Layout.preferredHeight: replyContainer.height
|
Layout.preferredHeight: replyContainer.height
|
||||||
height: replyContainer.height
|
height: replyContainer.height
|
||||||
|
implicitWidth: visible? colorLine.width+replyContainer.implicitWidth : 0
|
||||||
|
|
||||||
CursorShape {
|
CursorShape {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
Loading…
Reference in a new issue