Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/items/AbstractItem.qml
Show All 26 Lines | 25 | PlasmaCore.ToolTipArea { | |||
---|---|---|---|---|---|
27 | 27 | | |||
28 | height: inVisibleLayout ? visibleLayout.cellHeight : hiddenLayout.iconItemHeight | 28 | height: inVisibleLayout ? visibleLayout.cellHeight : hiddenLayout.iconItemHeight | ||
29 | width: inVisibleLayout ? visibleLayout.cellWidth : hiddenLayout.width | 29 | width: inVisibleLayout ? visibleLayout.cellWidth : hiddenLayout.width | ||
30 | 30 | | |||
31 | property var model: itemModel | 31 | property var model: itemModel | ||
32 | 32 | | |||
33 | property string itemId | 33 | property string itemId | ||
34 | property alias text: label.text | 34 | property alias text: label.text | ||
35 | property Item iconItem | 35 | property alias iconContainer: iconContainer | ||
36 | property int /*PlasmaCore.Types.ItemStatus*/ status: model.status || PlasmaCore.Types.UnknownStatus | 36 | property int /*PlasmaCore.Types.ItemStatus*/ status: model.status || PlasmaCore.Types.UnknownStatus | ||
37 | property int /*PlasmaCore.Types.ItemStatus*/ effectiveStatus: model.effectiveStatus || PlasmaCore.Types.UnknownStatus | 37 | property int /*PlasmaCore.Types.ItemStatus*/ effectiveStatus: model.effectiveStatus || PlasmaCore.Types.UnknownStatus | ||
38 | readonly property bool inHiddenLayout: effectiveStatus === PlasmaCore.Types.PassiveStatus | 38 | readonly property bool inHiddenLayout: effectiveStatus === PlasmaCore.Types.PassiveStatus | ||
39 | readonly property bool inVisibleLayout: effectiveStatus === PlasmaCore.Types.ActiveStatus | 39 | readonly property bool inVisibleLayout: effectiveStatus === PlasmaCore.Types.ActiveStatus | ||
40 | 40 | | |||
41 | signal clicked(var mouse) | 41 | signal clicked(var mouse) | ||
42 | signal pressed(var mouse) | 42 | signal pressed(var mouse) | ||
43 | signal wheel(var wheel) | 43 | signal wheel(var wheel) | ||
Show All 23 Lines | 66 | onContainsMouseChanged: { | |||
67 | if (inHiddenLayout && containsMouse) { | 67 | if (inHiddenLayout && containsMouse) { | ||
68 | root.hiddenLayout.currentIndex = index | 68 | root.hiddenLayout.currentIndex = index | ||
69 | } | 69 | } | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | //END CONNECTIONS | 72 | //END CONNECTIONS | ||
73 | 73 | | |||
74 | PulseAnimation { | 74 | PulseAnimation { | ||
75 | targetItem: iconItem | 75 | targetItem: iconContainer | ||
76 | running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus || | 76 | running: (abstractItem.status === PlasmaCore.Types.NeedsAttentionStatus || | ||
77 | abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus ) && | 77 | abstractItem.status === PlasmaCore.Types.RequiresAttentionStatus ) && | ||
78 | units.longDuration > 0 | 78 | units.longDuration > 0 | ||
79 | } | 79 | } | ||
80 | 80 | | |||
81 | function activated() { | 81 | function activated() { | ||
82 | activatedAnimation.start() | 82 | activatedAnimation.start() | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | SequentialAnimation { | 85 | SequentialAnimation { | ||
86 | id: activatedAnimation | 86 | id: activatedAnimation | ||
87 | loops: 1 | 87 | loops: 1 | ||
88 | 88 | | |||
89 | ScaleAnimator { | 89 | ScaleAnimator { | ||
90 | target: iconItem | 90 | target: iconContainer | ||
91 | from: 1 | 91 | from: 1 | ||
92 | to: 0.5 | 92 | to: 0.5 | ||
93 | duration: units.shortDuration | 93 | duration: units.shortDuration | ||
94 | easing.type: Easing.InQuad | 94 | easing.type: Easing.InQuad | ||
95 | } | 95 | } | ||
96 | 96 | | |||
97 | ScaleAnimator { | 97 | ScaleAnimator { | ||
98 | target: iconItem | 98 | target: iconContainer | ||
99 | from: 0.5 | 99 | from: 0.5 | ||
100 | to: 1 | 100 | to: 1 | ||
101 | duration: units.shortDuration | 101 | duration: units.shortDuration | ||
102 | easing.type: Easing.OutQuad | 102 | easing.type: Easing.OutQuad | ||
103 | } | 103 | } | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | MouseArea { | 106 | MouseArea { | ||
Show All 12 Lines | |||||
119 | onWheel: { | 119 | onWheel: { | ||
120 | abstractItem.wheel(wheel); | 120 | abstractItem.wheel(wheel); | ||
121 | //Don't accept the event in order to make the scrolling by mouse wheel working | 121 | //Don't accept the event in order to make the scrolling by mouse wheel working | ||
122 | //for the parent scrollview this icon is in. | 122 | //for the parent scrollview this icon is in. | ||
123 | wheel.accepted = false; | 123 | wheel.accepted = false; | ||
124 | } | 124 | } | ||
125 | } | 125 | } | ||
126 | 126 | | |||
127 | Row { | ||||
128 | spacing: units.smallSpacing | ||||
129 | anchors.horizontalCenter: inVisibleLayout ? parent.horizontalCenter : undefined | ||||
130 | Item { | ||||
131 | id: iconContainer | ||||
132 | anchors.verticalCenter: parent.verticalCenter | ||||
133 | width: Math.min(abstractItem.width, abstractItem.height) | ||||
134 | height: width | ||||
135 | property alias inHiddenLayout: abstractItem.inHiddenLayout | ||||
136 | property alias inVisibleLayout: abstractItem.inVisibleLayout | ||||
137 | } | ||||
127 | PlasmaComponents.Label { | 138 | PlasmaComponents.Label { | ||
128 | id: label | 139 | id: label | ||
129 | anchors { | 140 | anchors.verticalCenter: parent.verticalCenter | ||
130 | left: parent.left | | |||
131 | leftMargin: iconItem ? iconItem.width + units.smallSpacing : 0 | | |||
132 | verticalCenter: parent.verticalCenter | | |||
133 | } | | |||
134 | opacity: visible ? 1 : 0 | | |||
135 | visible: abstractItem.inHiddenLayout && !root.activeApplet | 141 | visible: abstractItem.inHiddenLayout && !root.activeApplet | ||
142 | opacity: visible ? 1 : 0 | ||||
136 | Behavior on opacity { | 143 | Behavior on opacity { | ||
137 | NumberAnimation { | 144 | NumberAnimation { | ||
138 | duration: units.longDuration | 145 | duration: units.longDuration | ||
139 | easing.type: Easing.InOutQuad | 146 | easing.type: Easing.InOutQuad | ||
140 | } | 147 | } | ||
141 | } | 148 | } | ||
142 | } | 149 | } | ||
143 | } | 150 | } | ||
151 | } | ||||
144 | 152 | |