18 import Ubuntu.Components 0.1
23 property string iconName
24 property int count: -1
25 property int progress: -1
26 property bool highlighted:
false
27 property bool itemFocused:
false
28 property real maxAngle: 0
29 property bool inverted:
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
43 onIconNameChanged: shaderEffectSource.scheduleUpdate();
44 onCountChanged: shaderEffectSource.scheduleUpdate();
45 onProgressChanged: shaderEffectSource.scheduleUpdate();
46 onHighlightedChanged: shaderEffectSource.scheduleUpdate();
47 onItemFocusedChanged: shaderEffectSource.scheduleUpdate();
51 width: parent.itemWidth + units.gu(1)
52 height: parent.itemHeight + units.gu(1)
53 anchors.centerIn: parent
58 anchors.margins: units.gu(1)
64 sourceSize.width: iconShape.width
65 sourceSize.height: iconShape.height
72 anchors.centerIn: iconItem
73 rotation: inverted ? 180 : 0
74 source: root.highlighted ?
"graphics/selected.sci" :
"graphics/non-selected.sci"
75 width: root.itemWidth + units.gu(0.5)
76 height: root.itemHeight + units.gu(0.5)
80 objectName:
"countEmblem"
86 width: Math.min(root.itemWidth, Math.max(units.gu(3), countLabel.implicitWidth + units.gu(2.5)))
88 source:
"graphics/notification.sci"
89 visible: root.count > 0
94 anchors.centerIn: parent
95 width: root.itemWidth - units.gu(1)
96 horizontalAlignment: Text.AlignHCenter
97 elide: Text.ElideRight
106 objectName:
"progressOverlay"
109 right: iconItem.right
110 bottom: iconItem.bottom
111 leftMargin: units.gu(1)
112 rightMargin: units.gu(1)
113 bottomMargin: units.gu(1)
115 height: units.gu(1.5)
116 visible: root.progress > -1
117 source:
"graphics/progressbar-trough.sci"
120 property int adjustedWidth: width - units.gu(2)
126 bottom: parent.bottom
128 width: Math.min(100, root.progress) / 100 * parent.adjustedWidth + units.gu(1)
135 bottom: parent.bottom
137 width: progressOverlay.width
138 source:
"graphics/progressbar-fill.sci"
143 objectName:
"focusedHighlight"
146 verticalCenter: parent.verticalCenter
148 visible: root.itemFocused
149 source:
"graphics/focused_app_arrow.png"
155 anchors.centerIn: parent
156 anchors.verticalCenterOffset: root.offset
157 width: iconItem.width
158 height: iconItem.height
159 property real itemOpacity: root.itemOpacity
160 property real brightness: Math.max(-1, root.brightness)
161 property real angle: root.angle
162 rotation: root.inverted ? 180 : 0
164 property variant source: ShaderEffectSource {
165 id: shaderEffectSource
177 axis { x: 1; y: 0; z: 0 }
178 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
179 angle: root.angle * 0.7
182 axis { x: 1; y: 0; z: 0 }
183 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
184 angle: root.angle * 0.7
187 axis { x: 1; y: 0; z: 0 }
188 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
189 angle: root.angle * 0.7
194 xScale: 1 - (Math.abs(angle) / 500)
195 yScale: 1 - (Math.abs(angle) / 500)
196 origin { x: iconItem.width / 2; y: iconItem.height / 2}
203 varying highp vec2 qt_TexCoord0;
204 uniform sampler2D source;
205 uniform lowp float brightness;
206 uniform lowp float itemOpacity;
209 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
210 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
211 sourceColor *= itemOpacity;
212 gl_FragColor = sourceColor;