[vlc-commits] Qt: move validators

Francois Cartegnie git at videolan.org
Tue Sep 3 11:47:04 CEST 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep  3 11:41:20 2013 +0200| [f867f9cfedebe742301341b388dbfeb84b7968c0] | committer: Francois Cartegnie

Qt: move validators

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

 modules/gui/qt4/Makefile.am                |    2 ++
 modules/gui/qt4/components/open_panels.cpp |   11 +--------
 modules/gui/qt4/components/open_panels.hpp |    8 -------
 modules/gui/qt4/util/validators.cpp        |   35 ++++++++++++++++++++++++++++
 modules/gui/qt4/util/validators.hpp        |   34 +++++++++++++++++++++++++++
 5 files changed, 72 insertions(+), 18 deletions(-)

diff --git a/modules/gui/qt4/Makefile.am b/modules/gui/qt4/Makefile.am
index 4dc3fa9..9530b74 100644
--- a/modules/gui/qt4/Makefile.am
+++ b/modules/gui/qt4/Makefile.am
@@ -111,6 +111,7 @@ libqt4_plugin_la_SOURCES = \
 	util/qmenuview.cpp util/qmenuview.hpp \
 	util/qt_dirs.cpp util/qt_dirs.hpp \
 	util/pictureflow.cpp util/pictureflow.hpp \
+	util/validators.cpp util/validators.hpp \
 	util/buttons/BrowseButton.cpp util/buttons/BrowseButton.hpp \
 	util/buttons/DeckButtonsLayout.cpp util/buttons/DeckButtonsLayout.hpp \
 	util/buttons/RoundButton.cpp util/buttons/RoundButton.hpp \
@@ -199,6 +200,7 @@ nodist_libqt4_plugin_la_SOURCES = \
 	util/qmenuview.moc.cpp \
 	util/qvlcapp.moc.cpp \
 	util/pictureflow.moc.cpp \
+	util/validators.moc.cpp \
 	util/buttons/RoundButton.moc.cpp \
 	util/buttons/DeckButtonsLayout.moc.cpp \
 	util/buttons/BrowseButton.moc.cpp \
diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 740ac04..53059c9 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -35,6 +35,7 @@
 #include "dialogs/open.hpp"
 #include "dialogs_provider.hpp" /* Open Subtitle file */
 #include "util/qt_dirs.hpp"
+#include "util/validators.hpp"
 #include <vlc_intf_strings.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
@@ -702,16 +703,6 @@ void NetOpenPanel::updateMRL()
     emit mrlUpdated( qsl, "" );
 }
 
-QValidator::State UrlValidator::validate( QString& str, int& ) const
-{
-    str = str.trimmed();
-    if( str.contains( ' ' ) )
-        return QValidator::Invalid;
-    if( !str.contains( "://" ) )
-        return QValidator::Intermediate;
-    return QValidator::Acceptable;
-}
-
 /**************************************************************************
  * 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 c936da8..4f541a1 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -148,14 +148,6 @@ public slots:
     virtual void updateMRL();
 };
 
-class UrlValidator : public QValidator
-{
-   Q_OBJECT
-public:
-   UrlValidator( QObject *parent ) : QValidator( parent ) { }
-   virtual QValidator::State validate( QString&, int& ) const;
-};
-
 class DiscOpenPanel: public OpenPanel
 {
     Q_OBJECT
diff --git a/modules/gui/qt4/util/validators.cpp b/modules/gui/qt4/util/validators.cpp
new file mode 100644
index 0000000..56be4e9
--- /dev/null
+++ b/modules/gui/qt4/util/validators.cpp
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * validators.cpp : Custom Input validators
+ ****************************************************************************
+ * Copyright (C) 2006-2013 the VideoLAN team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "validators.hpp"
+
+QValidator::State UrlValidator::validate( QString& str, int& ) const
+{
+    str = str.trimmed();
+    if( str.contains( ' ' ) )
+        return QValidator::Invalid;
+    if( !str.contains( "://" ) )
+        return QValidator::Intermediate;
+    return QValidator::Acceptable;
+}
diff --git a/modules/gui/qt4/util/validators.hpp b/modules/gui/qt4/util/validators.hpp
new file mode 100644
index 0000000..f40be28
--- /dev/null
+++ b/modules/gui/qt4/util/validators.hpp
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * validators.hpp : Custom Input validators
+ ****************************************************************************
+ * Copyright (C) 2006-2013 the VideoLAN team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VALIDATORS_HPP
+#define VALIDATORS_HPP
+
+#include <QValidator>
+
+class UrlValidator : public QValidator
+{
+   Q_OBJECT
+public:
+   UrlValidator( QObject *parent ) : QValidator( parent ) { }
+   virtual QValidator::State validate( QString&, int& ) const;
+};
+
+#endif // VALIDATORS_HPP



More information about the vlc-commits mailing list