@@ -24,11 +24,13 @@ Item {
2424 id: root
2525
2626 property url source
27+ // TODO convert into enums when available in QML
28+ property string scaleTo
2729
28− property real initialWidth: sourceSize.width > -1 ? sourceSize.width : units.gu(10)
29− property real initialHeight: sourceSize.height > -1 ? sourceSize.height : units.gu(10)
30− property size sourceSize
30+ property real initialWidth: units.gu(10)
31+ property real initialHeight: units.gu(10)
3132
33+ property alias sourceSize: image.sourceSize
3234 property alias fillMode: image.fillMode
3335 property alias asynchronous: image.asynchronous
3436 property alias cache: image.cache
@@ -87,23 +89,15 @@ Item {
8789
8890 property url nextSource
8991
90− width: {
91− if (root.sourceSize.width > -1) return root.sourceSize.width;
92− if (root.sourceSize.height > -1) return implicitWidth * root.sourceSize.height / implicitHeight
93− return implicitWidth
94− }
95− height: {
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
99− }
92+ width: root.scaleTo == "height" ? implicitWidth * root.height / implicitHeight : implicitWidth
93+ height: root.scaleTo == "width" ? implicitHeight * root.width / implicitWidth : implicitHeight
10094 fillMode: Image.PreserveAspectCrop
10195 asynchronous: true
10296 cache: false
10397 horizontalAlignment: Image.AlignHCenter
10498 verticalAlignment: Image.AlignVCenter
105− sourceSize.width: root.sourceSize.width
106− sourceSize.height: root.sourceSize.height
99+ sourceSize.width: root.scaleTo == "width" ? root.width : 0
100+ sourceSize.height: root.scaleTo == "height" ? root.height : 0
107101 }
108102 }
109103