summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-06-08 01:45:24 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-06-08 01:59:05 +0200
commit96f4169be97715e6b6b45663492e3791ba21ae09 (patch)
tree618753677e69ac590aa2cad267dfd7d31c574bfd /resources
parentSmooth scaling for images (diff)
downloadnheko-96f4169be97715e6b6b45663492e3791ba21ae09.tar.xz
Show presence and set custom status messages
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/Avatar.qml18
-rw-r--r--resources/qml/TimelineView.qml14
2 files changed, 31 insertions, 1 deletions
diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml
index 465a8e1c..9ac7b562 100644
--- a/resources/qml/Avatar.qml
+++ b/resources/qml/Avatar.qml
@@ -9,6 +9,7 @@ Rectangle {
 	radius: settings.avatarCircles ? height/2 : 3
 
 	property alias url: img.source
+	property string userid
 	property string displayName
 
 	Label {
@@ -42,6 +43,23 @@ Rectangle {
 				radius: settings.avatarCircles ? height/2 : 3
 			}
 		}
+
+	}
+
+	Rectangle {
+		anchors.bottom: avatar.bottom
+		anchors.right: avatar.right
+
+		height: avatar.height / 6
+		width: height
+		radius: settings.avatarCircles ? height / 2 : height / 4
+		color: switch (timelineManager.userPresence(userid)) {
+			case "online": return "#00cc66"
+			case "unavailable": return "#ff9933"
+			case "offline": return "#a82353"
+			default: "transparent"
+		}
 	}
+
 	color: colors.base
 }
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 08130033..ea6bf093 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -152,6 +152,8 @@ Page {
 
 			onCountChanged: if (atYEnd) model.currentIndex = 0 // Mark last event as read, since we are at the bottom
 
+			property int delegateMaxWidth: (settings.timelineMaxWidth > 100 && (parent.width - settings.timelineMaxWidth) > 32) ? settings.timelineMaxWidth : (parent.width - 32)
+
 			delegate: Rectangle {
 				// This would normally be previousSection, but our model's order is inverted.
 				property bool sectionBoundary: (ListView.nextSection != "" && ListView.nextSection !== ListView.section) || model.index === chat.count - 1
@@ -159,7 +161,7 @@ Page {
 				id: wrapper
 				property Item section
 				anchors.horizontalCenter: parent.horizontalCenter
-				width: (settings.timelineMaxWidth > 100 && (parent.width - settings.timelineMaxWidth) > 32) ? settings.timelineMaxWidth : (parent.width - 32)
+				width: chat.delegateMaxWidth
 				height: section ? section.height + timelinerow.height : timelinerow.height
 				color: "transparent"
 
@@ -236,6 +238,7 @@ Page {
 							height: avatarSize
 							url: chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/")
 							displayName: modelData.userName
+							userid: modelData.userId
 
 							MouseArea {
 								anchors.fill: parent
@@ -258,6 +261,15 @@ Page {
 								propagateComposedEvents: true
 							}
 						}
+
+						Label {
+							color: colors.buttonText
+							text: timelineManager.userStatus(modelData.userId)
+							textFormat: Text.PlainText
+							elide: Text.ElideRight
+							width: chat.delegateMaxWidth - parent.spacing*2 - userName.implicitWidth - avatarSize
+							font.italic: true
+						}
 					}
 				}
 			}