From c580597c8de0248984dd86a0d82e396adf0cedac Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 4 Sep 2020 17:00:21 -0700 Subject: [PATCH] make contact badge just be green/online, and move unread messages to right side of row --- qml/widgets/ContactRow.qml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index cc6aeaa6..4eceb291 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -11,26 +11,18 @@ import "../opaque" as Opaque import "../opaque/styles" import "../opaque/theme" import "../const" +import "../utils.js" as Utils Opaque.PortraitRow { - property int status: 0 + property int status: Const.state_disconnected property int badge property bool loading property string authorization - // TODO: should be in ContactRow property bool blocked - badgeColor: Theme.portraitContactBadgeColor - badgeVisible: badge > 0 - - badgeContent: Label { - id: lblUnread - color: Theme.portraitContactBadgeTextColor - font.pixelSize: Theme.badgeTextSize * gcd.themeScale - font.weight: Font.Bold - text: badge > 99 ? "99+" : badge - } + badgeColor: Theme.portraitOnlineBadgeColor + badgeVisible: (Utils.isGroup(handle) && status == Const.state_synced) || (Utils.isPeer(handle) && status == Const.state_authenticated) ProgressBar { // LOADING ? id: loadingProgress @@ -53,6 +45,26 @@ Opaque.PortraitRow { } } + Opaque.Badge { + id: unreadBadge + visible: badge > 0 + color: Theme.portraitContactBadgeColor + size: parent.height/4 + + anchors.right: parent.right + anchors.rightMargin: 25 * gcd.themeScale + anchors.leftMargin: 1 * gcd.themeScale + anchors.verticalCenter: parent.verticalCenter + + content: Label { + id: lblUnread + color: Theme.portraitContactBadgeTextColor + font.pixelSize: Theme.badgeTextSize * gcd.themeScale + font.weight: Font.Bold + text: badge > 99 ? "99+" : badge + } + } + Column { visible: authorization == Const.auth_unknown anchors.right: parent.right