2012-12-03 22:03:02 +01:00
|
|
|
|
|
|
|
#include "tablesubview.hpp"
|
|
|
|
|
2013-07-23 21:59:02 +02:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2012-12-11 13:22:43 +01:00
|
|
|
#include "../../model/doc/document.hpp"
|
|
|
|
|
2013-08-11 20:39:21 +02:00
|
|
|
#include "../filter/filterbox.hpp"
|
2014-01-20 16:17:49 +01:00
|
|
|
#include "../../model/world/idtable.hpp"
|
2012-12-03 22:03:02 +01:00
|
|
|
#include "table.hpp"
|
2013-07-25 14:29:56 +02:00
|
|
|
#include "tablebottombox.hpp"
|
2013-07-26 12:34:30 +02:00
|
|
|
#include "creator.hpp"
|
2012-12-03 22:03:02 +01:00
|
|
|
|
2012-12-11 13:22:43 +01:00
|
|
|
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
2013-10-31 13:40:14 +01:00
|
|
|
const CreatorFactoryBase& creatorFactory, bool sorting)
|
2012-12-03 22:03:02 +01:00
|
|
|
: SubView (id)
|
|
|
|
{
|
2013-07-23 21:59:02 +02:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
|
|
|
|
|
|
|
layout->setContentsMargins (QMargins (0, 0, 0, 0));
|
|
|
|
|
2013-07-27 13:28:12 +02:00
|
|
|
layout->addWidget (mBottom =
|
2013-07-28 13:43:16 +02:00
|
|
|
new TableBottomBox (creatorFactory, document.getData(), document.getUndoStack(), id, this), 0);
|
2013-07-26 12:42:15 +02:00
|
|
|
|
2013-07-26 12:51:45 +02:00
|
|
|
layout->insertWidget (0, mTable =
|
2013-10-31 13:40:14 +01:00
|
|
|
new Table (id, document.getData(), document.getUndoStack(), mBottom->canCreateAndDelete(), sorting), 2);
|
2013-07-25 14:29:56 +02:00
|
|
|
|
2013-08-24 17:17:22 +02:00
|
|
|
CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (document.getData(), this);
|
2013-08-18 16:53:28 +02:00
|
|
|
|
|
|
|
layout->insertWidget (0, filterBox);
|
2013-08-11 20:39:21 +02:00
|
|
|
|
2013-07-23 21:59:02 +02:00
|
|
|
QWidget *widget = new QWidget;
|
|
|
|
|
|
|
|
widget->setLayout (layout);
|
|
|
|
|
|
|
|
setWidget (widget);
|
2012-12-13 13:35:08 +01:00
|
|
|
|
2013-07-21 17:53:39 +02:00
|
|
|
connect (mTable, SIGNAL (editRequest (int)), this, SLOT (editRequest (int)));
|
2013-07-25 14:29:56 +02:00
|
|
|
|
|
|
|
connect (mTable, SIGNAL (selectionSizeChanged (int)),
|
|
|
|
mBottom, SLOT (selectionSizeChanged (int)));
|
|
|
|
connect (mTable, SIGNAL (tableSizeChanged (int, int, int)),
|
|
|
|
mBottom, SLOT (tableSizeChanged (int, int, int)));
|
|
|
|
|
|
|
|
mTable->tableSizeUpdate();
|
|
|
|
mTable->selectionSizeUpdate();
|
2013-07-26 18:22:31 +02:00
|
|
|
|
|
|
|
if (mBottom->canCreateAndDelete())
|
2014-01-19 11:44:47 +01:00
|
|
|
{
|
2013-07-26 18:22:31 +02:00
|
|
|
connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest()));
|
2014-01-19 11:44:47 +01:00
|
|
|
|
2014-01-21 08:27:29 +01:00
|
|
|
connect (mTable, SIGNAL (cloneRequest(const CSMWorld::UniversalId&)), this, SLOT(cloneRequest(const CSMWorld::UniversalId&)));
|
2014-01-20 13:59:00 +01:00
|
|
|
connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)),
|
|
|
|
mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)));
|
2014-01-19 11:44:47 +01:00
|
|
|
}
|
2013-07-29 15:00:41 +02:00
|
|
|
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
|
|
|
mTable, SLOT (requestFocus (const std::string&)));
|
2013-08-18 16:53:28 +02:00
|
|
|
|
|
|
|
connect (filterBox,
|
2013-08-22 13:14:35 +02:00
|
|
|
SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)),
|
|
|
|
mTable, SLOT (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
|
2012-12-03 22:03:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setEditLock (bool locked)
|
|
|
|
{
|
|
|
|
mTable->setEditLock (locked);
|
2013-07-28 14:51:47 +02:00
|
|
|
mBottom->setEditLock (locked);
|
2012-12-13 13:35:08 +01:00
|
|
|
}
|
|
|
|
|
2013-07-21 17:53:39 +02:00
|
|
|
void CSVWorld::TableSubView::editRequest (int row)
|
2012-12-13 13:35:08 +01:00
|
|
|
{
|
2013-07-21 17:53:39 +02:00
|
|
|
focusId (mTable->getUniversalId (row));
|
2013-06-15 06:40:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::updateEditorSetting(const QString &settingName, const QString &settingValue)
|
|
|
|
{
|
2013-07-21 17:53:39 +02:00
|
|
|
mTable->updateEditorSetting(settingName, settingValue);
|
2013-06-15 06:40:18 -05:00
|
|
|
}
|
2013-07-25 14:29:56 +02:00
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setStatusBar (bool show)
|
|
|
|
{
|
|
|
|
mBottom->setStatusBar (show);
|
2014-01-19 11:44:47 +01:00
|
|
|
}
|
|
|
|
|
2014-01-21 08:27:29 +01:00
|
|
|
void CSVWorld::TableSubView::cloneRequest(const CSMWorld::UniversalId& toClone)
|
2014-01-19 11:44:47 +01:00
|
|
|
{
|
2014-01-21 08:27:29 +01:00
|
|
|
emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType());
|
2014-01-19 11:44:47 +01:00
|
|
|
}
|