]> git.sesse.net Git - vlc/commitdiff
add artChanged signal to inputmanager and change backgroundwidget to use
authorIlkka Ollakka <ileoo@videolan.org>
Mon, 31 Dec 2007 12:16:53 +0000 (12:16 +0000)
committerIlkka Ollakka <ileoo@videolan.org>
Mon, 31 Dec 2007 12:16:53 +0000 (12:16 +0000)
it.

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

index 25b80d2066839199745aa88a6c007102439b1efc..7f6a378569ce5a9d1d61fe595bc5b6f845f580b1 100644 (file)
@@ -117,7 +117,7 @@ void VideoWidget::release( void *p_win )
 
 /**********************************************************************
  * Background Widget. Show a simple image background. Currently,
- * it's a static cone.
+ * it's album art if present or cone.
  **********************************************************************/
 #define ICON_SIZE 128
 #define MAX_BG_SIZE 400
@@ -153,8 +153,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
     backgroundLayout->setColumnStretch( 0, 1 );
     backgroundLayout->setColumnStretch( 2, 1 );
 
-    CONNECT( THEMIM, inputChanged( input_thread_t *),
-             this, update( input_thread_t * ) );
+    CONNECT( THEMIM->getIM(), artChanged( QString ), this, update( QString ) );
     resize( 300, 150 );
 }
 
@@ -162,9 +161,9 @@ BackgroundWidget::~BackgroundWidget()
 {
 }
 
-void BackgroundWidget::update( input_thread_t *p_input )
+void BackgroundWidget::update( QString url )
 {
-    if( !p_input || p_input->b_dead )
+    if( url.isNull() )
     {
         if( QDate::currentDate().dayOfYear() >= 354 )
             label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) );
@@ -173,11 +172,7 @@ void BackgroundWidget::update( input_thread_t *p_input )
         return;
     }
 
-    vlc_object_yield( p_input );
-    char *psz_arturl = input_item_GetArtURL( input_GetItem(p_input) );
-    vlc_object_release( p_input );
-
-    QString arturl = qfu( psz_arturl ).replace( "file://",QString("" ) );
+    QString arturl = url.replace( "file://",QString("" ) );
     if( arturl.isNull() )
     {
         if( QDate::currentDate().dayOfYear() >= 354 )
@@ -188,9 +183,8 @@ void BackgroundWidget::update( input_thread_t *p_input )
     else
     {
         label->setPixmap( QPixmap( arturl ) );
-        msg_Dbg( p_intf, "changing input b_need_update done %s", psz_arturl );
+        msg_Dbg( p_intf, "changing input b_need_update done ");
     }
-    free( psz_arturl );
 }
 
 void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
index 0a7e78173a9c5ed494e64396b2ac5670ebc5f76c..66caa58a1bb48efbc489f12ca524f71ba55f21c4 100644 (file)
@@ -85,7 +85,7 @@ private:
 
 public slots:
     void toggle(){ TOGGLEV( this ); }
-    void update( input_thread_t * );
+    void update( QString );
 };
 
 class VisualSelector : public QFrame
index 405fbbf36e1fb795c7ae88c4e77904f70264049e..d6c4f652366dc3bcb4787436ddca202e5ed4d4ce 100644 (file)
@@ -96,6 +96,7 @@ void InputManager::update()
         i_old_playing_status = 0;
         emit statusChanged( END_S ); // see vlc_input.h, input_state_e enum
         delInput();
+        emit artChanged( "" );
         return;
     }
 
@@ -183,6 +184,16 @@ void InputManager::update()
         i_old_playing_status = val.i_int;
         emit statusChanged( val.i_int == PAUSE_S ? PAUSE_S : PLAYING_S );
     }
+
+    QString url;
+    char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
+    url.sprintf("%s", psz_art );
+    free( psz_art );
+    if( artUrl != url )
+    {
+        emit artChanged( url );
+        artUrl = url;
+    }
 }
 
 void InputManager::sliderUpdate( float new_pos )
index e645f08994b5684615ecd6788a7f4292bf510aaa..a8781fdc6729190327dd5e7be8a8c1b328797e70 100644 (file)
@@ -46,6 +46,7 @@ private:
     input_thread_t *p_input;
     int             i_old_playing_status;
     QString         old_name;
+    QString         artUrl;
     int             i_rate;
 public slots:
     void togglePlayPause();
@@ -76,6 +77,7 @@ signals:
 #endif
     /// Play/pause status
     void statusChanged( int );
+    void artChanged( QString );
 };
 
 class MainInputManager : public QObject