]> git.lyx.org Git - lyx.git/commitdiff
Move the NoNewLineValidator to Validator.cpp where it fits better.
authorJulien Rioux <jrioux@lyx.org>
Sat, 24 Sep 2011 16:39:17 +0000 (16:39 +0000)
committerJulien Rioux <jrioux@lyx.org>
Sat, 24 Sep 2011 16:39:17 +0000 (16:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39743 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/Validator.cpp
src/frontends/qt4/Validator.h

index 4fe68d45c7010cc8aed023d0b9a705a97f0ffae7..d56d3b068104371d5f95c21578f10f3ee3fbf795 100644 (file)
@@ -20,6 +20,7 @@
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
 #include "qt_helpers.h"
+#include "Validator.h"
 
 #include "Author.h"
 #include "BufferList.h"
@@ -349,33 +350,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
 }
 
 
-/////////////////////////////////////////////////////////////////////
-//
-// NoNewLineValidator
-//
-/////////////////////////////////////////////////////////////////////
-
-class NoNewLineValidator : public QValidator
-{
-public:
-       NoNewLineValidator(QWidget *);
-       QValidator::State validate(QString & input, int & pos) const;
-};
-
-
-NoNewLineValidator::NoNewLineValidator(QWidget * parent)
-       : QValidator(parent)
-{
-}
-
-
-QValidator::State NoNewLineValidator::validate(QString & input, int & /*pos*/) const
-{
-       input.remove(QRegExp("[\\n\\r]"));
-       return QValidator::Acceptable;
-}
-
-
 /////////////////////////////////////////////////////////////////////
 //
 // StrftimeValidator
index e156dcb099dedbe83a86326438d197cae0c494b3..7f5d5d45e283634838252b710757d72918d08223 100644 (file)
@@ -138,6 +138,18 @@ QValidator::State DoubleAutoValidator::validate(QString & input, int & pos) cons
 }
 
 
+NoNewLineValidator::NoNewLineValidator(QWidget * parent)
+       : QValidator(parent)
+{}
+
+
+QValidator::State NoNewLineValidator::validate(QString & qtext, int &) const
+{
+       qtext.remove(QRegExp("[\\n\\r]"));
+       return QValidator::Acceptable;
+}
+
+
 PathValidator::PathValidator(bool acceptable_if_empty,
                             QWidget * parent)
        : QValidator(parent),
index 36250bbdca924721211af2eb446d1e4a39937803..e824659323652368a1ac8b87343fe97049529a16 100644 (file)
@@ -124,6 +124,18 @@ private:
 };
 
 
+// A class to ascertain that no newline characters are passed.
+class NoNewLineValidator : public QValidator
+{
+       Q_OBJECT
+public:
+       // Define a validator.
+       NoNewLineValidator(QWidget *);
+       // Remove newline characters from input.
+       QValidator::State validate(QString &, int &) const;
+};
+
+
 /** A class to ascertain whether the data passed to the @c validate()
  *  member function is a valid file path.
  *  The test is active only when the path is to be stored in a LaTeX