~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntu-shape-icon

« back to all changes in this revision

Viewing changes to examples/ubuntu-ui-toolkit-gallery/ActionBars.qml

  • Committer: Loïc Molinari
  • Date: 2015-08-06 13:16:24 UTC
  • mfrom: (1568.1.24 staging)
  • Revision ID: loic.molinari@canonical.com-20150806131624-vbtvrvpu5z1bapd8
Merged lp:ubuntu-ui-toolkit/staging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2015 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.4
 
18
import Ubuntu.Components 1.3
 
19
 
 
20
Template {
 
21
    objectName: "actionBarTemplate"
 
22
 
 
23
    property list<Action> actionList:  [
 
24
        Action {
 
25
            iconName: "alarm-clock"
 
26
            text: "Tick tock"
 
27
        },
 
28
        Action {
 
29
            iconName: "appointment"
 
30
            text: "Date"
 
31
        },
 
32
        Action {
 
33
            iconName: "attachment"
 
34
            text: "Attach"
 
35
        },
 
36
        Action {
 
37
            iconName: "contact"
 
38
            text: "Contact"
 
39
        },
 
40
        Action {
 
41
            iconName: "like"
 
42
            text: "Like"
 
43
        },
 
44
        Action {
 
45
            iconName: "lock"
 
46
            text: "Lock"
 
47
        }
 
48
    ]
 
49
 
 
50
    property list<Action> shortActionList: [
 
51
        Action {
 
52
            iconName: "share"
 
53
            text: "Share"
 
54
        },
 
55
        Action {
 
56
            iconName: "starred"
 
57
            text: "Favorite"
 
58
        }
 
59
    ]
 
60
 
 
61
    head.actions: actionList
 
62
 
 
63
    TemplateSection {
 
64
        title: "ActionBar"
 
65
        className: "ActionBar"
 
66
 
 
67
        TemplateRow {
 
68
            title: i18n.tr("Short list")
 
69
            titleWidth: units.gu(15)
 
70
 
 
71
            ActionBar {
 
72
                // no numberOfSlots specified. Using default value.
 
73
                id: shortBar
 
74
                actions: shortActionList
 
75
            }
 
76
        }
 
77
 
 
78
        TemplateRow {
 
79
            title: i18n.tr("Number of slots")
 
80
            titleWidth: units.gu(15)
 
81
            Slider {
 
82
                width: units.gu(20)
 
83
                id: numberOfActionsSlider
 
84
                minimumValue: 1
 
85
                maximumValue: 8
 
86
                value: 3
 
87
                live: true
 
88
            }
 
89
        }
 
90
 
 
91
        TemplateRow {
 
92
            title: i18n.tr("Long list")
 
93
            titleWidth: units.gu(15)
 
94
            ActionBar {
 
95
                id: bar
 
96
                numberOfSlots: numberOfActionsSlider.value.toFixed(0)
 
97
                actions: actionList
 
98
            }
 
99
        }
 
100
 
 
101
        TemplateRow {
 
102
            title: i18n.tr("Disabled")
 
103
            titleWidth: units.gu(15)
 
104
            ActionBar {
 
105
                enabled: false
 
106
                id: disabledBar
 
107
                numberOfSlots: numberOfActionsSlider.value.toFixed(0)
 
108
                actions: actionList
 
109
            }
 
110
        }
 
111
    }
 
112
}