Commit d7b2ad00 authored by kempe's avatar kempe

Refatored small audio player to work with loader and changed the name

parent 483cbe63
......@@ -60,13 +60,14 @@ DISTFILES += \
qml/cover/layouts/CoverDesign.qml \
qml/components/audioplayer/StationInfoLabel.qml \
qml/components/listmodels/ApiLanguageListModel.qml \
qml/components/audioplayer/DockerAudioPlayerSmalForm.ui.qml \
qml/components/audioplayer/DockerAudioPlayerSmal.qml \
qml/components/audioplayer/SleepTimerSwitch.qml \
qml/components/sleeptimer/SleepTimerDialogForm.ui.qml \
qml/components/sleeptimer/SleepTimerDialog.qml \
qml/components/sleeptimer/SleepTimer.qml \
qml/components/listmodels/PlayerLayoutListModel.qml
qml/components/listmodels/PlayerLayoutListModel.qml \
qml/components/audioplayer/DockedAudioPlayerLoader.qml \
qml/components/audioplayer/DockedAudioPlayerSmall.qml \
qml/components/audioplayer/DockedAudioPlayerSmallForm.ui.qml
OTHER_FILES += \
rpm/harbour-received.changes.in \
......
......@@ -4,18 +4,12 @@ import it.kempe.AudioPlayer 1.0
import "../sleeptimer"
import "../js/Favorites.js" as FavoritesUtils
DockerAudioPlayerSmalForm {
DockedAudioPlayerSmallForm {
id: player
// Layout
width: parent.width
dock: Dock.Bottom
Behavior on opacity { FadeAnimation {duration: 300}}
Behavior on y { }
// Property assignment
isPlaying: AudioPlayer.isPlaying
isFavorite: FavoritesUtils.isFavorite(window.stationData);
currentTrack: AudioPlayer.title
bufferProgress: AudioPlayer.bufferProgress
showProgressBar: AudioPlayer.isLoading || AudioPlayer.isBuffering
......@@ -27,7 +21,7 @@ DockerAudioPlayerSmalForm {
opener.onClicked: console.debug("Show fullscreen player controls")
buttonPlay.onClicked: AudioPlayer.togglePlayback();
timerSwitch.onClicked: toggleSleepTimer()
favoriteSwitch.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(stationData)
favoriteSwitch.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(window.stationData)
// Components
......@@ -47,7 +41,6 @@ DockerAudioPlayerSmalForm {
}
}
// Helper functions
function toggleSleepTimer() {
playerMenu.close()
if (timerSwitch.checked) {
......@@ -56,28 +49,4 @@ DockerAudioPlayerSmalForm {
sleepTimer.stopTimer()
}
}
function play(station) {
if(!player.expanded)
player.open = true;
player.stationData = JSON.parse(JSON.stringify(station));
player.isFavorite = FavoritesUtils.isFavorite(stationData);
window.stationIcon = stationData.stationLogo;
AudioPlayer.loadUrl(stationData.url)
}
function playNext() {
var nextStation = FavoritesUtils.getNextFavorite(stationData);
console.debug("Playing next favorite", JSON.stringify(nextStation));
play(nextStation);
}
function playPrev() {
var prevStation = FavoritesUtils.getPrevFavorite(stationData);
console.debug("Playing prev favorite", JSON.stringify(prevStation));
play(prevStation);
}
}
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../"
DockedPanel {
Item {
id: player
property bool isPlaying
property bool isFavorite
property var stationData
property string currentTrack
property int bufferProgress
property bool showProgressBar
......@@ -22,9 +20,6 @@ DockedPanel {
property real hightPadding: Theme.paddingMedium
height: Theme.itemSizeSmall + (hightPadding * 2)
contentHeight: height
flickableDirection: Flickable.VerticalFlick
MouseArea {
id: opener
......@@ -45,7 +40,7 @@ DockedPanel {
height: parent.height
width: parent.height
source: window.stationIcon
source: window.stationData ? window.stationData.stationLogo : ""
smooth: true
cache: true
......@@ -55,7 +50,7 @@ DockedPanel {
}
StationInfoLabel {
name: stationData ? stationData.name : ""
name: window.stationData ? window.stationData.name : ""
track: currentTrack
width: parent.width - (buttonPlay.width + stationIcon.width + Theme.paddingLarge*2)
height: parent.height
......
......@@ -3,5 +3,5 @@ import QtQuick 2.0
ListModel {
id: model
ListElement { title: qsTr("Original player"); fileName: "DockedAudioPlayer" }
ListElement { title: qsTr("Smal player"); fileName: "DockedAudioPlayerSmal" }
ListElement { title: qsTr("Small player"); fileName: "DockedAudioPlayerSmall" }
}
......@@ -191,7 +191,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Smal player</source>
<source>Small player</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -191,7 +191,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Smal player</source>
<source>Small player</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -191,7 +191,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Smal player</source>
<source>Small player</source>
<translation type="unfinished"></translation>
</message>
</context>
......
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