From 14ba4b50b5b194ddde64e0d24b301054355516c1 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 9 Nov 2019 15:19:10 -0400 Subject: [PATCH] Avatars on FindSomeone/JoinRoom pages --- TODO.md | 5 ++++- src/qml/Pages/AddChat/AddChat.qml | 3 +++ src/qml/Pages/AddChat/CreateRoom.qml | 9 +-------- src/qml/Pages/AddChat/CurrentUserAvatar.qml | 9 +++++++++ src/qml/Pages/AddChat/FindSomeone.qml | 6 ++++++ src/qml/Pages/AddChat/JoinRoom.qml | 6 ++++++ 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 src/qml/Pages/AddChat/CurrentUserAvatar.qml diff --git a/TODO.md b/TODO.md index 8337cc78..75fc4890 100644 --- a/TODO.md +++ b/TODO.md @@ -116,7 +116,6 @@ - Server selection - Register/Forgot? for SignIn dialog - - Add room - Prevent using the composer if no permission (power levels) - Prevent using an alias if that user is not in the room or no permission - Spinner when loading past room events @@ -154,6 +153,10 @@ - Opening links with keyboard - Client improvements + - In room creation, click avatar to set the future room's avatar + - In join room page, show the matching room's avatar when typing + - In find someone page, show the matching user's avatar when typing + - More error details - Refetch profile after manual profile change, don't wait for a room event diff --git a/src/qml/Pages/AddChat/AddChat.qml b/src/qml/Pages/AddChat/AddChat.qml index 3a73bffd..2cba0237 100644 --- a/src/qml/Pages/AddChat/AddChat.qml +++ b/src/qml/Pages/AddChat/AddChat.qml @@ -11,6 +11,9 @@ HPage { property string userId + readonly property var account: + Utils.getItem(modelSources["Account"] || [], "user_id", userId) + HColumnLayout { Layout.alignment: Qt.AlignCenter diff --git a/src/qml/Pages/AddChat/CreateRoom.qml b/src/qml/Pages/AddChat/CreateRoom.qml index a7401cbd..af24f64a 100644 --- a/src/qml/Pages/AddChat/CreateRoom.qml +++ b/src/qml/Pages/AddChat/CreateRoom.qml @@ -63,18 +63,11 @@ HBox { Layout.preferredWidth: 128 Layout.preferredHeight: Layout.preferredWidth - HUserAvatar { + CurrentUserAvatar { anchors.fill: parent z: 10 opacity: nameField.text ? 0 : 1 visible: opacity > 0 - clientUserId: parent.clientUserId - userId: clientUserId - displayName: account ? account.display_name : "" - mxc: account ? account.avatar_url : "" - - readonly property var account: - Utils.getItem(modelSources["Account"] || [], "user_id", userId) Behavior on opacity { HNumberAnimation {} } } diff --git a/src/qml/Pages/AddChat/CurrentUserAvatar.qml b/src/qml/Pages/AddChat/CurrentUserAvatar.qml new file mode 100644 index 00000000..1cac18a4 --- /dev/null +++ b/src/qml/Pages/AddChat/CurrentUserAvatar.qml @@ -0,0 +1,9 @@ +import QtQuick 2.12 +import "../../Base" + +HUserAvatar { + clientUserId: addChatPage.userId + userId: clientUserId + displayName: addChatPage.account ? addChatPage.account.display_name : "" + mxc: addChatPage.account ? addChatPage.account.avatar_url : "" +} diff --git a/src/qml/Pages/AddChat/FindSomeone.qml b/src/qml/Pages/AddChat/FindSomeone.qml index 43930fc4..118c7dea 100644 --- a/src/qml/Pages/AddChat/FindSomeone.qml +++ b/src/qml/Pages/AddChat/FindSomeone.qml @@ -53,6 +53,12 @@ HBox { readonly property string userId: addChatPage.userId + CurrentUserAvatar { + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: 128 + Layout.preferredHeight: Layout.preferredWidth + } + HTextField { id: userField placeholderText: qsTr("User ID (e.g. @john:matrix.org)") diff --git a/src/qml/Pages/AddChat/JoinRoom.qml b/src/qml/Pages/AddChat/JoinRoom.qml index e3afc5d7..3ee1a045 100644 --- a/src/qml/Pages/AddChat/JoinRoom.qml +++ b/src/qml/Pages/AddChat/JoinRoom.qml @@ -56,6 +56,12 @@ HBox { readonly property string userId: addChatPage.userId + CurrentUserAvatar { + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: 128 + Layout.preferredHeight: Layout.preferredWidth + } + HTextField { id: roomField placeholderText: qsTr("Alias (e.g. #example:matrix.org), URL or ID")