Real estate adjustments for chat page, fix unread indicator bug

This commit is contained in:
Sebastian J. Wolf 2020-09-19 18:49:11 +02:00
parent b625ce84ef
commit c2492efa0f

View file

@ -256,7 +256,7 @@ Page {
id: chatColumn id: chatColumn
width: parent.width width: parent.width
height: parent.height height: parent.height
spacing: Theme.paddingMedium spacing: Theme.paddingSmall
Row { Row {
id: headerRow id: headerRow
@ -271,13 +271,15 @@ Page {
replacementStringHint: chatNameText.text replacementStringHint: chatNameText.text
width: chatOverviewColumn.height width: chatOverviewColumn.height
height: chatOverviewColumn.height height: chatOverviewColumn.height
anchors.verticalCenter: parent.verticalCenter anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingSmall
} }
Column { Column {
id: chatOverviewColumn id: chatOverviewColumn
width: parent.width - chatPictureThumbnail.width - Theme.paddingMedium width: parent.width - chatPictureThumbnail.width - Theme.paddingMedium
anchors.verticalCenter: parent.verticalCenter anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingSmall
Text { Text {
id: chatNameText id: chatNameText
text: chatInformation.title !== "" ? Emoji.emojify(chatInformation.title, font.pixelSize) : qsTr("Unknown") text: chatInformation.title !== "" ? Emoji.emojify(chatInformation.title, font.pixelSize) : qsTr("Unknown")
@ -315,7 +317,7 @@ Page {
Item { Item {
id: chatViewItem id: chatViewItem
width: parent.width width: parent.width
height: parent.height - Theme.paddingMedium - headerRow.height - ( chatPage.isChannel ? 0 : ( newMessageColumn.height + Theme.paddingMedium ) ) height: parent.height - headerRow.height - Theme.paddingSmall - ( chatPage.isChannel ? 0 : ( newMessageColumn.height + Theme.paddingSmall ) )
property int previousHeight; property int previousHeight;
@ -397,6 +399,7 @@ Page {
onClicked: { onClicked: {
newMessageColumn.editMessageId = display.id; newMessageColumn.editMessageId = display.id;
newMessageTextField.text = Functions.getMessageText(display, false); newMessageTextField.text = Functions.getMessageText(display, false);
newMessageTextField.focus = true;
} }
text: qsTr("Edit Message") text: qsTr("Edit Message")
visible: display.can_be_edited visible: display.can_be_edited
@ -409,6 +412,10 @@ Page {
messageBackground.color = index > ( chatView.count - unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor; messageBackground.color = index > ( chatView.count - unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor;
messageBackground.opacity = index > ( chatView.count - unreadCount - 1 ) ? 0.5 : 0.2; messageBackground.opacity = index > ( chatView.count - unreadCount - 1 ) ? 0.5 : 0.2;
} }
onNewMessageReceived: {
messageBackground.color = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor;
messageBackground.opacity = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? 0.5 : 0.2;
}
} }
Row { Row {
@ -648,7 +655,7 @@ Page {
Column { Column {
id: newMessageColumn id: newMessageColumn
spacing: Theme.paddingMedium spacing: Theme.paddingSmall
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: !chatPage.isChannel visible: !chatPage.isChannel