[vlc-commits] Qt: trim the MRL before validating its content (fix #9289)

Ludovic Fauvet git at videolan.org
Thu Sep 5 15:44:06 CEST 2013


vlc/vlc-2.1 | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Sep  2 17:57:06 2013 +0200| [6b5c383b8148acbd5bc6498c6785f4ec148689d1] | committer: Jean-Baptiste Kempf

Qt: trim the MRL before validating its content (fix #9289)

The default implementation of QLineEdit only calls the fixup method if the
user presses Enter and the content is not currently valid.

(cherry picked from commit 4bbf21659b0b565034d15b1c1b8db8cda6e6c1a3)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=6b5c383b8148acbd5bc6498c6785f4ec148689d1
---

 modules/gui/qt4/components/open_panels.cpp |    6 +-----
 modules/gui/qt4/components/open_panels.hpp |    3 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 4c516cd..00b2b36 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -704,6 +704,7 @@ void NetOpenPanel::updateMRL()
 
 QValidator::State UrlValidator::validate( QString& str, int& ) const
 {
+    str = str.trimmed();
     if( str.contains( ' ' ) )
         return QValidator::Invalid;
     if( !str.contains( "://" ) )
@@ -711,11 +712,6 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
     return QValidator::Acceptable;
 }
 
-void UrlValidator::fixup( QString& str ) const
-{
-    str = str.trimmed();
-}
-
 /**************************************************************************
  * Open Capture device ( DVB, PVR, V4L, and similar )                     *
  **************************************************************************/
diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp
index 70082ba..c936da8 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -153,8 +153,7 @@ class UrlValidator : public QValidator
    Q_OBJECT
 public:
    UrlValidator( QObject *parent ) : QValidator( parent ) { }
-   void fixup( QString& ) const;
-   QValidator::State validate( QString&, int& ) const;
+   virtual QValidator::State validate( QString&, int& ) const;
 };
 
 class DiscOpenPanel: public OpenPanel



More information about the vlc-commits mailing list