~mterry/unity8/split

« back to all changes in this revision

Viewing changes to Dash/Music/MusicFilterGrid.qml

  • Committer: Michael Terry
  • Date: 2013-10-15 17:48:24 UTC
  • mfrom: (138.2.326 trunk)
  • Revision ID: michael.terry@canonical.com-20131015174824-x1n7rx100b0ph8v4
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import QtQuick 2.0
18
18
import "../../Components"
19
 
 
20
 
FilterGrid {
21
 
    id: filterGrid
22
 
 
23
 
    minimumHorizontalSpacing: units.gu(2)
24
 
    maximumNumberOfColumns: 5
25
 
    delegateWidth: units.gu(17)
26
 
    delegateHeight: iconHeight + units.gu(3.5)
27
 
    verticalSpacing: units.gu(2)
28
 
 
29
 
    readonly property int iconWidth: (width / columns) * 0.8
30
 
    readonly property int iconHeight: iconWidth
31
 
 
32
 
    signal clicked(int index, var delegateItem, real itemY)
33
 
    signal pressAndHold(int index, var delegateItem, real itemY)
34
 
 
35
 
    delegate: AlbumTile {
 
19
import "../Generic"
 
20
 
 
21
GenericFilterGrid {
 
22
    id: filtergrid
 
23
 
 
24
    delegateWidth: units.gu(11)
 
25
    delegateHeight: units.gu(16)
 
26
 
 
27
    iconWidth: units.gu(11)
 
28
    iconHeight: units.gu(11)
 
29
 
 
30
    delegate: Tile {
36
31
        id: tile
37
32
        objectName: "delegate" + index
38
 
        width: filterGrid.cellWidth
39
 
        height: filterGrid.cellHeight
40
 
        iconWidth: filterGrid.iconWidth
41
 
        iconHeight: filterGrid.iconHeight
42
 
 
43
 
        artist: model.title
44
 
        album: model.comment
 
33
        width: filtergrid.cellWidth
 
34
        height: filtergrid.cellHeight
 
35
        text: model.comment
 
36
        imageWidth: filtergrid.iconWidth
 
37
        imageHeight: filtergrid.iconHeight
45
38
        source: model.icon
 
39
        maximumLineCount: 2
 
40
        horizontalAlignment: Text.AlignLeft
 
41
 
 
42
        style: MusicTileStyle {
 
43
            artist: model.title
 
44
        }
46
45
 
47
46
        onClicked: {
48
47
            var data = { model: model }
49
 
            filterGrid.clicked(index, data, tile.y)
 
48
            filtergrid.clicked(index, data, tile.y)
50
49
        }
51
50
 
52
51
        onPressAndHold: {
53
52
            var data = { model: model }
54
 
            filterGrid.pressAndHold(index, data, tile.y)
 
53
            filtergrid.pressAndHold(index, data, tile.y)
55
54
        }
56
55
    }
57
56
}