~ahayzen/music-app/use-scrollview

« back to all changes in this revision

Viewing changes to app/components/Themes/Ambiance/BubbleShape.qml

  • Committer: Andrew Hayzen
  • Date: 2016-03-28 09:50:01 UTC
  • mfrom: (963.1.34 music-app)
  • mto: This revision was merged to the branch mainline in revision 967.
  • Revision ID: ahayzen@gmail.com-20160328095001-j6b33l2pbl4pgepe
* Merge of trunk
* Fixes for SongView to use PageHeader instead of PageHeadState

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 2015 Canonical Ltd.
 
2
 * Copyright 2016 Canonical Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU Lesser General Public License as published by
28
28
    /*!
29
29
      The background color of the bubble.
30
30
     */
31
 
    property color color: square ? theme.palette.normal.background : theme.palette.normal.overlay
 
31
    property color color: square
 
32
                            ? theme.palette.normal.background
 
33
                            : theme.palette.normal.overlay
32
34
 
33
35
    property point target
34
36
    property string direction: "down"
35
37
    property bool clipContent: false
36
38
    default property alias children: content.children
37
 
    // FIXME: This should not be necessary. See
38
 
    // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1214978
39
 
    property alias arrowSource: arrow.source
40
39
 
41
40
    implicitWidth: units.gu(10)
42
41
    implicitHeight: units.gu(8)
111
110
    UbuntuShape {
112
111
        anchors.fill: parent
113
112
        aspect: UbuntuShape.Flat
114
 
        backgroundColor: theme.palette.normal.overlay
 
113
        backgroundColor: bubbleShape.color
115
114
        source: bubbleShape.clipContent ? shapeSource : null
116
115
        visible: !square
117
116
    }
139
138
            visible: bubbleShape.clipContent
140
139
        }
141
140
    }
142
 
 
143
 
    Item {
144
 
        x: target.x
145
 
        y: target.y
146
 
 
147
 
        Image {
148
 
            id: arrow
149
 
 
150
 
            visible: !square && bubbleShape.direction != "none"
151
 
 
152
 
            function directionToRotation(direction) {
153
 
                switch (direction) {
154
 
                case "up":
155
 
                    return 180;
156
 
                case "left":
157
 
                    return 90;
158
 
                case "right":
159
 
                    return -90;
160
 
                default: // "down" or "none"
161
 
                    return 0;
162
 
                }
163
 
            }
164
 
 
165
 
            x: -width / 2.0
166
 
            y: -height
167
 
            transformOrigin: Item.Bottom
168
 
            rotation: directionToRotation(bubbleShape.direction)
169
 
            source: Qt.resolvedUrl("../artwork/bubble_arrow.png")
170
 
        }
171
 
    }
172
141
}