diff data/fileio/QuickTimeFileReader.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 42e6c8360df1
line wrap: on
line diff
--- a/data/fileio/QuickTimeFileReader.cpp	Thu Aug 16 16:47:07 2007 +0000
+++ b/data/fileio/QuickTimeFileReader.cpp	Fri Aug 24 11:41:48 2007 +0000
@@ -48,7 +48,7 @@
 };
 
 
-QuickTimeFileReader::QuickTimeFileReader(std::string path,
+QuickTimeFileReader::QuickTimeFileReader(QString path,
                                          DecodeMode decodeMode,
                                          CacheMode mode) :
     CodedAudioFileReader(mode),
@@ -74,7 +74,7 @@
 #else
     m_d->err = Gestalt(gestaltQuickTime,&QTversion);
     if ((m_d->err != noErr) || (QTversion < 0x07000000)) {
-        setError("Failed to find compatible version of QuickTime (version 7 or above required)");
+        m_error = QString("Failed to find compatible version of QuickTime (version 7 or above required)");
         return;
     }
 #endif 
@@ -100,7 +100,7 @@
         (url, 0, &dataRef, &dataRefType);
 
     if (m_d->err) { 
-        setError("Error creating data reference for QuickTime decoder", m_d->err);
+        m_error = QString("Error creating data reference for QuickTime decoder: code %1").arg(m_d->err);
         return;
     }
     
@@ -111,7 +111,7 @@
 
     DisposeHandle(dataRef);
     if (m_d->err) { 
-        setError("Error creating new movie for QuickTime decoder", m_d->err); 
+        m_error = QString("Error creating new movie for QuickTime decoder: code %1").arg(m_d->err); 
         return;
     }
 
@@ -140,10 +140,10 @@
     }
 	
     if (m_d->err && m_d->err != kQTPropertyNotSupportedErr) { 
-        setError("Error checking for DRM in QuickTime decoder", m_d->err);
+        m_error = QString("Error checking for DRM in QuickTime decoder: code %1").arg(m_d->err);
         return;
     } else if (!m_d->err && isProtected) { 
-        setError("File is protected with DRM");
+        m_error = QString("File is protected with DRM");
         return;
     } else if (m_d->err == kQTPropertyNotSupportedErr && !isProtected) {
         std::cerr << "QuickTime: File is not protected with DRM" << std::endl;
@@ -153,18 +153,18 @@
         SetMovieActive(m_d->movie, TRUE);
         m_d->err = GetMoviesError();
         if (m_d->err) {
-            setError("Error in QuickTime decoder activation", m_d->err);
+            m_error = QString("Error in QuickTime decoder activation: code %1").arg(m_d->err);
             return;
         }
     } else {
-	setError("Error in QuickTime decoder: Movie object not valid");
+	m_error = QString("Error in QuickTime decoder: Movie object not valid");
 	return;
     }
     
     m_d->err = MovieAudioExtractionBegin
         (m_d->movie, 0, &m_d->extractionSessionRef);
     if (m_d->err) {
-        setError("Error in QuickTime decoder extraction init", m_d->err);
+        m_error = QString("Error in QuickTime decoder extraction init: code %1").arg(m_d->err);
         return;
     }
 
@@ -176,7 +176,7 @@
          nil);
 
     if (m_d->err) {
-        setError("Error in QuickTime decoder property get", m_d->err);
+        m_error = QString("Error in QuickTime decoder property get: code %1").arg(m_d->err);
         return;
     }
 	
@@ -201,7 +201,7 @@
          &m_d->asbd);
 
     if (m_d->err) {
-        setError("Error in QuickTime decoder property set", m_d->err);
+        m_error = QString("Error in QuickTime decoder property set: code %1").arg(m_d->err);
         return;
     }
 
@@ -217,7 +217,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();
 
@@ -229,7 +229,8 @@
                 (m_d->extractionSessionRef, &framesRead, &m_d->buffer,
                  &extractionFlags);
             if (m_d->err) {
-                setError("Error in QuickTime decoding", m_d->err);
+                m_error = QString("Error in QuickTime decoding: code %1")
+                    .arg(m_d->err);
                 break;
             }
 
@@ -249,7 +250,7 @@
 
         m_d->err = MovieAudioExtractionEnd(m_d->extractionSessionRef);
         if (m_d->err) {
-            setError("Error ending QuickTime extraction session", m_d->err);
+            m_error = QString("Error ending QuickTime extraction session: code %1").arg(m_d->err);
         }
 
         m_completion = 100;
@@ -264,7 +265,7 @@
         }
     }
 
-    std::cerr << "QuickTimeFileReader::QuickTimeFileReader: frame count is now " << getFrameCount() << ", error is \"\"" << m_error << "\"" << std::endl;
+    std::cerr << "QuickTimeFileReader::QuickTimeFileReader: frame count is now " << getFrameCount() << ", error is \"\"" << m_error.toStdString() << "\"" << std::endl;
 }
 
 QuickTimeFileReader::~QuickTimeFileReader()
@@ -295,8 +296,8 @@
             (m_reader->m_d->extractionSessionRef, &framesRead,
              &m_reader->m_d->buffer, &extractionFlags);
         if (m_reader->m_d->err) {
-            m_reader->setError("Error in QuickTime decoding",
-                               m_reader->m_d->err);
+            m_reader->m_error = QString("Error in QuickTime decoding: code %1")
+                .arg(m_reader->m_d->err);
             break;
         }
        
@@ -314,14 +315,14 @@
     
     m_reader->m_d->err = MovieAudioExtractionEnd(m_reader->m_d->extractionSessionRef);
     if (m_reader->m_d->err) {
-        m_reader->setError("Error ending QuickTime extraction session", m_reader->m_d->err);
+        m_reader->m_error = QString("Error ending QuickTime extraction session: code %1").arg(m_reader->m_d->err);
     }
     
     m_reader->m_completion = 100;
 } 
 
 void
-QuickTimeFileReader::getSupportedExtensions(std::set<std::string> &extensions)
+QuickTimeFileReader::getSupportedExtensions(std::set<QString> &extensions)
 {
     extensions.insert("aiff");
     extensions.insert("au");