forked from mirror/openmw-tes3mp
added f-type hint to TableSubView
This commit is contained in:
parent
097c063b8a
commit
d188e68227
6 changed files with 57 additions and 18 deletions
|
@ -15,23 +15,28 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||||
|
|
||||||
layout->setContentsMargins (0, 0, 0, 0);
|
layout->setContentsMargins (0, 0, 0, 0);
|
||||||
|
|
||||||
RecordFilterBox *recordFilterBox = new RecordFilterBox (data, this);
|
mRecordFilterBox = new RecordFilterBox (data, this);
|
||||||
|
|
||||||
layout->addWidget (recordFilterBox);
|
layout->addWidget (mRecordFilterBox);
|
||||||
|
|
||||||
setLayout (layout);
|
setLayout (layout);
|
||||||
|
|
||||||
connect (recordFilterBox,
|
connect (mRecordFilterBox,
|
||||||
SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
||||||
this, SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
this, SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
||||||
|
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
recordFilterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
mRecordFilterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
|
|
||||||
connect(this, SIGNAL(useFilterRequest(const std::string&)), recordFilterBox, SIGNAL(useFilterRequest(const std::string&)));
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), mRecordFilterBox, SIGNAL(useFilterRequest(const std::string&)));
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVFilter::FilterBox::setRecordFilter (const std::string& filter)
|
||||||
|
{
|
||||||
|
mRecordFilterBox->setFilter (filter);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVFilter::FilterBox::dropEvent (QDropEvent* event)
|
void CSVFilter::FilterBox::dropEvent (QDropEvent* event)
|
||||||
{
|
{
|
||||||
std::vector<CSMWorld::UniversalId> data = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData())->getData();
|
std::vector<CSMWorld::UniversalId> data = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData())->getData();
|
||||||
|
|
|
@ -16,10 +16,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
namespace CSVFilter
|
namespace CSVFilter
|
||||||
{
|
{
|
||||||
|
class RecordFilterBox;
|
||||||
|
|
||||||
class FilterBox : public QWidget
|
class FilterBox : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
RecordFilterBox *mRecordFilterBox;
|
||||||
|
|
||||||
void dragEnterEvent (QDragEnterEvent* event);
|
void dragEnterEvent (QDragEnterEvent* event);
|
||||||
|
|
||||||
void dropEvent (QDropEvent* event);
|
void dropEvent (QDropEvent* event);
|
||||||
|
@ -30,6 +34,8 @@ namespace CSVFilter
|
||||||
|
|
||||||
FilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
FilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setRecordFilter (const std::string& filter);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
||||||
|
|
|
@ -15,18 +15,23 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare
|
||||||
|
|
||||||
layout->addWidget (new QLabel ("Record Filter", this));
|
layout->addWidget (new QLabel ("Record Filter", this));
|
||||||
|
|
||||||
EditWidget *editWidget = new EditWidget (data, this);
|
mEdit = new EditWidget (data, this);
|
||||||
|
|
||||||
layout->addWidget (editWidget);
|
layout->addWidget (mEdit);
|
||||||
|
|
||||||
setLayout (layout);
|
setLayout (layout);
|
||||||
|
|
||||||
connect (
|
connect (
|
||||||
editWidget, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
mEdit, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
||||||
this, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
this, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
||||||
|
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
editWidget, SLOT(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
mEdit, SLOT(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
|
|
||||||
connect(this, SIGNAL(useFilterRequest(const std::string&)), editWidget, SLOT(useFilterRequest(const std::string&)));
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), mEdit, SLOT(useFilterRequest(const std::string&)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVFilter::RecordFilterBox::setFilter (const std::string& filter)
|
||||||
|
{
|
||||||
|
mEdit->setText (QString::fromUtf8 (filter.c_str()));
|
||||||
}
|
}
|
|
@ -17,14 +17,20 @@ namespace CSMWorld
|
||||||
|
|
||||||
namespace CSVFilter
|
namespace CSVFilter
|
||||||
{
|
{
|
||||||
|
class EditWidget;
|
||||||
|
|
||||||
class RecordFilterBox : public QWidget
|
class RecordFilterBox : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
EditWidget *mEdit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RecordFilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
RecordFilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setFilter (const std::string& filter);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
||||||
|
|
|
@ -26,9 +26,9 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
layout->insertWidget (0, mTable =
|
layout->insertWidget (0, mTable =
|
||||||
new Table (id, mBottom->canCreateAndDelete(), sorting, document), 2);
|
new Table (id, mBottom->canCreateAndDelete(), sorting, document), 2);
|
||||||
|
|
||||||
CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (document.getData(), this);
|
mFilterBox = new CSVFilter::FilterBox (document.getData(), this);
|
||||||
|
|
||||||
layout->insertWidget (0, filterBox);
|
layout->insertWidget (0, mFilterBox);
|
||||||
|
|
||||||
QWidget *widget = new QWidget;
|
QWidget *widget = new QWidget;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
mTable->selectionSizeUpdate();
|
mTable->selectionSizeUpdate();
|
||||||
mTable->viewport()->installEventFilter(this);
|
mTable->viewport()->installEventFilter(this);
|
||||||
mBottom->installEventFilter(this);
|
mBottom->installEventFilter(this);
|
||||||
filterBox->installEventFilter(this);
|
mFilterBox->installEventFilter(this);
|
||||||
|
|
||||||
if (mBottom->canCreateAndDelete())
|
if (mBottom->canCreateAndDelete())
|
||||||
{
|
{
|
||||||
|
@ -63,17 +63,17 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
||||||
mTable, SLOT (requestFocus (const std::string&)));
|
mTable, SLOT (requestFocus (const std::string&)));
|
||||||
|
|
||||||
connect (filterBox,
|
connect (mFilterBox,
|
||||||
SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
||||||
mTable, SLOT (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
mTable, SLOT (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
||||||
|
|
||||||
connect(filterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)),
|
connect(mFilterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)),
|
||||||
this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)));
|
this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)));
|
||||||
|
|
||||||
connect(this, SIGNAL(useFilterRequest(const std::string&)), filterBox, SIGNAL(useFilterRequest(const std::string&)));
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), mFilterBox, SIGNAL(useFilterRequest(const std::string&)));
|
||||||
|
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
filterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
mFilterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::setEditLock (bool locked)
|
void CSVWorld::TableSubView::setEditLock (bool locked)
|
||||||
|
@ -97,6 +97,15 @@ void CSVWorld::TableSubView::setStatusBar (bool show)
|
||||||
mBottom->setStatusBar (show);
|
mBottom->setStatusBar (show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::TableSubView::useHint (const std::string& hint)
|
||||||
|
{
|
||||||
|
if (hint.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (hint[0]=='f' && hint.size()>=2)
|
||||||
|
mFilterBox->setRecordFilter (hint.substr (2));
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::cloneRequest(const CSMWorld::UniversalId& toClone)
|
void CSVWorld::TableSubView::cloneRequest(const CSMWorld::UniversalId& toClone)
|
||||||
{
|
{
|
||||||
emit cloneRequest(toClone.getId(), toClone.getType());
|
emit cloneRequest(toClone.getId(), toClone.getType());
|
||||||
|
|
|
@ -17,6 +17,11 @@ namespace CSMDoc
|
||||||
class Document;
|
class Document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace CSVFilter
|
||||||
|
{
|
||||||
|
class FilterBox;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
{
|
{
|
||||||
class Table;
|
class Table;
|
||||||
|
@ -29,6 +34,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
Table *mTable;
|
Table *mTable;
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
|
CSVFilter::FilterBox *mFilterBox;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -41,6 +47,8 @@ namespace CSVWorld
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
|
|
||||||
|
virtual void useHint (const std::string& hint);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* object, QEvent *event);
|
bool eventFilter(QObject* object, QEvent *event);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue