Commit 8451508b authored by Kempe's avatar Kempe
Browse files

[TASK] Change root window name

parent d685a462
......@@ -29,35 +29,35 @@ Python {
}
function playStationById(id) {
loading = true;
app.loading = true;
call('api.radio.getStationById', [''+id], function(response) {
var station = Rad.getStationFromRadioJson(response);
console.debug("Playing station:", JSON.stringify(station))
player.play(station);
loading = false;
app.loading = false;
});
}
function addRadIoAsFavorite(id) {
loading = true;
app.loading = true;
call('api.radio.getStationById', [''+id], function(response) {
var station = Rad.getStationFromRadioJson(response);
FavoritesUtils.addFavorite(station)
loading = false
app.loading = false
});
}
function updateFavorite(oldFavorite) {
loading = true;
app.loading = true;
call('api.radio.getStationById', [''+oldFavorite.radIoId], function(response) {
var station = Rad.getStationFromRadioJson(response);
FavoritesUtils.removeFavorite(oldFavorite);
FavoritesUtils.addFavorite(station);
console.log("Updated", JSON.stringify(oldFavorite));
loading = false;
app.loading = false;
});
}
......@@ -82,7 +82,7 @@ Python {
}
function getOptionsByCategoryAndUpdateList(method, category, mList) {
window.loading = true;
app.loading = true;
call(method, [], function(response) {
console.log("Number of results:", response.length)
console.debug(JSON.stringify(response))
......@@ -92,7 +92,7 @@ Python {
mList.append({ title: response.localized, name: response.systemEnglish, category: category})
});
loading = false
app.loading = false
});
}
......@@ -137,7 +137,7 @@ Python {
}
function getStationsAndUpdateList(method, params, mList) {
window.loading = true;
app.loading = true;
call(method, params, function(response) {
console.log("Number of results:", response.length)
console.debug(JSON.stringify(response))
......@@ -149,7 +149,7 @@ Python {
// }
});
loading = false
app.loading = false
});
}
......
......@@ -9,7 +9,7 @@ DockedAudioPlayerForm {
// Property assignment
isPlaying: AudioPlayer.isPlaying
isFavorite: FavoritesUtils.isFavorite(window.stationData);
isFavorite: FavoritesUtils.isFavorite(app.stationData);
currentTrack: AudioPlayer.title
bufferProgress: AudioPlayer.bufferProgress
showProgressBar: AudioPlayer.isLoading || AudioPlayer.isBuffering
......@@ -20,7 +20,7 @@ DockedAudioPlayerForm {
// Triggers
opener.onClicked: console.debug("Show fullscreen player controls")
buttonPlay.onClicked: AudioPlayer.togglePlayback();
buttonStar.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(window.stationData)
buttonStar.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(app.stationData)
buttonPrevious.onClicked: playPrev()
buttonNext.onClicked: playNext()
cancelSleepTimer.onClicked: sleepTimer.stopTimer()
......
......@@ -45,7 +45,7 @@ Item {
height: parent.height
width: parent.height
source: window.stationData ? window.stationData.stationLogo : ""
source: app.stationData ? app.stationData.stationLogo : ""
smooth: true
cache: true
......@@ -61,7 +61,7 @@ Item {
height: parent.height
StationInfoLabel {
name: window.stationData ? window.stationData.name : ""
name: app.stationData ? app.stationData.name : ""
track: currentTrack
width: parent.width
height: parent.height / 2
......
......@@ -41,18 +41,18 @@ DockedPanel {
if (!expanded)
open = true
window.stationData = JSON.parse(JSON.stringify(station));
AudioPlayer.loadUrl(window.stationData.url)
app.stationData = JSON.parse(JSON.stringify(station));
AudioPlayer.loadUrl(app.stationData.url)
}
function playNext() {
var nextStation = FavoritesUtils.getNextFavorite(window.stationData);
var nextStation = FavoritesUtils.getNextFavorite(app.stationData);
console.debug("Playing next favorite", JSON.stringify(nextStation));
play(nextStation);
}
function playPrev() {
var prevStation = FavoritesUtils.getPrevFavorite(window.stationData);
var prevStation = FavoritesUtils.getPrevFavorite(app.stationData);
console.debug("Playing prev favorite", JSON.stringify(prevStation));
play(prevStation);
}
......
......@@ -9,7 +9,7 @@ DockedAudioPlayerSmallForm {
// Property assignment
isPlaying: AudioPlayer.isPlaying
isFavorite: FavoritesUtils.isFavorite(window.stationData);
isFavorite: FavoritesUtils.isFavorite(app.stationData);
currentTrack: AudioPlayer.title
bufferProgress: AudioPlayer.bufferProgress
showProgressBar: AudioPlayer.isLoading || AudioPlayer.isBuffering
......@@ -21,7 +21,7 @@ DockedAudioPlayerSmallForm {
opener.onClicked: console.debug("Show fullscreen player controls")
buttonPlay.onClicked: AudioPlayer.togglePlayback();
timerSwitch.onClicked: toggleSleepTimer()
favoriteSwitch.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(window.stationData)
favoriteSwitch.onClicked: player.isFavorite = FavoritesUtils.toogleFavorite(app.stationData)
// Components
......
......@@ -40,7 +40,7 @@ Item {
height: parent.height
width: parent.height
source: window.stationData ? window.stationData.stationLogo : ""
source: app.stationData ? app.stationData.stationLogo : ""
smooth: true
cache: true
......@@ -50,7 +50,7 @@ Item {
}
StationInfoLabel {
name: window.stationData ? window.stationData.name : ""
name: app.stationData ? app.stationData.name : ""
track: currentTrack
width: parent.width - (buttonPlay.width + stationThumbnail.width + Theme.paddingLarge*2)
height: parent.height
......
......@@ -11,7 +11,7 @@ CoverBackground {
anchors.left: parent.left
title: AudioPlayer.title
thumbnail: window.stationData ? window.stationData.stationLogo : ""
thumbnail: app.stationData ? app.stationData.stationLogo : ""
}
......@@ -22,7 +22,7 @@ CoverBackground {
id: playToggle
iconSource: AudioPlayer.isPlaying ? "image://theme/icon-cover-pause" : "image://theme/icon-cover-play"
onTriggered: {
if(!window.stationData)
if(!app.stationData)
player.playNext()
else
AudioPlayer.togglePlayback()
......
......@@ -10,7 +10,7 @@ import "./components/js/Utils.js" as Utils
ApplicationWindow
{
id: window
id: app
property bool loading
property var stationData
......
......@@ -40,6 +40,6 @@ SettingsPageForm {
}
}
playerLayoutChanged.connect(window.playerLayoutUpdated)
playerLayoutChanged.connect(app.playerLayoutUpdated)
}
}
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