Доделал переключение каналов, небольшой рефакторинг

This commit is contained in:
2018-08-12 10:06:17 +02:00
parent 39aeb66fff
commit b6001e4e81
7 changed files with 77 additions and 37 deletions

View File

@@ -3,21 +3,21 @@ import QtQml.Models 2.1
ListModel {
id: root
readonly property var httpClient: HttpClient {
id: httpClient
readonly property var client: NooLiteClient {
id: nooLiteClient
onError: {
root.error(text)
root.isLoading = false
}
onReply: {
onModelLoad: {
root.populateModel(data)
root.isLoading = false
}
}
property string serviceUrl: undefined
property alias serviceUrl: nooLiteClient.serviceUrl
property bool isLoading: false
signal error(string text)
@@ -25,7 +25,7 @@ ListModel {
onServiceUrlChanged: reload()
function reload() {
root.httpClient.get(root.serviceUrl + '/static/channels.js')
root.client.loadModel()
root.isLoading = true
}
@@ -34,4 +34,8 @@ ListModel {
root.append(group)
})
}
function switchChannel(channelId) {
root.client.switchChannel(channelId)
}
}