@@ -19,6 +19,7 @@
1919
2020import QtQuick 2.0
2121import Ubuntu.Components 0.1
22+import Ubuntu.Settings.Components 0.1
2223import Unity.Indicators 0.1 as Indicators
2324
2425Indicators.IndicatorBase {
@@ -67,64 +68,13 @@ Indicators.IndicatorBase {
6768 width: itemImage.width + units.gu(1)
6869 anchors { top: parent.top; bottom: parent.bottom }
6970
70− /*
71− FIXME: should use Icon and the theme system
72− There is an Icon component in the SDK that the colorization is copied from.
73− We can't use it here unfortunately due to lack of support for image source
74− URIs and keeping aspect ratio.
75−
76− Related bugs:
77− http://launchpad.net/bugs/1284235
78− http://launchpad.net/bugs/1284233
79− */
80−
81− Image {
71+ StatusIcon {
8272 id: itemImage
83− objectName: "itemImage"
8473 height: indicatorWidget.iconSize
85− sourceSize.height: height
8674 anchors.centerIn: parent
87−
88− onSourceChanged: console.debug(source)
89− visible: false
90−
91− property string iconPath: "/usr/share/icons/suru/status/scalable/%1.svg"
92− property var icons: modelData.replace("image://theme/", "").split(",")
93− property int fallback: 0
94−
95− onStatusChanged: if (status == Image.Error && fallback < icons.length - 1) fallback += 1;
96−
97− // Needed to not introduce a binding loop on source
98− onFallbackChanged: updateSource()
99− Component.onCompleted: updateSource()
100− onIconsChanged: updateSource()
101−
102− function updateSource() {
103− source = icons.length > 0 ? iconPath.arg(icons[fallback]) : "";
104− }
105− }
106−
107− ShaderEffect {
108− id: colorizedImage
109−
110− anchors.fill: itemImage
111−
112− property Image source: itemImage.status == Image.Ready ? itemImage : null
113− property color keyColorOut: "#CCCCCC"
114− property color keyColorIn: "#808080"
115− property real threshold: 0.1
116−
117− fragmentShader: "
118− varying highp vec2 qt_TexCoord0;
119− uniform sampler2D source;
120− uniform highp vec4 keyColorOut;
121− uniform highp vec4 keyColorIn;
122− uniform lowp float threshold;
123− uniform lowp float qt_Opacity;
124− void main() {
125− lowp vec4 sourceColor = texture2D(source, qt_TexCoord0);
126− gl_FragColor = mix(vec4(keyColorOut.rgb, 1.0) * sourceColor.a, sourceColor, step(threshold, distance(sourceColor.rgb / sourceColor.a, keyColorIn.rgb))) * qt_Opacity;
127− }"
75+ source: modelData
76+ sets: ["status"]
77+ color: "#CCCCCC"
12878 }
12979 }
13080 }