From 2480603ee24a632eacd888343b55ac4b5f9811d7 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 23 Sep 2020 05:38:07 -0400 Subject: [PATCH] Improve unread counters theming & default look --- src/gui/MainPane/MessageIndicator.qml | 41 +++++++++++++++++++++++---- src/themes/Glass.qpl | 30 +++++++++++++++++--- src/themes/Midnight.qpl | 30 +++++++++++++++++--- 3 files changed, 88 insertions(+), 13 deletions(-) diff --git a/src/gui/MainPane/MessageIndicator.qml b/src/gui/MainPane/MessageIndicator.qml index 120a9aba..9d819ae6 100644 --- a/src/gui/MainPane/MessageIndicator.qml +++ b/src/gui/MainPane/MessageIndicator.qml @@ -5,12 +5,18 @@ import QtQuick 2.12 import "../Base" HLabel { + id: root + property QtObject indicatorTheme property int unreads: 0 property int highlights: 0 property bool localUnreads: false property bool localHighlights: false + readonly property bool useHighlightStyle: + highlights || (! unreads && localUnreads && localHighlights) + + text: unreads >= 1000000 ? Math.floor(unreads / 1000000) + "M" : unreads >= 1000 ? Math.floor(unreads / 1000) + "K" : @@ -18,25 +24,50 @@ HLabel { localUnreads ? "!" : "" + color: + useHighlightStyle ? + indicatorTheme.highlightText : + indicatorTheme.text + font.pixelSize: theme.fontSize.small - font.bold: text === "!" + font.bold: + useHighlightStyle ? + indicatorTheme.highlightBold : + indicatorTheme.bold + verticalAlignment: Qt.AlignVCenter - leftPadding: theme.spacing / 4 + leftPadding: theme.spacing / 3 rightPadding: leftPadding scale: text ? 1 : 0 visible: text !== "" background: Rectangle { + radius: + useHighlightStyle ? + indicatorTheme.highlightRadius : + indicatorTheme.radius + color: - highlights || (! unreads && localUnreads && localHighlights) ? - indicatorTheme.mentionBackground : + useHighlightStyle ? + indicatorTheme.highlightBackground : indicatorTheme.background - radius: theme.radius / 4 + border.width: + useHighlightStyle ? + indicatorTheme.highlightBorderWidth : + indicatorTheme.borderWidth + border.color: + useHighlightStyle ? + indicatorTheme.highlightBorder : + indicatorTheme.border + + Behavior on radius { HColorAnimation {} } Behavior on color { HColorAnimation {} } + Behavior on border.color { HColorAnimation {} } } Behavior on scale { HNumberAnimation {} } + Behavior on color { HColorAnimation {} } } diff --git a/src/themes/Glass.qpl b/src/themes/Glass.qpl index 08a450ee..f6ee1ae3 100644 --- a/src/themes/Glass.qpl +++ b/src/themes/Glass.qpl @@ -315,8 +315,19 @@ mainPane: int selectedBorderSize: 1 unreadIndicator: - color background: colors.accentBackground - color mentionBackground: colors.alertBackground + color background: colors.strongBackground + color text: colors.accentText + bool bold: false + color border: Qt.darker(text, 2) + int borderWidth: 1 + int radius: theme.radius / 2 + + color highlightBackground: colors.strongBackground + color highlightText: colors.errorText + bool highlightBold: false + color highlightBorder: Qt.darker(highlightText, 2) + int highlightBorderWidth: 1 + int highlightRadius: theme.radius / 2 listView: color background: colors.mediumBackground @@ -345,8 +356,19 @@ mainPane: int collapsedAvatarRadius: controls.avatar.radius unreadIndicator: - color background: colors.accentBackground - color mentionBackground: colors.alertBackground + color background: colors.strongBackground + color text: colors.accentText + bool bold: false + color border: Qt.darker(text, 2) + int borderWidth: 1 + int radius: theme.radius / 2 + + color highlightBackground: colors.strongBackground + color highlightText: colors.errorText + bool highlightBold: false + color highlightBorder: Qt.darker(highlightText, 2) + int highlightBorderWidth: 1 + int highlightRadius: theme.radius / 2 bottomBar: color background: "transparent" diff --git a/src/themes/Midnight.qpl b/src/themes/Midnight.qpl index dec0041b..24f62116 100644 --- a/src/themes/Midnight.qpl +++ b/src/themes/Midnight.qpl @@ -324,8 +324,19 @@ mainPane: int selectedBorderSize: 1 unreadIndicator: - color background: colors.accentBackground - color mentionBackground: colors.alertBackground + color background: colors.strongBackground + color text: colors.accentText + bool bold: false + color border: Qt.darker(text, 2) + int borderWidth: 1 + int radius: theme.radius / 2 + + color highlightBackground: colors.strongBackground + color highlightText: colors.errorText + bool highlightBold: false + color highlightBorder: Qt.darker(highlightText, 2) + int highlightBorderWidth: 1 + int highlightRadius: theme.radius / 2 listView: color background: colors.mediumBackground @@ -354,8 +365,19 @@ mainPane: int collapsedAvatarRadius: controls.avatar.radius unreadIndicator: - color background: colors.accentBackground - color mentionBackground: colors.alertBackground + color background: colors.strongBackground + color text: colors.accentText + bool bold: false + color border: Qt.darker(text, 2) + int borderWidth: 1 + int radius: theme.radius / 2 + + color highlightBackground: colors.strongBackground + color highlightText: colors.errorText + bool highlightBold: false + color highlightBorder: Qt.darker(highlightText, 2) + int highlightBorderWidth: 1 + int highlightRadius: theme.radius / 2 bottomBar: color background: "transparent"