]> git.sesse.net Git - vlc/commitdiff
Qt4 - Support for Media Art in the Media Info dialog and various fixed on that dialog.
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 13 Jun 2007 22:11:03 +0000 (22:11 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 13 Jun 2007 22:11:03 +0000 (22:11 +0000)
modules/gui/qt4/components/infopanels.cpp
modules/gui/qt4/components/infopanels.hpp
modules/gui/qt4/dialogs/mediainfo.cpp

index 27e74e74386542967e1521a5352561d8e993e51f..7fc3ad6960562475824e070add77d64d8d79a7a6 100644 (file)
@@ -47,39 +47,36 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
 {
     int line = 0;
     QGridLayout *l = new QGridLayout( this );
-    l->setColumnStretch( 2, 5 );
-    l->setColumnStretch( 5, 3 );
 
 #define ADD_META( string, widget ) {                             \
     l->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
     widget = new QLineEdit;                                      \
-    l->addWidget( widget, line, 1, 1, 7 );                       \
+    l->addWidget( widget, line, 1, 1, 9 );                       \
     line++;            }
 
     ADD_META( VLC_META_TITLE, title_text ); /* OK */
     ADD_META( VLC_META_ARTIST, artist_text ); /* OK */
-    ADD_META( VLC_META_GENRE, genre_text ); /* FIXME List id3genres.h is not
-                                               includable yet ? */
-
-    /* Album Name */
-    l->addWidget( new QLabel( qfu( VLC_META_COLLECTION ) + " :" ), line, 0 );
-    collection_text = new QLineEdit;
-    l->addWidget( collection_text, line, 1, 1, 5 );
-    l->addWidget( new QLabel( qfu( VLC_META_DATE ) + " :" ), line, 6 );
+    ADD_META( VLC_META_COLLECTION, collection_text ); /* OK */
+
+    /* Genre Name */ /* FIXME List id3genres.h is not includable yet ? */
+    genre_text = new QLineEdit;
+    l->addWidget( new QLabel( qtr( VLC_META_GENRE ) + " :" ), line, 0 );
+    l->addWidget( genre_text, line, 1, 1, 6 );
     /* Date (Should be in years) */
     date_text = new QSpinBox; setSpinBounds( date_text );
-    l->addWidget( date_text, line, 7 );
+    l->addWidget( new QLabel( qfu( VLC_META_DATE ) + " :" ), line, 7 );
+    l->addWidget( date_text, line, 8, 1, 2 );
     line++;
 
     /* Number and Rating */
     l->addWidget( new QLabel( qfu( _("Track number/Position" ) ) + " :" ),
                   line, 0 );
     seqnum_text = new QSpinBox; setSpinBounds( seqnum_text );
-    l->addWidget( seqnum_text, line, 1, 1, 3 );
+    l->addWidget( seqnum_text, line, 1, 1, 4 );
 
-    l->addWidget( new QLabel( qfu( VLC_META_RATING ) + " :" ), line, 4 );
+    l->addWidget( new QLabel( qfu( VLC_META_RATING ) + " :" ), line, 5 );
     rating_text = new QSpinBox; setSpinBounds( rating_text) ;
-    l->addWidget( rating_text, line, 5, 1, 3 );
+    l->addWidget( rating_text, line, 6, 1, 4 );
     line++;
 
     ADD_META( VLC_META_NOW_PLAYING, nowplaying_text );
@@ -87,23 +84,43 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
     /* Language and settings */
     l->addWidget( new QLabel( qfu( VLC_META_LANGUAGE ) + " :" ), line, 0 );
     language_text = new QLineEdit;
-    l->addWidget( language_text, line, 1, 1, 3 );
-    l->addWidget( new QLabel( qfu( VLC_META_SETTING ) + " :" ), line, 4 );
+    l->addWidget( language_text, line, 1, 1, 4 );
+    l->addWidget( new QLabel( qfu( VLC_META_SETTING ) + " :" ), line, 5 );
     setting_text = new QLineEdit;
-    l->addWidget( setting_text, line, 5, 1, 3 );
+    l->addWidget( setting_text, line, 6, 1, 4 );
     line++;
 
-    ADD_META( VLC_META_COPYRIGHT, copyright_text );
-    ADD_META( VLC_META_PUBLISHER, publisher_text );
+    /* ART_URL */
+    //    ADD_META( VLC_META_URL, setting_text );
+    art_cover = new QLabel( "" );
+    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" ) );
+
+    l->addWidget( art_cover, line, 8, 4, 2 );
 
-    ADD_META( VLC_META_ENCODED_BY, publisher_text );
-    ADD_META( VLC_META_DESCRIPTION, description_text ); // Comment Two lines?
+#define ADD_META_B( string, widget ) {                             \
+    l->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
+    widget = new QLineEdit;                                      \
+    l->addWidget( widget, line, 1, 1, 7 );                       \
+    line++;            }
+
+    ADD_META_B( VLC_META_COPYRIGHT, copyright_text );
+    ADD_META_B( VLC_META_PUBLISHER, publisher_text );
+
+    ADD_META_B( VLC_META_ENCODED_BY, publisher_text );
+    ADD_META_B( VLC_META_DESCRIPTION, description_text ); // Comment Two lines?
 
     /*  ADD_META( TRACKID)  DO NOT SHOW it */
     /*  ADD_URI - DO not show it, done outside */
 
-    /* ART_URL */
-    //    ADD_META( VLC_META_URL, setting_text );
+#undef ADD_META
+#undef ADD_META_B
+
+//  CONNECT( model,  artSet( QString ) , this, setArt( QString ) );
 }
 
 MetaPanel::~MetaPanel()
@@ -158,6 +175,15 @@ void MetaPanel::update( input_item_t *p_item )
 #undef UPDATE_META
 }
 
+void MetaPanel::setArt( QString artUrl )
+{
+    msg_Dbg( p_intf, "Trying to update art" );
+    if( artUrl.isNull() )
+        art_cover->setPixmap( QPixmap( ":/noart.png" ) );
+    else
+        art_cover->setPixmap( QPixmap( artUrl ) );
+}
+
 void MetaPanel::clear(){}
 
 ExtraMetaPanel::ExtraMetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
index 9fd7c3fd2a95bc7be1f8a81f895920d67984906f..ee5d29f8ec3a9e16f3f36bcea09e6fd659e97958 100644 (file)
@@ -45,6 +45,7 @@ class QTreeWidgetItem;
 class QTreeView;
 class QSpinBox;
 class QLineEdit;
+class QLabel;
 
 class MetaPanel: public QWidget
 {
@@ -68,10 +69,13 @@ private:
     QLineEdit *language_text;
     QLineEdit *nowplaying_text;
     QLineEdit *publisher_text;
+    QLabel *art_cover;
 
 public slots:
     void update( input_item_t * );
     void clear();
+private slots:
+    void setArt( QString );
 signals:
     void uriSet( QString );
 };
index 56d8d2b4dfef122c27575e8e97d3b3d92c12aa0f..1ed394141f8ab732f47b9ab9e2bde4042b1cfad4 100644 (file)
@@ -47,7 +47,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
     p_input = NULL;
 
     setWindowTitle( qtr( "Media information" ) );
-    resize( 600 , 450 );
+    resize( 700 , 450 );
 
     QGridLayout *layout = new QGridLayout( this );
 
@@ -68,12 +68,12 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
     closeButton->setDefault( true );
 
     uriLine = new QLineEdit;
-    QLabel *uriLabel = new QLabel( qtr( "Location" ) );
+    QLabel *uriLabel = new QLabel( qtr( "Location :" ) );
 
-    layout->addWidget( IT, 0, 0, 1, 3 );
-    layout->addWidget( closeButton, 2, 2 );
-    layout->addWidget( uriLine, 1, 1, 1, 2 );
+    layout->addWidget( IT, 0, 0, 1, 7 );
+    layout->addWidget( closeButton, 2, 6 );
     layout->addWidget( uriLabel, 1, 0, 1, 1 );
+    layout->addWidget( uriLine, 1, 1, 1, 6 );
 
     BUTTONACT( closeButton, close() );
     CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );