diff options
author | Kimmo Ollila <kimmo.ollila@digia.com> | 2013-05-29 10:58:18 +0300 |
---|---|---|
committer | Lasse Räihä <lasse.raiha@digia.com> | 2013-05-29 10:59:45 +0300 |
commit | f58e7419611cccb9141dbc5b0224b1f9d44cf45f (patch) | |
tree | 75d042fa104c4b91edc9486f9b08b8a78dd08f3c /QtDemo/qml | |
parent | 743225d98d2162d8dce1882ea3b3ca5384e02e93 (diff) |
Radio: Changed channel list to XML format
Change-Id: I563ad94f8b2914892dec6b7385d190d2d5569cce
Reviewed-by: Lasse Räihä <lasse.raiha@digia.com>
Diffstat (limited to 'QtDemo/qml')
-rw-r--r-- | QtDemo/qml/QtDemo/demos/radio/channels.xml | 27 | ||||
-rw-r--r-- | QtDemo/qml/QtDemo/demos/radio/radio.qml | 17 |
2 files changed, 35 insertions, 9 deletions
diff --git a/QtDemo/qml/QtDemo/demos/radio/channels.xml b/QtDemo/qml/QtDemo/demos/radio/channels.xml new file mode 100644 index 0000000..99522ab --- /dev/null +++ b/QtDemo/qml/QtDemo/demos/radio/channels.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> + <radio> + <channel> + <title>BBC World Service</title> + <url>http://vpr.streamguys.net/vpr24.mp3</url> + </channel> + <channel> + <title>CBC Music Hard Rock</title> + <url>http://2903.live.streamtheworld.com:80/CBC_HAROCK_H_SC.mp3</url> + </channel> + <channel> + <title>"JPR Classics"</title> + <url>http://jpr.streamguys.org:80/jpr-classics</url> + </channel> + <channel> + <title>VPR Classical</title> + <url>http://vprclassical.streamguys.net/vprclassical24.mp3</url> + </channel> + <channel> + <title>VPR Jazz24</title> + <url>http://vprjazz.streamguys.net/vprjazz24.mp3</url> + </channel> + <channel> + <title>Radio Paradise</title> + <url>http://scfire-m26.websys.aol.com:80/radio_paradise_mp3_128kbps.mp3</url> + </channel> + </radio> diff --git a/QtDemo/qml/QtDemo/demos/radio/radio.qml b/QtDemo/qml/QtDemo/demos/radio/radio.qml index df88dab..f76bc64 100644 --- a/QtDemo/qml/QtDemo/demos/radio/radio.qml +++ b/QtDemo/qml/QtDemo/demos/radio/radio.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 import QtMultimedia 5.0 +import QtQuick.XmlListModel 2.0 FocusScope { id: scope @@ -118,7 +119,7 @@ FocusScope { id: delegateText anchors.left: parent.left anchors.top: parent.top - text: (index+1) +". " +name + text: (index+1) +". " +title font.pixelSize: stationDelegate.opened? stationList.height*.15 : stationList.height*.1 font.weight: stationDelegate.opened? Font.Bold: Font.Normal color: stationList.openedIndex ===-1 || opened? "white": "#0e82b8" @@ -152,7 +153,7 @@ FocusScope { stationList.openedIndex=-1 }else { stationList.openedIndex= index - browseTimer.source = source + browseTimer.source = url browseTimer.restart() } } @@ -162,14 +163,12 @@ FocusScope { } } - ListModel { + XmlListModel { id: stationModel - ListElement{name: "BBC World Service"; source: "http://vpr.streamguys.net/vpr24.mp3"} - ListElement{name: "CBC Music Hard Rock"; source: "http://2903.live.streamtheworld.com:80/CBC_HAROCK_H_SC.mp3"} - ListElement{name: "JPR Classics & News"; source: "http://jpr.streamguys.org:80/jpr-classics"} - ListElement{name: "VPR Classical"; source: "http://vprclassical.streamguys.net/vprclassical24.mp3"} - ListElement{name: "VPR Jazz24"; source: "http://vprjazz.streamguys.net/vprjazz24.mp3"} - ListElement{name: "Radio Paradise"; source: "http://scfire-m26.websys.aol.com:80/radio_paradise_mp3_128kbps.mp3"} + source: "channels.xml" + query: "/radio/channel" + XmlRole {name: "title"; query: "title/string()"} + XmlRole {name: "url"; query: "url/string()"} } VolumeButton { |