" + encodeEmojiToQmlRichFormat(formattedText.join("")) + "
"; + QString encodeEmojis = encodeEmojiToQmlRichFormat(formattedText.join("")); + if( encodeEmojis.isEmpty() && images.isEmpty()) + return ""; + else + return images + "" + encodeEmojiToQmlRichFormat(formattedText.join("")) + "
"; } QString Utils::getFileContent(const QString& filePath){ diff --git a/linphone-app/ui/modules/Common/Dialog/FileViewDialog.qml b/linphone-app/ui/modules/Common/Dialog/FileViewDialog.qml index 71e5d06b7..5b067d43c 100644 --- a/linphone-app/ui/modules/Common/Dialog/FileViewDialog.qml +++ b/linphone-app/ui/modules/Common/Dialog/FileViewDialog.qml @@ -316,7 +316,7 @@ DialogPlus{ Icon{ id: fileIcon anchors.centerIn: parent - icon: FileViewDialogStyle.extension.unknownIcon + icon: FileViewDialogStyle.extension.icon iconSize: FileViewDialogStyle.extension.iconSize } } diff --git a/linphone-app/ui/modules/Common/Styles/Dialog/FileViewDialogStyle.qml b/linphone-app/ui/modules/Common/Styles/Dialog/FileViewDialogStyle.qml index cecc972b8..6bae8e163 100644 --- a/linphone-app/ui/modules/Common/Styles/Dialog/FileViewDialogStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Dialog/FileViewDialogStyle.qml @@ -103,7 +103,7 @@ QtObject { property var foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 's_d_b_fg') } property QtObject extension: QtObject { - property string unknownIcon: 'file_unknown_custom' + property string icon: 'file_extension_custom' property int iconSize: 60 } } \ No newline at end of file diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml index 008f0b397..9c5eac5dd 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatTextMessage.qml @@ -23,17 +23,16 @@ TextEdit { property ContentModel contentModel property string lastTextSelected : '' property font customFont : SettingsModel.textMessageFont - property int fitHeight: contentHeight + property int fitHeight: visible ? contentHeight : 0 property int fitWidth: implicitWidth signal rightClicked() - property int removeWarningFromBindingLoop : implicitWidth // Just a dummy variable to remove meaningless binding loop on implicitWidth height: fitHeight width: parent && parent.width || 1 - visible: contentModel + visible: contentModel && contentModel.text != '' clip: false textMargin: 0 readOnly: true diff --git a/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml b/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml index 5b04ca996..22d36354f 100644 --- a/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml @@ -12,10 +12,8 @@ import Utils 1.0 Item { id: mainItem - implicitHeight: message.height - //width: parent.width + Layout.fillWidth: true - //onWidthChanged: console.log(width) property alias isHovering: message.isHovering property alias isTopGrouped: message.isTopGrouped @@ -29,19 +27,11 @@ Item { signal conferenceIcsCopied() signal addContactClicked(string contactAddress) signal viewContactClicked(string contactAddress) + + implicitHeight: message.height RowLayout{ - /* - anchors { - left: parent.left - //leftMargin: ChatStyle.entry.metaWidth - right: parent.right - } - */ - //width: parent.width anchors.fill: parent - //onWidthChanged: console.log(width) spacing: 0 - //spacing: ChatStyle.entry.message.extraContent.spacing Message { id: message @@ -53,97 +43,78 @@ Item { onConferenceIcsCopied: mainItem.conferenceIcsCopied() onAddContactClicked: mainItem.addContactClicked(contactAddress) onViewContactClicked: mainItem.viewContactClicked(contactAddress) - /* - anchors { - left: parent.left - leftMargin: ChatStyle.entry.metaWidth - right: parent.right - }*/ + backgroundColorModel: ChatStyle.entry.message.outgoing.backgroundColor Layout.fillWidth: true - //Layout.fillHeight: true Layout.leftMargin: 10 //onImplicitHeightChanged: Layout.preferredHeight= implicitHeight - Layout.minimumHeight: implicitHeight // Avoid bug where UI is not computed by Qt - Layout.preferredHeight: implicitHeight - //Layout.preferredWidth: parent.width - //width: parent.width + //Layout.minimumHeight: implicitHeight // Avoid bug where UI is not computed by Qt + //Layout.preferredHeight: implicitHeight + // Not a style. Workaround to avoid a 0 width. // Arbitrary value. Layout.minimumWidth: 1 - //onWidthChanged: console.log(width) } - /* - RowLayout { - anchors.fill: parent - anchors.leftMargin: ChatStyle.entry.message.extraContent.leftMargin - spacing: ChatStyle.entry.message.extraContent.spacing - */ - Component { - id: iconComponent - Item{ - Icon { - id: iconId - readonly property var isError: Utils.includes([ - LinphoneEnums.ChatMessageStateFileTransferError, - LinphoneEnums.ChatMessageStateNotDelivered, - ], $chatEntry.state) - readonly property bool isUploaded: $chatEntry.state == LinphoneEnums.ChatMessageStateDelivered - readonly property bool isDelivered: $chatEntry.state == LinphoneEnums.ChatMessageStateDeliveredToUser - readonly property bool isRead: $chatEntry.state == LinphoneEnums.ChatMessageStateDisplayed - - icon: iconId.isError - ? 'chat_error' - : (iconId.isRead ? 'chat_read' : (iconId.isDelivered ? 'chat_delivered' : '' ) ) - iconSize: ChatStyle.entry.message.outgoing.sendIconSize - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - id:retryAction - anchors.fill: parent - visible: iconId.isError || $chatEntry.state == LinphoneEnums.ChatMessageStateIdle - onClicked: $chatEntry.resendMessage() - } - - TooltipArea { - id:tooltip - visible: text != '' - text: iconId.isError - ? qsTr('messageError') - : (iconId.isRead ? qsTr('messageRead') : (iconId.isDelivered ? qsTr('messageDelivered') : '')) - hoveringCursor : retryAction.visible?Qt.PointingHandCursor:Qt.ArrowCursor - } + Component { + id: iconComponent + Item{ + Icon { + id: iconId + readonly property var isError: Utils.includes([ + LinphoneEnums.ChatMessageStateFileTransferError, + LinphoneEnums.ChatMessageStateNotDelivered, + ], $chatEntry.state) + readonly property bool isUploaded: $chatEntry.state == LinphoneEnums.ChatMessageStateDelivered + readonly property bool isDelivered: $chatEntry.state == LinphoneEnums.ChatMessageStateDeliveredToUser + readonly property bool isRead: $chatEntry.state == LinphoneEnums.ChatMessageStateDisplayed + + icon: iconId.isError + ? 'chat_error' + : (iconId.isRead ? 'chat_read' : (iconId.isDelivered ? 'chat_delivered' : '' ) ) + iconSize: ChatStyle.entry.message.outgoing.sendIconSize + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + id:retryAction + anchors.fill: parent + visible: iconId.isError || $chatEntry.state == LinphoneEnums.ChatMessageStateIdle + onClicked: $chatEntry.resendMessage() + } + + TooltipArea { + id:tooltip + visible: text != '' + text: iconId.isError + ? qsTr('messageError') + : (iconId.isRead ? qsTr('messageRead') : (iconId.isDelivered ? qsTr('messageDelivered') : '')) + hoveringCursor : retryAction.visible?Qt.PointingHandCursor:Qt.ArrowCursor } } } + } + + Component { + id: indicator - Component { - id: indicator - - Item { - BusyIndicator { - anchors.centerIn: parent - - height: ChatStyle.entry.message.outgoing.busyIndicatorSize - width: ChatStyle.entry.message.outgoing.busyIndicatorSize - } + Item { + BusyIndicator { + anchors.centerIn: parent + + height: ChatStyle.entry.message.outgoing.busyIndicatorSize + width: ChatStyle.entry.message.outgoing.busyIndicatorSize } } + } + + Loader { + Layout.preferredWidth: ChatStyle.entry.message.outgoing.areaSize + Layout.fillHeight: true - Loader { - //height: ChatStyle.entry.lineHeight - //anchors.bottom: parent.bottom - //Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter - Layout.preferredWidth: ChatStyle.entry.message.outgoing.areaSize - Layout.fillHeight: true - //Layout.rightMargin: 10 - - sourceComponent: $chatEntry.state == LinphoneEnums.ChatMessageStateInProgress || $chatEntry.state == LinphoneEnums.ChatMessageStateFileTransferInProgress - ? indicator - : iconComponent - } - //} + sourceComponent: $chatEntry.state == LinphoneEnums.ChatMessageStateInProgress || $chatEntry.state == LinphoneEnums.ChatMessageStateFileTransferInProgress + ? indicator + : iconComponent + } } /* Rectangle{ diff --git a/linphone-app/ui/modules/Linphone/File/FileView.qml b/linphone-app/ui/modules/Linphone/File/FileView.qml index fbc1e3aa7..c16c5d742 100644 --- a/linphone-app/ui/modules/Linphone/File/FileView.qml +++ b/linphone-app/ui/modules/Linphone/File/FileView.qml @@ -155,8 +155,9 @@ Item { spacing: FileViewStyle.spacing Icon{ id: fileIcon + property bool isImage: UtilsCpp.isImage(mainItem.name) Layout.alignment: Qt.AlignCenter - icon: extensionText.text != '' ? FileViewStyle.extension.icon : FileViewStyle.extension.unknownIcon + icon: fileIcon.isImage ? FileViewStyle.extension.imageIcon : FileViewStyle.extension.icon iconSize: FileViewStyle.extension.iconSize Layout.fillHeight: true Layout.fillWidth: true @@ -173,7 +174,7 @@ Item { font.bold: true font.pointSize: extensionMetrics.font.pointSize clip: true - text: (mainItem.contentModel?Utils.getExtension(mainItem.name).toUpperCase():'') + text: (!fileIcon.isImage && mainItem.contentModel?Utils.getExtension(mainItem.name).toUpperCase():'') horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter TextMetrics{ diff --git a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml index ee59bc91c..328e1192c 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml @@ -220,7 +220,6 @@ QtObject { property QtObject extension: QtObject { property string icon: 'file_extension_custom' - property string unknownIcon: 'file_unknown_custom' property int iconSize: 60 property int internalSize: 37 property int radius: 0 diff --git a/linphone-app/ui/modules/Linphone/Styles/File/FileViewStyle.qml b/linphone-app/ui/modules/Linphone/Styles/File/FileViewStyle.qml index bd82d5c74..f13f6ac3b 100644 --- a/linphone-app/ui/modules/Linphone/Styles/File/FileViewStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/File/FileViewStyle.qml @@ -46,8 +46,8 @@ QtObject { } property QtObject extension: QtObject { - property string icon: 'file_extension_custom' - property string unknownIcon: 'file_unknown_custom' + property string icon: 'file_extension_custom' + property string imageIcon: 'file_image_custom' property int iconSize: 60 property int internalSize: 37 property int radius: 0 diff --git a/linphone-app/ui/views/App/Styles/Main/RecordingsStyle.qml b/linphone-app/ui/views/App/Styles/Main/RecordingsStyle.qml index 1e17dbb90..62e5ccaa2 100644 --- a/linphone-app/ui/views/App/Styles/Main/RecordingsStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/RecordingsStyle.qml @@ -57,7 +57,7 @@ QtObject { property QtObject openImage: QtObject { property int iconSize: buttons.size/2 property string name : 'openImage' - property string icon : 'file_unknown_custom' + property string icon : 'file_image_custom' property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'ma_n_b_inv_bg').color property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'ma_h_b_inv_bg').color property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'ma_p_b_inv_bg').color