made document data available to filter parser

pull/51/head
Marc Zinnschlag 12 years ago
parent 7aee1da5c6
commit d1516792ce

@ -506,7 +506,8 @@ void CSMFilter::Parser::error()
mError = true;
}
CSMFilter::Parser::Parser() : mIndex (0), mError (false) {}
CSMFilter::Parser::Parser (const CSMWorld::Data& data)
: mIndex (0), mError (false), mData (data) {}
bool CSMFilter::Parser::parse (const std::string& filter)
{

@ -5,6 +5,11 @@
#include "node.hpp"
namespace CSMWorld
{
class Data;
}
namespace CSMFilter
{
struct Token;
@ -15,6 +20,7 @@ namespace CSMFilter
std::string mInput;
int mIndex;
bool mError;
const CSMWorld::Data& mData;
Token getStringToken();
@ -38,7 +44,7 @@ namespace CSMFilter
public:
Parser();
Parser (const CSMWorld::Data& data);
bool parse (const std::string& filter);
///< Discards any previous calls to parse

@ -1,8 +1,8 @@
#include "editwidget.hpp"
CSVFilter::EditWidget::EditWidget (QWidget *parent)
: QLineEdit (parent)
CSVFilter::EditWidget::EditWidget (const CSMWorld::Data& data, QWidget *parent)
: QLineEdit (parent), mParser (data)
{
mPalette = palette();
connect (this, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&)));

@ -9,6 +9,11 @@
#include "../../model/filter/parser.hpp"
#include "../../model/filter/node.hpp"
namespace CSMWorld
{
class Data;
}
namespace CSVFilter
{
class EditWidget : public QLineEdit
@ -20,7 +25,7 @@ namespace CSVFilter
public:
EditWidget (QWidget *parent = 0);
EditWidget (const CSMWorld::Data& data, QWidget *parent = 0);
signals:

@ -5,14 +5,14 @@
#include "recordfilterbox.hpp"
CSVFilter::FilterBox::FilterBox (QWidget *parent)
CSVFilter::FilterBox::FilterBox (const CSMWorld::Data& data, QWidget *parent)
: QWidget (parent)
{
QHBoxLayout *layout = new QHBoxLayout (this);
layout->setContentsMargins (0, 0, 0, 0);
RecordFilterBox *recordFilterBox = new RecordFilterBox (this);
RecordFilterBox *recordFilterBox = new RecordFilterBox (data, this);
layout->addWidget (recordFilterBox);

@ -5,6 +5,11 @@
#include "../../model/filter/node.hpp"
namespace CSMWorld
{
class Data;
}
namespace CSVFilter
{
class FilterBox : public QWidget
@ -13,7 +18,7 @@ namespace CSVFilter
public:
FilterBox (QWidget *parent = 0);
FilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
signals:

@ -6,7 +6,7 @@
#include "editwidget.hpp"
CSVFilter::RecordFilterBox::RecordFilterBox (QWidget *parent)
CSVFilter::RecordFilterBox::RecordFilterBox (const CSMWorld::Data& data, QWidget *parent)
: QWidget (parent)
{
QHBoxLayout *layout = new QHBoxLayout (this);
@ -15,7 +15,7 @@ CSVFilter::RecordFilterBox::RecordFilterBox (QWidget *parent)
layout->addWidget (new QLabel ("Record Filter", this));
EditWidget *editWidget = new EditWidget (this);
EditWidget *editWidget = new EditWidget (data, this);
layout->addWidget (editWidget);

@ -9,6 +9,11 @@
#include "../../model/filter/node.hpp"
namespace CSMWorld
{
class Data;
}
namespace CSVFilter
{
class RecordFilterBox : public QWidget
@ -17,7 +22,7 @@ namespace CSVFilter
public:
RecordFilterBox (QWidget *parent = 0);
RecordFilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
signals:

@ -25,7 +25,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
layout->insertWidget (0, mTable =
new Table (id, document.getData(), document.getUndoStack(), mBottom->canCreateAndDelete()), 2);
CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (this);
CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (document.getData(), this);
layout->insertWidget (0, filterBox);

Loading…
Cancel
Save