/*SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport org.kde.kirigami as Kirigamiimport org.kde.graphicaleffects as KGraphicalEffectsimport org.kde.plasma.plasmoidItem {id: rootreadonly property int iconWidthDelta: (icon.width - icon.paintedWidth) / 2readonly property bool shiftBadgeDown: (Plasmoid.pluginName === "org.kde.plasma.icontasks") && task.audioStreamIcon !== nullItem {id: badgeMaskanchors.fill: parentRectangle {readonly property int offset: Math.round(Math.max(Kirigami.Units.smallSpacing / 2, badgeMask.width / 32))anchors.right: parent.rightanchors.rightMargin: -offsety: root.shiftBadgeDown ? (icon.height / 2) : 0Behavior on y {NumberAnimation { duration: Kirigami.Units.longDuration }}visible: task.smartLauncherItem.countVisiblewidth: badgeRect.width + offset * 2height: badgeRect.height + offset * 2radius: badgeRect.radius + offset * 2// Badge changes width based on number.onWidthChanged: maskShaderSource.scheduleUpdate()onVisibleChanged: maskShaderSource.scheduleUpdate()onYChanged: maskShaderSource.scheduleUpdate()}}ShaderEffectSource {id: iconShaderSourcesourceItem: iconhideSource: GraphicsInfo.api !== GraphicsInfo.Software}ShaderEffectSource {id: maskShaderSourcesourceItem: badgeMaskhideSource: truelive: false}KGraphicalEffects.BadgeEffect {id: shaderanchors.fill: parentsource: iconShaderSourcemask: maskShaderSourceonWidthChanged: maskShaderSource.scheduleUpdate()onHeightChanged: maskShaderSource.scheduleUpdate()}Badge {id: badgeRectanchors.right: parent.righty: {const offset = Math.round(Math.max(Kirigami.Units.smallSpacing / 2, badgeMask.width / 32));return offset + (root.shiftBadgeDown ? (icon.height / 2) : 0);}Behavior on y {NumberAnimation { duration: Kirigami.Units.longDuration }}height: Math.round(icon.paintedHeight * 0.45)visible: task.smartLauncherItem.countVisiblenumber: task.smartLauncherItem.count}}