diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,13 +65,12 @@ qml/ViewSelector.qml qml/MediaPlayListView.qml - qml/MediaAlbumView.qml - qml/MediaAllTracksView.qml qml/MediaTrackDelegate.qml qml/MediaAlbumTrackDelegate.qml qml/MediaTrackMetadataView.qml qml/GridBrowserView.qml qml/GridBrowserDelegate.qml + qml/ListBrowserView.qml ) if (KF5Baloo_FOUND) diff --git a/src/qml/ContentView.qml b/src/qml/ContentView.qml --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@ -147,12 +147,13 @@ onOpen: { elisa.singleAlbumProxyModel.loadAlbumData(databaseId) localAlbums.stackView.push(albumView, { + mainTitle: innerMainTitle, + secondaryTitle: innerSecondaryTitle, + image: innerImage, stackView: localAlbums.stackView, - albumName: innerMainTitle, - artistName: innerSecondaryTitle, - albumArtUrl: innerImage, }) } + onGoBack: localAlbums.stackView.pop() Binding { @@ -197,10 +198,10 @@ mainTitle: innerMainTitle, secondaryTitle: innerSecondaryTitle, image: innerImage, - stackView: localArtists.stackView }) } + onGoBack: localArtists.stackView.pop() Binding { @@ -227,13 +228,36 @@ rightMargin: elisaTheme.layoutHorizontalMargin } - firstPage: MediaAllTracksView { + firstPage: ListBrowserView { id: allTracksView focus: true - stackView: localTracks.stackView contentModel: elisa.allTracksProxyModel + delegate: MediaTrackDelegate { + id: entry + + width: allTracksView.delegateWidth + height: elisaTheme.trackDelegateHeight + + focus: true + + trackData: model.containerData + + isFirstTrackOfDisc: false + + isSingleDiscAlbum: model.isSingleDiscAlbum + + onEnqueue: elisa.mediaPlayList.enqueue(data) + + onReplaceAndPlay: elisa.mediaPlayList.replaceAndPlay(data) + + onClicked: contentDirectoryView.currentIndex = index + } + + image: elisaTheme.tracksIcon + mainTitle: i18nc("Title of the view of all tracks", "Tracks") + Binding { target: allTracksView property: 'expandedFilterView' @@ -550,22 +574,22 @@ GridBrowserView { id: innerAlbumGridView - property var stackView contentModel: elisa.singleArtistProxyModel isSubPage: true onOpen: { elisa.singleAlbumProxyModel.loadAlbumData(databaseId) localArtists.stackView.push(albumView, { + mainTitle: innerMainTitle, + secondaryTitle: innerSecondaryTitle, + image: innerImage, stackView: localArtists.stackView, - albumName: innerMainTitle, - artistName: innerSecondaryTitle, - albumArtUrl: innerImage, }) } - onGoBack: stackView.pop() + + onGoBack: localArtists.stackView.pop() Binding { target: innerAlbumGridView @@ -580,12 +604,37 @@ Component { id: albumView - MediaAlbumView { + ListBrowserView { id: albumGridView property var stackView contentModel: elisa.singleAlbumProxyModel + delegate: MediaAlbumTrackDelegate { + id: entry + + width: albumGridView.delegateWidth + height: ((model.isFirstTrackOfDisc && !isSingleDiscAlbum) ? elisaTheme.delegateHeight*2 : elisaTheme.delegateHeight) + + focus: true + + mediaTrack.trackData: model.containerData + + mediaTrack.isFirstTrackOfDisc: model.isFirstTrackOfDisc + + mediaTrack.isSingleDiscAlbum: model.isSingleDiscAlbum + + mediaTrack.onEnqueue: elisa.mediaPlayList.enqueue(data) + + mediaTrack.onReplaceAndPlay: elisa.mediaPlayList.replaceAndPlay(data) + + mediaTrack.isAlternateColor: (index % 2) === 1 + + mediaTrack.onClicked: contentDirectoryView.currentIndex = index + } + + allowArtistNavigation: true + onShowArtist: { listViews.currentIndex = 2 if (localArtists.stackView.depth === 3) { @@ -601,6 +650,7 @@ } allArtistsView.open(name, name, elisaTheme.defaultArtistImage, '') } + onGoBack: stackView.pop() expandedFilterView: true diff --git a/src/qml/MediaAllTracksView.qml b/src/qml/ListBrowserView.qml rename from src/qml/MediaAllTracksView.qml rename to src/qml/ListBrowserView.qml --- a/src/qml/MediaAllTracksView.qml +++ b/src/qml/ListBrowserView.qml @@ -27,12 +27,21 @@ import org.kde.elisa 1.0 FocusScope { - id: rootElement + id: listView - property var stackView + property bool isSubPage: false + property alias mainTitle: navigationBar.mainTitle + property alias secondaryTitle: navigationBar.secondaryTitle + property alias image: navigationBar.image + property alias delegate: contentDirectoryView.delegate property alias contentModel: contentDirectoryView.model property alias expandedFilterView: navigationBar.expandedFilterView + property alias showRating: navigationBar.showRating + property alias allowArtistNavigation: navigationBar.allowArtistNavigation + property var delegateWidth: scrollBar.visible ? contentDirectoryView.width - scrollBar.width : contentDirectoryView.width + signal goBack() + signal showArtist(var name) signal filterViewChanged(bool expandedFilterView) SystemPalette { @@ -51,10 +60,10 @@ NavigationActionBar { id: navigationBar - mainTitle: i18nc("Title of the view of all tracks", "Tracks") - secondaryTitle: "" - image: elisaTheme.tracksIcon - enableGoBack: false + mainTitle: listView.mainTitle + secondaryTitle: listView.secondaryTitle + image: listView.image + enableGoBack: isSubPage height: elisaTheme.navigationBarHeight Layout.preferredHeight: height @@ -76,9 +85,13 @@ onEnqueue: contentModel.enqueueToPlayList() - onFilterViewChanged: rootElement.filterViewChanged(expandedFilterView) + onFilterViewChanged: listView.filterViewChanged(expandedFilterView) onReplaceAndPlay: contentModel.replaceAndPlayOfPlayList() + + onGoBack: listView.goBack() + + onShowArtist: listView.showArtist(listView.contentModel.sourceModel.author) } Rectangle { @@ -99,27 +112,6 @@ } boundsBehavior: Flickable.StopAtBounds clip: true - - delegate: MediaTrackDelegate { - id: entry - - width: scrollBar.visible ? contentDirectoryView.width - scrollBar.width : contentDirectoryView.width - height: elisaTheme.trackDelegateHeight - - focus: true - - trackData: model.containerData - - isFirstTrackOfDisc: false - - isSingleDiscAlbum: model.isSingleDiscAlbum - - onEnqueue: elisa.mediaPlayList.enqueue(data) - - onReplaceAndPlay: elisa.mediaPlayList.replaceAndPlay(data) - - onClicked: contentDirectoryView.currentIndex = index - } } } } diff --git a/src/qml/MediaAlbumView.qml b/src/qml/MediaAlbumView.qml deleted file mode 100644 --- a/src/qml/MediaAlbumView.qml +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2016-2017 Matthieu Gallien - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.7 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.2 -import QtQml.Models 2.2 -import org.kde.elisa 1.0 -import QtQuick.Layouts 1.2 - -FocusScope { - id: topListing - - property var albumName - property var artistName - property var albumArtUrl - property bool isSingleDiscAlbum - property alias expandedFilterView: navigationBar.expandedFilterView - property var albumId - property alias contentModel: contentDirectoryView.model - - signal showArtist(var name) - signal goBack(); - signal filterViewChanged(bool expandedFilterView) - - SystemPalette { - id: myPalette - colorGroup: SystemPalette.Active - } - - Theme { - id: elisaTheme - } - - ColumnLayout { - anchors.fill: parent - spacing: 0 - - NavigationActionBar { - id: navigationBar - - height: elisaTheme.navigationBarHeight - - Layout.preferredHeight: height - Layout.minimumHeight: height - Layout.maximumHeight: height - Layout.fillWidth: true - - mainTitle: (topListing.artistName ? topListing.artistName : '') - secondaryTitle: topListing.albumName - image: (topListing.albumArtUrl ? topListing.albumArtUrl : elisaTheme.defaultAlbumImage) - allowArtistNavigation: true - - Binding { - target: contentModel - property: 'filterText' - value: navigationBar.filterText - } - - Binding { - target: contentModel - property: 'filterRating' - value: navigationBar.filterRating - } - - onGoBack: topListing.goBack() - - onFilterViewChanged: topListing.filterViewChanged(expandedFilterView) - - onShowArtist: topListing.showArtist(topListing.contentModel.sourceModel.author) - - onEnqueue: contentModel.enqueueToPlayList() - - onReplaceAndPlay: contentModel.replaceAndPlayOfPlayList() - } - - ListView { - id: contentDirectoryView - Layout.topMargin: 20 - Layout.fillHeight: true - Layout.fillWidth: true - contentWidth: parent.width - focus: true - - ScrollBar.vertical: ScrollBar { - id: scrollBar - } - boundsBehavior: Flickable.StopAtBounds - clip: true - - delegate: MediaAlbumTrackDelegate { - id: entry - - height: ((model.isFirstTrackOfDisc && !isSingleDiscAlbum) ? elisaTheme.delegateHeight*2 : elisaTheme.delegateHeight) - width: scrollBar.visible ? contentDirectoryView.width - scrollBar.width : contentDirectoryView.width - - focus: true - - mediaTrack.trackData: model.containerData - - mediaTrack.isFirstTrackOfDisc: model.isFirstTrackOfDisc - - mediaTrack.isSingleDiscAlbum: model.isSingleDiscAlbum - - mediaTrack.onEnqueue: elisa.mediaPlayList.enqueue(data) - - mediaTrack.onReplaceAndPlay: elisa.mediaPlayList.replaceAndPlay(data) - - mediaTrack.isAlternateColor: (index % 2) === 1 - - mediaTrack.onClicked: contentDirectoryView.currentIndex = index - } - } - } -} diff --git a/src/qml/NavigationActionBar.qml b/src/qml/NavigationActionBar.qml --- a/src/qml/NavigationActionBar.qml +++ b/src/qml/NavigationActionBar.qml @@ -123,7 +123,7 @@ LabelWithToolTip { id: albumLabel - text: secondaryTitle + text: mainTitle Layout.fillWidth: true Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter @@ -135,8 +135,6 @@ font { pointSize: elisaTheme.defaultFontPointSize * 2 } - - visible: secondaryTitle !== "" } TextMetrics { @@ -149,18 +147,20 @@ LabelWithToolTip { id: authorLabel - text: mainTitle + text: secondaryTitle color: myPalette.text Layout.fillWidth: true Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter font { - pointSize: (secondaryTitle !== "" ? elisaTheme.defaultFontPointSize : elisaTheme.defaultFontPointSize * 2) + pointSize: elisaTheme.defaultFontPointSize } elide: Text.ElideRight + + visible: secondaryTitle !== "" } Item { diff --git a/src/resources.qrc b/src/resources.qrc --- a/src/resources.qrc +++ b/src/resources.qrc @@ -3,7 +3,6 @@ qml/MediaPlayerControl.qml qml/RatingStar.qml qml/MediaPlayListView.qml - qml/MediaAlbumView.qml qml/ElisaMainWindow.qml qml/ApplicationMenu.qml qml/HeaderBar.qml @@ -17,7 +16,6 @@ qml/Theme.qml qml/PlatformIntegration.qml qml/LabelWithToolTip.qml - qml/MediaAllTracksView.qml qml/TopNotification.qml qml/TrackImportNotification.qml qml/TopNotificationItem.qml @@ -27,6 +25,7 @@ qml/MediaTrackMetadataView.qml qml/GridBrowserView.qml qml/GridBrowserDelegate.qml + qml/ListBrowserView.qml qtquickcontrols2.conf background.png