src/3rdparty/phonon/mmf/utils.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 8 3f74d0d4af4c
--- a/src/3rdparty/phonon/mmf/utils.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/3rdparty/phonon/mmf/utils.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -18,6 +18,7 @@
 
 #include "utils.h"
 #include <e32std.h>
+#include <mmf/common/mmferrors.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -69,6 +70,101 @@
     return result;
 }
 
+QString MMF::Utils::symbianErrorToString(int errorCode)
+{
+    /**
+     * Here we translate only the error codes which are likely to be
+     * meaningful to the user.  For example, when an error occurs
+     * during opening of a media file, displaying "not found" or
+     * "permission denied" is informative.  On the other hand,
+     * differentiating between KErrGeneral and KErrArgument at the UI
+     * level does not make sense.
+     */
+    switch (errorCode)
+    {
+    // System-wide errors
+    case KErrNone:
+        return tr("No error");
+    case KErrNotFound:
+        return tr("Not found");
+    case KErrNoMemory:
+        return tr("Out of memory");
+    case KErrNotSupported:
+        return tr("Not supported");
+    case KErrOverflow:
+        return tr("Overflow");
+    case KErrUnderflow:
+        return tr("Underflow");
+    case KErrAlreadyExists:
+        return tr("Already exists");
+    case KErrPathNotFound:
+        return tr("Path not found");
+    case KErrInUse:
+        return tr("In use");
+    case KErrNotReady:
+        return tr("Not ready");
+    case KErrAccessDenied:
+        return tr("Access denied");
+    case KErrCouldNotConnect:
+        return tr("Could not connect");
+    case KErrDisconnected:
+        return tr("Disconnected");
+    case KErrPermissionDenied:
+        return tr("Permission denied");
+
+    // Multimedia framework errors
+    case KErrMMNotEnoughBandwidth:
+        return tr("Insufficient bandwidth");
+    case KErrMMSocketServiceNotFound:
+    case KErrMMServerSocket:
+        return tr("Network unavailable");
+    case KErrMMNetworkRead:
+    case KErrMMNetworkWrite:
+    case KErrMMUDPReceive:
+        return tr("Network communication error");
+    case KErrMMServerNotSupported:
+        return tr("Streaming not supported");
+    case KErrMMServerAlert:
+        return tr("Server alert");
+    case KErrMMInvalidProtocol:
+        return tr("Invalid protocol");
+    case KErrMMInvalidURL:
+        return tr("Invalid URL");
+    case KErrMMMulticast:
+        return tr("Multicast error");
+    case KErrMMProxyServer:
+    case KErrMMProxyServerConnect:
+        return tr("Proxy server error");
+    case KErrMMProxyServerNotSupported:
+        return tr("Proxy server not supported");
+    case KErrMMAudioDevice:
+        return tr("Audio output error");
+    case KErrMMVideoDevice:
+        return tr("Video output error");
+    case KErrMMDecoder:
+        return tr("Decoder error");
+    case KErrMMPartialPlayback:
+        return tr("Audio or video components could not be played");
+    case KErrMMDRMNotAuthorized:
+        return tr("DRM error");
+
+    /*
+    // We don't use QoS settings
+    case KErrMMQosLowBandwidth:
+    case KErrMMQosUnsupportedTrafficClass:
+    case KErrMMQosPoorTrafficClass:
+    case KErrMMQosUnsupportedParameters:
+    case KErrMMQosPoorParameters:
+    case KErrMMQosNotSupported:
+    */
+
+    // Catch-all for errors other than those above
+    default:
+    {
+        return tr("Unknown error (%1)").arg(errorCode);
+    }
+    }
+}
 
 #ifndef QT_NO_DEBUG