@@ -24,11 +24,13 @@ Item {
26 property url source
26 property url source
27+ // TODO convert into enums when available in QML
28+ property string scaleTo
28− property real initialWidth: sourceSize.width > -1 ? sourceSize.width : units.gu(10)
30+ property real initialWidth: units.gu(10)
29− property real initialHeight: sourceSize.height > -1 ? sourceSize.height : units.gu(10)
31+ property real initialHeight: units.gu(10)
30− property size sourceSize
33+ property alias sourceSize: image.sourceSize
32 property alias fillMode: image.fillMode
34 property alias fillMode: image.fillMode
33 property alias asynchronous: image.asynchronous
35 property alias asynchronous: image.asynchronous
34 property alias cache: image.cache
36 property alias cache: image.cache
@@ -87,23 +89,15 @@ Item {
88 property url nextSource
90 property url nextSource
91− if (root.sourceSize.width > -1) return root.sourceSize.width;
92− if (root.sourceSize.height > -1) return implicitWidth * root.sourceSize.height / implicitHeight
92+ width: root.scaleTo == "height" ? implicitWidth * root.height / implicitHeight : implicitWidth
93− return implicitWidth
93+ height: root.scaleTo == "width" ? implicitHeight * root.width / implicitWidth : implicitHeight
96− if (root.sourceSize.height > -1) return root.sourceSize.height;
97− if (root.sourceSize.width > -1) return implicitHeight* root.sourceSize.width / implicitWidth
98− return implicitHeight
100 fillMode: Image.PreserveAspectCrop
94 fillMode: Image.PreserveAspectCrop
101 asynchronous: true
95 asynchronous: true
102 cache: false
96 cache: false
103 horizontalAlignment: Image.AlignHCenter
97 horizontalAlignment: Image.AlignHCenter
104 verticalAlignment: Image.AlignVCenter
98 verticalAlignment: Image.AlignVCenter
105− sourceSize.width: root.sourceSize.width
99+ sourceSize.width: root.scaleTo == "width" ? root.width : 0
106− sourceSize.height: root.sourceSize.height
100+ sourceSize.height: root.scaleTo == "height" ? root.height : 0