From 3fa35b88c9d56cdd7debd26a5e5d0bf211ffab26 Mon Sep 17 00:00:00 2001 From: vslg Date: Tue, 7 Jul 2020 17:03:07 -0300 Subject: [PATCH] Add offline icon and fix theme colors --- src/gui/MainPane/AccountContextMenu.qml | 13 ++-- .../RoomPane/MemberView/MemberDelegate.qml | 9 +-- src/icons/thin/presence-offline.svg | 68 +++++++++++++++++++ src/themes/Glass.qpl | 8 +-- src/themes/Midnight.qpl | 8 +-- 5 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 src/icons/thin/presence-offline.svg diff --git a/src/gui/MainPane/AccountContextMenu.qml b/src/gui/MainPane/AccountContextMenu.qml index 681527d4..a85070fb 100644 --- a/src/gui/MainPane/AccountContextMenu.qml +++ b/src/gui/MainPane/AccountContextMenu.qml @@ -14,6 +14,8 @@ HMenu { property string statusMsg property bool firstSyncDone + onOpened: statusText.forceActiveFocus() + function setPresence(presence, statusMsg = null) { py.callClientCoro(userId, "set_presence", [presence, statusMsg]) @@ -21,7 +23,7 @@ HMenu { HMenuItem { - enabled: presence !== "online" && firstSyncDone + enabled: firstSyncDone icon.name: "presence" icon.color: theme.controls.presence.online text: qsTr("Online") @@ -30,7 +32,7 @@ HMenu { HMenuItem { visible: presence - enabled: presence !== "unavailable" && firstSyncDone + enabled: firstSyncDone icon.name: "presence-busy" icon.color: theme.controls.presence.unavailable text: qsTr("Unavailable") @@ -38,8 +40,8 @@ HMenu { } HMenuItem { - enabled: presence !== "offline" && firstSyncDone - icon.name: "presence" + enabled: firstSyncDone + icon.name: "presence-offline" icon.color: theme.controls.presence.offline text: qsTr("Offline") onTriggered: setPresence("offline") @@ -47,7 +49,7 @@ HMenu { HMenuItem { visible: presence - enabled: presence !== "invisible" && firstSyncDone + enabled: firstSyncDone icon.name: "presence-invisible" icon.color: theme.controls.presence.offline text: qsTr("Invisible") @@ -78,7 +80,6 @@ HMenu { } defaultText: statusMsg - placeholderText: qsTr("Beautiful day!") Layout.fillWidth: true } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml index 51a38f1c..53b1b82e 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml @@ -45,12 +45,9 @@ HTile { TitleRightInfoLabel { tile: member text: - (model.presence !== "online") && - model.last_active_ago !== -1 ? - "for " + - utils.formatRelativeTime( - model.last_active_ago - ) : + model.presence !== "online" && + model.last_active_ago !== -1 ? + utils.formatRelativeTime(model.last_active_ago) : "" } } diff --git a/src/icons/thin/presence-offline.svg b/src/icons/thin/presence-offline.svg new file mode 100644 index 00000000..3bd1ce1e --- /dev/null +++ b/src/icons/thin/presence-offline.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/src/themes/Glass.qpl b/src/themes/Glass.qpl index ac385b4f..6e404078 100644 --- a/src/themes/Glass.qpl +++ b/src/themes/Glass.qpl @@ -51,13 +51,13 @@ colors: color strongAccentElement: hsluv(hue, saturation * 1.5, intensity * 72, 1) color positiveBackground: - hsluv(155, saturation * 1.5, intensity * 52, opacity) + hsluv(155, saturation * 1.5, intensity * 52, 1) color middleBackground: - hsluv(60, saturation * 1.5, intensity * 52, opacity) + hsluv(60, saturation * 1.5, intensity * 52, 1) color negativeBackground: - hsluv(0, saturation * 1.5, intensity * 52, opacity) + hsluv(0, saturation * 1.5, intensity * 52, 1) color alertBackground: negativeBackground @@ -269,7 +269,7 @@ controls: presence: color online: colors.positiveText - color unavailable: hsluv(0, 90, 35, 1) + color unavailable: colors.warningText color offline: hsluv(0, 0, 30, 1) color border: "black" real opacity: 1.0 diff --git a/src/themes/Midnight.qpl b/src/themes/Midnight.qpl index 67f60800..0a427a35 100644 --- a/src/themes/Midnight.qpl +++ b/src/themes/Midnight.qpl @@ -54,13 +54,13 @@ colors: color strongAccentElement: hsluv(hue, saturation * 1.5, intensity * 72, 1) color positiveBackground: - hsluv(155, saturation * 1.5, intensity * 52, opacity) + hsluv(155, saturation * 1.5, intensity * 52, 1) color middleBackground: - hsluv(60, saturation * 1.5, intensity * 52, opacity) + hsluv(60, saturation * 1.5, intensity * 52, 1) color negativeBackground: - hsluv(0, saturation * 1.5, intensity * 52, opacity) + hsluv(0, saturation * 1.5, intensity * 52, 1) color alertBackground: negativeBackground @@ -275,7 +275,7 @@ controls: presence: color online: colors.positiveText - color unavailable: hsluv(0, 90, 35, 1) + color unavailable: colors.warningText color offline: hsluv(0, 0, 30, 1) color border: "black" real opacity: 1.0