Add avatar with status icon componant
Will be used later for 1-to-1 user room delegates and room members pane
This commit is contained in:
		| @@ -4,30 +4,30 @@ import QtQuick.Layouts 1.4 | |||||||
|  |  | ||||||
| Item { | Item { | ||||||
|     property bool invisible: false |     property bool invisible: false | ||||||
|     property string username: "?" |     property string name: "?" | ||||||
|     property var imageSource: null |     property var imageSource: null | ||||||
|     property int dimmension: 48 |     property int dimmension: 48 | ||||||
|  |  | ||||||
|     id: root |     id: "root" | ||||||
|     width: dimmension |     width: dimmension | ||||||
|     height: invisible ? 1 : dimmension |     height: invisible ? 1 : dimmension | ||||||
|  |  | ||||||
|     Rectangle { |     Rectangle { | ||||||
|         id: letterRectangle |         id: "letterRectangle" | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|         visible: ! invisible && imageSource === null |         visible: ! invisible && imageSource === null | ||||||
|         color: Qt.hsla(Backend.hueFromString(username), 0.22, 0.5, 1) |         color: Qt.hsla(Backend.hueFromString(name), 0.22, 0.5, 1) | ||||||
|  |  | ||||||
|         HLabel { |         HLabel { | ||||||
|             anchors.centerIn: parent |             anchors.centerIn: parent | ||||||
|             text: username.charAt(0) |             text: name.charAt(0) | ||||||
|             color: "white" |             color: "white" | ||||||
|             font.pixelSize: letterRectangle.height / 1.4 |             font.pixelSize: letterRectangle.height / 1.4 | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Image { |     Image { | ||||||
|         id: avatarImage |         id: "avatarImage" | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|         visible: ! invisible && imageSource !== null |         visible: ! invisible && imageSource !== null | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								harmonyqml/components/base/StatusAvatar.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								harmonyqml/components/base/StatusAvatar.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | import QtQuick 2.7 | ||||||
|  | import QtQuick.Controls 2.0 | ||||||
|  | import QtQuick.Layouts 1.4 | ||||||
|  |  | ||||||
|  | Avatar { | ||||||
|  |     Image { | ||||||
|  |         id: "status" | ||||||
|  |         anchors.right: parent.right | ||||||
|  |         anchors.bottom: parent.bottom | ||||||
|  |         source: "../../icons/status.svg" | ||||||
|  |         asynchronous: true | ||||||
|  |         sourceSize.width: 12 | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -56,7 +56,7 @@ Column { | |||||||
|         layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight |         layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight | ||||||
|         anchors.right: isOwn ? parent.right : undefined |         anchors.right: isOwn ? parent.right : undefined | ||||||
|  |  | ||||||
|         Base.Avatar { id: avatar; invisible: combine; username: displayName } |         Base.Avatar { id: avatar; invisible: combine; name: displayName } | ||||||
|  |  | ||||||
|         ColumnLayout { |         ColumnLayout { | ||||||
|             spacing: 0 |             spacing: 0 | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ Rectangle { | |||||||
|             id: "avatar" |             id: "avatar" | ||||||
|             Layout.alignment: Qt.AlignTop |             Layout.alignment: Qt.AlignTop | ||||||
|             dimmension: root.Layout.minimumHeight |             dimmension: root.Layout.minimumHeight | ||||||
|             username: chatPage.room.display_name |             name: chatPage.room.display_name | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         Base.HLabel { |         Base.HLabel { | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ Rectangle { | |||||||
|  |  | ||||||
|         Base.Avatar { |         Base.Avatar { | ||||||
|             id: "avatar" |             id: "avatar" | ||||||
|             username: chatPage.user.display_name |             name: chatPage.user.display_name | ||||||
|             dimmension: root.Layout.minimumHeight |             dimmension: root.Layout.minimumHeight | ||||||
|             //visible: textArea.text === "" |             //visible: textArea.text === "" | ||||||
|             visible: textArea.height <= root.Layout.minimumHeight |             visible: textArea.height <= root.Layout.minimumHeight | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ ColumnLayout { | |||||||
|         id: "row" |         id: "row" | ||||||
|         spacing: 0 |         spacing: 0 | ||||||
|  |  | ||||||
|         Base.Avatar { id: "avatar"; username: display_name; dimmension: 36 } |         Base.Avatar { id: "avatar"; name: display_name; dimmension: 36 } | ||||||
|  |  | ||||||
|         ColumnLayout { |         ColumnLayout { | ||||||
|             Layout.fillWidth: true |             Layout.fillWidth: true | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ MouseArea { | |||||||
|         id: row |         id: row | ||||||
|         spacing: 1 |         spacing: 1 | ||||||
|  |  | ||||||
|         Base.Avatar { id: avatar; username: display_name; dimmension: 36 } |         Base.Avatar { id: avatar; name: display_name; dimmension: 36 } | ||||||
|  |  | ||||||
|         ColumnLayout { |         ColumnLayout { | ||||||
|             spacing: 0 |             spacing: 0 | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								harmonyqml/icons/status.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								harmonyqml/icons/status.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12"/></svg> | ||||||
| After Width: | Height: | Size: 121 B | 
		Reference in New Issue
	
	Block a user
	