[vlc-commits] commit: Qt4 media info: show local file path instead of file:// URI ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Mon May 31 15:14:12 CEST 2010


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 31 16:13:08 2010 +0300| [c58c542836b0e1a4d14d6155e3abc98c042d2019] | committer: Rémi Denis-Courmont 

Qt4 media info: show local file path instead of file:// URI

This fixes #3626.
(cherry picked from commit 83ffb866a8590db08ada770a568ade8f6fdcf293)

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

 modules/gui/qt4/dialogs/mediainfo.cpp |   22 ++++++++++++++++++++--
 modules/gui/qt4/dialogs/mediainfo.hpp |    2 ++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/dialogs/mediainfo.cpp b/modules/gui/qt4/dialogs/mediainfo.cpp
index cdb0199..d0062c9 100644
--- a/modules/gui/qt4/dialogs/mediainfo.cpp
+++ b/modules/gui/qt4/dialogs/mediainfo.cpp
@@ -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 );
+}
diff --git a/modules/gui/qt4/dialogs/mediainfo.hpp b/modules/gui/qt4/dialogs/mediainfo.hpp
index 469ae67..49c1f18 100644
--- a/modules/gui/qt4/dialogs/mediainfo.hpp
+++ b/modules/gui/qt4/dialogs/mediainfo.hpp
@@ -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>;
 };



More information about the vlc-commits mailing list