Members: show last active time and status message

Left:

- Something like "Active" should be shown instead of a relative time
  when the member is considered currently active by the matrix server,
  but an "Active" text takes too much space

- Show a colored circle in the bottom right corner of avatars to
  indicate if they're online, away, or offline

- Reduce opacity of offline members, but is there a way to know if
  the server has presence disabled? For servers like matrix.org,
  Riot shows the entire list of members with half opacity at all time,
  we want to avoid that

- Setting our status text with a text field in AccountDelegate
  context menu, similar to the DeviceDelegate's context menu

- Setting our online/away/invisible/offline status from
  AccountDelegate context menu

- Replace the useless "Mirage x.y.z" button in the top left of the UI
  with a control to affect all accounts's status
This commit is contained in:
miruka 2020-06-02 18:43:05 -04:00
parent 50e17e950d
commit 512c08fe0a
2 changed files with 49 additions and 12 deletions

View File

@ -27,6 +27,9 @@ HTile {
} }
HColumnLayout { HColumnLayout {
HRowLayout {
spacing: room.spacing
TitleLabel { TitleLabel {
text: model.display_name || model.id text: model.display_name || model.id
color: color:
@ -39,12 +42,22 @@ HTile {
Behavior on color { HColorAnimation {} } Behavior on color { HColorAnimation {} }
} }
TitleRightInfoLabel {
tile: room
// color: theme.mainPane.listView.member.lastActiveAgo
text:
model.last_active_ago === -1 ?
"" :
utils.formatRelativeTime(model.last_active_ago)
}
}
SubtitleLabel { SubtitleLabel {
tile: member tile: member
// text: model.display_name ? model.id : ""
text: [model.last_active_ago, model.currently_active,
model.presence, model.status_message].join(" | ")
color: theme.chat.roomPane.listView.member.subtitle color: theme.chat.roomPane.listView.member.subtitle
text:
model.status_message.trim() ||
(model.display_name ? model.id : "")
} }
} }
} }

View File

@ -328,6 +328,30 @@ QtObject {
} }
function formatRelativeTime(milliseconds) {
const seconds = Math.floor(milliseconds / 1000)
return (
seconds < 60 ?
qsTr("%1s").arg(seconds) :
seconds < 60 * 60 ?
qsTr("%1mn").arg(Math.floor(seconds / 60)) :
seconds < 60 * 60 * 24 ?
qsTr("%1h").arg(Math.floor(seconds / 60 / 60)) :
seconds < 60 * 60 * 24 * 30 ?
qsTr("%1d").arg(Math.floor(seconds / 60 / 60 / 24)) :
seconds < 60 * 60 * 24 * 30 * 12 ?
qsTr("%1mo").arg(Math.floor(seconds / 60 / 60 / 24 / 30)) :
qsTr("%1y").arg(Math.floor(seconds / 60 / 60 / 24 / 30 / 12))
)
}
function formatDuration(milliseconds) { function formatDuration(milliseconds) {
const totalSeconds = milliseconds / 1000 const totalSeconds = milliseconds / 1000