|
|
|
@ -4,8 +4,13 @@
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
#include <QDoubleSpinBox>
|
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QDataWidgetMapper>
|
|
|
|
|
|
|
|
|
|
#include "../../model/world/columnbase.hpp"
|
|
|
|
|
#include "../../model/world/idtable.hpp"
|
|
|
|
|
|
|
|
|
|
CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
|
|
|
|
bool createAndDelete)
|
|
|
|
@ -23,6 +28,9 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|
|
|
|
|
|
|
|
|
int columns = model->columnCount();
|
|
|
|
|
|
|
|
|
|
mWidgetMapper = new QDataWidgetMapper (this);
|
|
|
|
|
mWidgetMapper->setModel (model);
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<columns; ++i)
|
|
|
|
|
{
|
|
|
|
|
int flags = model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();
|
|
|
|
@ -30,8 +38,54 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|
|
|
|
if (flags & CSMWorld::ColumnBase::Flag_Dialogue)
|
|
|
|
|
{
|
|
|
|
|
layout->addWidget (new QLabel (model->headerData (i, Qt::Horizontal).toString()), i, 0);
|
|
|
|
|
|
|
|
|
|
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display>
|
|
|
|
|
(model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
|
|
|
|
|
|
|
|
|
QWidget *widget = 0;
|
|
|
|
|
|
|
|
|
|
if (model->flags (model->index (0, i)) & Qt::ItemIsEditable)
|
|
|
|
|
{
|
|
|
|
|
switch (display)
|
|
|
|
|
{
|
|
|
|
|
case CSMWorld::ColumnBase::Display_String:
|
|
|
|
|
|
|
|
|
|
layout->addWidget (widget = new QLineEdit, i, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CSMWorld::ColumnBase::Display_Integer:
|
|
|
|
|
|
|
|
|
|
/// \todo configure widget properly (range)
|
|
|
|
|
layout->addWidget (widget = new QSpinBox, i, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CSMWorld::ColumnBase::Display_Float:
|
|
|
|
|
|
|
|
|
|
/// \todo configure widget properly (range, format?)
|
|
|
|
|
layout->addWidget (widget = new QDoubleSpinBox, i, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (display)
|
|
|
|
|
{
|
|
|
|
|
case CSMWorld::ColumnBase::Display_String:
|
|
|
|
|
case CSMWorld::ColumnBase::Display_Integer:
|
|
|
|
|
case CSMWorld::ColumnBase::Display_Float:
|
|
|
|
|
|
|
|
|
|
layout->addWidget (widget = new QLabel, i, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (widget)
|
|
|
|
|
mWidgetMapper->addMapping (widget, i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mWidgetMapper->setCurrentModelIndex (
|
|
|
|
|
dynamic_cast<CSMWorld::IdTable&> (*model).getModelIndex (id.getId(), 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
|
|
|
|