forked from nesnomis/harbour-allradio2
Initial commit (new git name)
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Nemo.Notifications 1.0
|
||||
import Amber.Mpris 1.0
|
||||
import "pages"
|
||||
import "items"
|
||||
import "helpers"
|
||||
|
||||
ApplicationWindow
|
||||
{
|
||||
id: allRadio
|
||||
property string _version: Qt.application.version
|
||||
property string _language: Qt.locale().name.slice(0,2)
|
||||
property string _country: Qt.locale().name.slice(-2)
|
||||
property int sleepTime: 0
|
||||
property alias mediaPlayerPanel: mediaPlayerPanel
|
||||
property alias radioPlayer: radioPlayer
|
||||
property alias radioBrowser: radioBrowser
|
||||
property alias sleepTimer: sleepTimer
|
||||
/*
|
||||
property RadioPlayer radioPlayer : RadioPlayer {id:radioPlayer}
|
||||
property RadioBrowser radioBrowser : RadioBrowser {id:radioBrowser;parent: allRadio}
|
||||
property SleepTimer sleepTimer : SleepTimer {id:sleepTimer}
|
||||
*/
|
||||
SleepTimer {id: sleepTimer}
|
||||
RadioBrowser {id: radioBrowser; parent: allRadio}
|
||||
RadioPlayer {id: radioPlayer}
|
||||
RadioMprisPlayer {id: radioMprisPlayer}
|
||||
MediaPlayerPanel {id: mediaPlayerPanel}
|
||||
Notification {id: notification;onClicked: console.log("Clicked")}
|
||||
|
||||
// Not finished. --latest and --random should work though
|
||||
function handleArguments() {
|
||||
for(var i = 1; i < Qt.application.arguments.length; i++) {
|
||||
switch (Qt.application.arguments[i]) {
|
||||
case "--help": help();break; // no argument
|
||||
case "--sleep": console.info("*** SLEEP *** : "+Qt.application.arguments[i+1]);break; // play for 1-120 minutes (sleeptimer)
|
||||
case "--latest": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);latest();break; // latest, saved, random, world
|
||||
case "--random": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);random();break; // latest, saved, random, world
|
||||
}
|
||||
}
|
||||
}
|
||||
// Help text to be displayed in the console
|
||||
function help(){
|
||||
console.info("help")
|
||||
}
|
||||
// Play latest from console 'harbour-allradio --latest'
|
||||
function latest(){
|
||||
radioPlayer.loadRecentPlay()
|
||||
radioPlayer.playStream()
|
||||
}
|
||||
// Play random from console (stations added to favorites needed) 'harbour-allradio --random'
|
||||
function random(){
|
||||
radioPlayer.loadRandomPlay()
|
||||
radioPlayer.playStream()
|
||||
}
|
||||
|
||||
initialPage: Component { AllRadio { } }
|
||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||
allowedOrientations: defaultAllowedOrientations
|
||||
Component.onCompleted: {mediaPlayerPanel.parent.z = 99;handleArguments()}
|
||||
}
|
||||
Reference in New Issue
Block a user