diff --git a/src/app/commoncomponents/DataTransferMessageDelegate.qml b/src/app/commoncomponents/DataTransferMessageDelegate.qml index f06a02724771297dde220fefc9bc8e60b365b71a..fce9697e3abb55683973ca6f739f911ed8ef719a 100644 --- a/src/app/commoncomponents/DataTransferMessageDelegate.qml +++ b/src/app/commoncomponents/DataTransferMessageDelegate.qml @@ -40,19 +40,20 @@ Loader { property int seq: MsgSeq.single property string author: Author property string body: Body - property var transferStatus: Status - - width: ListView.view ? ListView.view.width : 0 - - sourceComponent: { - if (root.transferStatus === Interaction.Status.TRANSFER_FINISHED) { - mediaInfo = MessagesAdapter.getMediaInfo(root.body) - if (Object.keys(mediaInfo).length !== 0 && WITH_WEBENGINE) - return localMediaMsgComp + property int transferStatus: Status + onTransferStatusChanged: { + if (transferStatus === Interaction.Status.TRANSFER_FINISHED) { + mediaInfo = MessagesAdapter.getMediaInfo(root.body); + if (Object.keys(mediaInfo).length !== 0 && WITH_WEBENGINE) { + sourceComponent = localMediaMsgComp; + return; + } } - return dataTransferMsgComp + sourceComponent = dataTransferMsgComp; } + width: ListView.view ? ListView.view.width : 0 + opacity: 0 Behavior on opacity { NumberAnimation { duration: 100 } } onLoaded: opacity = 1 @@ -294,8 +295,6 @@ Loader { return avComp } - - Component { id: avComp @@ -304,7 +303,7 @@ Loader { var qml = WITH_WEBENGINE ? "qrc:/webengine/MediaPreviewBase.qml" : "qrc:/nowebengine/MediaPreviewBase.qml" - setSource( qml, { isVideo: mediaInfo.isVideo, html:mediaInfo.html } ) + setSource( qml, { isVideo: mediaInfo.isVideo, html: mediaInfo.html } ) } } } @@ -383,9 +382,11 @@ Loader { antialiasing: true autoTransform: true asynchronous: true - source: Body !== undefined ? UtilsAdapter.urlFromLocalPath(Body) : '' - Component.onCompleted: localMediaMsgItem.bubble.imgSource = source + Component.onCompleted: { + source = UtilsAdapter.urlFromLocalPath(Body); + localMediaMsgItem.bubble.imgSource = source; + } // The sourceSize represents the maximum source dimensions. // This should not be a dynamic binding, as property changes @@ -401,7 +402,6 @@ Loader { if (img.status == Image.Ready && aspectRatio) { height = Qt.binding(() => JamiQmlUtils.clamp(idealWidth / aspectRatio, 64, 256)) width = Qt.binding(() => height * aspectRatio) - } } diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp index 7a0479efb0298e9cf226799320ae25755aeb026b..48b4fed51bc52a268cdb01f8b98d151c592c7722 100644 --- a/src/app/mainapplication.cpp +++ b/src/app/mainapplication.cpp @@ -70,7 +70,7 @@ messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& // In debug mode, always include file URI (including line info). // Only do this when the level Info/Debug, as it is already included in the constructed // message for the other levels. - if (type == QtDebugMsg || type == QtInfoMsg) { + if (type == QtDebugMsg || type == QtInfoMsg || !isQml) { auto fileName = isQml ? context.file : QUrl::fromLocalFile(context.file).toString(); fileLineInfo = QString(" %1:%2").arg(!fileName.isEmpty() ? fileName : "unknown", context.line ? QString::number(context.line) : "0"); diff --git a/src/app/mainview/components/DocumentPreview.qml b/src/app/mainview/components/DocumentPreview.qml index ae037ddc9436bfe0b8f496e14ea7d0e5bf0d91a5..1f3caf6b58da190c8d1d0e230acd84a52102b1ca 100644 --- a/src/app/mainview/components/DocumentPreview.qml +++ b/src/app/mainview/components/DocumentPreview.qml @@ -128,11 +128,11 @@ Item { fillMode: Image.PreserveAspectCrop source: { - fileSource = "file://" + Body; + fileSource = UtilsAdapter.urlFromLocalPath(Body); if (!mediaInfo.isImage && !mediaInfo.isAnimatedImage) { return ""; } - return "file://" + Body; + return fileSource; } } } diff --git a/src/app/mainview/components/MessageListView.qml b/src/app/mainview/components/MessageListView.qml index 4afa3d188d4f87a5805a86567a9d61511f4b4396..11961b2b4065936cd73296eb042e762ce049c7f8 100644 --- a/src/app/mainview/components/MessageListView.qml +++ b/src/app/mainview/components/MessageListView.qml @@ -147,7 +147,7 @@ JamiListView { id: overlay anchors.fill: parent color: JamiTheme.chatviewBgColor - visible: opacity !== 0 + visible: opacity > 0 SequentialAnimation { id: fadeAnimation NumberAnimation { diff --git a/src/app/webengine/MediaPreviewBase.qml b/src/app/webengine/MediaPreviewBase.qml index 7c4f8671fe97988f3209718a84281cf20cbf8812..39ac690861517ed2283f7406a11fad074dfa67f9 100644 --- a/src/app/webengine/MediaPreviewBase.qml +++ b/src/app/webengine/MediaPreviewBase.qml @@ -41,7 +41,7 @@ WebEngineView { } settings.fullScreenSupportEnabled: isVideo settings.javascriptCanOpenWindows: false - Component.onCompleted: loadHtml(html, 'file://') + Component.onCompleted: loadHtml(html, 'file:///') layer.enabled: !isFullScreen layer.effect: OpacityMask { maskSource: MessageBubble { diff --git a/src/app/webengine/VideoPreview.qml b/src/app/webengine/VideoPreview.qml index 32c90c793d178c9488761b2cb8e9af4bc4efbf5b..7c3dc060163731f0adfcc74624c00eea2ac8836a 100644 --- a/src/app/webengine/VideoPreview.qml +++ b/src/app/webengine/VideoPreview.qml @@ -35,7 +35,7 @@ Rectangle { anchors.topMargin: root.isVideo ? 0 : wev.implicitHeight / 2 settings.fullScreenSupportEnabled: root.isVideo settings.javascriptCanOpenWindows: false - Component.onCompleted: loadHtml(root.html, 'file://') + Component.onCompleted: loadHtml(root.html, 'file:///') onFullScreenRequested: function (request) { if (request.toggleOn) { layoutManager.pushFullScreenItem(this, root, null, function () { diff --git a/src/libclient/api/interaction.h b/src/libclient/api/interaction.h index f6e74743243b576bea2ecdddc667ed80f1790561..8d73329f5dc2b9a1d04fb17df815604b3f525bbf 100644 --- a/src/libclient/api/interaction.h +++ b/src/libclient/api/interaction.h @@ -443,8 +443,10 @@ struct Info Info(const SwarmMessage& msg, const QString& accountUri) { MapStringString msgBody; - for (const auto& key : msg.body.keys()) { - msgBody.insert(key, msg.body.value(key)); + for (auto it = msg.body.cbegin(); it != msg.body.cend(); ++it) { + const auto& key = it.key(); + const auto& value = it.value(); + msgBody.insert(key, value); } init(msgBody, accountUri); parentId = msg.linearizedParent; diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index 9b36e52a942c9cc3dd12580f855efe984e69e87a..277804e4c04de133822b2f56a3db2b8fc07e09fa 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -2381,7 +2381,8 @@ ConversationModelPimpl::slotMessageReceived(const QString& accountId, auto msg = interaction::Info(message, linked.owner.profileInfo.uri); if (msg.type == interaction::Type::CALL) { - msg.body = interaction::getCallInteractionString(msg.authorUri == linked.owner.profileInfo.uri, + msg.body = interaction::getCallInteractionString(msg.authorUri + == linked.owner.profileInfo.uri, msg); } else if (msg.type == interaction::Type::DATA_TRANSFER) { // save data transfer interaction to db and assosiate daemon id with interaction id, @@ -2851,7 +2852,7 @@ ConversationModelPimpl::addConversationRequest(const MapStringString& convReques void ConversationModelPimpl::slotPendingContactAccepted(const QString& uri) { - profile::Type type; + profile::Type type {}; try { type = linked.owner.contactModel->getContact(uri).profileInfo.type; } catch (std::out_of_range& e) { diff --git a/src/libclient/messagelistmodel.cpp b/src/libclient/messagelistmodel.cpp index c6fc1802a733eadd14a33a2222d9ed36a77122de..661e50a8be14ff1f1dd2f2c0341d41e705b71cc7 100644 --- a/src/libclient/messagelistmodel.cpp +++ b/src/libclient/messagelistmodel.cpp @@ -20,7 +20,6 @@ #include "api/accountmodel.h" #include "api/contactmodel.h" -#include "api/conversationmodel.h" #include <QFileInfo> @@ -186,7 +185,11 @@ MessageListModel::update(const QString& id, const interaction::Info& interaction return true; } } - // Just update bodies notify the view. + // DataTransfer interactions should not be updated. + if (current.type == interaction::Type::DATA_TRANSFER) { + return true; + } + // Just update bodies notify the view otherwise. current.body = interaction.body; current.previousBodies = interaction.previousBodies; current.parsedBody = interaction.parsedBody;