~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to qml/Dash/CardHeader.qml

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    property alias oldPrice: oldPriceLabel.text
27
27
    property alias altPrice: altPriceLabel.text
28
28
 
 
29
    property alias titleWeight: titleLabel.font.weight
 
30
 
 
31
    // FIXME: Saviq, used to scale fonts down in Carousel
 
32
    property real fontScale: 1.0
 
33
 
 
34
    property alias headerAlignment: titleLabel.horizontalAlignment
 
35
 
29
36
    visible: mascotImage.status === Image.Ready || title || price
30
 
    height: row.height > 0 ? row.height + row.spacing * 2 : 0
 
37
    height: row.height > 0 ? row.height + row.margins * 2 : 0
31
38
 
32
39
    Row {
33
40
        id: row
34
41
        objectName: "outerRow"
35
42
 
36
 
        anchors { top: parent.top; left: parent.left; right: parent.right; margins: spacing }
37
 
        spacing: units.gu(1)
 
43
        property real margins: units.gu(1)
 
44
 
 
45
        anchors {
 
46
            top: parent.top; left: parent.left; right: parent.right
 
47
            margins: margins
 
48
            leftMargin: spacing
 
49
            rightMargin: spacing
 
50
        }
 
51
        spacing: mascotShape.visible || (template && template["overlay"]) ? margins : 0
38
52
 
39
53
        UbuntuShape {
40
54
            id: mascotShape
41
55
            objectName: "mascotShape"
42
56
 
43
 
            width: units.gu(8)
44
 
            height: units.gu(8)
 
57
            // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
 
58
            width: units.gu(6)
 
59
            height: units.gu(5.625)
45
60
            visible: image.status === Image.Ready
 
61
            readonly property int maxSize: Math.max(width, height)
46
62
 
47
63
            image: Image {
48
64
                id: mascotImage
49
 
                sourceSize { width: mascotShape.width; height: mascotShape.height }
 
65
 
 
66
                sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
 
67
                fillMode: Image.PreserveAspectCrop
 
68
                horizontalAlignment: Image.AlignHCenter
 
69
                verticalAlignment: Image.AlignVCenter
50
70
            }
51
71
        }
52
72
 
53
73
        Column {
54
74
            objectName: "column"
55
75
            width: parent.width - x
 
76
            spacing: units.gu(0.5)
56
77
 
57
78
            Label {
58
79
                id: titleLabel
62
83
                font.weight: Font.DemiBold
63
84
                wrapMode: Text.Wrap
64
85
                maximumLineCount: 2
 
86
                fontSize: "small"
 
87
                font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
 
88
                color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
65
89
            }
66
90
 
67
91
            Label {
69
93
                objectName: "subtitleLabel"
70
94
                anchors { left: parent.left; right: parent.right }
71
95
                elide: Text.ElideRight
 
96
                font.weight: Font.Light
72
97
                visible: titleLabel.text && text
 
98
                fontSize: "x-small"
 
99
                font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
 
100
                color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
73
101
            }
74
102
 
75
103
            Row {