|
|
@ -177,10 +177,11 @@ void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
CSVWorld::DialogueDelegateDispatcher::DialogueDelegateDispatcher(QObject* parent,
|
|
|
|
CSVWorld::DialogueDelegateDispatcher::DialogueDelegateDispatcher(QObject* parent,
|
|
|
|
CSMWorld::IdTable* table, CSMDoc::Document& document, QAbstractItemModel *model) :
|
|
|
|
CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
|
|
|
|
|
|
|
CSMDoc::Document& document, QAbstractItemModel *model) :
|
|
|
|
mParent(parent),
|
|
|
|
mParent(parent),
|
|
|
|
mTable(model ? model : table),
|
|
|
|
mTable(model ? model : table),
|
|
|
|
mDocument (document),
|
|
|
|
mCommandDispatcher (commandDispatcher), mDocument (document),
|
|
|
|
mNotEditableDelegate(table, parent)
|
|
|
|
mNotEditableDelegate(table, parent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -192,7 +193,7 @@ CSVWorld::CommandDelegate* CSVWorld::DialogueDelegateDispatcher::makeDelegate(CS
|
|
|
|
if (delegateIt == mDelegates.end())
|
|
|
|
if (delegateIt == mDelegates.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delegate = CommandDelegateFactoryCollection::get().makeDelegate (
|
|
|
|
delegate = CommandDelegateFactoryCollection::get().makeDelegate (
|
|
|
|
display, mDocument, mParent);
|
|
|
|
display, &mCommandDispatcher, mDocument, mParent);
|
|
|
|
mDelegates.insert(std::make_pair(display, delegate));
|
|
|
|
mDelegates.insert(std::make_pair(display, delegate));
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -352,13 +353,16 @@ CSVWorld::EditWidget::~EditWidget()
|
|
|
|
delete mNestedTableDispatcher;
|
|
|
|
delete mNestedTableDispatcher;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSVWorld::EditWidget::EditWidget(QWidget *parent, int row, CSMWorld::IdTable* table, CSMDoc::Document& document, bool createAndDelete) :
|
|
|
|
CSVWorld::EditWidget::EditWidget(QWidget *parent,
|
|
|
|
mDispatcher(this, table, document),
|
|
|
|
int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
|
|
|
|
|
|
|
CSMDoc::Document& document, bool createAndDelete) :
|
|
|
|
|
|
|
|
mDispatcher(this, table, commandDispatcher, document),
|
|
|
|
mNestedTableDispatcher(NULL),
|
|
|
|
mNestedTableDispatcher(NULL),
|
|
|
|
QScrollArea(parent),
|
|
|
|
QScrollArea(parent),
|
|
|
|
mWidgetMapper(NULL),
|
|
|
|
mWidgetMapper(NULL),
|
|
|
|
mNestedTableMapper(NULL),
|
|
|
|
mNestedTableMapper(NULL),
|
|
|
|
mMainWidget(NULL),
|
|
|
|
mMainWidget(NULL),
|
|
|
|
|
|
|
|
mCommandDispatcher (commandDispatcher),
|
|
|
|
mDocument (document),
|
|
|
|
mDocument (document),
|
|
|
|
mTable(table)
|
|
|
|
mTable(table)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -442,7 +446,14 @@ void CSVWorld::EditWidget::remake(int row)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable)));
|
|
|
|
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable)));
|
|
|
|
|
|
|
|
|
|
|
|
NestedTable* table = new NestedTable(mDocument, mNestedModels.back(), this);
|
|
|
|
int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
|
|
|
int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSMWorld::UniversalId id = CSMWorld::UniversalId(
|
|
|
|
|
|
|
|
static_cast<CSMWorld::UniversalId::Type> (mTable->data (mTable->index (row, typeColumn)).toInt()),
|
|
|
|
|
|
|
|
mTable->data (mTable->index (row, idColumn)).toString().toUtf8().constData());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NestedTable* table = new NestedTable(mDocument, id, mNestedModels.back(), this);
|
|
|
|
// FIXME: does not work well when enum delegates are used
|
|
|
|
// FIXME: does not work well when enum delegates are used
|
|
|
|
//table->resizeColumnsToContents();
|
|
|
|
//table->resizeColumnsToContents();
|
|
|
|
table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged);
|
|
|
|
table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged);
|
|
|
@ -499,7 +510,7 @@ void CSVWorld::EditWidget::remake(int row)
|
|
|
|
mNestedTableMapper->setModel(mNestedModels.back());
|
|
|
|
mNestedTableMapper->setModel(mNestedModels.back());
|
|
|
|
// FIXME: lack MIME support?
|
|
|
|
// FIXME: lack MIME support?
|
|
|
|
mNestedTableDispatcher =
|
|
|
|
mNestedTableDispatcher =
|
|
|
|
new DialogueDelegateDispatcher (this, mTable, mDocument, mNestedModels.back());
|
|
|
|
new DialogueDelegateDispatcher (this, mTable, mCommandDispatcher, mDocument, mNestedModels.back());
|
|
|
|
mNestedTableMapper->setItemDelegate(mNestedTableDispatcher);
|
|
|
|
mNestedTableMapper->setItemDelegate(mNestedTableDispatcher);
|
|
|
|
|
|
|
|
|
|
|
|
int columnCount =
|
|
|
|
int columnCount =
|
|
|
@ -626,7 +637,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|
|
|
|
|
|
|
|
|
|
|
mMainLayout = new QVBoxLayout(mainWidget);
|
|
|
|
mMainLayout = new QVBoxLayout(mainWidget);
|
|
|
|
|
|
|
|
|
|
|
|
mEditWidget = new EditWidget(mainWidget, mTable->getModelIndex(mCurrentId, 0).row(), mTable, document, false);
|
|
|
|
mEditWidget = new EditWidget(mainWidget,
|
|
|
|
|
|
|
|
mTable->getModelIndex(mCurrentId, 0).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)),
|
|
|
|
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)),
|
|
|
|
this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));
|
|
|
|
this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));
|
|
|
|
|
|
|
|
|
|
|
|