Improve unread counters theming & default look

This commit is contained in:
miruka 2020-09-23 05:38:07 -04:00
parent bb8f394b78
commit 2480603ee2
3 changed files with 88 additions and 13 deletions

View File

@ -5,12 +5,18 @@ import QtQuick 2.12
import "../Base" import "../Base"
HLabel { HLabel {
id: root
property QtObject indicatorTheme property QtObject indicatorTheme
property int unreads: 0 property int unreads: 0
property int highlights: 0 property int highlights: 0
property bool localUnreads: false property bool localUnreads: false
property bool localHighlights: false property bool localHighlights: false
readonly property bool useHighlightStyle:
highlights || (! unreads && localUnreads && localHighlights)
text: text:
unreads >= 1000000 ? Math.floor(unreads / 1000000) + "M" : unreads >= 1000000 ? Math.floor(unreads / 1000000) + "M" :
unreads >= 1000 ? Math.floor(unreads / 1000) + "K" : unreads >= 1000 ? Math.floor(unreads / 1000) + "K" :
@ -18,25 +24,50 @@ HLabel {
localUnreads ? "!" : localUnreads ? "!" :
"" ""
color:
useHighlightStyle ?
indicatorTheme.highlightText :
indicatorTheme.text
font.pixelSize: theme.fontSize.small font.pixelSize: theme.fontSize.small
font.bold: text === "!" font.bold:
useHighlightStyle ?
indicatorTheme.highlightBold :
indicatorTheme.bold
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
leftPadding: theme.spacing / 4 leftPadding: theme.spacing / 3
rightPadding: leftPadding rightPadding: leftPadding
scale: text ? 1 : 0 scale: text ? 1 : 0
visible: text !== "" visible: text !== ""
background: Rectangle { background: Rectangle {
radius:
useHighlightStyle ?
indicatorTheme.highlightRadius :
indicatorTheme.radius
color: color:
highlights || (! unreads && localUnreads && localHighlights) ? useHighlightStyle ?
indicatorTheme.mentionBackground : indicatorTheme.highlightBackground :
indicatorTheme.background 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 color { HColorAnimation {} }
Behavior on border.color { HColorAnimation {} }
} }
Behavior on scale { HNumberAnimation {} } Behavior on scale { HNumberAnimation {} }
Behavior on color { HColorAnimation {} }
} }

View File

@ -315,8 +315,19 @@ mainPane:
int selectedBorderSize: 1 int selectedBorderSize: 1
unreadIndicator: unreadIndicator:
color background: colors.accentBackground color background: colors.strongBackground
color mentionBackground: colors.alertBackground 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: listView:
color background: colors.mediumBackground color background: colors.mediumBackground
@ -345,8 +356,19 @@ mainPane:
int collapsedAvatarRadius: controls.avatar.radius int collapsedAvatarRadius: controls.avatar.radius
unreadIndicator: unreadIndicator:
color background: colors.accentBackground color background: colors.strongBackground
color mentionBackground: colors.alertBackground 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: bottomBar:
color background: "transparent" color background: "transparent"

View File

@ -324,8 +324,19 @@ mainPane:
int selectedBorderSize: 1 int selectedBorderSize: 1
unreadIndicator: unreadIndicator:
color background: colors.accentBackground color background: colors.strongBackground
color mentionBackground: colors.alertBackground 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: listView:
color background: colors.mediumBackground color background: colors.mediumBackground
@ -354,8 +365,19 @@ mainPane:
int collapsedAvatarRadius: controls.avatar.radius int collapsedAvatarRadius: controls.avatar.radius
unreadIndicator: unreadIndicator:
color background: colors.accentBackground color background: colors.strongBackground
color mentionBackground: colors.alertBackground 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: bottomBar:
color background: "transparent" color background: "transparent"