Skip to content

Commit

Permalink
playing around with dock player, breaking even more
Browse files Browse the repository at this point in the history
Signed-off-by: Conrad Hübler <Conrad.Huebler@gmx.net>
  • Loading branch information
conradhuebler committed Mar 23, 2024
1 parent 57abf37 commit 398b784
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 90 deletions.
7 changes: 5 additions & 2 deletions qml/pages/FirstPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ Page {

// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
clip: true

// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
clip: true
anchors {
fill: parent
bottomMargin: minPlayerPanel.margin
bottom: minPlayerPanel.top
}
clip: miniPlayerPanel.expanded
contentHeight: parent.height - Theme.itemSizeExtraLarge - Theme.paddingLarge

// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
Expand Down Expand Up @@ -52,7 +53,9 @@ Page {
}

SlideshowView {
clip: true
id: swipeView
height: parent.height
itemWidth: width
itemHeight: height
orientation: Qt.Horizontal
Expand Down
15 changes: 1 addition & 14 deletions qml/pages/PlaylistPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ Item {
onPlayListChanged:
{
pLtrackList.clear();
console.log("Playlist changed with playlist.qml", playlistManager.size)
for(var i = 0; i < playlistManager.size; ++i)
{
console.log(i)
playlistManager.requestPlaylistItem(i)
pLtrackList.addTrack(playlistManager.playlist_track, playlistManager.playlist_artist, playlistManager.playlist_album, playlistManager.playlist_track_id, playlistManager.playlist_duration)
}
pLtrackList.highlight_index = playlistManager.current_track
}

onClearList:
Expand All @@ -58,19 +57,7 @@ Item {
onTrackInformation:
{
pLtrackList.setTrack(index, id, title, artist, album, image, duration)
console.log(image)
}

}
Connections {
target: pythonApi
onTrackChanged:
{
console.log("PlaylistPage::onTrackChanged in pythonApi", title)
pLtrackList.addTrack(title, artist, album, id, duration)
}


}

}
1 change: 1 addition & 0 deletions qml/pages/TrackList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ SilicaListView {
{
mediaPlayer.blockAutoNext = true
playlistManager.playPosition(model.index)
highlight_index = model.index
}
}
menu: ContextMenu {
Expand Down
155 changes: 81 additions & 74 deletions qml/pages/widgets/MiniPlayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.nemomobile.mpris 1.0

DockedPanel {
id: miniPlayerPanel
//parent: pageStack.currentPage

width: parent.width
height: Theme.itemSizeExtraLarge + Theme.paddingLarge
Expand All @@ -24,16 +23,6 @@ DockedPanel {
progressSlider.visible = true
show();
}

Rectangle {
anchors.fill: parent
color: Theme.overlayBackgroundColor
opacity: 0.8
SwipeArea {
anchors.fill: parent
onSwipeDown: minPlayerPanel.hide()
}
}
Image {
id: bgImage
height: 0.75 * parent.height
Expand All @@ -42,77 +31,96 @@ DockedPanel {
anchors.bottom: parent.bottom
}

Label {
id: mediaTitle

Column
{
anchors.top: parent.top
anchors.topMargin: Theme.paddingSmall
anchors.horizontalCenter: parent.horizontalCenter
truncationMode: TruncationMode.Fade
width: parent.width - 2 * Theme.paddingLarge
//horizontalAlignment: (contentWidth > width) ? Text.AlignLeft : Text.AlignHCenter
}

Label {
id: playTime
anchors.top: mediaTitle.bottom
anchors.topMargin: Theme.paddingSmall / 6
property string pos: {
if ((mediaPlayer.position / 1000) > 3599) Format.formatDuration(minPlayer.position / 1000, Formatter.DurationLong)
else return Format.formatDuration(mediaPlayer.position / 1000, Formatter.DurationShort)
}
property string dur: {
if ((mediaPlayer.duration / 1000) > 3599) Format.formatDuration(minPlayer.duration / 1000, Formatter.DurationLong)
else return Format.formatDuration(mediaPlayer.duration / 1000, Formatter.DurationShort)
Label
{
id: mediaTitle
//anchors.top: parent.top
//anchors.topMargin: Theme.paddingSmall
//anchors.horizontalCenter: parent.horizontalCenter
truncationMode: TruncationMode.Fade
width: parent.width - 2 * Theme.paddingLarge
//horizontalAlignment: (contentWidth > width) ? Text.AlignLeft : Text.AlignHCenter
}
text: pos + " / " + dur;
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraSmall
}

Slider {
id: progressSlider
anchors.top: playTime.bottom
anchors.topMargin: Theme.paddingSmall / 6
width: parent.width
minimumValue: 0
maximumValue: 100
visible: false
}

Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: progressSlider.bottom
anchors.topMargin: Theme.paddingSmall / 4
IconButton {
id : prevButton
icon.source: "image://theme/icon-m-previous"
visible: playlistManager.canPrev;
onClicked: {
playlistManager.previousTrackClicked()
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: mediaTitle.bottom
//anchors.topMargin: Theme.paddingSmall / 4
width: miniPlayerPanel.width -2 * Theme.paddingLarge
id: buttonsRow
IconButton {
anchors.horizontalCenter: playButton.left
id : prevButton
icon.source: "image://theme/icon-m-previous"
visible: playlistManager.canPrev;
onClicked: {
playlistManager.previousTrackClicked()
}
}
}
IconButton {
id:playButton
icon.source: mediaPlayer.isPlaying ? "image://theme/icon-m-pause" : "image://theme/icon-m-play"
onClicked: {
if (mediaPlayer.playbackState == 1)
{
mediaPlayer.pause()
IconButton {
anchors.horizontalCenter: parent.horizontalCenter
id:playButton
icon.source: mediaPlayer.isPlaying ? "image://theme/icon-m-pause" : "image://theme/icon-m-play"
onClicked: {
if (mediaPlayer.playbackState == 1)
{
mediaPlayer.pause()
}
else if(mediaPlayer.playbackState == 2){
mediaPlayer.play()
}
}
else if(mediaPlayer.playbackState == 2){
mediaPlayer.play()
}
IconButton {
anchors.horizontalCenter: playButton.right
id: nextButton
icon.source: "image://theme/icon-m-next"
visible: playlistManager.canNext;
onClicked: {
console.log("play next")
mediaPlayer.blockAutoNext = true
playlistManager.nextTrackClicked()
}
}
}
IconButton {
id: nextButton
icon.source: "image://theme/icon-m-next"
visible: playlistManager.canNext;
onClicked: {
console.log("play next")
mediaPlayer.blockAutoNext = true
playlistManager.nextTrackClicked()
Row{
//anchors.centerIn: parent
anchors.top: parent.buttonsRow
width: miniPlayerPanel.width

id: progressSliderRow
Label
{
id: playedTime
property string pos: {
if ((mediaPlayer.position / 1000) > 3599) Format.formatDuration(minPlayer.position / 1000, Formatter.DurationLong)
else return Format.formatDuration(mediaPlayer.position / 1000, Formatter.DurationShort)
}
text: pos;
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraSmall
}
Slider {
id: progressSlider
minimumValue: 0
maximumValue: 100
visible: false
width: miniPlayerPanel.width - Theme.paddingLarge
}
Label {
id: playTime
property string dur: {
if ((mediaPlayer.duration / 1000) > 3599) Format.formatDuration(minPlayer.duration / 1000, Formatter.DurationLong)
else return Format.formatDuration(mediaPlayer.duration / 1000, Formatter.DurationShort)
}
text: dur;
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraSmall
}
}
}
Expand Down Expand Up @@ -146,7 +154,6 @@ DockedPanel {
target: pythonApi
onCurrentTrackInfo:
{

mediaTitle.text = track_num + " - " + title + " - " +album + " - " + artist
bgImage.source = album_image
prevButton.enabled = playlistManager.canPrev;
Expand Down

0 comments on commit 398b784

Please sign in to comment.