35
title: i18n.tr("Music")
35
title: i18n.tr("Recent")
37
/* Dev button for search.
40
text: i18n.tr("Search")
41
anchors.top: parent.top
42
anchors.topMargin: units.gu(2)
43
anchors.bottom: recentlyPlayed.top
44
anchors.bottomMargin: units.gu(1)
47
PopupUtils.open(Qt.resolvedUrl("MusicSearch.qml"), mainView,
49
title: i18n.tr("Search")
42
Library.clearRecentHistory()
43
recentModel.filterRecent()
59
height: mainpage.height
61
contentHeight: mainView.hasRecent ? recentlyPlayed.height + recentlist.height + genres.height + genrelist.height + albums.height + albumlist.height + units.gu(4)
62
: genres.height + genrelist.height + albums.height + albumlist.height + units.gu(3)
71
verticalCenter: parent.verticalCenter
73
leftMargin: units.gu(2)
75
text: i18n.tr("Recent")
76
color: styleMusic.common.music
78
visible: mainView.hasRecent
83
anchors.top: recentlyPlayed.bottom
84
anchors.topMargin: units.gu(1)
88
// TODO: Update when view counts are collected
89
model: recentModel.model
90
delegate: recentDelegate
97
width: recentlist.height - units.gu(2)
99
visible: mainView.hasRecent && !loading.visible
101
id: clearRecentButton
102
anchors.centerIn: parent
103
text: i18n.tr("Clear History")
105
Library.clearRecentHistory()
106
mainView.hasRecent = false
107
recentModel.filterRecent()
111
orientation: ListView.Horizontal
112
visible: mainView.hasRecent
117
property string title: model.title
118
property string title2: model.title2 !== "Playlist" ? model.title2 : i18n.tr("Playlist")
119
property var covers: type === "playlist" ? Playlists.getPlaylistCovers(title) : (model.art !== undefined ? [{art: model.art}] : [{author: model.title2, album: model.title}])
120
property string type: model.type
121
property string time: model.time
122
property string key: model.key
124
height: recentlist.height - units.gu(1)
131
verticalCenter: parent.verticalCenter
133
count: recentItem.covers.length
134
size: recentItem.width
135
covers: recentItem.covers
138
Item { // Background so can see text in current state
141
bottom: parent.bottom
149
bottom: parent.bottom
153
height: recentShape.height
155
color: styleMusic.common.black
161
anchors.bottom: parent.bottom
162
anchors.bottomMargin: units.gu(3)
163
anchors.left: parent.left
164
anchors.leftMargin: units.gu(1)
165
anchors.right: parent.right
166
anchors.rightMargin: units.gu(1)
167
color: styleMusic.common.white
168
elide: Text.ElideRight
171
font.weight: Font.DemiBold
175
anchors.left: parent.left
176
anchors.leftMargin: units.gu(1)
177
anchors.bottom: parent.bottom
178
anchors.bottomMargin: units.gu(1)
179
anchors.right: parent.right
180
anchors.rightMargin: units.gu(1)
181
color: styleMusic.common.white
182
elide: Text.ElideRight
189
if (type === "playlist") {
190
albumTracksModel.filterPlaylistTracks(key)
192
songsPage.album = title;
194
songsPage.genre = undefined;
196
songsPage.line1 = title2
197
songsPage.line2 = title
198
songsPage.covers = recentItem.covers
199
songsPage.isAlbum = (type === "album")
200
songsPage.title = songsPage.isAlbum ? i18n.tr("Album") : i18n.tr("Playlist")
202
mainPageStack.push(songsPage)
205
// TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well.
206
onPressedChanged: recentShape.pressed = pressed
212
ListItem.ThinDivider {
214
anchors.top: mainView.hasRecent ? recentlist.bottom : parent.top
215
visible: genrelist.count > 1
219
anchors.top: genreDivider.bottom
220
visible: genrelist.count > 1
223
verticalCenter: parent.verticalCenter
225
leftMargin: units.gu(2)
227
text: i18n.tr("Genres")
228
color: styleMusic.common.music
231
// TODO: add music genres. frequency of play? most tracks?
235
anchors.top: genres.bottom
236
anchors.topMargin: units.gu(1)
239
visible: genrelist.count > 1
240
model: SortFilterModel {
241
id: genresModelFilter
246
filter.property: "genre"
247
filter.pattern: /\S+/
250
delegate: genreDelegate
255
orientation: ListView.Horizontal
261
objectName: "genreItemObject"
262
height: genrelist.height - units.gu(1)
266
id: albumGenreModelRepeater
273
property string art: model.art
275
property var covers: []
279
genreShape.count = count
280
genreShape.covers = covers
283
covers.push({art: item.art});
285
if (index === count - 1) {
302
verticalCenter: parent.verticalCenter
305
size: genreItem.width
312
songsPage.album = undefined
313
songsPage.covers = genreShape.covers
314
songsPage.genre = model.genre
315
songsPage.isAlbum = true
316
songsPage.line1 = i18n.tr("Genre")
317
songsPage.line2 = model.genre
318
songsPage.title = i18n.tr("Genre")
320
mainPageStack.push(songsPage)
323
// TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well.
324
onPressedChanged: genreShape.pressed = pressed
326
Item { // Background so can see text in current state
329
bottom: parent.bottom
333
height: units.gu(5.5)
337
bottom: parent.bottom
341
height: genreShape.height
343
color: styleMusic.common.black
349
anchors.bottom: parent.bottom
350
anchors.bottomMargin: units.gu(1)
351
anchors.left: parent.left
352
anchors.leftMargin: units.gu(1)
353
anchors.right: parent.right
354
anchors.rightMargin: units.gu(1)
355
color: styleMusic.common.white
356
elide: Text.ElideRight
359
font.weight: Font.DemiBold
363
anchors.bottom: parent.bottom
364
anchors.bottomMargin: units.gu(3)
365
anchors.left: parent.left
366
anchors.leftMargin: units.gu(1)
367
anchors.right: parent.right
368
anchors.rightMargin: units.gu(1)
369
color: styleMusic.common.white
370
elide: Text.ElideRight
371
text: i18n.tr("%1 song", "%1 songs", songGenreModel.rowCount).arg(songGenreModel.rowCount)
378
ListItem.ThinDivider {
380
anchors.top: genrelist.visible
382
: (mainView.hasRecent ? recentlist.bottom : parent.top)
388
verticalCenter: parent.verticalCenter
390
leftMargin: units.gu(2)
392
text: i18n.tr("Albums")
393
color: styleMusic.common.music
395
anchors.top: albumsDivider.bottom
401
anchors.top: albums.bottom
402
anchors.topMargin: units.gu(1)
405
model: SortFilterModel {
406
id: albumsModelFilter
407
property alias rowCount: albumsModel.rowCount
412
sort.property: "title"
413
sort.order: Qt.AscendingOrder
415
delegate: albumDelegate
420
orientation: ListView.Horizontal
425
property string artist: model.artist
426
property string album: model.title
427
property var covers: [{art: model.art}]
430
objectName: "albumItemObject"
431
height: albumlist.height - units.gu(1)
438
verticalCenter: parent.verticalCenter
440
count: albumItem.covers.length
441
size: albumItem.width
442
covers: albumItem.covers
448
songsPage.album = album
449
songsPage.covers = covers
450
songsPage.genre = undefined
451
songsPage.isAlbum = true
452
songsPage.line1 = artist
453
songsPage.line2 = album
454
songsPage.title = i18n.tr("Album")
456
mainPageStack.push(songsPage)
459
// TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well.
460
onPressedChanged: albumShape.pressed = pressed
462
Item { // Background so can see text in current state
465
bottom: parent.bottom
473
bottom: parent.bottom
477
height: albumShape.height
479
color: styleMusic.common.black
485
anchors.bottom: parent.bottom
486
anchors.bottomMargin: units.gu(1)
487
anchors.left: parent.left
488
anchors.leftMargin: units.gu(1)
489
anchors.right: parent.right
490
anchors.rightMargin: units.gu(1)
491
color: styleMusic.common.white
492
elide: Text.ElideRight
498
anchors.bottom: parent.bottom
499
anchors.bottomMargin: units.gu(3)
500
anchors.left: parent.left
501
anchors.leftMargin: units.gu(1)
502
anchors.right: parent.right
503
anchors.rightMargin: units.gu(1)
504
color: styleMusic.common.white
505
elide: Text.ElideRight
508
font.weight: Font.DemiBold
51
model: recentModel.model
54
coverSources: model.type === "playlist" ? Playlists.getPlaylistCovers(title) : (model.art !== undefined ? [{art: model.art}] : [{author: model.title2, album: model.title}])
55
objectName: "albumsPageGridItem" + index
56
primaryText: model.title
57
secondaryText: model.title2 !== "Playlist" ? model.title2 : i18n.tr("Playlist")
60
if (type === "playlist") {
61
albumTracksModel.filterPlaylistTracks(model.key)
63
songsPage.album = title;
65
songsPage.genre = undefined;
67
songsPage.line1 = secondaryText
68
songsPage.line2 = primaryText
69
songsPage.covers = coverSources
70
songsPage.isAlbum = (type === "album")
71
songsPage.title = songsPage.isAlbum ? i18n.tr("Album") : i18n.tr("Playlist")
73
mainPageStack.push(songsPage)