summaryrefslogtreecommitdiffstats
path: root/noatun/library/playlistsaver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'noatun/library/playlistsaver.cpp')
-rw-r--r--noatun/library/playlistsaver.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/noatun/library/playlistsaver.cpp b/noatun/library/playlistsaver.cpp
index 58f5d5d2..8b34deca 100644
--- a/noatun/library/playlistsaver.cpp
+++ b/noatun/library/playlistsaver.cpp
@@ -1,15 +1,15 @@
#include <noatun/playlistsaver.h>
-#include <qdom.h>
+#include <tqdom.h>
#include <kio/netaccess.h>
-#include <qfile.h>
-#include <qtextstream.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
#include <noatun/app.h>
#include "ksaver.h"
#include <ksimpleconfig.h>
#include <kmimetype.h>
#include <klocale.h>
-#include <qregexp.h>
-#include <qxml.h>
+#include <tqregexp.h>
+#include <tqxml.h>
#include <kdebug.h>
PlaylistSaver::PlaylistSaver()
@@ -71,7 +71,7 @@ bool PlaylistSaver::metalist(const KURL &url)
{
kdDebug(66666) << k_funcinfo << "url=" << url.url() << endl;
- QString end=url.filename().right(3).lower();
+ TQString end=url.filename().right(3).lower();
/*
if (end=="mp3" || end=="ogg") // we want to download streams only
{
@@ -100,12 +100,12 @@ bool PlaylistSaver::metalist(const KURL &url)
url.protocol().lower()=="http")
{
KMimeType::Ptr mimetype = KMimeType::findByURL(url);
- QString type=mimetype->name();
+ TQString type=mimetype->name();
if (type!="application/octet-stream")
return false;
- QMap<QString,QString> map;
+ TQMap<TQString,TQString> map;
map["playObject"]="Arts::StreamPlayObject";
map["title"] = i18n("Stream from %1").arg(url.host());
@@ -138,29 +138,29 @@ bool PlaylistSaver::metalist(const KURL &url)
bool PlaylistSaver::saveXML(const KURL &file, int )
{
- QString localFile;
+ TQString localFile;
if (file.isLocalFile())
- localFile = QFile::encodeName(file.path());
+ localFile = TQFile::encodeName(file.path());
else
localFile = napp->tempSaveName(file.path());
// QDom is a pain :)
- QDomDocument doc("playlist");
- doc.setContent(QString("<!DOCTYPE XMLPlaylist><playlist version=\"1.0\" client=\"noatun\"/>"));
+ TQDomDocument doc("playlist");
+ doc.setContent(TQString("<!DOCTYPE XMLPlaylist><playlist version=\"1.0\" client=\"noatun\"/>"));
- QDomElement docElem=doc.documentElement();
+ TQDomElement docElem=doc.documentElement();
reset();
PlaylistItem i;
- QStringList props;
+ TQStringList props;
while ((i=writeItem()))
{
// write all properties
props=i.properties();
- QDomElement elem=doc.createElement("item");
- for (QStringList::Iterator pi(props.begin()); pi!=props.end(); ++pi)
+ TQDomElement elem=doc.createElement("item");
+ for (TQStringList::Iterator pi(props.begin()); pi!=props.end(); ++pi)
{
- QString val=i.property(*pi);
+ TQString val=i.property(*pi);
elem.setAttribute(*pi, val);
if ((*pi)=="url")
@@ -179,7 +179,7 @@ bool PlaylistSaver::saveXML(const KURL &file, int )
Noatun::KSaver saver(localFile);
if (!saver.open())
return false;
- saver.textStream().setEncoding(QTextStream::UnicodeUTF8);
+ saver.textStream().setEncoding(TQTextStream::UnicodeUTF8);
saver.textStream() << doc.toString();
saver.close();
@@ -198,8 +198,8 @@ public:
}
bool startElement(
- const QString&, const QString &,
- const QString &name, const QXmlAttributes &a
+ const TQString&, const TQString &,
+ const TQString &name, const TQXmlAttributes &a
)
{
if (fresh)
@@ -218,7 +218,7 @@ public:
if (name != "item")
return true;
- QMap<QString,QString> propMap;
+ TQMap<TQString,TQString> propMap;
for (int i=0; i<a.count(); i++)
{
@@ -237,18 +237,18 @@ public:
PlaylistSaver *saver;
bool fresh;
bool inEntry, inTitle;
- QMap<QString,QString> propMap;
- QString mAbsPath;
+ TQMap<TQString,TQString> propMap;
+ TQString mAbsPath;
- MSASXStructure(PlaylistSaver *s, const QString &absPath)
+ MSASXStructure(PlaylistSaver *s, const TQString &absPath)
: saver(s), fresh(true), inEntry(false),
inTitle(false), mAbsPath(absPath)
{
//kdDebug(66666) << k_funcinfo << endl;
}
- bool startElement(const QString&, const QString &,
- const QString &name, const QXmlAttributes &a)
+ bool startElement(const TQString&, const TQString &,
+ const TQString &name, const TQXmlAttributes &a)
{
if (fresh)
{
@@ -290,12 +290,12 @@ public:
{
if(a.qName(i).lower()=="href")
{
- QString filename=a.value(i);
- if (filename.find(QRegExp("^[a-zA-Z0-9]+:/"))==0)
+ TQString filename=a.value(i);
+ if (filename.find(TQRegExp("^[a-zA-Z0-9]+:/"))==0)
{
KURL url(filename);
KMimeType::Ptr mimetype = KMimeType::findByURL(url);
- QString type=mimetype->name();
+ TQString type=mimetype->name();
if (type != "application/octet-stream")
{
propMap["url"]=filename;
@@ -333,7 +333,7 @@ public:
}
else if(name.lower()=="param")
{
- QString keyName="", keyValue="";
+ TQString keyName="", keyValue="";
for (int i=0; i<a.count(); i++)
{
@@ -382,7 +382,7 @@ public:
return true;
}
- bool endElement(const QString&,const QString&, const QString& name)
+ bool endElement(const TQString&,const TQString&, const TQString& name)
{
// kdDebug(66666) << k_funcinfo << "name='" << name << "'" << endl;
if (name.lower()=="entry")
@@ -390,7 +390,7 @@ public:
if(inEntry)
{
/* kdDebug(66666) << "</ENTRY> =====================" << endl;
- for (QMap<QString,QString>::ConstIterator it=propMap.begin(); it!=propMap.end(); ++it )
+ for (TQMap<TQString,TQString>::ConstIterator it=propMap.begin(); it!=propMap.end(); ++it )
kdDebug(66666) << "key='" << it.key() << "', val='" << it.data() << "'" << endl;
*/
saver->readItem(propMap);
@@ -419,7 +419,7 @@ public:
return true;
}
- bool characters(const QString &ch)
+ bool characters(const TQString &ch)
{
if(inTitle)
{
@@ -439,18 +439,18 @@ bool PlaylistSaver::loadXML(const KURL &url, int opt)
kdDebug(66666) << k_funcinfo <<
"file='" << url.url() << "', opt=" << opt << endl;
- QString dest;
+ TQString dest;
if(KIO::NetAccess::download(url, dest, 0L))
{
- QFile file(dest);
+ TQFile file(dest);
if (!file.open(IO_ReadOnly))
return false;
reset();
// QXml is horribly documented
- QXmlInputSource source(&file);
- QXmlSimpleReader reader;
+ TQXmlInputSource source(&file);
+ TQXmlSimpleReader reader;
if (opt == ASX ||
url.path().right(4).lower()==".wax" ||
@@ -478,7 +478,7 @@ bool PlaylistSaver::loadM3U(const KURL &file, int /*opt*/)
{
kdDebug(66666) << k_funcinfo << "file='" << file.path() << endl;
- QString localFile;
+ TQString localFile;
if(!KIO::NetAccess::download(file, localFile, 0L))
return false;
@@ -489,7 +489,7 @@ bool PlaylistSaver::loadM3U(const KURL &file, int /*opt*/)
list.setGroup("playlist");
// some stupid Windows lusers like to be case insensitive
- QStringList groups=list.groupList().grep(QRegExp("^playlist$", false));
+ TQStringList groups=list.groupList().grep(TQRegExp("^playlist$", false));
if (groups.count())
{
KURL l;
@@ -499,14 +499,14 @@ bool PlaylistSaver::loadM3U(const KURL &file, int /*opt*/)
}
#endif
- QFile saver(localFile);
+ TQFile saver(localFile);
saver.open(IO_ReadOnly);
- QTextStream t(&saver);
+ TQTextStream t(&saver);
bool isExt = false; // flag telling if we load an EXTM3U file
- QString filename;
- QString extinf;
- QMap<QString,QString> prop;
+ TQString filename;
+ TQString extinf;
+ TQMap<TQString,TQString> prop;
reset();
while (!t.eof())
@@ -541,7 +541,7 @@ bool PlaylistSaver::loadM3U(const KURL &file, int /*opt*/)
if (filename.isEmpty())
continue;
- if (filename.find(QRegExp("^[a-zA-Z0-9]+:/"))==0)
+ if (filename.find(TQRegExp("^[a-zA-Z0-9]+:/"))==0)
{
//kdDebug(66666) << k_funcinfo << "url filename = " << filename << endl;
@@ -591,9 +591,9 @@ bool PlaylistSaver::loadM3U(const KURL &file, int /*opt*/)
int length = (extinf.left(timeTitleSep)).toInt();
if (length>0)
- prop["length"]=QString::number(length*1000);
+ prop["length"]=TQString::number(length*1000);
- QString displayTitle=extinf.mid(timeTitleSep+1);
+ TQString displayTitle=extinf.mid(timeTitleSep+1);
if (!displayTitle.isEmpty())
{
int artistTitleSep = displayTitle.find(" - ",0);
@@ -628,14 +628,14 @@ bool PlaylistSaver::saveM3U(const KURL &file, int opt)
bool isExt=(opt==EXTM3U); // easier ;)
- QString local(napp->tempSaveName(file.path()));
- QFile saver(local);
+ TQString local(napp->tempSaveName(file.path()));
+ TQFile saver(local);
saver.open(IO_ReadWrite | IO_Truncate);
- QTextStream t(&saver);
+ TQTextStream t(&saver);
reset();
PlaylistItem i;
- QStringList props;
+ TQStringList props;
// this is more code but otoh faster than checking for isExt inside the loop
if(isExt)
@@ -647,7 +647,7 @@ bool PlaylistSaver::saveM3U(const KURL &file, int opt)
int length = static_cast<int>(((i.property("length")).toInt())/1000);
if(length==0) length=-1; // special value in an EXTM3U file, means "unknown"
KURL u(i.property("url"));
- QString title;
+ TQString title;
// if a playlistitem is without a tag or ONLY title is set
if((i.property("author").isEmpty() && i.property("title").isEmpty())
@@ -656,8 +656,8 @@ bool PlaylistSaver::saveM3U(const KURL &file, int opt)
else
title = i.property("author") + " - " + i.property("title");
-// kdDebug(66666) << "#EXTINF:"<< QString::number(length) << "," << title << endl;
- t << "#EXTINF:"<< QString::number(length) << "," << title << '\n';
+// kdDebug(66666) << "#EXTINF:"<< TQString::number(length) << "," << title << endl;
+ t << "#EXTINF:"<< TQString::number(length) << "," << title << '\n';
if (u.isLocalFile())
t << u.path() << '\n';
@@ -683,9 +683,9 @@ bool PlaylistSaver::saveM3U(const KURL &file, int opt)
return true;
}
-static QString findNoCase(const QMap<QString,QString> &map, const QString &key)
+static TQString findNoCase(const TQMap<TQString,TQString> &map, const TQString &key)
{
- for (QMap<QString,QString>::ConstIterator i=map.begin(); i!=map.end(); ++i)
+ for (TQMap<TQString,TQString>::ConstIterator i=map.begin(); i!=map.end(); ++i)
{
if (i.key().lower() == key.lower())
return i.data();
@@ -697,14 +697,14 @@ bool PlaylistSaver::loadPLS(const KURL &file, int /*opt*/)
{
kdDebug(66666) << k_funcinfo << "file='" << file.path() << endl;
- QString localFile;
+ TQString localFile;
if(!KIO::NetAccess::download(file, localFile, 0L))
return false;
- QFile checkFile(localFile);
+ TQFile checkFile(localFile);
checkFile.open(IO_ReadOnly);
- QTextStream t(&checkFile);
- QString firstLine = t.readLine();
+ TQTextStream t(&checkFile);
+ TQString firstLine = t.readLine();
if(firstLine.lower() != "[playlist]")
{
kdDebug(66666) << k_funcinfo << "PLS didn't start with '[playlist]', aborting" << endl;
@@ -716,15 +716,15 @@ bool PlaylistSaver::loadPLS(const KURL &file, int /*opt*/)
//list.setGroup("playlist");
// some stupid Windows lusers like to be case insensitive
- QStringList groups = list.groupList().grep(QRegExp("^playlist$", false));
+ TQStringList groups = list.groupList().grep(TQRegExp("^playlist$", false));
/*
if (!groups.count()) // didn't find "[playlist]", it's not a .pls file
return false;
*/
- QMap<QString,QString> group = list.entryMap(groups[0]);
+ TQMap<TQString,TQString> group = list.entryMap(groups[0]);
- QString numOfEntries = findNoCase(group, "numberofentries");
+ TQString numOfEntries = findNoCase(group, "numberofentries");
if(numOfEntries.isEmpty())
return false;
@@ -733,14 +733,14 @@ bool PlaylistSaver::loadPLS(const KURL &file, int /*opt*/)
unsigned int nEntries = numOfEntries.toInt();
for(unsigned int entry = 1; entry <= nEntries; ++entry )
{
- QString str;
+ TQString str;
str.sprintf("file%d", entry);
- QString cast = findNoCase(group, str.utf8());
+ TQString cast = findNoCase(group, str.utf8());
str.sprintf("title%d", entry);
- QString title = findNoCase(group, str.utf8());
+ TQString title = findNoCase(group, str.utf8());
// assume that everything in a pls is a streamable file
- QMap<QString,QString> map;
+ TQMap<TQString,TQString> map;
KURL url(cast);
if (!url.hasPath())
@@ -764,7 +764,7 @@ bool PlaylistSaver::savePLS(const KURL &, int)
return false;
}
-void PlaylistSaver::setGroup(const QString &)
+void PlaylistSaver::setGroup(const TQString &)
{
}