Commit 0490f101 authored by George Vogiatzis's avatar George Vogiatzis Committed by Nate Graham
Browse files

Mark applications that play audio, for all task icon sizes

Summary:
Fix cases where indicator not showing. Eg. icon-only task manager.
Place the indicator in the top right corner of the icon. And move it to the side or top if there is enough space.
Audio icon will no more move the task icon off-center.
When placed in the corner, use a smaller click area for muting audio, to avoid accidental mute.
Click area drops to 0.45 and Icon size to 0.63 from what would normally had.

Issues:
Has overlapping issues with other overlays: badge, and group expander.
Poor visibility.
Breeze icon is off center and overlaps(with the blue line at the right). For now,
moved audio icon a touch left, some other theme icons may look off-center.

BUG: 381656
FIXED-IN: 5.18.0

{F7814299}

Reviewers: #vdg, #plasma, ndavis, ngraham, hein

Reviewed By: #vdg, #plasma, ngraham, hein

Subscribers: plasma-devel, hein, ngraham

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25925
parent 6e813baf
......@@ -36,7 +36,7 @@ Item {
}
PropertyChanges {
target: audioStreamIcon
source: "audio-volume-high"
elementId: "audio-volume-high"
}
},
State {
......@@ -48,7 +48,7 @@ Item {
}
PropertyChanges {
target: audioStreamIcon
source: "audio-volume-muted"
elementId: "audio-volume-muted"
}
}
]
......@@ -88,13 +88,86 @@ Item {
]
opacity: 0
// The indicator should still shown even if the label is hidden,
// but only if there's enough room for it.
visible: opacity > 0 && (task.width > icon.paintedWidth + audioStreamIconBox.width)
// Do not display the indicator if the icons are too small.
visible: opacity > 0 && Math.min(iconBox.width, iconBox.height) >= units.iconSizes.small
PlasmaCore.IconItem {
PlasmaCore.Svg {
id: audioSvg
imagePath: "icons/audio"
}
PlasmaCore.SvgItem {
id: audioStreamIcon
anchors.fill: parent
svg: audioSvg
smooth: false
height: Math.round(Math.min(parent.height * 1.4, units.iconSizes.smallMedium) / 2) * 2
width: height
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
// Avoid overlap to the right.
rightMargin: (parent.width - width) / 2 + units.smallSpacing / 4
}
states: [
State {
name: "horizontal"
// When there is enough space for the audio icon, to fit right of the centered task icon.
when: (frame.width > Math.min(iconBox.width, iconBox.height) +
Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium) * 2)
AnchorChanges {
target: audioStreamIconLoader
anchors.top: undefined
anchors.verticalCenter: frame.verticalCenter
}
PropertyChanges {
target: audioStreamIconLoader
anchors.rightMargin: iconBox.adjustMargin(true, parent.width, taskFrame.margins.right)
width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium))
}
PropertyChanges {
target: audioStreamIcon
height: parent.height
width: parent.width
}
},
State {
name: "vertical"
// When audio icon can fit above the centered task icon.
when: (frame.height > Math.min(iconBox.width, iconBox.height) +
Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium) * 2)
AnchorChanges {
target: audioStreamIconLoader
anchors.right: undefined
anchors.horizontalCenter: frame.horizontalCenter
}
PropertyChanges {
target: audioStreamIconLoader
anchors.topMargin: iconBox.adjustMargin(false, frame.height, taskFrame.margins.top)
width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium))
}
PropertyChanges {
target: audioStreamIcon
height: parent.height
width: parent.width
}
}
]
}
MouseArea {
......
......@@ -457,7 +457,7 @@ MouseArea {
// the text label margin, which derives from the icon width.
State {
name: "standalone"
when: !label.visible && !audioStreamIconLoader.shown
when: !label.visible
AnchorChanges {
target: iconBox
......@@ -494,13 +494,14 @@ MouseArea {
readonly property bool shown: item && item.visible
source: "AudioStream.qml"
width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium))
width: Math.min(Math.min(iconBox.width, iconBox.height) * 0.45, units.iconSizes.smallMedium)
height: width
anchors {
right: parent.right
rightMargin: iconBox.adjustMargin(true, parent.width, taskFrame.margins.right)
verticalCenter: parent.verticalCenter
right: frame.right
top: frame.top
rightMargin: iconBox.adjustMargin(true, parent.width, taskFrame.margins.right) + units.smallSpacing / 2
topMargin: iconBox.adjustMargin(true, parent.width, taskFrame.margins.top) + units.smallSpacing / 2
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment