Commit fce53904 authored by kempe's avatar kempe

Implemented sleep and favourite functions on new layout

parent ab7cc910
......@@ -62,7 +62,8 @@ DISTFILES += \
qml/components/audioplayer/StationInfoLabel.qml \
qml/components/listmodels/ApiLanguageListModel.qml \
qml/components/audioplayer/DockerAudioPlayerSmalForm.ui.qml \
qml/components/audioplayer/DockerAudioPlayerSmal.qml
qml/components/audioplayer/DockerAudioPlayerSmal.qml \
qml/components/audioplayer/SleepTimerSwitch.qml
OTHER_FILES += \
rpm/harbour-received.changes.in \
......
......@@ -25,7 +25,29 @@ DockerAudioPlayerSmalForm {
// Triggers
opener.onClicked: console.debug("Show fullscreen player controls")
buttonPlay.onClicked: AudioPlayer.togglePlayback();
favoriteSwitch.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(stationData)
sleepTimer.onSleepTriggered: AudioPlayer.stop()
timerSwitch.onClicked: {
playerMenu.close()
if (timerSwitch.checked) {
var sTime = DB.loadSleepTimer()
console.debug("DB HOUR: " + sTime.hour)
console.debug("DB MINUTE: " + sTime.minute)
var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", {
hour: sTime.hour,
minute: sTime.minute,
hourMode: DateTime.TwentyFourHours
})
dialog.accepted.connect(function() {
DB.updateSleepTimer(dialog.hour, dialog.minute)
var sec = (dialog.minute + (dialog.hour * 60)) * 60;
sleepTimer.startTimer(sec);
})
} else {
sleepTimer.stopTimer()
}
}
......
......@@ -8,6 +8,7 @@ DockedPanel {
property alias opener: opener
property alias buttonPlay: buttonPlay
property alias playerMenu: playerMenu
property bool showProgressBar: false
property bool isPlaying: false
......@@ -16,6 +17,8 @@ DockedPanel {
property string currentTrack: ""
property alias sleepTimer: sleepTimer
property alias timerSwitch: timerSwitch
property alias favoriteSwitch: favoriteSwitch
property real hightPadding: Theme.paddingMedium
property var stationData
......@@ -26,6 +29,7 @@ DockedPanel {
SleepTimer {
id: sleepTimer
onRunningChanged: timerSwitch.checked = running // For some reason the binding on timerSwitch is not working
}
MouseArea {
......@@ -71,4 +75,32 @@ DockedPanel {
icon.source: isPlaying ? "image://theme/icon-m-pause" : "image://theme/icon-m-play"
}
}
PushUpMenu {
id: playerMenu
width: parent.width
Row {
id: pushupMenuRow
width: parent.width
property real itemWidth: width / 2
Switch {
id: favoriteSwitch
width: pushupMenuRow.itemWidth
icon.source: "image://theme/icon-m-favorite"
checked: isFavorite
}
SleepTimerSwitch {
id: timerSwitch
width: pushupMenuRow.itemWidth
clockText: sleepTimer.clockText
checked: sleepTimer.running
showText: sleepTimer.running
}
}
}
}
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../"
Column {
id: root
signal clicked
property string clockText
property bool showText
property alias checked: m_switch.checked
Switch {
id: m_switch
width: parent.width
icon.source: "image://theme/icon-m-timer"
onClicked: root.clicked()
}
Label {
id: timerText
text: root.clockText
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeExtraSmall
anchors.horizontalCenter: m_switch.horizontalCenter
visible: root.showText
}
}
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