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 )
/**********************************************************************
* 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 )
......
......@@ -85,7 +85,7 @@ private:
public slots:
void toggle(){ TOGGLEV( this ); }
void update( input_thread_t * );
void update( QString );
};
class VisualSelector : public QFrame
......
......@@ -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 )
......
......@@ -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
......
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