]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Validator.cpp
thrid attempt at changing the naming pattern of the intermediated 'mocced' files
[lyx.git] / src / frontends / qt4 / Validator.cpp
index 69d82329bdebecb837cbe1492ebb34983912ac44..51103d957df393514ffbeee851c1fc1bbf373f7e 100644 (file)
 #include "Validator.h"
 #include "qt_helpers.h"
 
-#include "gettext.h"
+#include "support/gettext.h"
 #include "LyXRC.h"
 
 #include "frontends/alert.h"
 
-#include "frontends/controllers/Dialog.h"
-
 #include "support/docstring.h"
 #include "support/lstrings.h"
-#include "support/std_ostream.h"
 
 #include <QLineEdit>
 #include <QWidget>
 
-#include <sstream>
-
-using lyx::support::isStrDbl;
-using std::string;
-
+using namespace std;
 
 namespace lyx {
+namespace frontend {
 
 LengthValidator::LengthValidator(QWidget * parent)
        : QValidator(parent),
@@ -46,14 +40,14 @@ LengthValidator::LengthValidator(QWidget * parent)
 QValidator::State LengthValidator::validate(QString & qtext, int &) const
 {
        string const text = fromqstr(qtext);
-       if (text.empty() || isStrDbl(text))
+       if (text.empty() || support::isStrDbl(text))
                return QValidator::Acceptable;
 
        if (glue_length_) {
                GlueLength gl;
                return (isValidGlueLength(text, &gl)) ?
                        QValidator::Acceptable : QValidator::Intermediate;
-               }
+       }
 
        Length l;
        bool const valid_length = isValidLength(text, &l);
@@ -98,8 +92,7 @@ LengthAutoValidator::LengthAutoValidator(QWidget * parent)
 
 QValidator::State LengthAutoValidator::validate(QString & qtext, int & dummy) const
 {
-       string const text = fromqstr(qtext);
-       if (text == "auto")
+       if (qtext == "auto")
                return QValidator::Acceptable;
        return LengthValidator::validate(qtext, dummy);
 }
@@ -113,18 +106,19 @@ LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit * ed)
 }
 
 
-DoubleAutoValidator::DoubleAutoValidator(QWidget * parent) :
-       QDoubleValidator(parent) {}
+DoubleAutoValidator::DoubleAutoValidator(QWidget * parent)
+       : QDoubleValidator(parent)
+{}
 
 
 DoubleAutoValidator::DoubleAutoValidator(double bottom,
-       double top, int decimals, QObject * parent) :
-       QDoubleValidator(bottom, top, decimals, parent) {}
+               double top, int decimals, QObject * parent)
+       : QDoubleValidator(bottom, top, decimals, parent)
+{}
 
 
 QValidator::State DoubleAutoValidator::validate(QString & input, int & pos) const {
-       string const text = fromqstr(input);
-       if (text == "auto")
+       if (input == "auto")
                return QValidator::Acceptable;
        return QDoubleValidator::validate(input, pos);
 }
@@ -164,9 +158,9 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
        if (!latex_doc_)
                return QValidator::Acceptable;
 
-       docstring const text = lyx::support::trim(qstring_to_ucs4(qtext));
+       docstring const text = support::trim(qstring_to_ucs4(qtext));
        if (text.empty())
-               return  acceptable_if_empty_ ?
+               return acceptable_if_empty_ ?
                        QValidator::Acceptable : QValidator::Intermediate;
 
        docstring invalid_chars = from_ascii("#$%{}()[]\"^");
@@ -177,7 +171,7 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
 
                static int counter = 0;
                if (counter == 0) {
-                       lyx::frontend::Alert::error(_("Invalid filename"),
+                       Alert::error(_("Invalid filename"),
                                     _("LyX does not provide LaTeX support for file names containing any of these characters:\n") +
                                         printable_list(invalid_chars));
                }
@@ -189,10 +183,9 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
 }
 
 
-void PathValidator::setChecker(lyx::frontend::KernelDocType const & type,
-                              LyXRC const & lyxrc)
+void PathValidator::setChecker(KernelDocType const & type, LyXRC const & lyxrc)
 {
-       latex_doc_ = type == lyx::frontend::Kernel::LATEX;
+       latex_doc_ = type == LATEX;
        tex_allows_spaces_ = lyxrc.tex_allows_spaces;
 }
 
@@ -207,6 +200,7 @@ PathValidator * getPathValidator(QLineEdit * ed)
        return dynamic_cast<PathValidator *>(validator);
 }
 
+} // namespace frontend
 } // namespace lyx
 
-#include "Validator_moc.cpp"
+#include "moc_Validator.cpp"