Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a9d941b3 authored by Konrad Materka's avatar Konrad Materka

[applets/systemtray] Simplify icon size logic

Summary: This change simplifies icon size logic - now it is controled only in one place: AbstractItem. This gives additional benefits, like icons perfectly centered.

Test Plan: Highlights should always be centered

Reviewers: #plasma_workspaces, #plasma, ngraham, broulik, davidedmundson, apol

Reviewed By: #plasma_workspaces, #plasma, ngraham, broulik

Subscribers: mart, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28109
parent ecac6a60
...@@ -28,7 +28,7 @@ PlasmaCore.ToolTipArea { ...@@ -28,7 +28,7 @@ PlasmaCore.ToolTipArea {
property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
implicitWidth: units.iconSizes.smallMedium implicitWidth: units.iconSizes.smallMedium
implicitHeight: implicitWidth implicitHeight: implicitWidth
visible: root.hiddenLayout.contentItem.children.length > 0 visible: root.hiddenLayout.count > 0
subText: root.expanded ? i18n("Close popup") : i18n("Show hidden icons") subText: root.expanded ? i18n("Close popup") : i18n("Show hidden icons")
......
...@@ -74,8 +74,9 @@ MouseArea { ...@@ -74,8 +74,9 @@ MouseArea {
} }
CurrentItemHighLight { CurrentItemHighLight {
parent: hiddenTasksColumn.contentItem readonly property bool hiddenAppletActivated: root.activeApplet && root.activeApplet.parent && root.activeApplet.parent.inHiddenLayout
target: root.activeApplet && root.activeApplet.parent && root.activeApplet.parent.inHiddenLayout ? root.activeApplet.parent.parent : null parent: hiddenAppletActivated ? root.activeApplet.parent : hiddenTasksColumn.contentItem
location: PlasmaCore.Types.LeftEdge target: hiddenAppletActivated ? root.activeApplet.parent : null
location: LayoutMirroring.enabled ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.LeftEdge
} }
} }
...@@ -32,7 +32,7 @@ PlasmaCore.ToolTipArea { ...@@ -32,7 +32,7 @@ PlasmaCore.ToolTipArea {
property string itemId property string itemId
property alias text: label.text property alias text: label.text
property Item iconItem property alias iconContainer: iconContainer
property int /*PlasmaCore.Types.ItemStatus*/ status: model.status || PlasmaCore.Types.UnknownStatus property int /*PlasmaCore.Types.ItemStatus*/ status: model.status || PlasmaCore.Types.UnknownStatus
property int /*PlasmaCore.Types.ItemStatus*/ effectiveStatus: model.effectiveStatus || PlasmaCore.Types.UnknownStatus property int /*PlasmaCore.Types.ItemStatus*/ effectiveStatus: model.effectiveStatus || PlasmaCore.Types.UnknownStatus
readonly property bool inHiddenLayout: effectiveStatus === PlasmaCore.Types.PassiveStatus readonly property bool inHiddenLayout: effectiveStatus === PlasmaCore.Types.PassiveStatus
...@@ -72,7 +72,7 @@ PlasmaCore.ToolTipArea { ...@@ -72,7 +72,7 @@ PlasmaCore.ToolTipArea {
//END CONNECTIONS //END CONNECTIONS
PulseAnimation { PulseAnimation {
targetItem: iconItem targetItem: iconContainer
running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus || running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus ||
abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus ) && abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus ) &&
units.longDuration > 0 units.longDuration > 0
...@@ -87,7 +87,7 @@ PlasmaCore.ToolTipArea { ...@@ -87,7 +87,7 @@ PlasmaCore.ToolTipArea {
loops: 1 loops: 1
ScaleAnimator { ScaleAnimator {
target: iconItem target: iconContainer
from: 1 from: 1
to: 0.5 to: 0.5
duration: units.shortDuration duration: units.shortDuration
...@@ -95,7 +95,7 @@ PlasmaCore.ToolTipArea { ...@@ -95,7 +95,7 @@ PlasmaCore.ToolTipArea {
} }
ScaleAnimator { ScaleAnimator {
target: iconItem target: iconContainer
from: 0.5 from: 0.5
to: 1 to: 1
duration: units.shortDuration duration: units.shortDuration
...@@ -124,19 +124,27 @@ PlasmaCore.ToolTipArea { ...@@ -124,19 +124,27 @@ PlasmaCore.ToolTipArea {
} }
} }
PlasmaComponents.Label { Row {
id: label spacing: units.smallSpacing
anchors { anchors.horizontalCenter: inVisibleLayout ? parent.horizontalCenter : undefined
left: parent.left Item {
leftMargin: iconItem ? iconItem.width + units.smallSpacing : 0 id: iconContainer
verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.min(abstractItem.width, abstractItem.height)
height: width
property alias inHiddenLayout: abstractItem.inHiddenLayout
property alias inVisibleLayout: abstractItem.inVisibleLayout
} }
opacity: visible ? 1 : 0 PlasmaComponents.Label {
visible: abstractItem.inHiddenLayout && !root.activeApplet id: label
Behavior on opacity { anchors.verticalCenter: parent.verticalCenter
NumberAnimation { visible: abstractItem.inHiddenLayout && !root.activeApplet
duration: units.longDuration opacity: visible ? 1 : 0
easing.type: Easing.InOutQuad Behavior on opacity {
NumberAnimation {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
} }
} }
} }
......
...@@ -24,7 +24,6 @@ AbstractItem { ...@@ -24,7 +24,6 @@ AbstractItem {
id: plasmoidContainer id: plasmoidContainer
property Item applet: model.applet || null property Item applet: model.applet || null
iconItem: applet
text: applet ? applet.title : "" text: applet ? applet.title : ""
itemId: applet ? applet.pluginName : "" itemId: applet ? applet.pluginName : ""
...@@ -51,19 +50,6 @@ AbstractItem { ...@@ -51,19 +50,6 @@ AbstractItem {
} }
} }
onHeightChanged: {
if (applet) {
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
}
}
onWidthChanged: {
if (applet) {
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
}
}
//This is to make preloading effective, minimizes the scene changes //This is to make preloading effective, minimizes the scene changes
function preloadFullRepresentationItem(fullRepresentationItem) { function preloadFullRepresentationItem(fullRepresentationItem) {
if (fullRepresentationItem && fullRepresentationItem.parent === null) { if (fullRepresentationItem && fullRepresentationItem.parent === null) {
...@@ -75,11 +61,8 @@ AbstractItem { ...@@ -75,11 +61,8 @@ AbstractItem {
onAppletChanged: { onAppletChanged: {
if (applet) { if (applet) {
applet.parent = plasmoidContainer applet.parent = plasmoidContainer.iconContainer
applet.anchors.left = plasmoidContainer.left applet.anchors.fill = applet.parent
applet.anchors.verticalCenter = plasmoidContainer.verticalCenter
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
applet.visible = true applet.visible = true
preloadFullRepresentationItem(applet.fullRepresentationItem) preloadFullRepresentationItem(applet.fullRepresentationItem)
......
...@@ -30,10 +30,11 @@ AbstractItem { ...@@ -30,10 +30,11 @@ AbstractItem {
icon: model.ToolTipIcon !== "" ? model.ToolTipIcon : model.Icon ? model.Icon : model.IconName icon: model.ToolTipIcon !== "" ? model.ToolTipIcon : model.Icon ? model.Icon : model.IconName
textFormat: Text.AutoText textFormat: Text.AutoText
iconItem: iconItem
PlasmaCore.IconItem { PlasmaCore.IconItem {
id: iconItem id: iconItem
parent: taskIcon.iconContainer
anchors.fill: iconItem.parent
source: { source: {
if (model.status === PlasmaCore.Types.NeedsAttentionStatus) { if (model.status === PlasmaCore.Types.NeedsAttentionStatus) {
if (model.AttentionIcon) { if (model.AttentionIcon) {
...@@ -45,15 +46,7 @@ AbstractItem { ...@@ -45,15 +46,7 @@ AbstractItem {
} }
return model.Icon ? model.Icon : model.IconName return model.Icon ? model.Icon : model.IconName
} }
width: Math.min(parent.width, parent.height)
height: width
active: taskIcon.containsMouse active: taskIcon.containsMouse
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
} }
onContextMenu: { onContextMenu: {
......
...@@ -92,8 +92,9 @@ MouseArea { ...@@ -92,8 +92,9 @@ MouseArea {
} }
CurrentItemHighLight { CurrentItemHighLight {
visualParent: tasksGrid readonly property bool visibleAppletActivated: root.activeApplet && root.activeApplet.parent && root.activeApplet.parent.inVisibleLayout
target: root.activeApplet && root.activeApplet.parent && root.activeApplet.parent.inVisibleLayout ? root.activeApplet.parent.parent : root parent: visibleAppletActivated ? root.activeApplet.parent : root
target: visibleAppletActivated ? root.activeApplet.parent : root
location: plasmoid.location location: plasmoid.location
} }
......
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