diff data/fileio/OggVorbisFileReader.cpp @ 290:92e8dbde73cd

* Revert revision 713. We do like QStrings after all.
author Chris Cannam
date Fri, 24 Aug 2007 11:41:48 +0000
parents 20028c634494
children c022976d18e8
line wrap: on
line diff
--- a/data/fileio/OggVorbisFileReader.cpp	Thu Aug 16 16:47:07 2007 +0000
+++ b/data/fileio/OggVorbisFileReader.cpp	Fri Aug 24 11:41:48 2007 +0000
@@ -32,7 +32,7 @@
 
 static int instances = 0;
 
-OggVorbisFileReader::OggVorbisFileReader(std::string path,
+OggVorbisFileReader::OggVorbisFileReader(QString path,
                                          DecodeMode decodeMode,
                                          CacheMode mode) :
     CodedAudioFileReader(mode),
@@ -49,15 +49,15 @@
     m_channelCount = 0;
     m_sampleRate = 0;
 
-    std::cerr << "OggVorbisFileReader::OggVorbisFileReader(" << path << "): now have " << (++instances) << " instances" << std::endl;
+    std::cerr << "OggVorbisFileReader::OggVorbisFileReader(" << path.toLocal8Bit().data() << "): now have " << (++instances) << " instances" << std::endl;
 
     Profiler profiler("OggVorbisFileReader::OggVorbisFileReader", true);
 
-    QFileInfo info(path.c_str());
+    QFileInfo info(path);
     m_fileSize = info.size();
 
-    if (!(m_oggz = oggz_open(path.c_str(), OGGZ_READ))) {
-        setError("File is not an OGG file", path);
+    if (!(m_oggz = oggz_open(path.toLocal8Bit().data(), OGGZ_READ))) {
+	m_error = QString("File %1 is not an OGG file.").arg(path);
 	return;
     }
 
@@ -70,7 +70,7 @@
     if (decodeMode == DecodeAtOnce) {
 
 	m_progress = new QProgressDialog
-	    (QObject::tr("Decoding %1...").arg(QFileInfo(path.c_str()).fileName()),
+	    (QObject::tr("Decoding %1...").arg(QFileInfo(path).fileName()),
 	     QObject::tr("Stop"), 0, 100);
 	m_progress->hide();
 
@@ -100,7 +100,7 @@
 
 OggVorbisFileReader::~OggVorbisFileReader()
 {
-    std::cerr << "OggVorbisFileReader::~OggVorbisFileReader(" << m_path << "): now have " << (--instances) << " instances" << std::endl;
+    std::cerr << "OggVorbisFileReader::~OggVorbisFileReader(" << m_path.toLocal8Bit().data() << "): now have " << (--instances) << " instances" << std::endl;
     if (m_decodeThread) {
         m_cancelled = true;
         m_decodeThread->wait();
@@ -166,7 +166,7 @@
         const FishSoundComment *comment = fish_sound_comment_first_byname
             (fs, "TITLE");
         if (comment && comment->value) {
-            reader->m_title = comment->value;
+            reader->m_title = QString::fromUtf8(comment->value);
         }
         reader->m_commentsRead = true;
     }
@@ -198,7 +198,7 @@
 }
 
 void
-OggVorbisFileReader::getSupportedExtensions(std::set<std::string> &extensions)
+OggVorbisFileReader::getSupportedExtensions(std::set<QString> &extensions)
 {
     extensions.insert("ogg");
 }