diff --git a/TODO.md b/TODO.md index d1f177c1..f7e3be4b 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,6 @@ - Qt.AlignCenter instead of V | H - banner button repair - Wrong avatar for group rooms -- Can assign "" to an Image source - Make sure to not cache user images and that sourceSize is set everywhere - Reduce messages ListView cacheBuffer height once http thumbnails downloading is implemented @@ -107,5 +106,5 @@ - Previewing room without joining - Distribution - - List dependencies + - Include python dependencies in binary with rcc? - README.md diff --git a/src/qml/Base/HAvatar.qml b/src/qml/Base/HAvatar.qml index c6aa34a2..88d7b57d 100644 --- a/src/qml/Base/HAvatar.qml +++ b/src/qml/Base/HAvatar.qml @@ -12,18 +12,12 @@ HRectangle { implicitHeight: theme.avatar.size property string name: "" - property var imageUrl: null + property var imageUrl: "" property var toolTipImageUrl: imageUrl property alias fillMode: avatarImage.fillMode readonly property alias hovered: hoverHandler.hovered - onImageUrlChanged: if (imageUrl) { avatarImage.source = imageUrl } - - onToolTipImageUrlChanged: if (imageUrl) { - avatarToolTipImage.source = toolTipImageUrl - } - readonly property var params: Utils.thumbnailParametersFor(width, height) color: imageUrl ? "transparent" : @@ -48,6 +42,7 @@ HRectangle { sourceSize.width: params.width sourceSize.height: params.height fillMode: Image.PreserveAspectCrop + source: Qt.resolvedUrl(imageUrl) HoverHandler { id: hoverHandler @@ -74,6 +69,7 @@ HRectangle { width: sourceSize.width height: sourceSize.width fillMode: Image.PreserveAspectCrop + source: Qt.resolvedUrl(toolTipImageUrl) } } } diff --git a/src/qml/Base/HFileDialogOpener.qml b/src/qml/Base/HFileDialogOpener.qml index ef05c86e..6fc644d3 100644 --- a/src/qml/Base/HFileDialogOpener.qml +++ b/src/qml/Base/HFileDialogOpener.qml @@ -5,10 +5,12 @@ import QtQuick 2.12 import Qt.labs.platform 1.1 Item { + id: opener anchors.fill: parent property alias dialog: fileDialog - property var selectedFile: null + property string selectedFile: "" + property string file: "" enum FileType { All, Images } property int fileType: FileType.All @@ -39,8 +41,10 @@ Item { modality: Qt.NonModal onVisibleChanged: if (visible) { - selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile)) + opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile)) + opener.file = Qt.binding(() => Qt.resolvedUrl(file)) } - onRejected: selectedFile = null + onAccepted: { opener.selectedFile = currentFile, opener.file = file } + onRejected: { selectedFile = null; file = null} } } diff --git a/src/qml/Pages/EditAccount/Profile.qml b/src/qml/Pages/EditAccount/Profile.qml index bec4aa62..7593545b 100644 --- a/src/qml/Pages/EditAccount/Profile.qml +++ b/src/qml/Pages/EditAccount/Profile.qml @@ -43,8 +43,8 @@ HGridLayout { id: avatar userId: editAccount.userId - imageUrl: fileDialog.selectedFile || defaultImageUrl - toolTipImageUrl: null + imageUrl: fileDialog.selectedFile || fileDialog.file || defaultImageUrl + toolTipImageUrl: "" Layout.alignment: Qt.AlignHCenter @@ -54,7 +54,8 @@ HGridLayout { HRectangle { z: 10 visible: opacity > 0 - opacity: ! avatar.imageUrl || avatar.hovered ? 1 : 0 + opacity: ! fileDialog.dialog.visible && + (! avatar.imageUrl || avatar.hovered) ? 1 : 0 Behavior on opacity { HNumberAnimation {} } anchors.fill: parent