[vlc-devel] commit: Qt: create a helper function to manage core ArtUrl ( Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Jan 25 00:21:41 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jan 25 00:19:52 2010 +0100| [439cd43d4b55e315e69ddbf2c9a6764cab65988d] | committer: Jean-Baptiste Kempf 

Qt: create a helper function to manage core ArtUrl

decodeArtURL( input_item_t *p_item ) should be self-explanatory.
And use it.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=439cd43d4b55e315e69ddbf2c9a6764cab65988d
---

 modules/gui/qt4/input_manager.cpp |   35 +++++++++++++++++++++--------------
 modules/gui/qt4/input_manager.hpp |    1 +
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 0eb0415..70678f8 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -594,26 +594,33 @@ void InputManager::requestArtUpdate()
     }
 }
 
-void InputManager::UpdateArt()
+const QString InputManager::decodeArtURL( input_item_t *p_item )
 {
-    QString url;
+    assert( p_item );
 
-    if( hasInput() )
-    {
-        char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
-        if( psz_art && !strncmp( psz_art, "file://", 7 ) &&
-                decode_URI( psz_art + 7 ) )
+    char *psz_art = input_item_GetArtURL( p_item );
+    QString url;
+    if( psz_art && !strncmp( psz_art, "file://", 7 ) &&
+            decode_URI( psz_art + 7 ) )
 #ifdef WIN32
-            url = qfu( psz_art + 8 ); // Remove extra / starting on Win32.
+        url = qfu( psz_art + 8 ); // Remove extra / starting on Win32.
 #else
-            url = qfu( psz_art + 7 );
+        url = qfu( psz_art + 7 );
 #endif
-        free( psz_art );
+    free( psz_art );
 
-        url = url.replace( "file://", "" );
-        /* Taglib seems to define a attachment://, It won't work yet */
-        url = url.replace( "attachment://", "" );
-    }
+    url = url.replace( "file://", "" );
+    /* Taglib seems to define a attachment://, It won't work yet */
+    url = url.replace( "attachment://", "" );
+    return url;
+}
+
+void InputManager::UpdateArt()
+{
+    QString url;
+
+    if( hasInput() )
+        url = decodeArtURL( input_GetItem( p_input ) );
 
     /* the art hasn't changed, no need to update */
     if(artUrl == url)
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 604a5b6..35d0c4b 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -132,6 +132,7 @@ public:
     void requestArtUpdate();
 
     QString getName() { return oldName; }
+    static const QString decodeArtURL( input_item_t *p_item );
 
 private:
     intf_thread_t  *p_intf;




More information about the vlc-devel mailing list