Commit d2348d98 authored by Jean-Philippe Andre's avatar Jean-Philippe Andre

Qt: use the CoverArtLabel in the playlist view and media information dialog

parent 4dd472bb
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "qt4.hpp" #include "qt4.hpp"
#include "components/info_panels.hpp" #include "components/info_panels.hpp"
#include "components/interface_widgets.hpp"
#include <QTreeWidget> #include <QTreeWidget>
#include <QListView> #include <QListView>
...@@ -105,13 +106,7 @@ MetaPanel::MetaPanel( QWidget *parent, ...@@ -105,13 +106,7 @@ MetaPanel::MetaPanel( QWidget *parent,
line++; line++;
/* ART_URL */ /* ART_URL */
art_cover = new QLabel( "" ); art_cover = new CoverArtLabel( VLC_OBJECT( p_intf ) );
art_cover->setMinimumHeight( 128 );
art_cover->setMinimumWidth( 128 );
art_cover->setMaximumHeight( 128 );
art_cover->setMaximumWidth( 128 );
art_cover->setScaledContents( true );
art_cover->setPixmap( QPixmap( ":/noart.png" ) );
metaLayout->addWidget( art_cover, line, 8, 4, 2, Qt::AlignRight ); metaLayout->addWidget( art_cover, line, 8, 4, 2, Qt::AlignRight );
/* Settings is unused */ /* Settings is unused */
...@@ -229,16 +224,8 @@ void MetaPanel::update( input_item_t *p_item ) ...@@ -229,16 +224,8 @@ void MetaPanel::update( input_item_t *p_item )
#undef UPDATE_META_INT #undef UPDATE_META_INT
#undef UPDATE_META #undef UPDATE_META
/* Art Urls */ /* Update Art */
psz_meta = input_item_GetArtURL( p_item ); art_cover->update( p_item );
if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
{
QString artUrl = qfu( psz_meta ).replace( "file://",QString("" ) );
art_cover->setPixmap( QPixmap( artUrl ) );
}
else
art_cover->setPixmap( QPixmap( ":/noart.png" ) );
free( psz_meta );
} }
/** /**
...@@ -332,7 +319,7 @@ void MetaPanel::clear() ...@@ -332,7 +319,7 @@ void MetaPanel::clear()
language_text->clear(); language_text->clear();
nowplaying_text->clear(); nowplaying_text->clear();
publisher_text->clear(); publisher_text->clear();
art_cover; art_cover->update( NULL );
setEditMode( false ); setEditMode( false );
} }
......
...@@ -49,6 +49,7 @@ class QTreeWidgetItem; ...@@ -49,6 +49,7 @@ class QTreeWidgetItem;
class QTreeView; class QTreeView;
class QSpinBox; class QSpinBox;
class QLineEdit; class QLineEdit;
class CoverArtLabel;
class MetaPanel: public QWidget class MetaPanel: public QWidget
{ {
...@@ -80,7 +81,7 @@ private: ...@@ -80,7 +81,7 @@ private:
QLineEdit *nowplaying_text; QLineEdit *nowplaying_text;
QLineEdit *publisher_text; QLineEdit *publisher_text;
// QLineEdit *encodedby_text; // QLineEdit *encodedby_text;
QLabel *art_cover; CoverArtLabel *art_cover;
public slots: public slots:
void update( input_item_t * ); void update( input_item_t * );
......
...@@ -64,13 +64,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, ...@@ -64,13 +64,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
artContainer->setMaximumHeight( 128 ); artContainer->setMaximumHeight( 128 );
/* Art label */ /* Art label */
art = new ArtLabel; art = new ArtLabel( p_intf );
art->setMinimumHeight( 128 );
art->setMinimumWidth( 128 );
art->setMaximumHeight( 128 );
art->setMaximumWidth( 128 );
art->setScaledContents( true );
art->setPixmap( QPixmap( ":/noart.png" ) );
art->setToolTip( qtr( "Double click to get media information" ) ); art->setToolTip( qtr( "Double click to get media information" ) );
artContLay->addWidget( art, 1 ); artContLay->addWidget( art, 1 );
...@@ -103,7 +97,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, ...@@ -103,7 +97,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
emit rootChanged( p_root->i_id ); emit rootChanged( p_root->i_id );
/* art */ /* art */
CONNECT( THEMIM->getIM(), artChanged( QString ) , this, setArt( QString ) ); CONNECT( THEMIM->getIM(), artChanged( input_item_t* ) ,
art, update( input_item_t* ) );
/* Add the two sides of the QSplitter */ /* Add the two sides of the QSplitter */
addWidget( leftW ); addWidget( leftW );
...@@ -129,15 +124,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, ...@@ -129,15 +124,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
setWindowIcon( QApplication::windowIcon() ); setWindowIcon( QApplication::windowIcon() );
} }
void PlaylistWidget::setArt( QString url )
{
if( prevArt != url )
{
art->setPixmap( QPixmap( url.isEmpty() ? ":/noart.png" : url ) );
prevArt = url;
}
}
PlaylistWidget::~PlaylistWidget() PlaylistWidget::~PlaylistWidget()
{ {
getSettings()->beginGroup("playlistdialog"); getSettings()->beginGroup("playlistdialog");
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "components/interface_widgets.hpp"
#include <QSplitter> #include <QSplitter>
#include <QLabel> #include <QLabel>
...@@ -40,6 +41,8 @@ ...@@ -40,6 +41,8 @@
class PLSelector; class PLSelector;
class PLPanel; class PLPanel;
class QPushButton; class QPushButton;
class CoverArtLabel;
class ArtLabel;
class PlaylistWidget : public QSplitter class PlaylistWidget : public QSplitter
{ {
...@@ -51,8 +54,7 @@ private: ...@@ -51,8 +54,7 @@ private:
PLSelector *selector; PLSelector *selector;
PLPanel *rightPanel; PLPanel *rightPanel;
QPushButton *addButton; QPushButton *addButton;
QLabel *art; ArtLabel *art;
QString prevArt;
QWidget *parent; QWidget *parent;
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
...@@ -60,15 +62,16 @@ protected: ...@@ -60,15 +62,16 @@ protected:
virtual void dragEnterEvent( QDragEnterEvent * ); virtual void dragEnterEvent( QDragEnterEvent * );
virtual void closeEvent( QCloseEvent * ); virtual void closeEvent( QCloseEvent * );
private slots:
void setArt( QString );
signals: signals:
void rootChanged( int ); void rootChanged( int );
}; };
class ArtLabel : public QLabel class ArtLabel : public CoverArtLabel
{ {
Q_OBJECT Q_OBJECT
public:
ArtLabel( intf_thread_t *intf ) : CoverArtLabel( VLC_OBJECT( intf ) ) {};
virtual ~ArtLabel() {};
void mouseDoubleClickEvent( QMouseEvent *event ) void mouseDoubleClickEvent( QMouseEvent *event )
{ {
THEDP->mediaInfoDialog(); THEDP->mediaInfoDialog();
......
...@@ -117,7 +117,7 @@ void InputManager::delInput() ...@@ -117,7 +117,7 @@ void InputManager::delInput()
emit positionUpdated( -1.0, 0 ,0 ); emit positionUpdated( -1.0, 0 ,0 );
emit statusChanged( END_S ); emit statusChanged( END_S );
emit nameChanged( "" ); emit nameChanged( "" );
emit artChanged( "" ); emit artChanged( NULL );
emit rateChanged( INPUT_RATE_DEFAULT ); emit rateChanged( INPUT_RATE_DEFAULT );
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
...@@ -366,18 +366,7 @@ void InputManager::UpdateTeletext() ...@@ -366,18 +366,7 @@ void InputManager::UpdateTeletext()
void InputManager::UpdateArt() void InputManager::UpdateArt()
{ {
/* Update Art meta */ /* Update Art meta */
QString url; emit artChanged( input_GetItem( p_input ) );
char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
url.sprintf("%s", psz_art );
free( psz_art );
if( artUrl != url )
{
artUrl = url.replace( "file://",QString("" ) );
/* Taglib seems to define a attachment://, It won't work yet */
artUrl = url.replace( "attachment://",QString("" ) );
emit artChanged( artUrl );
msg_Dbg( p_intf, "Art: %s", qtu( artUrl ) );
}
} }
/* User update of the slider */ /* User update of the slider */
......
...@@ -121,7 +121,7 @@ signals: ...@@ -121,7 +121,7 @@ signals:
void navigationChanged( int ); void navigationChanged( int );
/// Play/pause status /// Play/pause status
void statusChanged( int ); void statusChanged( int );
void artChanged( QString ); void artChanged( input_item_t* );
/// Teletext /// Teletext
void teletextEnabled( bool ); void teletextEnabled( bool );
void toggleTelexButtons(); void toggleTelexButtons();
......
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