Commit 32cdbfa3 authored by Ilkka Ollakka's avatar Ilkka Ollakka

add artChanged signal to inputmanager and change backgroundwidget to use

it.
parent 4251cd0a
...@@ -117,7 +117,7 @@ void VideoWidget::release( void *p_win ) ...@@ -117,7 +117,7 @@ void VideoWidget::release( void *p_win )
/********************************************************************** /**********************************************************************
* Background Widget. Show a simple image background. Currently, * 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 ICON_SIZE 128
#define MAX_BG_SIZE 400 #define MAX_BG_SIZE 400
...@@ -153,8 +153,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) : ...@@ -153,8 +153,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
backgroundLayout->setColumnStretch( 0, 1 ); backgroundLayout->setColumnStretch( 0, 1 );
backgroundLayout->setColumnStretch( 2, 1 ); backgroundLayout->setColumnStretch( 2, 1 );
CONNECT( THEMIM, inputChanged( input_thread_t *), CONNECT( THEMIM->getIM(), artChanged( QString ), this, update( QString ) );
this, update( input_thread_t * ) );
resize( 300, 150 ); resize( 300, 150 );
} }
...@@ -162,9 +161,9 @@ BackgroundWidget::~BackgroundWidget() ...@@ -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 ) if( QDate::currentDate().dayOfYear() >= 354 )
label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) ); label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) );
...@@ -173,11 +172,7 @@ void BackgroundWidget::update( input_thread_t *p_input ) ...@@ -173,11 +172,7 @@ void BackgroundWidget::update( input_thread_t *p_input )
return; return;
} }
vlc_object_yield( p_input ); QString arturl = url.replace( "file://",QString("" ) );
char *psz_arturl = input_item_GetArtURL( input_GetItem(p_input) );
vlc_object_release( p_input );
QString arturl = qfu( psz_arturl ).replace( "file://",QString("" ) );
if( arturl.isNull() ) if( arturl.isNull() )
{ {
if( QDate::currentDate().dayOfYear() >= 354 ) if( QDate::currentDate().dayOfYear() >= 354 )
...@@ -188,9 +183,8 @@ void BackgroundWidget::update( input_thread_t *p_input ) ...@@ -188,9 +183,8 @@ void BackgroundWidget::update( input_thread_t *p_input )
else else
{ {
label->setPixmap( QPixmap( arturl ) ); 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 ) void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
......
...@@ -85,7 +85,7 @@ private: ...@@ -85,7 +85,7 @@ private:
public slots: public slots:
void toggle(){ TOGGLEV( this ); } void toggle(){ TOGGLEV( this ); }
void update( input_thread_t * ); void update( QString );
}; };
class VisualSelector : public QFrame class VisualSelector : public QFrame
......
...@@ -96,6 +96,7 @@ void InputManager::update() ...@@ -96,6 +96,7 @@ void InputManager::update()
i_old_playing_status = 0; i_old_playing_status = 0;
emit statusChanged( END_S ); // see vlc_input.h, input_state_e enum emit statusChanged( END_S ); // see vlc_input.h, input_state_e enum
delInput(); delInput();
emit artChanged( "" );
return; return;
} }
...@@ -183,6 +184,16 @@ void InputManager::update() ...@@ -183,6 +184,16 @@ void InputManager::update()
i_old_playing_status = val.i_int; i_old_playing_status = val.i_int;
emit statusChanged( val.i_int == PAUSE_S ? PAUSE_S : PLAYING_S ); 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 ) void InputManager::sliderUpdate( float new_pos )
......
...@@ -46,6 +46,7 @@ private: ...@@ -46,6 +46,7 @@ private:
input_thread_t *p_input; input_thread_t *p_input;
int i_old_playing_status; int i_old_playing_status;
QString old_name; QString old_name;
QString artUrl;
int i_rate; int i_rate;
public slots: public slots:
void togglePlayPause(); void togglePlayPause();
...@@ -76,6 +77,7 @@ signals: ...@@ -76,6 +77,7 @@ signals:
#endif #endif
/// Play/pause status /// Play/pause status
void statusChanged( int ); void statusChanged( int );
void artChanged( QString );
}; };
class MainInputManager : public QObject class MainInputManager : public QObject
......
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