1/* 2 * Copyright (C) 2019 3 * Jean-Luc Barriere <jlbarriere68@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 3. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18import QtQuick 2.9 19import QtQuick.Controls 2.2 20import QtQuick.Layouts 1.3 21import NosonApp 1.0 22import NosonMediaScanner 1.0 23import "../components" 24import "../components/Delegates" 25import "../components/Flickables" 26 27 28MusicPage { 29 id: composersPage 30 objectName: "composersPage" 31 pageFlickable: composerGridView 32 searchable: true 33 34 ComposerList { 35 id: composers 36 Component.onCompleted: init() 37 } 38 39 onSearchClicked: filter.visible = true 40 41 header: MusicFilter { 42 id: filter 43 visible: false 44 } 45 46 MusicGridView { 47 id: composerGridView 48 itemWidth: units.gu(12) 49 heightOffset: units.gu(7) 50 51 model: SortFilterModel { 52 model: composers 53 sort.property: "composer" 54 sort.order: Qt.AscendingOrder 55 sortCaseSensitivity: Qt.CaseInsensitive 56 filter.property: "normalized" 57 filter.pattern: new RegExp(normalizedInput(filter.displayText), "i") 58 filterCaseSensitivity: Qt.CaseInsensitive 59 } 60 61 delegate: Card { 62 id: composerCard 63 height: composerGridView.cellHeight 64 width: composerGridView.cellWidth 65 coverSources: makeCoverSource(undefined, model.composer, undefined) 66 noCover: "qrc:/images/none.png" 67 objectName: "composersPageGridItem" + index 68 primaryText: (model.composer !== "<Undefined>" ? model.composer : tr_undefined) 69 secondaryTextVisible: false 70 71 onClicked: { 72 stackView.push("qrc:/controls2/ThisDevice/ComposerView.qml", 73 { 74 "composer": model.composer, 75 "covers": composerCard.imageSource != "" ? [{art: composerCard.imageSource}] : coverSources, 76 "pageTitle": pageTitle 77 }) 78 } 79 } 80 } 81} 82