~ahayzen/music-app/remix-add-card-view

15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
1
/*
409.3.70 by Victor Thompson
Update copyright
2
 * Copyright (C) 2013, 2014
3
 *      Andrew Hayzen <ahayzen@gmail.com>
4
 *      Daniel Holm <d.holmen@gmail.com>
5
 *      Victor Thompson <victor.thompson@gmail.com>
15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
6
 *
7
 * This program is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; version 3.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
628.1.1 by Akiva Avraham
Updated library imports to qtquick-2.3
20
import QtQuick 2.3
586.2.1 by Andrew Hayzen
* Bump Ubuntu.Components to 1.1
21
import Ubuntu.Components 1.1
409.3.4 by Andrew Hayzen
* Groundwork to migrate pages/sheets to mediascanner2 (except recent and playlists)
22
import Ubuntu.MediaScanner 0.1
23
import Ubuntu.Thumbnailer 0.1
15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
24
import QtMultimedia 5.0
25
import QtQuick.LocalStorage 2.0
17 by Daniel Holm
Added database for meta data and some code for it. Changed storage to settings to have seperate databases.
26
import "settings.js" as Settings
29.2.9 by Daniel Holm
Added reset button in settings; after meta data is reset, it creates a brand new db; playlist aaction in toolbar.
27
import "playlists.js" as Playlists
423.1.1 by Andrew Hayzen
* Add Central common/Expandable.qml
28
import "common"
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
29
import "common/ListItemActions"
15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
30
31
466.2.12 by Andrew Hayzen
* Abstract Page to MusicPage to make bottom edge implementation easier
32
MusicPage {
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
33
    id: mainpage
583.1.1 by Andrew Hayzen
* Initial conversion of splitting the helpers
34
    objectName: "tracksPage"
357.1.1 by Andrew Hayzen
* Fix for Songs tab name
35
    title: i18n.tr("Songs")
15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
36
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
37
    ListView {
38
        id: tracklist
39
        anchors.fill: parent
40
        anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
41
        highlightFollowsCurrentItem: false
545.1.5 by Andrew Hayzen
* Fixes for autopilot
42
        objectName: "trackstab-listview"
586.2.1 by Andrew Hayzen
* Bump Ubuntu.Components to 1.1
43
        model: SortFilterModel {
409.4.1 by Andrew Hayzen
* Use sortFilterModel to correctly sort Albums and Tracks
44
            id: songsModelFilter
409.4.4 by Andrew Hayzen
* Fix for sort filter models so they appear the same as mediascanner2 models
45
            property alias rowCount: songsModel.rowCount
409.4.1 by Andrew Hayzen
* Use sortFilterModel to correctly sort Albums and Tracks
46
            model: SongsModel {
47
                id: songsModel
48
                store: musicStore
49
            }
50
            sort.property: "title"
51
            sort.order: Qt.AscendingOrder
409.3.4 by Andrew Hayzen
* Groundwork to migrate pages/sheets to mediascanner2 (except recent and playlists)
52
        }
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
53
        delegate: trackDelegate
54
        Component {
55
            id: trackDelegate
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
56
57
            ListItemWithActions {
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
58
                id: track
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
59
                color: "transparent"
603.1.3 by Andrew Hayzen
* Create helpers MusicAlbums MusicArtists MusicTracks MusicPlaylists AlbumsPage
60
                objectName: "tracksPageListItem" + index
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
61
                width: parent.width
62
                height: styleMusic.common.itemHeight
63
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
64
                rightSideActions: [
65
                    AddToQueue {
66
                    },
67
                    AddToPlaylist {
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
68
69
                    }
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
70
                ]
71
                triggerActionOnMouseRelease: true
72
560.1.2 by Victor Thompson
merge trunk
73
                // TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well.
74
                onPressedChanged: musicRow.pressed = pressed
75
545.1.1 by Andrew Hayzen
* Initial transition to using ListItemWithActions.qml
76
                onItemClicked: trackClicked(tracklist.model, index)  // play track
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
77
508.1.2 by Andrew Hayzen
* Merge of trunk
78
                MusicRow {
560.1.1 by Victor Thompson
Make UbuntuShapes appear pressed
79
                    id: musicRow
612.2.1 by Victor Thompson
Use art property to allow mediascanner2 to determine if embedded art exists
80
                    covers: [{art: model.art}]
508.1.2 by Andrew Hayzen
* Merge of trunk
81
                    column: Column {
82
                        spacing: units.gu(1)
83
                        Label {
84
                            id: trackArtist
85
                            color: styleMusic.common.subtitle
86
                            fontSize: "x-small"
87
                            text: model.author
88
                        }
89
90
                        Label {
91
                            id: trackTitle
92
                            color: styleMusic.common.music
93
                            fontSize: "medium"
508.1.5 by Andrew Hayzen
* Fix for autopilot
94
                            objectName: "tracktitle"
508.1.2 by Andrew Hayzen
* Merge of trunk
95
                            text: model.title
96
                        }
97
98
                        Label {
99
                            id: trackAlbum
100
                            color: styleMusic.common.subtitle
101
                            fontSize: "xx-small"
102
                            text: model.album
103
                        }
423.1.1 by Andrew Hayzen
* Add Central common/Expandable.qml
104
                    }
105
                }
106
107
                states: State {
108
                    name: "Current"
109
                    when: track.ListView.isCurrentItem
23.1.1 by Victor Thompson
Initial commit of franken-merge branch.
110
                }
111
            }
112
        }
15 by Daniel Holm
Begin transition to new folderlistmodel and added a reusable toolbar.
113
    }
114
}
240.4.1 by Victor Thompson
Allow Songs tab's header to be hidden/shown while navigating the list
115