Commit 5ee2db18 authored by camilo higuita's avatar camilo higuita

add right placeholder icons

parent 43c8d226
......@@ -54,16 +54,13 @@ Maui.ApplicationWindow
/******************** PLAYBACK ********************/
/*************************************************/
property bool isShuffle: Maui.FM.loadSettings("SHUFFLE","PLAYBACK", false)
property var currentTrack: ({
fav: "0",
stars: "0"
})
readonly property var currentTrack: mainlistEmpty? ({url: "", artwork: "", fav: "0", stars: "0"}) : mainPlaylist.table.listModel.get(currentTrackIndex)
property int currentTrackIndex: -1
property int prevTrackIndex: 0
property string currentArtwork: !mainlistEmpty ? mainPlaylist.listModel.get(0).artwork : ""
property bool currentBabe: currentTrack.fav == "0" ? false : true
readonly property string currentArtwork: currentTrack.artwork
readonly property bool currentBabe: currentTrack.fav == "0" ? false : true
property alias durationTimeLabel: player.duration
property string progressTimeLabel: player.transformTime((player.duration/1000) *(player.pos/ 1000))
......@@ -81,9 +78,8 @@ Maui.ApplicationWindow
artists: 2,
playlists: 3,
folders: 4,
cloud : 5,
youtube: 6,
search: 7})
youtube: 5,
search: 6})
property string syncPlaylist: ""
property bool sync: false
......@@ -136,7 +132,7 @@ Maui.ApplicationWindow
headBar.middleContent : Maui.ActionGroup
{
id: _actionGroup
// Layout.fillWidth: true
// Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: implicitWidth
currentIndex : swipeView.currentIndex
......@@ -149,11 +145,11 @@ Maui.ApplicationWindow
icon.name: "folder"
},
// Action
// {
// text: qsTr("Cloud")
// icon.name: "folder-cloud"
// },
// Action
// {
// text: qsTr("Cloud")
// icon.name: "folder-cloud"
// },
Action
{
......@@ -486,6 +482,40 @@ Maui.ApplicationWindow
position: ToolBar.Footer
rightContent: ToolButton
{
icon.name: "media-speaker"
onClicked: _sliderPopup.open()
Popup
{
id: _sliderPopup
height: 150
width: parent.width
y: -150
x: 0
// closePolicy: Popup.CloseOnEscape | Popup.CloseOnPress
Slider
{
id: _volumeSlider
visible: true
height: parent.height
width: 20
anchors.horizontalCenter: parent.horizontalCenter
from: 0
to: 100
value: player.volume
orientation: Qt.Vertical
onMoved:
{
player.volume = value
}
}
}
}
middleContent: [
ToolButton
{
......@@ -730,14 +760,14 @@ Maui.ApplicationWindow
}
}
// Loader
// {
// active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem || item
// sourceComponent: CloudView
// {
// id: cloudView
// }
// }
// Loader
// {
// active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem || item
// sourceComponent: CloudView
// {
// id: cloudView
// }
// }
Loader
{
......
#include "player.h"
#include "../../utils/bae.h"
#ifdef STATIC_MAUIKIT
#include "mauiaccounts.h"
#else
#include <mauiaccounts.h>
#endif
//#ifdef STATIC_MAUIKIT
//#include "mauiaccounts.h"
//#else
//#include <mauiaccounts.h>
//#endif
Player::Player(QObject *parent) : QObject(parent),
player(new QMediaPlayer(this)),
......@@ -27,7 +27,8 @@ inline QNetworkRequest getOcsRequest(const QNetworkRequest& request)
rawHeaders.insert(headerKey, request.rawHeader(headerKey));
}
const auto account = FMH::toModel(MauiAccounts::instance()->getCurrentAccount());
// const auto account = FMH::toModel(MauiAccounts::instance()->getCurrentAccount());
const auto account = FMH::MODEL();
const QString concatenated = QString("%1:%2").arg(account[FMH::MODEL_KEY::USER], account[FMH::MODEL_KEY::PASSWORD]);
const QByteArray data = concatenated.toLocal8Bit().toBase64();
......@@ -111,8 +112,8 @@ QString Player::transformTime(const int &pos)
void Player::setUrl(const QUrl &value)
{
if(value == this->url)
return;
// if(value == this->url)
// return;
this->url = value;
emit this->urlChanged();
......
......@@ -4,8 +4,6 @@ function playTrack(index)
{
if((index < mainPlaylist.listView.count) && (mainPlaylist.listView.count > 0) && (index > -1))
{
currentTrack = mainPlaylist.list.get(index)
if(typeof(currentTrack) === "undefined") return
if(!Maui.FM.fileExists(currentTrack.url) && currentTrack.url.startsWith("file://"))
......@@ -16,7 +14,6 @@ function playTrack(index)
player.url = currentTrack.url;
player.playing = true
currentArtwork = currentTrack.artwork
progressBar.enabled = true
root.title = currentTrack.title + " - " +currentTrack.artist
......@@ -79,13 +76,12 @@ function nextTrack()
else
next = currentTrackIndex+1 >= mainPlaylist.listView.count? 0 : currentTrackIndex+1
prevTrackIndex = mainPlaylist.listView.currentIndex
prevTrackIndex = currentTrackIndex
playAt(next)
if(onQueue > 0)
{
onQueue--
console.log(onQueue)
}
}
}
......@@ -94,8 +90,8 @@ function previousTrack()
{
if(!mainlistEmpty)
{
var previous = previous = currentTrackIndex-1 >= 0 ? mainPlaylist.listView.currentIndex-1 : currentTrackIndex-1
prevTrackIndex = mainPlaylist.listView.currentIndex
const previous = currentTrackIndex-1 >= 0 ? mainPlaylist.listView.currentIndex-1 : mainPlaylist.listView.count-1
prevTrackIndex = currentTrackIndex
playAt(previous)
}
}
......
......@@ -340,7 +340,6 @@ BabeList
width: listView.width
number : trackNumberVisible ? true : false
coverArt : coverArtVisible ? (control.width > 200) : coverArtVisible
showQuickActions: control.showQuickActions
onPressAndHold: if(Kirigami.Settings.isMobile && allowMenu) openItemMenu(index)
onRightClicked: if(allowMenu) openItemMenu(index)
......@@ -359,6 +358,16 @@ BabeList
}else false
}
ToolButton
{
Layout.fillHeight: true
Layout.preferredWidth: implicitWidth
visible: control.showQuickActions && (Kirigami.Settings.isMobile ? true : delegate.hovered)
icon.name: "media-playlist-append"
onClicked: delegate.append()
opacity: delegate.hovered ? 0.8 : 0.6
}
onClicked:
{
currentIndex = index
......
......@@ -14,7 +14,7 @@ Maui.ItemDelegate
id: control
isCurrentItem: ListView.isCurrentItem || isSelected
default property alias content : _template.content
property bool showQuickActions: true
property bool number : false
property bool coverArt : false
......@@ -87,16 +87,6 @@ Maui.ItemDelegate
iconVisible: !control.sameAlbum && control.coverArt
imageSource: model.artwork ? model.artwork : "qrc:/assets/cover.png"
ToolButton
{
Layout.fillHeight: true
Layout.preferredWidth: implicitWidth
visible: showQuickActions && (Kirigami.Settings.isMobile ? true : control.hovered)
icon.name: "media-playlist-append"
onClicked: control.append()
opacity: control.hovered ? 0.8 : 0.6
}
}
......
......@@ -34,7 +34,7 @@ Item
{
anchors.fill: parent
visible: !browser.count
emoji: "qrc:/assets/MusicCloud.png"
emoji: "qrc:/assets/dialog-information.svg"
isMask: false
title : "No Folders!"
body: "Add new music to your sources to browse by folders"
......
......@@ -62,6 +62,26 @@ Maui.ToolBar
}
}
rightContent: [
ToolButton
{
icon.name: "edit-delete"
onClicked:
{
player.stop()
mainPlaylist.table.list.clear()
root.sync = false
root.syncPlaylist = ""
}
}
]
leftContent: ToolButton
{
icon.name: "document-save"
onClicked: mainPlaylist.table.saveList()
}
middleContent: ListView
{
id: _listView
......@@ -73,7 +93,7 @@ Maui.ToolBar
interactive: true
currentIndex: currentTrackIndex
spacing: Maui.Style.space.medium
// cacheBuffer: control.width * 1
// cacheBuffer: control.width * 1
onCurrentIndexChanged: positionViewAtIndex(currentIndex, ListView.Center)
highlightFollowsCurrentItem: true
......@@ -103,6 +123,7 @@ Maui.ToolBar
{
anchors.fill: parent
iconSizeHint: height - Maui.Style.space.small
iconVisible: false
imageSource: model.artwork ? model.artwork : "qrc:/assets/cover.png"
label1.text: model.title
label2.text: model.artist + " | " + model.album
......
......@@ -15,7 +15,7 @@ import "../../view_models/BabeTable"
Maui.Page
{
id: mainPlaylistRoot
id: control
property alias list : table.list
property alias listModel: table.listModel
......@@ -58,47 +58,15 @@ Maui.Page
holder.title : "Meh!"
holder.body: "Start putting together your playlist!"
holder.emojiSize: Maui.Style.iconSizes.huge
onRowClicked: play(index)
showQuickActions: false
listView.header: Maui.ToolBar
{
Kirigami.Theme.inherit: false
z: table.z +999
width: table.width
visible: table.list.count > 0
rightContent: ToolButton
{
icon.name: "edit-clear"
onClicked:
{
player.stop()
mainPlaylist.table.list.clear()
root.sync = false
root.syncPlaylist = ""
}
}
middleContent: Label
{
text: qsTr("Now playing")
}
leftContent: ToolButton
{
icon.name: "document-save"
onClicked: mainPlaylist.table.saveList()
}
}
listView.footer: Rectangle
listView.header: Rectangle
{
visible: root.sync
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet:Kirigami.Theme.Complementary
z: table.z + 999
width: table.width
height: Maui.Style.rowHeightAlt
height: visible ? Maui.Style.rowHeightAlt : 0
color: Kirigami.Theme.backgroundColor
RowLayout
......@@ -127,6 +95,59 @@ Maui.Page
}
}
delegate: TableDelegate
{
id: delegate
width: listView.width
number : false
coverArt : true
showEmblem: false
onPressAndHold: if(Kirigami.Settings.isMobile && table.allowMenu) table.openItemMenu(index)
onRightClicked: if(allowMenu) openItemMenu(index)
sameAlbum:
{
if(coverArt)
{
if(list.get(index-1))
{
if(list.get(index-1).album === album && list.get(index-1).artist === artist) true
else false
}else false
}else false
}
ToolButton
{
Layout.fillHeight: true
Layout.preferredWidth: implicitWidth
visible: (Kirigami.Settings.isMobile ? true : delegate.hovered)
icon.name: "edit-clear"
onClicked:
{
if(index === currentTrackIndex)
player.stop()
list.remove(index)
}
opacity: delegate.hovered ? 0.8 : 0.6
}
onClicked:
{
table.currentIndex = index
if(Kirigami.Settings.isMobile)
control.play(index)
}
onDoubleClicked:
{
table.currentIndex = index
if(!Kirigami.Settings.isMobile)
control.play(index)
}
}
onArtworkDoubleClicked: contextMenu.babeIt(index)
property int startContentY
......
......@@ -52,7 +52,7 @@ Maui.Page
Maui.NewDialog
{
id: newPlaylistDialog
title: qsTr("New Playlist...")
title: qsTr("Add new playlist")
onFinished: addPlaylist(text)
acceptText: qsTr("Create")
rejectButton.visible: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment