~fboucault/unity-2d/dash_lens_bar_robust_icon

« back to all changes in this revision

Viewing changes to places/FilterPane.qml

  • Committer: Florian Boucault
  • Date: 2011-08-25 14:25:43 UTC
  • mfrom: (653.2.41 backend_filters)
  • Revision ID: florian@boucault.net-20110825142543-z60gvz5unwgw1fjv
[dash] New filters pane on the right hand side of the search results.

Implemented filters:
- multirange
- checkoption
- ratings

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import Effects 1.0
21
21
 
22
22
FocusScope {
23
 
    id: searchRefine
 
23
    id: filterPane
24
24
 
25
25
    property bool folded: true
26
26
    property int headerHeight
51
51
                    color: "white"
52
52
                }
53
53
 
54
 
        onClicked: searchRefine.folded = !searchRefine.folded
 
54
        onClicked: filterPane.folded = !filterPane.folded
55
55
 
56
56
        focus: true
57
57
 
58
58
        /* Do not navigate down to the options if they are folded */
59
 
        KeyNavigation.down: !searchRefine.folded ? options : header
 
59
        KeyNavigation.down: !filterPane.folded ? options : header
60
60
 
61
61
        anchors.left: parent.left
62
62
        anchors.right: parent.right
79
79
        FoldingArrow {
80
80
            id: arrow
81
81
 
82
 
            folded: searchRefine.folded
 
82
            folded: filterPane.folded
83
83
 
84
84
            anchors.verticalCenter: title.verticalCenter
85
85
            anchors.right: parent.right
86
86
        }
87
87
    }
88
88
 
89
 
    VisualItemModel {
90
 
        id: optionsModel
91
 
 
92
 
        SearchRefineOptionType {
93
 
            title: u2d.tr("Type")
94
 
            lens: searchRefine.lens
95
 
        }
96
 
    }
97
 
 
98
89
    ListView {
99
90
        id: options
100
91
 
 
92
        clip: true
101
93
        opacity: folded ? 0.0 : 1.0
102
94
        Behavior on opacity {NumberAnimation {duration: 100; easing.type: Easing.InOutQuad}}
103
95
 
109
101
        anchors.topMargin: 7
110
102
        anchors.bottom: parent.bottom
111
103
        orientation: ListView.Vertical
 
104
        spacing: 12
112
105
 
113
106
        /* Make sure the first section is selected when getting the focus */
114
107
        currentIndex: 0
123
116
        /* Non-draggable when all items are visible */
124
117
        boundsBehavior: Flickable.StopAtBounds
125
118
 
126
 
        model: optionsModel
 
119
        model: filterPane.lens != undefined ? filterPane.lens.filters : undefined
 
120
        /* Dynamically load the QML file corresponding to filter.rendererName.
 
121
           For example, if filter.rendererName == "filter-checkoption" then
 
122
           load "FilterCheckoption.qml".
 
123
        */
 
124
        delegate: FilterLoader {
 
125
            width: ListView.view.width
 
126
            lens: filterPane.lens
 
127
            filterModel: filter
 
128
            isFirst: index == 0
 
129
        }
127
130
    }
128
131
}