shoutcastDirectoryService.cpp

Go to the documentation of this file.
00001 void stationDirectoryTree::shoutcast_loadDirectory()
00002 {
00003   // start fetching the new list
00004   shoutcast_genreStartNewFileParsing = true;
00005   shoutcast_genreFound = false;
00006   shoutcast_genreJob = KIO::get(KUrl("http://www.shoutcast.com/sbin/newxml.phtml"),
00007                                KIO::Reload,
00008                                KIO::HideProgressInfo);
00009   connect(shoutcast_genreJob,
00010           SIGNAL(data(KIO::Job *, const QByteArray &)),
00011           this,
00012           SLOT(shoutcastAddGenres(KIO::Job *, const QByteArray &)));
00013 /*  connect(shoutcastGenreJob,
00014           SIGNAL(result(KJob *)),
00015           this,
00016           SLOT(emitSignalAboutShoutcastGenreFetchingResult()));*/
00017 }
00018 
00019 void stationDirectoryTree::shoutcast_addGenres(KIO::Job *sender, const QByteArray &data)
00020 {
00021   shoutcast_genreXmlSource.setData(data);
00022   if (shoutcast_genreStartNewFileParsing) {
00023     shoutcast_genreXmlReader.parse(&shoutcast_genreXmlSource, true);
00024     shoutcast_genreStartNewFileParsing = false;
00025   } else {
00026     shoutcast_genreXmlReader.parseContinue();
00027   };
00028 }
00029 
00030 bool stationDirectoryTree::startElement(const QString & namespaceURI,
00031                                         const QString & localName,
00032                                         const QString & qName,
00033                                         const QXmlAttributes & atts)
00034 {
00035   // variables
00036   QTreeWidgetItem *m_item;
00037   int temp;
00038 
00039   // code
00040   if (localName == "genre") {
00041     temp = atts.index("name");
00042     if (temp >= 0) {
00043       m_item = new QTreeWidgetItem(this);
00044       m_item->setText(0, atts.value(temp));
00045       m_item->setIcon(0, genreIcon);
00046       shoutcast_genreFound = true;
00047     };
00048   };
00049   return true;  // do not abort the parsing
00050 }
00051 

Generated on Sat May 2 10:43:44 2009 for kradioripper by  doxygen 1.5.6