Commit 48f7e0b2 authored by Clément Stenac's avatar Clément Stenac

Very very preliminary Qt implementation of album art

parent 2b7997ac
......@@ -287,7 +287,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
selector->setMaximumWidth( 130 );
left->addWidget( selector );
QLabel *art = new QLabel( "" );
art = new QLabel( "" );
art->setMaximumHeight( 128 );
art->setMaximumWidth( 128 );
art->setScaledContents( true );
......@@ -302,6 +302,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
CONNECT( qobject_cast<StandardPLPanel *>(rightPanel)->model, artSet( QString ) , this, setArt( QString ) );
connect( selector, SIGNAL(activated( int )),
this, SIGNAL( rootChanged( int ) ) );
emit rootChanged( p_root->i_id );
......@@ -312,6 +314,12 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
setLayout( layout );
}
void PlaylistWidget::setArt( QString url )
{
fprintf( stderr, "************** YEAH ! *************\n" );
art->setPixmap( QPixmap( url ) );
}
PlaylistWidget::~PlaylistWidget()
{
}
......
......@@ -136,6 +136,9 @@ private:
PLSelector *selector;
PLPanel *rightPanel;
QPushButton *addButton;
QLabel *art;
private slots:
void setArt( QString );
signals:
void rootChanged( int );
};
......
......@@ -55,6 +55,7 @@ public slots:
virtual void setRoot( int ) = 0;
};
class PlaylistWidget;
class StandardPLPanel: public PLPanel
{
......@@ -65,8 +66,10 @@ public:
virtual ~StandardPLPanel();
protected:
virtual void keyPressEvent( QKeyEvent *e );
private:
protected:
PLModel *model;
friend class PlaylistWidget;
private:
QTreeView *view;
QPushButton *repeatButton , *randomButton,*addButton;
ClickLineEdit *searchLine;
......
......@@ -30,6 +30,7 @@
#include <playlist_model.hpp>
class QTreeView;
class PlaylistWidget;
class PLSelector: public QWidget
{
......@@ -37,9 +38,11 @@ class PLSelector: public QWidget
public:
PLSelector( QWidget *p, intf_thread_t *_p_intf, playlist_t * );
virtual ~PLSelector();
protected:
PLModel *model;
friend class PlaylistWidget;
private:
intf_thread_t *p_intf;
PLModel *model;
QTreeView *view;
private slots:
void setSource( const QModelIndex& );
......
......@@ -132,6 +132,15 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
strings[2] = QString( psz_duration );
type = p_item->p_input->i_type;
current = iscurrent;
fprintf( stderr, "Updating current %i\n" );
fprintf( stderr, "Meta %p art %s\n", p_item->p_input->p_meta,p_item->p_input->p_meta ?p_item->p_input->p_meta->psz_arturl : "non" );
if( current && p_item->p_input->p_meta &&
p_item->p_input->p_meta->psz_arturl &&
!strncmp( p_item->p_input->p_meta->psz_arturl, "file://", 7 ) )
{
fprintf( stderr, "Have art %s\n", p_item->p_input->p_meta->psz_arturl );
model->sendArt( qfu( p_item->p_input->p_meta->psz_arturl ) );
}
}
/*************************************************************************
......@@ -593,6 +602,13 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
/************************* Actions ******************************/
void PLModel::sendArt( QString url )
{
QString arturl = url.replace( "file://",QString("" ) );
fprintf( stderr, "send %s\n", qta( arturl ) );
emit artSet( arturl );
}
/**
* Deletion, here we have to do a ugly slow hack as we retrieve the full
* list of indexes to delete at once: when we delete a node and all of
......
......@@ -121,6 +121,8 @@ public:
void doDelete( QModelIndexList selected );
void search( QString search );
void sort( int column, Qt::SortOrder order );
void sendArt( QString url );
private:
void addCallbacks();
void delCallbacks();
......@@ -159,6 +161,8 @@ private:
PLItem *p_cached_item_bi;
int i_cached_id;
int i_cached_input_id;
signals:
void artSet( QString );
public slots:
void activateItem( const QModelIndex &index );
void activateItem( playlist_item_t *p_item );
......
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