]> git.sesse.net Git - vlc/commitdiff
Qt: create a helper function to manage core ArtUrl
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 24 Jan 2010 23:19:52 +0000 (00:19 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 24 Jan 2010 23:21:44 +0000 (00:21 +0100)
decodeArtURL( input_item_t *p_item ) should be self-explanatory.
And use it.

modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp

index 0eb04156439c835e695be9c22d8f2faee023676f..70678f8476a227a1c2265ed4928043d481f8c360 100644 (file)
@@ -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)
index 604a5b689a9f7631f1fe7d2f6cdcac9c55f74a6c..35d0c4b299ab4047bd5db1e360ef34ee0c1fae3e 100644 (file)
@@ -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;