File: ListItemLayouts.qml

package info (click to toggle)
lomiri-ui-toolkit 1.3.5110%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 26,436 kB
  • sloc: cpp: 85,830; python: 5,537; sh: 1,344; javascript: 919; ansic: 573; makefile: 204
file content (268 lines) | stat: -rw-r--r-- 8,502 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
 * Copyright 2015 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import Lomiri.Components 1.3

Template {
    objectName: "listItemLayoutTemplate"

    TemplateSection {
        className: "ListItemLayout"
        title: "Examples of core apps list items"
        // no spacing between the list items in the Column
        spacing: 0

        ListItem {
            id: addressbookListItem
            height: addressbookLayout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: addressbookLayout

                title.color: LomiriColors.lightAubergine
                title.text: "Address book list item: Name goes here"

                Rectangle {
                    SlotsLayout.position: SlotsLayout.Leading
                    color: "pink"
                    height: units.gu(6)
                    width: height
                    visible: width > 0
                }
            }
        }

        ListItem {
            id: addressbookDetailsListItem
            height: addressbookDetailsLayout.height + (divider.visible ? divider.height : 0)
            ListItemLayout {
                id: addressbookDetailsLayout

                title.color: LomiriColors.lightAubergine
                title.text: "+12 3456789012"
                subtitle.text: "Mobile"

                Icon {
                    name: "message"
                    height: units.gu(2)
                }

                Icon {
                    name: "call-start"
                    height: units.gu(2)
                }
            }

        }


        ListItem {
            id: telegramContactsListItem

            height: telegramContactsLayout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: telegramContactsLayout
                title.text: "Telegram Name goes here"
                subtitle.text: "last seen 12:02"
                summary.text: "Oh wow! What a nice layout!"

                Rectangle {
                    id: imageShape
                    SlotsLayout.position: SlotsLayout.Leading
                    height: units.gu(6)
                    width: height
                    color: "red"
                }
            }
        }

        ListItem {
            id: systemSettings1
            height: systemSettings1_layout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: systemSettings1_layout
                title.text: "Call forwarding"

                ProgressionSlot {}

                Text {
                    font.pixelSize: FontUtils.sizeToPixels("medium")
                    text: "Off"
                    color: "#525252"
                }
            }
        }

        ListItem {
            id: systemSettings2
            height: systemSettings2_layout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: systemSettings2_layout
                title.text: "Flight mode"

                //see http://bazaar.launchpad.net/~lomiri-branches/lomiri/wily/lomiri-system-settings/wily-proposed/view/head:/src/qml/EntryComponent.qml
                Icon {
                    SlotsLayout.position: SlotsLayout.Leading
                    width: units.gu(6);
                    height: units.gu(6);
                    name: "airplane-mode"
                }
                Switch { }
            }
        }

        ListItem {
            id: systemSettings3
            height: systemSettings3_layout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: systemSettings3_layout
                title.text: "الفيسبوك"
                subtitle.text: "الفيسبوك"

                LayoutMirroring.enabled: true
                LayoutMirroring.childrenInherit: true

                ProgressionSlot {}

                Icon {
                    SlotsLayout.position: SlotsLayout.Leading
                    width: units.gu(6);
                    height: units.gu(6);
                    name: "facebook"
                }
            }
        }
    }

    TemplateSection {
        className: "ListItemLayout"
        title: "Custom labels properties"
        spacing: 0

        ListItem {
            height: customLabelsLayout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: customLabelsLayout
                title.text: "Lorem ipsum..."
                title.color: "blue"
                title.horizontalAlignment: Text.AlignHCenter

                subtitle.text: "..dolor sit amet, consectetur adipiscing elit..."
                subtitle.color: "red"
                subtitle.horizontalAlignment: Text.AlignHCenter

                summary.text: "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." +
                    "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi" +
                    "ut aliquip ex ea commodo consequat."
                summary.color: "green"
                summary.horizontalAlignment: Text.AlignHCenter
            }
        }
    }

    TemplateSection {
        className: "ListItemLayout"
        title: "With swiping actions"
        // no spacing between the list items in the Column
        spacing: 0

        ListItemActions {
            id: exampleLeadingActions
            actions: [
                Action {
                    iconName: "delete"
                }
            ]
        }
        ListItemActions {
            id: exampleTrailingActions
            actions: [
                Action {
                    iconName: "edit"
                },
                Action {
                    iconName: "save-to"
                }
            ]
        }

        ListItemWithLabel {
            title.text: i18n.tr("Leading and trailing actions")
            leadingActions: exampleLeadingActions
            trailingActions: exampleTrailingActions
        }

    }

    TemplateSection {
        className: "ListItemLayout"
        title: "Custom vertical positioning of slots"
        // no spacing between the list items in the Column
        spacing: 0

        ListItem {
            id: dialerHistoryListItem
            height: dialerHistoryLayout.height + (divider.visible ? divider.height : 0)

            ListItemLayout {
                id: dialerHistoryLayout

                title.text: "+12 3456789012 (3)"
                title.color: LomiriColors.lightAubergine
                subtitle.text: "Mobile"

                Rectangle {
                    SlotsLayout.position: SlotsLayout.Leading
                    color: "pink"
                    height: units.gu(6)
                    width: height
                    visible: width > 0
                }

                Item {
                    id: slot
                    width: label2.width
                    height: parent.height
                    //as we want to position labels to align with title and subtitle
                    SlotsLayout.overrideVerticalPositioning: true

                    Label {
                        id: lab
                        anchors.right: label2.right
                        text: "19:17"
                        fontSize: "small"
                        y: dialerHistoryLayout.mainSlot.y + dialerHistoryLayout.title.y
                           + dialerHistoryLayout.title.baselineOffset - baselineOffset
                    }

                    Label {
                        id: label2
                        text: "Outgoing"
                        fontSize: "small"
                        y: dialerHistoryLayout.mainSlot.y + dialerHistoryLayout.subtitle.y
                           + dialerHistoryLayout.subtitle.baselineOffset - baselineOffset
                    }
                }
            }
        }
    }
}