Assign icon to genreated categories

This commit is contained in:
craig.p.drummond
2013-04-09 17:39:56 +00:00
committed by craig.p.drummond
parent 1154a0b1c3
commit 1d64674f56
3 changed files with 85 additions and 81 deletions

View File

@@ -1,72 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<streams>
<stream name="IceCast" url="http://dir.xiph.org/yp.xml" type="0"/>
<stream name="SomaFM" url="http://somafm.com/channels.xml" type="1"/>
<stream name="Australia" url="http://www.australianliveradio.com/" type="2"/>
<stream name="Albania" url="http://www.listenlive.eu/albania.html" region="Europe" type="2"/>
<stream name="Andorra" url="http://www.listenlive.eu/andorra.html" region="Europe" type="2"/>
<stream name="Armenia" url="http://www.listenlive.eu/armenia.html" region="Europe" type="2"/>
<stream name="Austria" url="http://www.listenlive.eu/austria.html" region="Europe" type="2"/>
<stream name="Azerbaijan" url="http://www.listenlive.eu/azerbaijan.html" region="Europe" type="2"/>
<stream name="Belarus" url="http://www.listenlive.eu/belarus.html" region="Europe" type="2"/>
<stream name="Belgium" url="http://www.listenlive.eu/belgium.html" region="Europe" type="2"/>
<stream name="Bosnia-Herzegovina" url="http://www.listenlive.eu/bosnia.html" region="Europe" type="2"/>
<stream name="Bulgaria" url="http://www.listenlive.eu/bulgaria.html" region="Europe" type="2"/>
<stream name="Croatia" url="http://www.listenlive.eu/croatia.html" region="Europe" type="2"/>
<stream name="Cyprus" url="http://www.listenlive.eu/cyprus.html" region="Europe" type="2"/>
<stream name="Czech Republic" url="http://www.listenlive.eu/czech-republic.html" region="Europe" type="2"/>
<stream name="Denmark" url="http://www.listenlive.eu/denmark.html" region="Europe" type="2"/>
<stream name="Estonia" url="http://www.listenlive.eu/estonia.html" region="Europe" type="2"/>
<stream name="Faroe Islands" url="http://www.listenlive.eu/faroe.html" region="Europe" type="2"/>
<stream name="Finland" url="http://www.listenlive.eu/finland.html" region="Europe" type="2"/>
<stream name="France" url="http://www.listenlive.eu/france.html" region="Europe" type="2"/>
<stream name="Georgia" url="http://www.listenlive.eu/georgia.html" region="Europe" type="2"/>
<stream name="Germany" url="http://www.listenlive.eu/germany.html" region="Europe" type="2"/>
<stream name="Gibraltar" url="http://www.listenlive.eu/gibraltar.html" region="Europe" type="2"/>
<stream name="Greece" url="http://www.listenlive.eu/greece.html" region="Europe" type="2"/>
<stream name="Hungary" url="http://www.listenlive.eu/hungary.html" region="Europe" type="2"/>
<stream name="Iceland" url="http://www.listenlive.eu/iceland.html" region="Europe" type="2"/>
<stream name="Ireland" url="http://www.listenlive.eu/ireland.html" region="Europe" type="2"/>
<stream name="Italy" url="http://www.listenlive.eu/italy.html" region="Europe" type="2"/>
<stream name="Latvia" url="http://www.listenlive.eu/latvia.html" region="Europe" type="2"/>
<stream name="Liechtenstein" url="http://www.listenlive.eu/liechtenstein.html" region="Europe" type="2"/>
<stream name="Lithuania" url="http://www.listenlive.eu/lithuania.html" region="Europe" type="2"/>
<stream name="Luxembourg" url="http://www.listenlive.eu/luxembourg.html" region="Europe" type="2"/>
<stream name="Macedonia" url="http://www.listenlive.eu/macedonia.html" region="Europe" type="2"/>
<stream name="Malta" url="http://www.listenlive.eu/malta.html" region="Europe" type="2"/>
<stream name="Moldova" url="http://www.listenlive.eu/moldova.html" region="Europe" type="2"/>
<stream name="Monaco" url="http://www.listenlive.eu/monaco.html" region="Europe" type="2"/>
<stream name="Montenegro" url="http://www.listenlive.eu/montenegro.html" region="Europe" type="2"/>
<stream name="Netherlands" url="http://www.listenlive.eu/netherlands.html" region="Europe" type="2"/>
<stream name="Norway" url="http://www.listenlive.eu/norway.html" region="Europe" type="2"/>
<stream name="Poland" url="http://www.listenlive.eu/poland.html" region="Europe" type="2"/>
<stream name="Portugal" url="http://www.listenlive.eu/portugal.html" region="Europe" type="2"/>
<stream name="Romania" url="http://www.listenlive.eu/romania.html" region="Europe" type="2"/>
<stream name="Russia" url="http://www.listenlive.eu/russia.html" region="Europe" type="2"/>
<stream name="San Marino" url="http://www.listenlive.eu/san-marino.html" region="Europe" type="2"/>
<stream name="Serbia" url="http://www.listenlive.eu/serbia.html" region="Europe" type="2"/>
<stream name="Slovakia" url="http://www.listenlive.eu/slovakia.html" region="Europe" type="2"/>
<stream name="Slovenia" url="http://www.listenlive.eu/slovenia.html" region="Europe" type="2"/>
<stream name="Spain" url="http://www.listenlive.eu/spain.html" region="Europe" type="2"/>
<stream name="Sweden" url="http://www.listenlive.eu/sweden.html" region="Europe" type="2"/>
<stream name="Switzerland" url="http://www.listenlive.eu/switzerland.html" region="Europe" type="2"/>
<stream name="Turkey" url="http://www.listenlive.eu/turkey.html" region="Europe" type="2"/>
<stream name="Ukraine" url="http://www.listenlive.eu/ukraine.html" region="Europe" type="2"/>
<stream name="United Kingdom" url="http://www.listenlive.eu/uk.html" region="Europe" type="2"/>
<stream name="Vatican State" url="http://www.listenlive.eu/vatican.html" region="Europe" type="2"/>
<stream name="Alberta" url="http://www.canadianwebradio.com/alberta.html" region="Canada" type="2"/>
<stream name="British Columbia" url="http://www.canadianwebradio.com/british-columbia.html" region="Canada" type="2"/>
<stream name="Manitoba" url="http://www.canadianwebradio.com/manitoba.html" region="Canada" type="2"/>
<stream name="New Brunswick" url="http://www.canadianwebradio.com/new-brunswick.html" region="Canada" type="2"/>
<stream name="Newfoundland" url="http://www.canadianwebradio.com/newfoundland.html" region="Canada" type="2"/>
<stream name="Northwest Territories" url="http://www.canadianwebradio.com/northwest-territories.html" region="Canada" type="2"/>
<stream name="Nova Scotia" url="http://www.canadianwebradio.com/nova-scotia.html" region="Canada" type="2"/>
<stream name="Nunavut" url="http://www.canadianwebradio.com/nunavut.html" region="Canada" type="2"/>
<stream name="Ontario" url="http://www.canadianwebradio.com/ontario.html" region="Canada" type="2"/>
<stream name="Prince Edward Island" url="http://www.canadianwebradio.com/prince-edward-island.html" region="Canada" type="2"/>
<stream name="Quebec" url="http://www.canadianwebradio.com/quebec.html" region="Canada" type="2"/>
<stream name="Saskatchewan" url="http://www.canadianwebradio.com/saskatchewan.html" region="Canada" type="2"/>
<stream name="Yukon" url="http://www.canadianwebradio.com/yukon.html" region="Canada" type="2"/>
<stream name="New Zealand" url="http://www.nzradioguide.co.nz/" type="2"/>
<stream name="USA" url="http://www.usliveradio.com/" type="2"/>
<stream name="IceCast" url="http://dir.xiph.org/yp.xml" type="0" icon="cube"/>
<stream name="SomaFM" url="http://somafm.com/channels.xml" type="1" icon="trebleclef"/>
<stream name="Australia" url="http://www.australianliveradio.com/" type="2" icon="radio"/>
<stream name="Albania" url="http://www.listenlive.eu/albania.html" region="Europe" type="2" icon="radio"/>
<stream name="Andorra" url="http://www.listenlive.eu/andorra.html" region="Europe" type="2" icon="radio"/>
<stream name="Armenia" url="http://www.listenlive.eu/armenia.html" region="Europe" type="2" icon="radio"/>
<stream name="Austria" url="http://www.listenlive.eu/austria.html" region="Europe" type="2" icon="radio"/>
<stream name="Azerbaijan" url="http://www.listenlive.eu/azerbaijan.html" region="Europe" type="2" icon="radio"/>
<stream name="Belarus" url="http://www.listenlive.eu/belarus.html" region="Europe" type="2" icon="radio"/>
<stream name="Belgium" url="http://www.listenlive.eu/belgium.html" region="Europe" type="2" icon="radio"/>
<stream name="Bosnia-Herzegovina" url="http://www.listenlive.eu/bosnia.html" region="Europe" type="2" icon="radio"/>
<stream name="Bulgaria" url="http://www.listenlive.eu/bulgaria.html" region="Europe" type="2" icon="radio"/>
<stream name="Croatia" url="http://www.listenlive.eu/croatia.html" region="Europe" type="2" icon="radio"/>
<stream name="Cyprus" url="http://www.listenlive.eu/cyprus.html" region="Europe" type="2" icon="radio"/>
<stream name="Czech Republic" url="http://www.listenlive.eu/czech-republic.html" region="Europe" type="2" icon="radio"/>
<stream name="Denmark" url="http://www.listenlive.eu/denmark.html" region="Europe" type="2" icon="radio"/>
<stream name="Estonia" url="http://www.listenlive.eu/estonia.html" region="Europe" type="2" icon="radio"/>
<stream name="Faroe Islands" url="http://www.listenlive.eu/faroe.html" region="Europe" type="2" icon="radio"/>
<stream name="Finland" url="http://www.listenlive.eu/finland.html" region="Europe" type="2" icon="radio"/>
<stream name="France" url="http://www.listenlive.eu/france.html" region="Europe" type="2" icon="radio"/>
<stream name="Georgia" url="http://www.listenlive.eu/georgia.html" region="Europe" type="2" icon="radio"/>
<stream name="Germany" url="http://www.listenlive.eu/germany.html" region="Europe" type="2" icon="radio"/>
<stream name="Gibraltar" url="http://www.listenlive.eu/gibraltar.html" region="Europe" type="2" icon="radio"/>
<stream name="Greece" url="http://www.listenlive.eu/greece.html" region="Europe" type="2" icon="radio"/>
<stream name="Hungary" url="http://www.listenlive.eu/hungary.html" region="Europe" type="2" icon="radio"/>
<stream name="Iceland" url="http://www.listenlive.eu/iceland.html" region="Europe" type="2" icon="radio"/>
<stream name="Ireland" url="http://www.listenlive.eu/ireland.html" region="Europe" type="2" icon="radio"/>
<stream name="Italy" url="http://www.listenlive.eu/italy.html" region="Europe" type="2" icon="radio"/>
<stream name="Latvia" url="http://www.listenlive.eu/latvia.html" region="Europe" type="2" icon="radio"/>
<stream name="Liechtenstein" url="http://www.listenlive.eu/liechtenstein.html" region="Europe" type="2" icon="radio"/>
<stream name="Lithuania" url="http://www.listenlive.eu/lithuania.html" region="Europe" type="2" icon="radio"/>
<stream name="Luxembourg" url="http://www.listenlive.eu/luxembourg.html" region="Europe" type="2" icon="radio"/>
<stream name="Macedonia" url="http://www.listenlive.eu/macedonia.html" region="Europe" type="2" icon="radio"/>
<stream name="Malta" url="http://www.listenlive.eu/malta.html" region="Europe" type="2" icon="radio"/>
<stream name="Moldova" url="http://www.listenlive.eu/moldova.html" region="Europe" type="2" icon="radio"/>
<stream name="Monaco" url="http://www.listenlive.eu/monaco.html" region="Europe" type="2" icon="radio"/>
<stream name="Montenegro" url="http://www.listenlive.eu/montenegro.html" region="Europe" type="2" icon="radio"/>
<stream name="Netherlands" url="http://www.listenlive.eu/netherlands.html" region="Europe" type="2" icon="radio"/>
<stream name="Norway" url="http://www.listenlive.eu/norway.html" region="Europe" type="2" icon="radio"/>
<stream name="Poland" url="http://www.listenlive.eu/poland.html" region="Europe" type="2" icon="radio"/>
<stream name="Portugal" url="http://www.listenlive.eu/portugal.html" region="Europe" type="2" icon="radio"/>
<stream name="Romania" url="http://www.listenlive.eu/romania.html" region="Europe" type="2" icon="radio"/>
<stream name="Russia" url="http://www.listenlive.eu/russia.html" region="Europe" type="2" icon="radio"/>
<stream name="San Marino" url="http://www.listenlive.eu/san-marino.html" region="Europe" type="2" icon="radio"/>
<stream name="Serbia" url="http://www.listenlive.eu/serbia.html" region="Europe" type="2" icon="radio"/>
<stream name="Slovakia" url="http://www.listenlive.eu/slovakia.html" region="Europe" type="2" icon="radio"/>
<stream name="Slovenia" url="http://www.listenlive.eu/slovenia.html" region="Europe" type="2" icon="radio"/>
<stream name="Spain" url="http://www.listenlive.eu/spain.html" region="Europe" type="2" icon="radio"/>
<stream name="Sweden" url="http://www.listenlive.eu/sweden.html" region="Europe" type="2" icon="radio"/>
<stream name="Switzerland" url="http://www.listenlive.eu/switzerland.html" region="Europe" type="2" icon="radio"/>
<stream name="Turkey" url="http://www.listenlive.eu/turkey.html" region="Europe" type="2" icon="radio"/>
<stream name="Ukraine" url="http://www.listenlive.eu/ukraine.html" region="Europe" type="2" icon="radio"/>
<stream name="United Kingdom" url="http://www.listenlive.eu/uk.html" region="Europe" type="2" icon="radio"/>
<stream name="Vatican State" url="http://www.listenlive.eu/vatican.html" region="Europe" type="2" icon="radio"/>
<stream name="Alberta" url="http://www.canadianwebradio.com/alberta.html" region="Canada" type="2" icon="radio"/>
<stream name="British Columbia" url="http://www.canadianwebradio.com/british-columbia.html" region="Canada" type="2" icon="radio"/>
<stream name="Manitoba" url="http://www.canadianwebradio.com/manitoba.html" region="Canada" type="2" icon="radio"/>
<stream name="New Brunswick" url="http://www.canadianwebradio.com/new-brunswick.html" region="Canada" type="2" icon="radio"/>
<stream name="Newfoundland" url="http://www.canadianwebradio.com/newfoundland.html" region="Canada" type="2" icon="radio"/>
<stream name="Northwest Territories" url="http://www.canadianwebradio.com/northwest-territories.html" region="Canada" type="2" icon="radio"/>
<stream name="Nova Scotia" url="http://www.canadianwebradio.com/nova-scotia.html" region="Canada" type="2" icon="radio"/>
<stream name="Nunavut" url="http://www.canadianwebradio.com/nunavut.html" region="Canada" type="2" icon="radio"/>
<stream name="Ontario" url="http://www.canadianwebradio.com/ontario.html" region="Canada" type="2" icon="radio"/>
<stream name="Prince Edward Island" url="http://www.canadianwebradio.com/prince-edward-island.html" region="Canada" type="2" icon="radio"/>
<stream name="Quebec" url="http://www.canadianwebradio.com/quebec.html" region="Canada" type="2" icon="radio"/>
<stream name="Saskatchewan" url="http://www.canadianwebradio.com/saskatchewan.html" region="Canada" type="2" icon="radio"/>
<stream name="Yukon" url="http://www.canadianwebradio.com/yukon.html" region="Canada" type="2" icon="radio"/>
<stream name="New Zealand" url="http://www.nzradioguide.co.nz/" type="2" icon="radio"/>
<stream name="USA" url="http://www.usliveradio.com/" type="2" icon="radio"/>
</streams>

View File

@@ -50,12 +50,14 @@ QList<WebStream *> WebStream::getAll()
if (doc.isStartElement() && QLatin1String("stream")==doc.name()) {
QString name=doc.attributes().value("name").toString();
QString icon=doc.attributes().value("icon").toString();
QString region=doc.attributes().value("region").toString();
unsigned int type=doc.attributes().value("type").toString().toUInt();
QUrl url=QUrl(doc.attributes().value("url").toString());
switch (type) {
case WS_IceCast: providers.append(new IceCastWebStream(name, doc.attributes().value("region").toString(), url)); break;
case WS_SomaFm: providers.append(new SomaFmWebStream(name, doc.attributes().value("region").toString(), url)); break;
case WS_Radio: providers.append(new RadioWebStream(name, doc.attributes().value("region").toString(), url)); break;
case WS_IceCast: providers.append(new IceCastWebStream(name, icon, region, url)); break;
case WS_SomaFm: providers.append(new SomaFmWebStream(name, icon, region, url)); break;
case WS_Radio: providers.append(new RadioWebStream(name, icon, region, url)); break;
default: break;
}
}
@@ -107,7 +109,7 @@ void WebStream::downloadFinished()
if (streams.isEmpty()) {
emit error(i18nc("message \n url", "No streams downloaded from %1\n(%2)").arg(name).arg(url.toString()));
} else {
StreamsModel::self()->add(name, streams);
StreamsModel::self()->add(name, icon, streams);
}
} else {
emit error(i18nc("message \n url", "Failed to download streams from %1\n(%2)").arg(name).arg(url.toString()));

View File

@@ -37,13 +37,14 @@ public:
static QList<WebStream *> getAll();
static WebStream * get(const QUrl &url);
WebStream(const QString &n, const QString &r, const QUrl &u)
: name(n), region(r), url(u), job(0) { }
WebStream(const QString &n, const QString &i, const QString &r, const QUrl &u)
: name(n),icon(i), region(r), url(u), job(0) { }
virtual ~WebStream() { }
virtual QList<StreamsModel::StreamItem *> parse(QIODevice *dev)=0;
const QString & getName() const { return name; }
const QString & getIcon() const { return icon; }
const QString & getRegion() const { return region; }
const QUrl & getUrl() const { return url; }
bool isDownloading() const { return 0!=job; }
@@ -59,6 +60,7 @@ private Q_SLOTS:
protected:
QString name;
QString icon;
QString region;
QUrl url;
QNetworkReply *job;
@@ -67,24 +69,24 @@ protected:
class IceCastWebStream : public WebStream
{
public:
IceCastWebStream(const QString &n, const QString &r, const QUrl &u)
: WebStream(n, r, u) { }
IceCastWebStream(const QString &n, const QString &i, const QString &r, const QUrl &u)
: WebStream(n, i, r, u) { }
QList<StreamsModel::StreamItem *> parse(QIODevice *dev);
};
class SomaFmWebStream : public WebStream
{
public:
SomaFmWebStream(const QString &n, const QString &r, const QUrl &u)
: WebStream(n, r, u) { }
SomaFmWebStream(const QString &n, const QString &i, const QString &r, const QUrl &u)
: WebStream(n, i, r, u) { }
QList<StreamsModel::StreamItem *> parse(QIODevice *dev);
};
class RadioWebStream : public WebStream
{
public:
RadioWebStream(const QString &n, const QString &r, const QUrl &u)
: WebStream(n, r, u) { }
RadioWebStream(const QString &n, const QString &i, const QString &r, const QUrl &u)
: WebStream(n, i, r, u) { }
QList<StreamsModel::StreamItem *> parse(QIODevice *dev);
};