cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21596 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-14 00:21:31 +00:00
parent 5609f23db4
commit d93679c1db
4 changed files with 32 additions and 47 deletions

View File

@ -1,5 +1,5 @@
/** /**
* \file GuiTocDialog.C * \file TocModel.cpp
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -17,16 +17,8 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <climits>
#include <vector>
#include <string>
using std::endl; using std::endl;
using std::pair;
using std::map; using std::map;
using std::vector;
using std::string;
using std::make_pair;
using std::max; using std::max;
using std::min; using std::min;
@ -126,9 +118,8 @@ void TocModel::populate(Toc const & toc)
} }
void TocModel::populate(TocIterator & iter, void TocModel::populate(TocIterator & iter, TocIterator const & end,
TocIterator const & end, QModelIndex const & parent)
QModelIndex const & parent)
{ {
int curdepth = iter->depth() + 1; int curdepth = iter->depth() + 1;
@ -166,7 +157,7 @@ void TocModel::populate(TocIterator & iter,
} }
int TocModel::modelDepth() int TocModel::modelDepth() const
{ {
return maxdepth_ - mindepth_; return maxdepth_ - mindepth_;
} }

View File

@ -23,7 +23,8 @@
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class TocModel: public QStandardItemModel { class TocModel : public QStandardItemModel
{
Q_OBJECT Q_OBJECT
public: public:
@ -44,12 +45,11 @@ public:
/// ///
QModelIndex const modelIndex(TocIterator const & it) const; QModelIndex const modelIndex(TocIterator const & it) const;
/// ///
int modelDepth(); int modelDepth() const;
private: private:
/// ///
void populate(TocIterator & it, void populate(TocIterator & it, TocIterator const & end,
TocIterator const & end,
QModelIndex const & parent); QModelIndex const & parent);
/// ///
typedef std::map<QModelIndex, TocIterator> TocMap; typedef std::map<QModelIndex, TocIterator> TocMap;

View File

@ -26,11 +26,11 @@
#include <QLineEdit> #include <QLineEdit>
#include <QWidget> #include <QWidget>
using lyx::support::isStrDbl;
using std::string; using std::string;
namespace lyx { namespace lyx {
namespace frontend {
LengthValidator::LengthValidator(QWidget * parent) LengthValidator::LengthValidator(QWidget * parent)
: QValidator(parent), : QValidator(parent),
@ -41,7 +41,7 @@ LengthValidator::LengthValidator(QWidget * parent)
QValidator::State LengthValidator::validate(QString & qtext, int &) const QValidator::State LengthValidator::validate(QString & qtext, int &) const
{ {
string const text = fromqstr(qtext); string const text = fromqstr(qtext);
if (text.empty() || isStrDbl(text)) if (text.empty() || support::isStrDbl(text))
return QValidator::Acceptable; return QValidator::Acceptable;
if (glue_length_) { if (glue_length_) {
@ -173,7 +173,7 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
static int counter = 0; static int counter = 0;
if (counter == 0) { if (counter == 0) {
frontend::Alert::error(_("Invalid filename"), Alert::error(_("Invalid filename"),
_("LyX does not provide LaTeX support for file names containing any of these characters:\n") + _("LyX does not provide LaTeX support for file names containing any of these characters:\n") +
printable_list(invalid_chars)); printable_list(invalid_chars));
} }
@ -185,10 +185,9 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
} }
void PathValidator::setChecker(frontend::KernelDocType const & type, void PathValidator::setChecker(KernelDocType const & type, LyXRC const & lyxrc)
LyXRC const & lyxrc)
{ {
latex_doc_ = type == frontend::LATEX; latex_doc_ = type == LATEX;
tex_allows_spaces_ = lyxrc.tex_allows_spaces; tex_allows_spaces_ = lyxrc.tex_allows_spaces;
} }
@ -203,6 +202,7 @@ PathValidator * getPathValidator(QLineEdit * ed)
return dynamic_cast<PathValidator *>(validator); return dynamic_cast<PathValidator *>(validator);
} }
} // namespace frontend
} // namespace lyx } // namespace lyx
#include "Validator_moc.cpp" #include "Validator_moc.cpp"

View File

@ -26,7 +26,7 @@
#define VALIDATOR_H #define VALIDATOR_H
#include "Length.h" #include "Length.h"
#include "Dialog.h" #include "Dialog.h" // KernelDocType
#include <QValidator> #include <QValidator>
@ -36,6 +36,10 @@ class QLineEdit;
namespace lyx { namespace lyx {
class LyXRC;
namespace frontend {
/** A class to ascertain whether the data passed to the @c validate() /** A class to ascertain whether the data passed to the @c validate()
* member function can be interpretted as a GlueLength. * member function can be interpretted as a GlueLength.
*/ */
@ -61,11 +65,6 @@ public:
//@} //@}
private: private:
#if defined(Q_DISABLE_COPY)
LengthValidator( const LengthValidator & );
LengthValidator& operator=( const LengthValidator & );
#endif
Length b_; Length b_;
GlueLength g_; GlueLength g_;
bool no_bottom_; bool no_bottom_;
@ -86,36 +85,36 @@ LengthValidator * unsignedLengthValidator(QLineEdit *);
class LengthAutoValidator : public LengthValidator class LengthAutoValidator : public LengthValidator
{ {
Q_OBJECT Q_OBJECT
public: public:
/// Define a validator for widget @c parent. /// Define a validator for widget @c parent.
LengthAutoValidator(QWidget * parent); LengthAutoValidator(QWidget * parent);
/** @returns QValidator::Acceptable if @c data is a GlueLength /** @returns QValidator::Acceptable if @c data is a GlueLength
* or is "auto". If not, returns QValidator::Intermediate. * or is "auto". If not, returns QValidator::Intermediate.
*/ */
QValidator::State validate(QString & data, int &) const; QValidator::State validate(QString & data, int &) const;
}; };
/// @returns a new @c LengthAutoValidator that does not accept negative lengths. /// @returns a new @c LengthAutoValidator that does not accept negative lengths.
LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *); LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *);
//FIXME As above, this should really take a text argument. //FIXME As above, this should really take a text argument.
/** /**
* A class to determine whether the passed is a double * A class to determine whether the passed is a double
* or is "auto". * or is "auto".
* *
*/ */
class DoubleAutoValidator : public QDoubleValidator { class DoubleAutoValidator : public QDoubleValidator
{
Q_OBJECT Q_OBJECT
public: public:
DoubleAutoValidator(QWidget * parent); DoubleAutoValidator(QWidget * parent);
DoubleAutoValidator(double bottom, double top, int decimals, DoubleAutoValidator(double bottom, double top, int decimals,
QObject * parent); QObject * parent);
QValidator::State validate(QString & input, int & pos) const; QValidator::State validate(QString & input, int & pos) const;
}; };
// Forward declarations
class LyXRC;
/** A class to ascertain whether the data passed to the @c validate() /** A class to ascertain whether the data passed to the @c validate()
* member function is a valid file path. * member function is a valid file path.
@ -142,15 +141,9 @@ public:
* @param lyxrc contains a @c tex_allows_spaces member that * @param lyxrc contains a @c tex_allows_spaces member that
* is used to define what is legal. * is used to define what is legal.
*/ */
void setChecker(frontend::KernelDocType const & doc_type, void setChecker(KernelDocType const & doc_type, LyXRC const & lyxrc);
LyXRC const & lyxrc);
private: private:
#if defined(Q_DISABLE_COPY)
PathValidator(const PathValidator &);
PathValidator & operator=(const PathValidator &);
#endif
bool acceptable_if_empty_; bool acceptable_if_empty_;
bool latex_doc_; bool latex_doc_;
bool tex_allows_spaces_; bool tex_allows_spaces_;
@ -160,6 +153,7 @@ private:
/// @returns the PathValidator attached to the widget, or 0. /// @returns the PathValidator attached to the widget, or 0.
PathValidator * getPathValidator(QLineEdit *); PathValidator * getPathValidator(QLineEdit *);
} // namespace frontend
} // namespace lyx } // namespace lyx
# endif // NOT VALIDATOR_H # endif // NOT VALIDATOR_H