diff --git a/.gitignore b/.gitignore index c2c1bcf8..5c45aba0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ doc/Doxyfile GeneratedFiles/ .vs/ +.vscode/ x64/ x86/ [wW]in32/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 01506c8b..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "files.associations": { - "*.tcc": "cpp", - "array": "cpp", - "string": "cpp", - "string_view": "cpp", - "ranges": "cpp", - "thread": "cpp", - "xstring": "cpp" - } -} \ No newline at end of file diff --git a/src/mainview/components/MessageListView.qml b/src/mainview/components/MessageListView.qml index bb2ab9a9..dee42c3b 100644 --- a/src/mainview/components/MessageListView.qml +++ b/src/mainview/components/MessageListView.qml @@ -297,43 +297,68 @@ ListView { Layout.alignment: Qt.AlignVCenter } + Connections { + target: MessagesAdapter + + function onCurrentConvComposingListChanged () { + var typeIndicatorNameTextString = "" + var nameList = MessagesAdapter.currentConvComposingList + + if (nameList.length > 4) { + typeIndicatorNameText.text = "" + typeIndicatorEndingText.text = JamiStrings.typeIndicatorMax + typeIndicatorNameText.calculateWidth() + return + } + if (nameList.length === 1) { + typeIndicatorNameText.text = nameList[0] + typeIndicatorEndingText.text = + JamiStrings.typeIndicatorSingle.replace("{}", "") + typeIndicatorNameText.calculateWidth() + return + } + + for (var i = 0; i < nameList.length; i++) { + typeIndicatorNameTextString += nameList[i] + + if (i === nameList.length - 2) + typeIndicatorNameTextString += JamiStrings.typeIndicatorAnd + else if (i !== nameList.length - 1) + typeIndicatorNameTextString += ", " + } + typeIndicatorNameText.text = typeIndicatorNameTextString + typeIndicatorEndingText.text = + JamiStrings.typeIndicatorPlural.replace("{}", "") + typeIndicatorNameText.calculateWidth() + } + } + Text { id: typeIndicatorNameText + property int textWidth: 0 + + function calculateWidth () { + if (!text) + return 0 + else { + var textSize = JamiQmlUtils.getTextBoundingRect(font, text).width + var typingContentWidth = typingDots.width + typingDots.anchors.leftMargin + + typeIndicatorNameText.anchors.leftMargin + + typeIndicatorEndingText.contentWidth + typeIndicatorNameText.Layout.preferredWidth = + Math.min(typeIndicatorContainer.width - 5 - typingContentWidth, + textSize) + } + } + Layout.alignment: Qt.AlignVCenter Layout.leftMargin: JamiTheme.sbsMessageBasePreferredPadding - Layout.preferredWidth: { - var textSize = text ? JamiQmlUtils.getTextBoundingRect(font, text).width : 0 - var typingContentWidth = typingDots.width + typingDots.anchors.leftMargin - + typeIndicatorNameText.anchors.leftMargin - + typeIndicatorEndingText.contentWidth - return Math.min(typeIndicatorContainer.width - 5 - typingContentWidth, textSize) - } font.pointSize: 8 font.bold: Font.DemiBold elide: Text.ElideRight color: JamiTheme.textColor - text: { - var finalText = "" - var nameList = MessagesAdapter.currentConvComposingList - - if (nameList.length > 4) - return "" - if (nameList.length === 1) - return nameList[0] - - for (var i = 0; i < nameList.length; i++) { - finalText += nameList[i] - - if (i === nameList.length - 2) - finalText += JamiStrings.typeIndicatorAnd - else if (i !== nameList.length - 1) - finalText += ", " - } - - return finalText - } } Text { @@ -343,16 +368,6 @@ ListView { font.pointSize: 8 color: JamiTheme.textColor - text: { - var nameList = MessagesAdapter.currentConvComposingList - - if (nameList.length > 4) - return JamiStrings.typeIndicatorMax - if (nameList.length === 1) - return JamiStrings.typeIndicatorSingle.replace("{}", "") - - return JamiStrings.typeIndicatorPlural.replace("{}", "") - } } } }