[vlc-commits] Remove all reliance upon QUrl for handling MRLs in GUI

Jonathan Heard git at videolan.org
Thu Jan 19 17:54:12 CET 2017


vlc | branch: master | Jonathan Heard <jon.vlc at jeh.org.uk> | Thu Jan 19 16:21:23 2017 +0000| [1866ec487ef02569055e106bb923aa2689dd35f1] | committer: Hugo Beauzée-Luyssen

Remove all reliance upon QUrl for handling MRLs in GUI

Fixes #17850

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/gui/qt/components/playlist/playlist_item.cpp  | 4 ++--
 modules/gui/qt/components/playlist/playlist_item.hpp  | 5 ++---
 modules/gui/qt/components/playlist/playlist_model.cpp | 2 +-
 modules/gui/qt/components/playlist/vlc_model.cpp      | 2 +-
 modules/gui/qt/components/sout/sout_widgets.cpp       | 8 +++++++-
 modules/gui/qt/dialogs/openurl.cpp                    | 1 -
 modules/gui/qt/dialogs/playlist.cpp                   | 1 -
 7 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt/components/playlist/playlist_item.cpp b/modules/gui/qt/components/playlist/playlist_item.cpp
index a38cf93..317f30b 100644
--- a/modules/gui/qt/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt/components/playlist/playlist_item.cpp
@@ -125,13 +125,13 @@ bool PLItem::operator< ( AbstractPLItem& other )
     return false;
 }
 
-QUrl PLItem::getURI() const
+QString PLItem::getURI() const
 {
     QString uri;
     vlc_mutex_lock( &p_input->lock );
     uri = QString( p_input->psz_uri );
     vlc_mutex_unlock( &p_input->lock );
-    return QUrl( uri );
+    return uri;
 }
 
 QString PLItem::getTitle() const
diff --git a/modules/gui/qt/components/playlist/playlist_item.hpp b/modules/gui/qt/components/playlist/playlist_item.hpp
index 636bb57..b88314b 100644
--- a/modules/gui/qt/components/playlist/playlist_item.hpp
+++ b/modules/gui/qt/components/playlist/playlist_item.hpp
@@ -32,7 +32,6 @@
 
 #include <QList>
 #include <QString>
-#include <QUrl>
 
 class AbstractPLItem
 {
@@ -57,7 +56,7 @@ protected:
     virtual AbstractPLItem *child( int id ) const = 0;
     void removeChild( AbstractPLItem *item );
     void clearChildren();
-    virtual QUrl getURI() const = 0;
+    virtual QString getURI() const = 0;
     virtual QString getTitle() const = 0;
     virtual bool readOnly() const = 0;
 
@@ -79,7 +78,7 @@ private:
     int id() const Q_DECL_OVERRIDE;
     input_item_t *inputItem() Q_DECL_OVERRIDE { return p_input; }
     AbstractPLItem *child( int id ) const Q_DECL_OVERRIDE { return children.value( id ); };
-    virtual QUrl getURI() const Q_DECL_OVERRIDE;
+    virtual QString getURI() const Q_DECL_OVERRIDE;
     virtual QString getTitle() const Q_DECL_OVERRIDE;
     virtual bool readOnly() const Q_DECL_OVERRIDE;
 
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 7e5a991..d4b5df7 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -1048,7 +1048,7 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
         if( !item )
             return false;
 
-        char*  psz_path = vlc_uri2path( qtu( item->getURI().toString() ) );
+        char*  psz_path = vlc_uri2path( qtu( item->getURI() ) );
         free(  psz_path );
         return psz_path != NULL;
     }
diff --git a/modules/gui/qt/components/playlist/vlc_model.cpp b/modules/gui/qt/components/playlist/vlc_model.cpp
index 7d48f73..e877b5d 100644
--- a/modules/gui/qt/components/playlist/vlc_model.cpp
+++ b/modules/gui/qt/components/playlist/vlc_model.cpp
@@ -163,7 +163,7 @@ QString VLCModel::getURI( const QModelIndex &index ) const
 {
     AbstractPLItem *item = getItem( index );
     if ( !item ) return QString();
-    return item->getURI().toString();
+    return item->getURI();
 }
 
 input_item_t * VLCModel::getInputItem( const QModelIndex &index ) const
diff --git a/modules/gui/qt/components/sout/sout_widgets.cpp b/modules/gui/qt/components/sout/sout_widgets.cpp
index f84ebdb..45243b9 100644
--- a/modules/gui/qt/components/sout/sout_widgets.cpp
+++ b/modules/gui/qt/components/sout/sout_widgets.cpp
@@ -70,6 +70,8 @@ SoutInputBox::SoutInputBox( QWidget *_parent, const QString& mrl ) : QGroupBox(
 void SoutInputBox::setMRL( const QString& mrl )
 {
     QUrl uri = QUrl::fromEncoded( mrl.toLatin1() );
+    QString type = uri.scheme();
+
     if( !uri.isValid() &&
         !mrl.startsWith("http") &&
         !mrl.startsWith("ftp") &&
@@ -82,10 +84,14 @@ void SoutInputBox::setMRL( const QString& mrl )
             sourceLine->setText( mrl );
         }
     }
+    else if ( type == "window" )
+    {
+        /* QUrl mangles X11 Window identifiers so use the raw mrl */
+        sourceLine->setText( mrl );
+    }
     else
     {
         sourceLine->setText( uri.toString() );
-        QString type = uri.scheme();
         if ( type.isEmpty() ) type = qtr( I_FILE_SLASH_DIR );
         sourceValueLabel->setText( type );
     }
diff --git a/modules/gui/qt/dialogs/openurl.cpp b/modules/gui/qt/dialogs/openurl.cpp
index e0f7c26..2e4606c 100644
--- a/modules/gui/qt/dialogs/openurl.cpp
+++ b/modules/gui/qt/dialogs/openurl.cpp
@@ -35,7 +35,6 @@
 #include <QClipboard>
 #include <QMimeData>
 #include <QList>
-#include <QUrl>
 #include <QFile>
 #include <QLabel>
 
diff --git a/modules/gui/qt/dialogs/playlist.cpp b/modules/gui/qt/dialogs/playlist.cpp
index 0da5c98..beb47a3 100644
--- a/modules/gui/qt/dialogs/playlist.cpp
+++ b/modules/gui/qt/dialogs/playlist.cpp
@@ -30,7 +30,6 @@
 
 #include "util/qt_dirs.hpp"
 
-#include <QUrl>
 #include <QMimeData>
 #include <QHBoxLayout>
 



More information about the vlc-commits mailing list