Commit a35d2b9a authored by George Vogiatzis's avatar George Vogiatzis Committed by Nate Graham

[Applet/Task Manager] Move audio indicator to the corner

Summary:
When vertical or Icon-only task manager, shrink click area 10% and
indicator 30%.
This allows moving it closer to the corner, away from the center,
to avoid accidental audio muting.

BUG: 416553
FIXED-IN: 5.19.0

Test Plan:
With patch
{F7919362}

Reviewers: #vdg, #plasma, hein, ngraham

Reviewed By: #vdg, ngraham

Subscribers: broulik, Fuchs, ndavis, filipf, cblack, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26861
parent 37e9bd06
......@@ -106,25 +106,35 @@ MouseArea {
PlasmaCore.SvgItem {
id: audioStreamIcon
// Need audio indicator twice, to keep iconBox in the center.
readonly property var requiredSpace: Math.min(iconBox.width, iconBox.height)
+ Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium) * 2
svg: audioSvg
smooth: false
height: Math.round(Math.min(parent.height * 1.4, units.iconSizes.smallMedium) / 2) * 2
height: Math.round(Math.min(parent.height * indicatorScale, units.iconSizes.smallMedium))
width: height
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
// Avoid overlap to the right.
rightMargin: (parent.width - width) / 2 + units.smallSpacing / 4
horizontalCenter: parent.horizontalCenter
}
states: [
State {
name: "verticalIconsOnly"
when: tasks.vertical && frame.width < audioStreamIcon.requiredSpace
PropertyChanges {
target: audioStreamIconLoader
anchors.rightMargin: Math.round(taskFrame.margins.right * indicatorScale)
}
},
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)
when: frame.width > audioStreamIcon.requiredSpace
AnchorChanges {
target: audioStreamIconLoader
......@@ -135,8 +145,6 @@ MouseArea {
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))
}
......@@ -150,9 +158,7 @@ MouseArea {
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)
when: frame.height > audioStreamIcon.requiredSpace
AnchorChanges {
target: audioStreamIconLoader
......@@ -164,7 +170,7 @@ MouseArea {
PropertyChanges {
target: audioStreamIconLoader
anchors.topMargin: iconBox.adjustMargin(false, frame.height, taskFrame.margins.top)
anchors.topMargin: taskFrame.margins.top
width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium))
}
......
......@@ -492,16 +492,17 @@ MouseArea {
id: audioStreamIconLoader
readonly property bool shown: item && item.visible
readonly property var indicatorScale: 1.2
source: "AudioStream.qml"
width: Math.min(Math.min(iconBox.width, iconBox.height) * 0.45, units.iconSizes.smallMedium)
width: Math.min(Math.min(iconBox.width, iconBox.height) * 0.4, units.iconSizes.smallMedium)
height: width
anchors {
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
rightMargin: taskFrame.margins.right
topMargin: Math.round(taskFrame.margins.top * indicatorScale)
}
}
......
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