~danielholm/musicapp/trunk

« back to all changes in this revision

Viewing changes to MusicApp.qml

  • Committer: Daniel Holm
  • Date: 2013-03-04 22:32:56 UTC
  • Revision ID: admin@danielholm.se-20130304223256-e307milefi89u9gl
Initial commit.m

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import Ubuntu.Components 0.1
 
3
import Ubuntu.Components.ListItems 0.1
 
4
import Ubuntu.Components.Popups 0.1
 
5
 
 
6
MainView {
 
7
    objectName: i18n.tr("Music Player")
 
8
 
 
9
    width: units.gu(50)
 
10
    height: units.gu(75)
 
11
 
 
12
    Tabs {
 
13
        id: tabs
 
14
        anchors.fill: parent
 
15
 
 
16
        // First tab begins here
 
17
        Tab {
 
18
            objectName: "Tab1"
 
19
 
 
20
            title: i18n.tr("Playing")
 
21
 
 
22
            // Tab content begins here
 
23
            page: Page {
 
24
                // toolbar
 
25
                tools: ToolbarActions {
 
26
 
 
27
                    // Share
 
28
                    Action {
 
29
                        objectName: "share"
 
30
 
 
31
                        iconSource: Qt.resolvedUrl("images/share-app.png")
 
32
                        text: i18n.tr("Share")
 
33
 
 
34
                        onTriggered: {
 
35
                            label.text = i18n.tr("Share pressed")
 
36
                        }
 
37
                    }
 
38
 
 
39
                    // prevous track
 
40
                    Action {
 
41
                        objectName: "prev"
 
42
 
 
43
                        iconSource: Qt.resolvedUrl("prev.png")
 
44
                        text: i18n.tr("Previous")
 
45
 
 
46
                        onTriggered: {
 
47
                            label.text = i18n.tr("Prev track pressed")
 
48
                        }
 
49
                    }
 
50
 
 
51
                    // Play or pause
 
52
                    Action {
 
53
                        objectName: "plaus"
 
54
 
 
55
                        iconSource: Qt.resolvedUrl("prev.png")
 
56
                        text: i18n.tr("Play")
 
57
 
 
58
                        onTriggered: {
 
59
                            label.text = i18n.tr("Play pressed")
 
60
                            // should also change button to pause icon
 
61
                        }
 
62
                    }
 
63
 
 
64
                    // Next track
 
65
                    Action {
 
66
                        objectName: "next"
 
67
 
 
68
                        iconSource: Qt.resolvedUrl("next.png")
 
69
                        text: i18n.tr("Next")
 
70
 
 
71
                        onTriggered: {
 
72
                            label.text = i18n.tr("Next track pressed")
 
73
                        }
 
74
                    }
 
75
 
 
76
                    // Settings
 
77
                    Action {
 
78
                        objectName: "settings"
 
79
 
 
80
                        iconSource: Qt.resolvedUrl("settings.png")
 
81
                        text: i18n.tr("Settings")
 
82
 
 
83
                        onTriggered: {
 
84
                            label.text = i18n.tr("Settings pressed")
 
85
                        }
 
86
                    }
 
87
                }
 
88
                Column {
 
89
                    id: pageLayout
 
90
 
 
91
                    anchors {
 
92
                        fill: parent
 
93
                        margins: root.margins
 
94
                        topMargin: title.height
 
95
                    }
 
96
                    spacing: units.gu(1)
 
97
 
 
98
                    Row {
 
99
                        spacing: units.gu(1)
 
100
                    }
 
101
 
 
102
                    Row {
 
103
                        spacing: units.gu(1)
 
104
                        // Album cover here
 
105
                        UbuntuShape {
 
106
                            width: units.gu(40)
 
107
                            height: units.gu(40)
 
108
                            image: Image {
 
109
                                source: "images/music.png"
 
110
                                fillMode: Image.PreserveAspectCrop
 
111
                                horizontalAlignment: Image.AlignHCenter
 
112
                                verticalAlignment: Image.AlignVCenter
 
113
                            }
 
114
                        }
 
115
                    }
 
116
                }
 
117
            }
 
118
        }
 
119
 
 
120
        // Second tab begins here
 
121
        Tab {
 
122
            objectName: "Artists Tab"
 
123
 
 
124
            title: i18n.tr("Artists")
 
125
            page: Page {
 
126
                anchors.margins: units.gu(2)
 
127
 
 
128
                tools: ToolbarActions {
 
129
                    Action {
 
130
                        objectName: "action"
 
131
 
 
132
                        iconSource: Qt.resolvedUrl("avatar.png")
 
133
                        text: i18n.tr("Tap me!")
 
134
 
 
135
                        onTriggered: {
 
136
                            label.text = i18n.tr("Toolbar tapped")
 
137
                        }
 
138
                    }
 
139
                }
 
140
 
 
141
                Column {
 
142
                    anchors.centerIn: parent
 
143
                    Label {
 
144
                        id: toolbar_artist
 
145
                        objectName: "Artist Toolbar"
 
146
 
 
147
                        text: i18n.tr("List all artists on device here.")
 
148
                    }
 
149
                }
 
150
            }
 
151
        }
 
152
 
 
153
        // Third tab begins here
 
154
        Tab {
 
155
            objectName: "Albums Tab"
 
156
 
 
157
            title: i18n.tr("Albums")
 
158
            page: Page {
 
159
                anchors.margins: units.gu(2)
 
160
 
 
161
                tools: ToolbarActions {
 
162
                    Action {
 
163
                        objectName: "action"
 
164
 
 
165
                        iconSource: Qt.resolvedUrl("avatar.png")
 
166
                        text: i18n.tr("Tap me!")
 
167
 
 
168
                        onTriggered: {
 
169
                            label.text = i18n.tr("Toolbar tapped")
 
170
                        }
 
171
                    }
 
172
                }
 
173
 
 
174
                Column {
 
175
                    anchors.centerIn: parent
 
176
                    Label {
 
177
                        id: toolbar_album
 
178
                        objectName: "Album Toolbar"
 
179
 
 
180
                        text: i18n.tr("List all albums on device here.")
 
181
                    }
 
182
                }
 
183
            }
 
184
        }
 
185
 
 
186
        // Fourth tab begins here
 
187
        Tab {
 
188
            objectName: "Tracks Tab"
 
189
 
 
190
            title: i18n.tr("Tracks")
 
191
            page: Page {
 
192
                anchors.margins: units.gu(2)
 
193
 
 
194
                tools: ToolbarActions {
 
195
                    Action {
 
196
                        objectName: "action"
 
197
 
 
198
                        iconSource: Qt.resolvedUrl("avatar.png")
 
199
                        text: i18n.tr("Tap me!")
 
200
 
 
201
                        onTriggered: {
 
202
                            label.text = i18n.tr("Toolbar tapped")
 
203
                        }
 
204
                    }
 
205
                }
 
206
 
 
207
                Column {
 
208
                    anchors.centerIn: parent
 
209
                    Label {
 
210
                        id: toolbar_track
 
211
                        objectName: "Track Toolbar"
 
212
 
 
213
                        text: i18n.tr("List all tracks here.")
 
214
                    }
 
215
                }
 
216
            }
 
217
        }
 
218
 
 
219
 
 
220
    } // tabs
 
221
} // main view