harbour-allradio/qml/models/GetCountryStations.qml

42 lines
1.6 KiB
QML

import QtQuick 2.0
import QtQuick.XmlListModel 2.0
Item {
property string name: ""
property bool nameExact: false
property string countrycode: ""
property string tag: ""
property bool tagExcact: false
property string codec: ""
property string order: ""
property bool reverse: false
property int offset: 0
property int limit: 150
property string source: ""
// Allradio specific:
property string country: countrycode ? radioBrowser.getCountryName(countrycode) : "World"
property alias finished: searchModel.finished
property string filterString
property alias stationsModel: searchModel.stationsModel
property bool clear: false
property AdvancedSearchModel searchModel : AdvancedSearchModel {id:searchModel}
onSourceChanged: {searchModel.source = source}
onClearChanged: if (clear) {searchModel.clear;searchModel.stationsModel.clear();offset=0;clear=false}
function getStations() {
searchModel.xml=""
filterString = ""
if (name !== "") {filterString = "&name="+name+"&nameExact="+nameExact}
if (countrycode !== "") filterString = filterString + "&countrycode="+countrycode
if (tag !== "") filterString = filterString + "&tag="+tag+"&tagExact="+tagExcact
if (codec !== "") filterString = filterString + "&codec="+codec
if (order !== "") filterString = filterString + "&order="+order
if (order === "name") reverse = false; else reverse = true
filterString = filterString + "&reverse="+reverse + "&offset="+offset+"&limit="+limit
source = radioBrowser.serverUrl + "/xml/stations/search?hidebroken=true"+filterString
}
}