diff --git a/TODO.md b/TODO.md
index b00e0e21..d1f177c1 100644
--- a/TODO.md
+++ b/TODO.md
@@ -19,6 +19,9 @@
- Handle thumbnail response status 400
- "Loading..." if going to edit account page while it's loading
- Improve avatar tooltips position, add stuff to room tooltips (last msg?)
+- Accept drag and dropping a picture in account settings to set avatar
+- When all the events loaded on beginning in a room are name/avatar changes,
+ no last event room text is displayed
- Qt 5.12
- New input handlers
diff --git a/src/icons/upload_avatar.svg b/src/icons/upload_avatar.svg
new file mode 100644
index 00000000..d270d3f6
--- /dev/null
+++ b/src/icons/upload_avatar.svg
@@ -0,0 +1 @@
+
diff --git a/src/qml/Base/HAvatar.qml b/src/qml/Base/HAvatar.qml
index 341d5a6f..c6aa34a2 100644
--- a/src/qml/Base/HAvatar.qml
+++ b/src/qml/Base/HAvatar.qml
@@ -16,6 +16,8 @@ HRectangle {
property var toolTipImageUrl: imageUrl
property alias fillMode: avatarImage.fillMode
+ readonly property alias hovered: hoverHandler.hovered
+
onImageUrlChanged: if (imageUrl) { avatarImage.source = imageUrl }
onToolTipImageUrlChanged: if (imageUrl) {
@@ -45,7 +47,7 @@ HRectangle {
z: 2
sourceSize.width: params.width
sourceSize.height: params.height
- fillMode: params.fillMode
+ fillMode: Image.PreserveAspectCrop
HoverHandler {
id: hoverHandler
diff --git a/src/qml/Base/HFileDialogOpener.qml b/src/qml/Base/HFileDialogOpener.qml
index d51a5029..ef05c86e 100644
--- a/src/qml/Base/HFileDialogOpener.qml
+++ b/src/qml/Base/HFileDialogOpener.qml
@@ -36,7 +36,7 @@ Item {
)
title: "Select file"
- modality: Qt.WindowModal
+ modality: Qt.NonModal
onVisibleChanged: if (visible) {
selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
diff --git a/src/qml/Pages/EditAccount/Profile.qml b/src/qml/Pages/EditAccount/Profile.qml
index 20b768c3..bec4aa62 100644
--- a/src/qml/Pages/EditAccount/Profile.qml
+++ b/src/qml/Pages/EditAccount/Profile.qml
@@ -51,6 +51,38 @@ HGridLayout {
Layout.preferredWidth: Math.min(flickable.height, avatarPreferredSize)
Layout.preferredHeight: Layout.preferredWidth
+ HRectangle {
+ z: 10
+ visible: opacity > 0
+ opacity: ! avatar.imageUrl || avatar.hovered ? 1 : 0
+ Behavior on opacity { HNumberAnimation {} }
+
+ anchors.fill: parent
+ color: Qt.hsla(0, 0, 0, avatar.imageUrl ? 0.7 : 1)
+
+ HColumnLayout {
+ anchors.centerIn: parent
+ spacing: currentSpacing
+
+ HIcon {
+ svgName: "upload_avatar"
+ dimension: 64
+ Layout.alignment: Qt.AlignCenter
+ }
+
+ Item { Layout.preferredHeight: 8 }
+
+ HLabel {
+ text: qsTr("Upload profile picture")
+ color: Qt.hsla(0, 0, 0.9, 1)
+ font.pixelSize: theme.fontSize.big
+ wrapMode: Text.WordWrap
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignCenter
+ }
+ }
+ }
+
HFileDialogOpener {
id: fileDialog
fileType: HFileDialogOpener.FileType.Images
@@ -69,7 +101,7 @@ HGridLayout {
HLabel {
text: qsTr("User ID:
%1")
- .arg(Utils.coloredNameHtml(userId, userId))
+ .arg(Utils.coloredNameHtml(userId, userId, userId))
textFormat: Text.StyledText
wrapMode: Text.Wrap
diff --git a/src/qml/utils.js b/src/qml/utils.js
index 5e3de386..62c01207 100644
--- a/src/qml/utils.js
+++ b/src/qml/utils.js
@@ -45,10 +45,10 @@ function nameColor(name) {
}
-function coloredNameHtml(name, alt_id) {
+function coloredNameHtml(name, user_id, display_text) {
// substring: remove leading @
- return "" +
- escapeHtml(name || alt_id) +
+ return "" +
+ escapeHtml(display_text || name || alt_id) +
""
}