2012-12-03 21:03:02 +00:00
|
|
|
|
|
|
|
#include "tablesubview.hpp"
|
|
|
|
|
2013-07-23 19:59:02 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2012-12-11 12:22:43 +00:00
|
|
|
#include "../../model/doc/document.hpp"
|
|
|
|
|
2013-08-11 18:39:21 +00:00
|
|
|
#include "../filter/filterbox.hpp"
|
|
|
|
|
2012-12-03 21:03:02 +00:00
|
|
|
#include "table.hpp"
|
2013-07-25 12:29:56 +00:00
|
|
|
#include "tablebottombox.hpp"
|
2013-07-26 10:34:30 +00:00
|
|
|
#include "creator.hpp"
|
2012-12-03 21:03:02 +00:00
|
|
|
|
2012-12-11 12:22:43 +00:00
|
|
|
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
2013-07-26 10:42:15 +00:00
|
|
|
const CreatorFactoryBase& creatorFactory)
|
2012-12-03 21:03:02 +00:00
|
|
|
: SubView (id)
|
|
|
|
{
|
2013-07-23 19:59:02 +00:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
|
|
|
|
|
|
|
layout->setContentsMargins (QMargins (0, 0, 0, 0));
|
|
|
|
|
2013-07-27 11:28:12 +00:00
|
|
|
layout->addWidget (mBottom =
|
2013-07-28 11:43:16 +00:00
|
|
|
new TableBottomBox (creatorFactory, document.getData(), document.getUndoStack(), id, this), 0);
|
2013-07-26 10:42:15 +00:00
|
|
|
|
2013-07-26 10:51:45 +00:00
|
|
|
layout->insertWidget (0, mTable =
|
|
|
|
new Table (id, document.getData(), document.getUndoStack(), mBottom->canCreateAndDelete()), 2);
|
2013-07-25 12:29:56 +00:00
|
|
|
|
2013-08-11 18:39:21 +00:00
|
|
|
layout->insertWidget (0, new CSVFilter::FilterBox (this));
|
|
|
|
|
2013-07-23 19:59:02 +00:00
|
|
|
QWidget *widget = new QWidget;
|
|
|
|
|
|
|
|
widget->setLayout (layout);
|
|
|
|
|
|
|
|
setWidget (widget);
|
2012-12-13 12:35:08 +00:00
|
|
|
|
2013-07-21 15:53:39 +00:00
|
|
|
connect (mTable, SIGNAL (editRequest (int)), this, SLOT (editRequest (int)));
|
2013-07-25 12:29:56 +00: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 16:22:31 +00:00
|
|
|
|
|
|
|
if (mBottom->canCreateAndDelete())
|
|
|
|
connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest()));
|
2013-07-29 13:00:41 +00:00
|
|
|
|
|
|
|
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
|
|
|
mTable, SLOT (requestFocus (const std::string&)));
|
2012-12-03 21:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setEditLock (bool locked)
|
|
|
|
{
|
|
|
|
mTable->setEditLock (locked);
|
2013-07-28 12:51:47 +00:00
|
|
|
mBottom->setEditLock (locked);
|
2012-12-13 12:35:08 +00:00
|
|
|
}
|
|
|
|
|
2013-07-21 15:53:39 +00:00
|
|
|
void CSVWorld::TableSubView::editRequest (int row)
|
2012-12-13 12:35:08 +00:00
|
|
|
{
|
2013-07-21 15:53:39 +00:00
|
|
|
focusId (mTable->getUniversalId (row));
|
2013-06-15 11:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::updateEditorSetting(const QString &settingName, const QString &settingValue)
|
|
|
|
{
|
2013-07-21 15:53:39 +00:00
|
|
|
mTable->updateEditorSetting(settingName, settingValue);
|
2013-06-15 11:40:18 +00:00
|
|
|
}
|
2013-07-25 12:29:56 +00:00
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setStatusBar (bool show)
|
|
|
|
{
|
|
|
|
mBottom->setStatusBar (show);
|
|
|
|
}
|