1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-30 14:50:12 +03:00

add BadgeText in Latte lib from the plasmoid

-- move BadgeText in Latte lib in order to be able
to be used from plasmoid and containment at the
same time
This commit is contained in:
Michail Vourlakos 2018-02-25 17:31:10 +02:00
parent 1e57260c5f
commit e92b570a4f
4 changed files with 12 additions and 7 deletions

View File

@ -35,6 +35,7 @@ Rectangle {
property bool fullCircle: true
property bool showNumber: true
property bool showText: false
property bool textWithBackgroundColor: false
property int radiusPerCentage: 100
@ -119,12 +120,8 @@ Rectangle {
}
font.pixelSize: 0.6 * parent.height
font.bold: true
color: useBackgroundColor ? theme.backgroundColor : theme.textColor
color: textWithBackgroundColor ? theme.backgroundColor : theme.textColor
visible: showNumber || showText
property bool useBackgroundColor: ( (mainItemContainer.badgeIndicator > 0)
|| (centralItem.smartLauncherItem.countVisible && !centralItem.smartLauncherItem.progressVisible) )
&& proportion>0
}

View File

@ -2,3 +2,4 @@ module org.kde.latte
plugin lattedockplugin
GlowPoint 0.1 GlowPoint.qml
BadgeText 0.1 BadgeText.qml

View File

@ -489,7 +489,7 @@ Item{
}
}
CircleText {
Latte.BadgeText {
id: taskNumber
anchors.centerIn: parent
//opacity: taskNumberLoader.opacityN && !root.enableShadows ? 1 : 0

View File

@ -22,6 +22,8 @@ import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.1 as Latte
Item {
id: background
@ -51,7 +53,7 @@ Item {
}
]
CircleText {
Latte.BadgeText {
id: progressCircle
anchors.centerIn: parent
width: 0.8 * parent.width
@ -59,6 +61,11 @@ Item {
numberValue: mainItemContainer.badgeIndicator > 0 ? mainItemContainer.badgeIndicator : centralItem.smartLauncherItem.count
fullCircle: true
showNumber: true
textWithBackgroundColor: ( (mainItemContainer.badgeIndicator > 0)
|| (centralItem.smartLauncherItem.countVisible && !centralItem.smartLauncherItem.progressVisible) )
&& proportion>0
proportion: {
if (mainItemContainer.badgeIndicator > 0 ||
(centralItem.smartLauncherItem.countVisible && !centralItem.smartLauncherItem.progressVisible)) {