]> git.sesse.net Git - vlc/commitdiff
Qt4 media info: show local file path instead of file:// URI
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 31 May 2010 13:13:08 +0000 (16:13 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 31 May 2010 13:13:08 +0000 (16:13 +0300)
This fixes #3626.

modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/dialogs/mediainfo.hpp

index cdb01991a26fc7eca12474f64f57a20c49f1e787..d0062c935bbc764f98df3d6855b84178dc470fbd 100644 (file)
@@ -29,6 +29,8 @@
 #include "dialogs/mediainfo.hpp"
 #include "input_manager.hpp"
 
+#include <vlc_url.h>
+
 #include <QTabWidget>
 #include <QGridLayout>
 #include <QLineEdit>
@@ -73,7 +75,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
     closeButton->setDefault( true );
 
     QLabel *uriLabel = new QLabel( qtr( "Location:" ) );
-    QLineEdit *uriLine = new QLineEdit;
+    uriLine = new QLineEdit;
 
     layout->addWidget( infoTabW, 0, 0, 1, 8 );
     layout->addWidget( uriLabel, 1, 0, 1, 1 );
@@ -87,7 +89,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
     BUTTONACT( saveMetaButton, saveMeta() );
 
     /* Let the MetaData Panel update the URI */
-    CONNECT( MP, uriSet( const QString& ), uriLine, setText( const QString& ) );
+    CONNECT( MP, uriSet( const QString& ), this, updateURI( const QString& ) );
     CONNECT( MP, editing(), saveMetaButton, show() );
 
     /* Display the buttonBar according to the Tab selected */
@@ -181,3 +183,19 @@ void MediaInfoDialog::updateButtons( int i_tab )
         saveMetaButton->hide();
 }
 
+void MediaInfoDialog::updateURI( const QString& uri )
+{
+    QString location;
+
+    /* If URI points to a local file, show the path instead of the URI */
+    char *path = make_path( qtu( uri ) );
+    if( path != NULL )
+    {
+        location = qfu( path );
+        free( path );
+    }
+    else
+        location = uri;
+
+    uriLine->setText( location );
+}
index 469ae6718876c75c23c990f975a2f2e9b5736974..49c1f18ed53625a469b99b3f13df189baab52ebe 100644 (file)
@@ -56,6 +56,7 @@ private:
     ExtraMetaPanel *EMP;
 
     QPushButton *saveMetaButton;
+    QLineEdit   *uriLine;
 
 private slots:
     void updateAllTabs( input_item_t * );
@@ -65,6 +66,7 @@ private slots:
 
     void saveMeta();
     void updateButtons( int i_tab );
+    void updateURI( const QString& );
 
     friend class    Singleton<MediaInfoDialog>;
 };