18 import Ubuntu.Components 0.1
23 property string iconName
24 property int count: -1
25 property int progress: -1
26 property bool itemFocused:
false
27 property real maxAngle: 0
28 property bool inverted:
false
29 property bool clipCorner:
false
31 readonly
property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
32 readonly
property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
34 property int itemWidth
35 property int itemHeight
37 property real angle: 0
39 property real offset: 0
40 property real itemOpacity: 1
41 property real brightness: 0
45 width: parent.itemWidth + units.gu(1)
46 height: parent.itemHeight + units.gu(1)
47 anchors.centerIn: parent
52 anchors.margins: units.gu(1)
58 sourceSize.width: iconShape.width
59 sourceSize.height: iconShape.height
60 fillMode: Image.PreserveAspectCrop
67 anchors.centerIn: iconItem
68 source:
"graphics/icon-top-highlight.png"
69 width: root.itemWidth - units.gu(1)
70 height: root.itemHeight - units.gu(1)
74 objectName:
"countEmblem"
80 width: Math.min(root.itemWidth, Math.max(units.gu(3), countLabel.implicitWidth + units.gu(2.5)))
82 source:
"graphics/notification.sci"
83 visible: root.count > 0
88 anchors.centerIn: parent
89 width: root.itemWidth - units.gu(1)
90 horizontalAlignment: Text.AlignHCenter
91 elide: Text.ElideRight
100 objectName:
"progressOverlay"
103 right: iconItem.right
104 bottom: iconItem.bottom
105 leftMargin: units.gu(1)
106 rightMargin: units.gu(1)
107 bottomMargin: units.gu(1)
109 height: units.gu(1.5)
110 visible: root.progress > -1
111 source:
"graphics/progressbar-trough.sci"
114 property int adjustedWidth: width - units.gu(2)
120 bottom: parent.bottom
122 width: Math.min(100, root.progress) / 100 * parent.adjustedWidth + units.gu(1)
129 bottom: parent.bottom
131 width: progressOverlay.width
132 source:
"graphics/progressbar-fill.sci"
137 objectName:
"focusedHighlight"
140 verticalCenter: parent.verticalCenter
142 visible: root.itemFocused
143 source:
"graphics/focused_app_arrow.png"
149 anchors.centerIn: parent
150 width: iconItem.width
151 height: iconItem.height
155 topMargin: -units.gu(2)
156 leftMargin: -units.gu(2)
157 rightMargin: -units.gu(2)
158 bottomMargin: units.gu(1.2)
161 rotation: root.rotation + 45
167 anchors.centerIn: parent
168 anchors.verticalCenterOffset: root.offset
169 width: iconItem.width
170 height: iconItem.height
171 property real itemOpacity: root.itemOpacity
172 property real brightness: Math.max(-1, root.brightness)
173 property real angle: root.angle
174 property bool clipCorner: root.clipCorner
175 rotation: root.inverted ? 180 : 0
177 property variant source: ShaderEffectSource {
178 id: shaderEffectSource
183 property var mask: ShaderEffectSource {
194 axis { x: 1; y: 0; z: 0 }
195 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
196 angle: root.angle * 0.7
199 axis { x: 1; y: 0; z: 0 }
200 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
201 angle: root.angle * 0.7
204 axis { x: 1; y: 0; z: 0 }
205 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
206 angle: root.angle * 0.7
211 xScale: 1 - (Math.abs(angle) / 500)
212 yScale: 1 - (Math.abs(angle) / 500)
213 origin { x: iconItem.width / 2; y: iconItem.height / 2}
220 varying highp vec2 qt_TexCoord0;
221 uniform sampler2D source;
222 uniform sampler2D mask;
223 uniform lowp float brightness;
224 uniform lowp float itemOpacity;
225 uniform bool clipCorner;
228 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
229 highp vec4 maskColor = texture2D(mask, qt_TexCoord0);
230 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
231 sourceColor *= itemOpacity;
233 sourceColor *= maskColor.a;
235 gl_FragColor = sourceColor;