Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
sailfish-apps
Received
Commits
483cbe63
Commit
483cbe63
authored
Nov 17, 2017
by
kempe
Browse files
Refactored audioPlayer to work with the loader
parent
6e32bf43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
42 deletions
+5
-42
qml/components/audioplayer/DockedAudioPlayer.qml
qml/components/audioplayer/DockedAudioPlayer.qml
+2
-33
qml/components/audioplayer/DockedAudioPlayerForm.ui.qml
qml/components/audioplayer/DockedAudioPlayerForm.ui.qml
+3
-9
No files found.
qml/components/audioplayer/DockedAudioPlayer.qml
View file @
483cbe63
...
...
@@ -7,15 +7,9 @@ import "../js/Favorites.js" as FavoritesUtils
DockedAudioPlayerForm
{
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
...
...
@@ -26,7 +20,7 @@ DockedAudioPlayerForm {
// Triggers
opener.onClicked
:
console
.
debug
(
"
Show fullscreen player controls
"
)
buttonPlay.onClicked
:
AudioPlayer
.
togglePlayback
();
buttonStar.onClicked
:
player
.
isFavorite
=
FavoritesUtils
.
toogleFavorite
(
stationData
)
buttonStar.onClicked
:
player
.
isFavorite
=
FavoritesUtils
.
toogleFavorite
(
window
.
stationData
)
buttonPrevious.onClicked
:
playPrev
()
buttonNext.onClicked
:
playNext
()
cancelSleepTimer.onClicked
:
sleepTimer
.
stopTimer
()
...
...
@@ -50,29 +44,4 @@ DockedAudioPlayerForm {
onActivateTimer
:
sleepTimer
.
startTimer
(
sec
)
}
}
// Helper functions
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
);
}
}
qml/components/audioplayer/DockedAudioPlayerForm.ui.qml
View file @
483cbe63
import
QtQuick
2.6
import
Sailfish
.
Silica
1.0
import
"
../
"
import
"
../sleeptimer
"
DockedPanel
{
Item
{
id
:
player
property
bool
isPlaying
property
bool
isFavorite
property
var
stationData
property
string
currentTrack
property
int
bufferProgress
property
bool
showProgressBar
...
...
@@ -21,16 +19,12 @@ DockedPanel {
property
alias
buttonPrevious
:
controls
.
buttonPrevious
property
alias
buttonNext
:
controls
.
buttonNext
property
alias
playerMenu
:
playerMenu
property
alias
cancelSleepTimer
:
cancelSleepTimer
property
alias
setSleepTimer
:
setSleepTimer
property
real
hightPadding
:
Theme
.
paddingMedium
height
:
Theme
.
itemSizeExtraLarge
+
(
hightPadding
*
2
)
contentHeight
:
height
flickableDirection
:
Flickable
.
VerticalFlick
MouseArea
{
id
:
opener
...
...
@@ -51,7 +45,7 @@ DockedPanel {
height
:
parent
.
height
width
:
parent
.
height
source
:
window
.
station
Icon
source
:
window
.
station
Data
?
window
.
stationData
.
stationLogo
:
""
smooth
:
true
cache
:
true
...
...
@@ -67,7 +61,7 @@ DockedPanel {
height
:
parent
.
height
StationInfoLabel
{
name
:
stationData
?
stationData
.
name
:
""
name
:
window
.
stationData
?
window
.
stationData
.
name
:
""
track
:
currentTrack
width
:
parent
.
width
height
:
parent
.
height
/
2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment