summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/om3u.cpp
authorllornkcor <llornkcor>2004-02-09 18:44:58 (UTC)
committer llornkcor <llornkcor>2004-02-09 18:44:58 (UTC)
commitda2559d959567db6a1501e62aa9b2c7c693cc074 (patch) (unidiff)
treeccbacc2fbed3dab16b0da4c8d1524368d11e40f3 /core/multimedia/opieplayer/om3u.cpp
parent31fb2e7e1ea652abefc82febbc5739198fa6aaa7 (diff)
downloadopie-da2559d959567db6a1501e62aa9b2c7c693cc074.zip
opie-da2559d959567db6a1501e62aa9b2c7c693cc074.tar.gz
opie-da2559d959567db6a1501e62aa9b2c7c693cc074.tar.bz2
utf8 patch from Nikita V. Youshchenko <yoush@cs.msu.su>
Diffstat (limited to 'core/multimedia/opieplayer/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 8b92a8c..778eb22 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -64,12 +64,13 @@ Om3u::Om3u( const QString &filePath, int mode)
64 64
65Om3u::~Om3u(){} 65Om3u::~Om3u(){}
66 66
67void Om3u::readM3u() { 67void Om3u::readM3u() {
68// qDebug("<<<<<<reading m3u "+f.name()); 68// qDebug("<<<<<<reading m3u "+f.name());
69 QTextStream t(&f); 69 QTextStream t(&f);
70 t.setEncoding(QTextStream::UnicodeUTF8);
70 QString s; 71 QString s;
71 while ( !t.atEnd() ) { 72 while ( !t.atEnd() ) {
72 s=t.readLine(); 73 s=t.readLine();
73 // qDebug(s); 74 // qDebug(s);
74 if( s.find( "#", 0, TRUE) == -1 ) { 75 if( s.find( "#", 0, TRUE) == -1 ) {
75 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 76 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
@@ -94,12 +95,13 @@ void Om3u::readM3u() {
94 } 95 }
95 } 96 }
96} 97}
97 98
98void Om3u::readPls() { //it's a pls file 99void Om3u::readPls() { //it's a pls file
99 QTextStream t( &f ); 100 QTextStream t( &f );
101 t.setEncoding(QTextStream::UnicodeUTF8);
100 QString s; 102 QString s;
101 while ( !t.atEnd() ) { 103 while ( !t.atEnd() ) {
102 s = t.readLine(); 104 s = t.readLine();
103 if( s.left(4) == "File" ) { 105 if( s.left(4) == "File" ) {
104 s = s.right( s.length() - 6 ); 106 s = s.right( s.length() - 6 );
105 s.replace( QRegExp( "%20" )," "); 107 s.replace( QRegExp( "%20" )," ");
@@ -130,18 +132,19 @@ void Om3u::readPls() { //it's a pls file
130 } 132 }
131 } 133 }
132} 134}
133 135
134void Om3u::write() { //writes list to m3u file 136void Om3u::write() { //writes list to m3u file
135 QString list; 137 QString list;
138 QTextStream t(&f);
139 t.setEncoding(QTextStream::UnicodeUTF8);
136 if(count()>0) { 140 if(count()>0) {
137 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
138 // qDebug(*it); 142 // qDebug(*it);
139 list += *it+"\n"; 143 t << *it << "\n";
140 } 144 }
141 f.writeBlock( list, list.length() );
142 } 145 }
143// f.close(); 146// f.close();
144} 147}
145 148
146void Om3u::add(const QString &filePath) { //adds to m3u file 149void Om3u::add(const QString &filePath) { //adds to m3u file
147 append(filePath); 150 append(filePath);