provide Progress information to indicators

--as a test case, the Plasma indicator now supports
the original plasma progress indicator of plasma
taskmanagers
pull/8/head
Michail Vourlakos 6 years ago
parent 153f5dab27
commit 551edf01fb

@ -66,6 +66,9 @@ Item{
readonly property bool animationsEnabled: root.animationsEnabled
readonly property real durationTime: root.durationTime
readonly property bool progressVisible: false /*since 0.9.2*/
readonly property real progress: 0 /*since 0.9.2*/
readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets
readonly property QtObject palette: colorizerManager.applyTheme

@ -56,32 +56,10 @@ PlasmaCore.FrameSvgItem {
return "south-active-tab";
} else {
return taskPrefix(basePrefix);
return root.taskPrefix(basePrefix);
}
}
function taskPrefix(prefix) {
var effectivePrefix;
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
effectivePrefix = "west-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
effectivePrefix = "north-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
effectivePrefix = "east-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
effectivePrefix = "south-" + prefix;
}
return [effectivePrefix, prefix];
}
states: [
State {
name: "launcher"

@ -52,6 +52,37 @@ LatteComponents.IndicatorItem {
sourceComponent: BackLayer{}
}
/* progress overlay for BackLayer*/
/* it is not added in the BackLayer because the BackLayer is rotated in some cases*/
Loader {
anchors.fill: parent
asynchronous: true
active: level.isBackground && indicator.progressVisible
sourceComponent: Item {
id: background
Item {
anchors {
top: parent.top
left: parent.left
bottom: parent.bottom
}
width: parent.width * (Math.min(indicator.progress, 100) / 100)
clip: true
PlasmaCore.FrameSvgItem {
id: progressFrame
width: background.width
height: background.height
imagePath: "widgets/tasks"
prefix: root.taskPrefix("progress").concat(root.taskPrefix("hover"))
}
}
}
}
//! Foreground Layer to draw arrows
Loader{
id: frontLayer
@ -61,4 +92,26 @@ LatteComponents.IndicatorItem {
sourceComponent: FrontLayer{}
}
function taskPrefix(prefix) {
var effectivePrefix;
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
effectivePrefix = "west-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
effectivePrefix = "north-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
effectivePrefix = "east-" + prefix;
}
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
effectivePrefix = "south-" + prefix;
}
return [effectivePrefix, prefix];
}
}

@ -67,6 +67,8 @@ Item{
readonly property color backgroundColor: iconImageBuffer.backgroundColor
readonly property color glowColor: iconImageBuffer.glowColor
readonly property bool progressVisible: smartLauncherItem && smartLauncherItem.progressVisible
readonly property real progress: smartLauncherItem && smartLauncherItem.progress
property QtObject buffers: null
property QtObject smartLauncherItem: null

@ -104,6 +104,9 @@ Item{
property color backgroundColor: taskIconItem.backgroundColor
property color glowColor: taskIconItem.glowColor
property bool progressVisible: taskIconItem.progressVisible
property real progress: taskIconItem.progress
property Item visualIconItem: taskIconItem.visualIconItem
property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent
property Item previewsTooltipVisualParent: taskIconItem.previewsTootipVisualParent

@ -69,6 +69,9 @@ Item {
readonly property bool animationsEnabled: root.animationsEnabled
readonly property real durationTime: root.durationTime
readonly property bool progressVisible: wrapper.progressVisible /*since 0.9.2*/
readonly property real progress: wrapper.progress /*since 0.9.2*/
readonly property bool usePlasmaTabsStyle: false
readonly property variant svgs: indicators ? indicators.svgs : []

Loading…
Cancel
Save