Skip to content

Commit

Permalink
[4.6.0.13] Sauna
Browse files Browse the repository at this point in the history
  • Loading branch information
CODeRUS committed Aug 31, 2024
1 parent d3d32be commit 58aace9
Show file tree
Hide file tree
Showing 1,147 changed files with 48,542 additions and 7,300 deletions.
151 changes: 151 additions & 0 deletions usr/lib/jolla-mediaplayer/plugins/jolla/AlbumPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// -*- qml -*-

import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Media 1.0
import com.jolla.mediaplayer 1.0

Page {
id: albumPage

property var media

Loader {
active: albumPage.isLandscape && coverArt.source != ""
anchors {
top: parent.top
bottom: parent.bottom
left: parent.horizontalCenter
right: parent.right
}

Component.onCompleted: setSource("CoverArtHolder.qml", { "view": view, "coverArt": coverArt })
}

CoverArt {
id: coverArt

// re-evaluate when state changes
source: (albumArtProvider.extracting || true) ? albumArtProvider.albumArt(media.title, media.author) : ""
}

MediaPlayerListView {
id: view

model: GriloTrackerModel {
query: {
//: placeholder string for albums without a known name
//% "Unknown album"
var unknownAlbum = qsTrId("mediaplayer-la-unknown-album")

//: placeholder string to be shown for media without a known artist
//% "Unknown artist"
var unknownArtist = qsTrId("mediaplayer-la-unknown-artist")

return AudioTrackerHelpers.getSongsQuery(albumHeader.searchText,
{"unknownArtist": unknownArtist,
"unknownAlbum": unknownAlbum,
"authorId": media.get("tracker-urn"),
"albumId": media.id})
}
}

contentWidth: albumPage.width

PullDownMenu {
MenuItem {
//: Shuffle all menu entry in album page
//% "Shuffle all"
text: qsTrId("mediaplayer-me-album-shuffle-all")
onClicked: AudioPlayer.shuffleAndPlay(view.model, view.count)
}

NowPlayingMenuItem { }

MenuItem {
//: Search menu entry
//% "Search"
text: qsTrId("mediaplayer-me-search")
onClicked: albumHeader.enableSearch()
enabled: view.count > 0 || albumHeader.searchText !== ''
}
}

ViewPlaceholder {
//: Placeholder text for an empty search view
//% "No items found"
text: qsTrId("mediaplayer-la-empty-search")
enabled: view.count === 0 && !busyIndicator.running
}

PageBusyIndicator {
id: busyIndicator

running: view.model.fetching
}

Component {
id: addPageComponent
AddToPlaylistPage { }
}

header: SearchPageHeader {
id: albumHeader
width: albumPage.isLandscape ? view.contentWidth : view.width

//: header for the page showing the songs that don't belong to a known album
//% "Unknown album"
title: media.title !== "" ? media.title : qsTrId("mediaplayer-la-unknown-album")

//: All songs search field placeholder text
//% "Search song"
placeholderText: qsTrId("mediaplayer-tf-album-search")

coverArt: albumPage.isLandscape ? null : coverArt
}

delegate: MediaListDelegate {
id: delegate

property var itemMedia: media

formatFilter: albumHeader.searchText
menu: menuComponent
onClicked: AudioPlayer.play(view.model, index)

ListView.onAdd: AddAnimation { target: delegate }
ListView.onRemove: animateRemoval()

function remove() {
AudioPlayer.remove(itemMedia, delegate, playlists)
}

Component {
id: menuComponent

ContextMenu {
width: view.contentWidth

MenuItem {
//: Add to playlist context menu item in album page
//% "Add to playlist"
text: qsTrId("mediaplayer-me-album-add-to-playlist")
onClicked: pageStack.animatorPush(addPageComponent, {media: itemMedia})
}
MenuItem {
//: Add to playing queue context menu item in album page
//% "Add to playing queue"
text: qsTrId("mediaplayer-me-album-add-to-playing-queue")
onClicked: AudioPlayer.addToQueue(itemMedia)
}
MenuItem {
//: Delete item
//% "Delete"
text: qsTrId("mediaplayer-me-all-songs-delete")
onClicked: remove()
}
}
}
}
}
}
104 changes: 104 additions & 0 deletions usr/lib/jolla-mediaplayer/plugins/jolla/AlbumsPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// -*- qml -*-

import QtQuick 2.0
import Sailfish.Silica 1.0
import com.jolla.mediaplayer 1.0
import Nemo.Thumbnailer 1.0

Page {
id: albumsPage

property var model
property string searchText

TrackerQueriesBuilder {
id: queriesBuilder
}

MediaPlayerListView {
id: view

property string query: queriesBuilder.getAlbumsQuery(albumsHeader.searchText)

model: albumsPage.model

Binding {
target: albumsPage.model.source
property: "query"
value: view.query
}

PullDownMenu {
NowPlayingMenuItem { }

MenuItem {
//: Search menu entry
//% "Search"
text: qsTrId("mediaplayer-me-search")
onClicked: albumsHeader.enableSearch()
enabled: view.count > 0 || albumsHeader.searchText !== ''
}
}

ViewPlaceholder {
text: {
if (albumsHeader.searchText !== '') {
//: Placeholder text for an empty search view
//% "No items found"
return qsTrId("mediaplayer-la-empty-search")
} else {
//: Placeholder text for an empty view
//% "Get some media"
return qsTrId("mediaplayer-la-get-some-media")
}
}
enabled: view.count === 0 && !busyIndicator.running
}

PageBusyIndicator {
id: busyIndicator

running: albumsPage.model.source.fetching
}

header: SearchPageHeader {
id: albumsHeader
width: parent.width

//: title for the Albums page
//% "Albums"
title: qsTrId("mediaplayer-he-albums")

//: Albums search field placeholder text
//% "Search album"
placeholderText: qsTrId("mediaplayer-tf-albums-search")

searchText: albumsPage.searchText
Component.onCompleted: if (searchText !== '') enableSearch()
}

delegate: MediaContainerListDelegate {
id: delegate

contentHeight: albumArt.height
leftPadding: albumArt.width + Theme.paddingLarge
formatFilter: albumsHeader.searchText
title: media.title
subtitle: media.author
titleFont.pixelSize: Theme.fontSizeLarge
subtitleFont.pixelSize: Theme.fontSizeMedium
onClicked: pageStack.animatorPush(Qt.resolvedUrl("AlbumPage.qml"), {media: media})

ListView.onAdd: AddAnimation { target: delegate }
ListView.onRemove: animateRemoval()

AlbumArt {
id: albumArt

// re-evaluate when state changes
source: (albumArtProvider.extracting || true) ? albumArtProvider.albumThumbnail(title, subtitle) : ""
highlighted: delegate.highlighted
}
}
}
}
133 changes: 133 additions & 0 deletions usr/lib/jolla-mediaplayer/plugins/jolla/AllSongsPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// -*- qml -*-

import QtQuick 2.0
import Sailfish.Silica 1.0
import com.jolla.mediaplayer 1.0

Page {
id: allSongsPage

property var model
property string searchText

TrackerQueriesBuilder {
id: queriesBuilder
}

MediaPlayerListView {
id: view

property string query: queriesBuilder.getSongsQuery(allSongsHeader.searchText)

model: allSongsPage.model

Binding {
target: allSongsPage.model.source
property: "query"
value: view.query
}

PullDownMenu {
MenuItem {
//: Shuffle all menu entry in all songs page
//% "Shuffle all"
text: qsTrId("mediaplayer-me-all-songs-shuffle-all")
onClicked: AudioPlayer.shuffleAndPlay(view.model, view.count)
}

NowPlayingMenuItem { }

MenuItem {
//: Search menu entry
//% "Search"
text: qsTrId("mediaplayer-me-search")
onClicked: allSongsHeader.enableSearch()
enabled: view.count > 0 || allSongsHeader.searchText !== ''
}
}

Component {
id: addPageComponent
AddToPlaylistPage { }
}

ViewPlaceholder {
text: {
if (allSongsHeader.searchText !== '') {
//: Placeholder text for an empty search view
//% "No items found"
return qsTrId("mediaplayer-la-empty-search")
} else {
//: Placeholder text for an empty view
//% "Get some media"
return qsTrId("mediaplayer-la-get-some-media")
}
}
enabled: view.count === 0 && !busyIndicator.running
}

PageBusyIndicator {
id: busyIndicator

running: allSongsPage.model.source.fetching
}

header: SearchPageHeader {
id: allSongsHeader
width: parent.width

//: Title for the all songs page
//% "All songs"
title: qsTrId("mediaplayer-he-all-songs")

//: All songs search field placeholder text
//% "Search song"
placeholderText: qsTrId("mediaplayer-tf-songs-search")

searchText: allSongsPage.searchText
Component.onCompleted: if (searchText !== '') enableSearch()
}

delegate: MediaListDelegate {
id: delegate

property var itemMedia: media

formatFilter: allSongsHeader.searchText

function remove() {
AudioPlayer.remove(itemMedia, delegate, playlists)
}

menu: menuComponent
onClicked: AudioPlayer.play(view.model, index)

ListView.onAdd: AddAnimation { target: delegate }
ListView.onRemove: animateRemoval()

Component {
id: menuComponent
ContextMenu {
MenuItem {
//: Add to playlist context menu item in all songs page
//% "Add to playlist"
text: qsTrId("mediaplayer-me-all-songs-add-to-playlist")
onClicked: pageStack.animatorPush(addPageComponent, {media: itemMedia})
}
MenuItem {
//: Add to playing queue context menu item in all songs page
//% "Add to playing queue"
text: qsTrId("mediaplayer-me-all-songs-add-to-playing-queue")
onClicked: AudioPlayer.addToQueue(itemMedia)
}
MenuItem {
//: Delete item
//% "Delete"
text: qsTrId("mediaplayer-me-all-songs-delete")
onClicked: remove()
}
}
}
}
}
}
Loading

0 comments on commit 58aace9

Please sign in to comment.