support pretty big badge messages counter

--following plasma paradigm we now support
badge messages until 9.999 and even more to
be shown to the user as indicator
pull/2/head
Michail Vourlakos 7 years ago
parent 18151ec023
commit 4370878b12

@ -38,6 +38,7 @@ Rectangle {
property bool textWithBackgroundColor: false
property int radiusPerCentage: 100
property int minimumWidth: 0
property double circleOpacity: 1
property double fontPixelSize: partSize // * 0.55
@ -49,8 +50,11 @@ Rectangle {
property color alphaBackColor: Qt.rgba(theme.backgroundColor.r, theme.backgroundColor.g, theme.backgroundColor.b, 0.45)
property color alphaBackColor2: Qt.rgba(theme.backgroundColor.r, theme.backgroundColor.g, theme.backgroundColor.b, 0.8)
width: Math.max(minimumWidth, valueText.width + 4*units.smallSpacing)
color: theme.backgroundColor //mainItemContainer.badgeIndicator > 0 ? alphaBackColor2 : alphaBackColor
radius: (radiusPerCentage / 100) * (width / 2)
radius: (radiusPerCentage / 100) * (height / 2)
border.width: Math.max(1,width/64)
border.color: root.minimizedDotColor //alphaBackColor2
@ -106,19 +110,34 @@ Rectangle {
}
}
Rectangle {
id: badgerBackground
anchors.fill: canvas
color: canvas.drawColor
visible: proportion === 100 && showNumber
radius: parent.radius
}
Text {
id: valueText
anchors.centerIn: parent
text: {
if (showNumber) {
return numberValue > 0 ? numberValue : ""
if (numberValue > 9999) {
return i18nc("Over 9999 new messages, overlay, keep short", "9,999+");
} else if (numberValue > 0) {
return numberValue.toLocaleString(Qt.locale(), 'f', 0);
} else {
return "";
}
}
if (showText) {
return textValue;
}
}
font.pixelSize: 0.6 * parent.height
font.pixelSize: 0.55 * parent.height
font.bold: true
color: textWithBackgroundColor ? theme.backgroundColor : theme.textColor
visible: showNumber || showText

@ -322,15 +322,16 @@ Item{
Rectangle{
id: maskRect
width: parent.width/2
height: width
radius: width
width: Math.max(infoBadge.contentWidth, parent.width / 2)
height: parent.height / 2
radius: parent.height
visible: badgesLoader.showProgress
//! Removes any remainings from the icon around the roundness at the corner
Rectangle{
id: maskCorner
width:parent.width/2
height:parent.height/2
width: parent.width/2
height: parent.height/2
}
states: [
@ -436,6 +437,7 @@ Item{
} //end of sourceComponent
TaskProgressOverlay{
id: infoBadge
anchors.fill:parent
opacity: badgesLoader.opacityN
visible: badgesLoader.showProgress
@ -495,7 +497,7 @@ Item{
anchors.centerIn: parent
//opacity: taskNumberLoader.opacityN && !root.enableShadows ? 1 : 0
width: 0.4 * parent.width
minimumWidth: 0.4 * parent.width
height: width
numberValue: taskNumberLoader.fixedIndex < 10 ? taskNumberLoader.fixedIndex : 0
textValue: (keysArrayIndex>=0 && keysArrayIndex<10) ? keysAboveTen[keysArrayIndex] : ''

@ -27,10 +27,12 @@ import org.kde.latte 0.1 as Latte
Item {
id: background
readonly property int contentWidth: progressCircle.width + 0.1*height
Item {
id: subRectangle
width: parent.width/ 2
height: width
width: contentWidth
height: parent.height / 2
states: [
State {
@ -56,8 +58,8 @@ Item {
Latte.BadgeText {
id: progressCircle
anchors.centerIn: parent
width: 0.8 * parent.width
height: width
minimumWidth: 0.8 * parent.height
height: 0.8 * parent.height
numberValue: mainItemContainer.badgeIndicator > 0 ? mainItemContainer.badgeIndicator : centralItem.smartLauncherItem.count
fullCircle: true
showNumber: true

Loading…
Cancel
Save