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"
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 {} }
}

View File

@ -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"

View File

@ -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"