Commit 439cd43d authored by Jean-Baptiste Kempf's avatar 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.
parent e0054371
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment