[vlc-commits] Qt: mediainfo, difference between URI and URL

Jean-Baptiste Kempf git at videolan.org
Sun May 22 19:38:03 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 22 19:36:18 2011 +0200| [929f2db29bfc8913cc831927e83be66af016fe1b] | committer: Jean-Baptiste Kempf

Qt: mediainfo, difference between URI and URL

One is the actual URL, the other is a metadata
Close #4157

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=929f2db29bfc8913cc831927e83be66af016fe1b
---

 modules/gui/qt4/components/info_panels.cpp |   33 +++++++++++++++++----------
 modules/gui/qt4/components/info_panels.hpp |    4 +++
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
index 018828b..7f2da22 100644
--- a/modules/gui/qt4/components/info_panels.cpp
+++ b/modules/gui/qt4/components/info_panels.cpp
@@ -132,13 +132,19 @@ MetaPanel::MetaPanel( QWidget *parent,
 
     /* Language on the same line */
     ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++;
+    ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); line++;
+
+    lblURL = new QLabel;
+    lblURL->setOpenExternalLinks( true );
+    lblURL->setTextFormat( Qt::RichText );
+    metaLayout->addWidget( lblURL, line -1, 7, 1, -1 );
+
+    ADD_META( VLC_META_COPYRIGHT, copyright_text, 0,  7 ); line++;
 
     /* ART_URL */
     art_cover = new CoverArtLabel( this, p_intf );
-    metaLayout->addWidget( art_cover, line + 1, 7, 6, 3, Qt::AlignLeft );
+    metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft );
 
-    ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); line++;
-    ADD_META( VLC_META_COPYRIGHT, copyright_text, 0,  7 ); line++;
     ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++;
 
     label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont );
@@ -207,16 +213,9 @@ void MetaPanel::update( input_item_t *p_item )
         title_text->setText( "" );
 
     /* URL / URI */
-    psz_meta = input_item_GetURL( p_item );
+    psz_meta = input_item_GetURI( p_item );
     if( !EMPTY_STR( psz_meta ) )
-        emit uriSet( qfu( psz_meta ) );
-    else
-    {
-        free( psz_meta );
-        psz_meta = input_item_GetURI( p_item );
-        if( !EMPTY_STR( psz_meta ) )
-            emit uriSet( qfu( psz_meta ) );
-    }
+         emit uriSet( qfu( psz_meta ) );
     free( psz_meta );
 
     /* Other classic though */
@@ -235,6 +234,16 @@ void MetaPanel::update( input_item_t *p_item )
 //    UPDATE_META( Setting, setting_text );
 //    UPDATE_META_INT( Rating, rating_text );
 
+    /* URL */
+    psz_meta = input_item_GetURL( p_item );
+    if( !EMPTY_STR( psz_meta ) && strcmp( psz_meta, currentURL ) )
+    {
+        free( currentURL ); currentURL = strdup( psz_meta );
+
+        lblURL->setText( "<a href='" + qfu( psz_meta ) + "'>" +
+                        qfu( psz_meta ).remove( QRegExp( ".*://") ) + "</a>" );
+        free( psz_meta );
+    }
 #undef UPDATE_META_INT
 #undef UPDATE_META
 
diff --git a/modules/gui/qt4/components/info_panels.hpp b/modules/gui/qt4/components/info_panels.hpp
index 7be324e..7784043 100644
--- a/modules/gui/qt4/components/info_panels.hpp
+++ b/modules/gui/qt4/components/info_panels.hpp
@@ -50,6 +50,7 @@ class QSpinBox;
 class QLineEdit;
 class CoverArtLabel;
 class QTextEdit;
+class QLabel;
 
 class MetaPanel: public QWidget
 {
@@ -84,6 +85,9 @@ private:
     QLineEdit *encodedby_text;
     CoverArtLabel *art_cover;
 
+    QLabel   *lblURL;
+    char     *currentURL;
+
 public slots:
     void update( input_item_t * );
     void clear();



More information about the vlc-commits mailing list