|
|
|
@ -17,8 +17,6 @@
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QScrollBar>
|
|
|
|
|
|
|
|
|
@ -40,6 +38,7 @@
|
|
|
|
|
#include "util.hpp"
|
|
|
|
|
#include "tablebottombox.hpp"
|
|
|
|
|
#include "nestedtable.hpp"
|
|
|
|
|
#include "recordbuttonbar.hpp"
|
|
|
|
|
/*
|
|
|
|
|
==============================NotEditableSubDelegate==========================================
|
|
|
|
|
*/
|
|
|
|
@ -64,16 +63,24 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QMo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::Columns::ColumnId columnId = static_cast<CSMWorld::Columns::ColumnId> (
|
|
|
|
|
mTable->getColumnId (index.column()));
|
|
|
|
|
|
|
|
|
|
if (QVariant::String == v.type())
|
|
|
|
|
{
|
|
|
|
|
label->setText(v.toString());
|
|
|
|
|
}
|
|
|
|
|
else //else we are facing enums
|
|
|
|
|
else if (CSMWorld::Columns::hasEnums (columnId))
|
|
|
|
|
{
|
|
|
|
|
int data = v.toInt();
|
|
|
|
|
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (static_cast<CSMWorld::Columns::ColumnId> (mTable->getColumnId (index.column()))));
|
|
|
|
|
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (columnId));
|
|
|
|
|
|
|
|
|
|
label->setText(QString::fromUtf8(enumNames.at(data).c_str()));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
label->setText (v.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::NotEditableSubDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
|
|
|
@ -548,17 +555,37 @@ void CSVWorld::EditWidget::remake(int row)
|
|
|
|
|
this->setWidgetResizable(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==============================DialogueSubView==========================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
|
|
|
|
const CreatorFactoryBase& creatorFactory, bool sorting) :
|
|
|
|
|
QVBoxLayout& CSVWorld::SimpleDialogueSubView::getMainLayout()
|
|
|
|
|
{
|
|
|
|
|
return *mMainLayout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::IdTable& CSVWorld::SimpleDialogueSubView::getTable()
|
|
|
|
|
{
|
|
|
|
|
return *mTable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::CommandDispatcher& CSVWorld::SimpleDialogueSubView::getCommandDispatcher()
|
|
|
|
|
{
|
|
|
|
|
return mCommandDispatcher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWorld::EditWidget& CSVWorld::SimpleDialogueSubView::getEditWidget()
|
|
|
|
|
{
|
|
|
|
|
return *mEditWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CSVWorld::SimpleDialogueSubView::isLocked() const
|
|
|
|
|
{
|
|
|
|
|
return mLocked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) :
|
|
|
|
|
SubView (id),
|
|
|
|
|
mEditWidget(0),
|
|
|
|
|
mMainLayout(NULL),
|
|
|
|
|
mTable(dynamic_cast<CSMWorld::IdTable*>(document.getData().getTableModel(id))),
|
|
|
|
|
mUndoStack(document.getUndoStack()),
|
|
|
|
|
mLocked(false),
|
|
|
|
|
mDocument(document),
|
|
|
|
|
mCommandDispatcher (document, CSMWorld::UniversalId::getParentType (id.getType()))
|
|
|
|
@ -566,169 +593,29 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|
|
|
|
connect(mTable, SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT(dataChanged(const QModelIndex&)));
|
|
|
|
|
connect(mTable, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex&, int, int)));
|
|
|
|
|
|
|
|
|
|
changeCurrentId(id.getId());
|
|
|
|
|
updateCurrentId();
|
|
|
|
|
|
|
|
|
|
QWidget *mainWidget = new QWidget(this);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
|
|
|
|
QToolButton* prevButton = new QToolButton(mainWidget);
|
|
|
|
|
prevButton->setIcon(QIcon(":/go-previous.png"));
|
|
|
|
|
prevButton->setToolTip ("Switch to previous record");
|
|
|
|
|
QToolButton* nextButton = new QToolButton(mainWidget);
|
|
|
|
|
nextButton->setIcon(QIcon(":/go-next.png"));
|
|
|
|
|
nextButton->setToolTip ("Switch to next record");
|
|
|
|
|
buttonsLayout->addWidget(prevButton, 0);
|
|
|
|
|
buttonsLayout->addWidget(nextButton, 1);
|
|
|
|
|
buttonsLayout->addStretch(2);
|
|
|
|
|
|
|
|
|
|
QToolButton* cloneButton = new QToolButton(mainWidget);
|
|
|
|
|
cloneButton->setIcon(QIcon(":/edit-clone.png"));
|
|
|
|
|
cloneButton->setToolTip ("Clone record");
|
|
|
|
|
QToolButton* addButton = new QToolButton(mainWidget);
|
|
|
|
|
addButton->setIcon(QIcon(":/add.png"));
|
|
|
|
|
addButton->setToolTip ("Add new record");
|
|
|
|
|
QToolButton* deleteButton = new QToolButton(mainWidget);
|
|
|
|
|
deleteButton->setIcon(QIcon(":/edit-delete.png"));
|
|
|
|
|
deleteButton->setToolTip ("Delete record");
|
|
|
|
|
QToolButton* revertButton = new QToolButton(mainWidget);
|
|
|
|
|
revertButton->setIcon(QIcon(":/edit-undo.png"));
|
|
|
|
|
revertButton->setToolTip ("Revert record");
|
|
|
|
|
|
|
|
|
|
if (mTable->getFeatures() & CSMWorld::IdTable::Feature_Preview)
|
|
|
|
|
{
|
|
|
|
|
QToolButton* previewButton = new QToolButton(mainWidget);
|
|
|
|
|
previewButton->setIcon(QIcon(":/edit-preview.png"));
|
|
|
|
|
previewButton->setToolTip ("Open a preview of this record");
|
|
|
|
|
buttonsLayout->addWidget(previewButton);
|
|
|
|
|
connect(previewButton, SIGNAL(clicked()), this, SLOT(showPreview()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mTable->getFeatures() & CSMWorld::IdTable::Feature_View)
|
|
|
|
|
{
|
|
|
|
|
QToolButton* viewButton = new QToolButton(mainWidget);
|
|
|
|
|
viewButton->setIcon(QIcon(":/cell.png"));
|
|
|
|
|
viewButton->setToolTip ("Open a scene view of the cell this record is located in");
|
|
|
|
|
buttonsLayout->addWidget(viewButton);
|
|
|
|
|
connect(viewButton, SIGNAL(clicked()), this, SLOT(viewRecord()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buttonsLayout->addWidget(cloneButton);
|
|
|
|
|
buttonsLayout->addWidget(addButton);
|
|
|
|
|
buttonsLayout->addWidget(deleteButton);
|
|
|
|
|
buttonsLayout->addWidget(revertButton);
|
|
|
|
|
|
|
|
|
|
connect(nextButton, SIGNAL(clicked()), this, SLOT(nextId()));
|
|
|
|
|
connect(prevButton, SIGNAL(clicked()), this, SLOT(prevId()));
|
|
|
|
|
connect(cloneButton, SIGNAL(clicked()), this, SLOT(cloneRequest()));
|
|
|
|
|
connect(revertButton, SIGNAL(clicked()), &mCommandDispatcher, SLOT(executeRevert()));
|
|
|
|
|
connect(deleteButton, SIGNAL(clicked()), &mCommandDispatcher, SLOT(executeDelete()));
|
|
|
|
|
|
|
|
|
|
mMainLayout = new QVBoxLayout(mainWidget);
|
|
|
|
|
setWidget (mainWidget);
|
|
|
|
|
|
|
|
|
|
mEditWidget = new EditWidget(mainWidget,
|
|
|
|
|
mTable->getModelIndex(mCurrentId, 0).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
|
mTable->getModelIndex(getUniversalId().getId(), 0).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
|
|
|
|
|
|
mMainLayout->addWidget(mEditWidget);
|
|
|
|
|
mEditWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
|
|
|
|
|
|
mMainLayout->addWidget (mBottom = new TableBottomBox (creatorFactory, document, id, this));
|
|
|
|
|
|
|
|
|
|
mBottom->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
connect(mBottom, SIGNAL(requestFocus(const std::string&)), this, SLOT(requestFocus(const std::string&)));
|
|
|
|
|
|
|
|
|
|
connect(addButton, SIGNAL(clicked()), mBottom, SLOT(createRequest()));
|
|
|
|
|
|
|
|
|
|
if(!mBottom->canCreateAndDelete())
|
|
|
|
|
{
|
|
|
|
|
cloneButton->setDisabled (true);
|
|
|
|
|
addButton->setDisabled (true);
|
|
|
|
|
deleteButton->setDisabled (true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataChanged(mTable->getModelIndex (mCurrentId, 0));
|
|
|
|
|
mMainLayout->addLayout (buttonsLayout);
|
|
|
|
|
setWidget (mainWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::prevId ()
|
|
|
|
|
{
|
|
|
|
|
int newRow = mTable->getModelIndex(mCurrentId, 0).row() - 1;
|
|
|
|
|
|
|
|
|
|
if (newRow < 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
while (newRow >= 0)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex newIndex(mTable->index(newRow, 0));
|
|
|
|
|
|
|
|
|
|
if (!newIndex.isValid())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (newRow, 1)).toInt());
|
|
|
|
|
if (!(state == CSMWorld::RecordBase::State_Deleted || state == CSMWorld::RecordBase::State_Erased))
|
|
|
|
|
{
|
|
|
|
|
mEditWidget->remake(newRow);
|
|
|
|
|
|
|
|
|
|
setUniversalId(CSMWorld::UniversalId (static_cast<CSMWorld::UniversalId::Type> (mTable->data (mTable->index (newRow, 2)).toInt()),
|
|
|
|
|
mTable->data (mTable->index (newRow, 0)).toString().toUtf8().constData()));
|
|
|
|
|
|
|
|
|
|
changeCurrentId(std::string(mTable->data (mTable->index (newRow, 0)).toString().toUtf8().constData()));
|
|
|
|
|
|
|
|
|
|
mEditWidget->setDisabled(mLocked);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
--newRow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::nextId ()
|
|
|
|
|
{
|
|
|
|
|
int newRow = mTable->getModelIndex(mCurrentId, 0).row() + 1;
|
|
|
|
|
|
|
|
|
|
if (newRow >= mTable->rowCount())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (newRow < mTable->rowCount())
|
|
|
|
|
{
|
|
|
|
|
QModelIndex newIndex(mTable->index(newRow, 0));
|
|
|
|
|
|
|
|
|
|
if (!newIndex.isValid())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (newRow, 1)).toInt());
|
|
|
|
|
if (!(state == CSMWorld::RecordBase::State_Deleted))
|
|
|
|
|
{
|
|
|
|
|
mEditWidget->remake(newRow);
|
|
|
|
|
|
|
|
|
|
setUniversalId(CSMWorld::UniversalId (static_cast<CSMWorld::UniversalId::Type> (mTable->data (mTable->index (newRow, 2)).toInt()),
|
|
|
|
|
mTable->data (mTable->index (newRow, 0)).toString().toUtf8().constData()));
|
|
|
|
|
|
|
|
|
|
changeCurrentId(std::string(mTable->data (mTable->index (newRow, 0)).toString().toUtf8().constData()));
|
|
|
|
|
|
|
|
|
|
mEditWidget->setDisabled(mLocked);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
++newRow;
|
|
|
|
|
}
|
|
|
|
|
dataChanged(mTable->getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::setEditLock (bool locked)
|
|
|
|
|
{
|
|
|
|
|
if (!mEditWidget) // hack to indicate that mCurrentId is no longer valid
|
|
|
|
|
if (!mEditWidget) // hack to indicate that getUniversalId().getId() is no longer valid
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mLocked = locked;
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid())
|
|
|
|
|
{
|
|
|
|
@ -741,9 +628,9 @@ void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::dataChanged (const QModelIndex & index)
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::dataChanged (const QModelIndex & index)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
(index.parent().isValid() ? index.parent().row() : index.row()) == currentIndex.row())
|
|
|
|
@ -774,9 +661,9 @@ void CSVWorld::DialogueSubView::dataChanged (const QModelIndex & index)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() && currentIndex.row() >= start && currentIndex.row() <= end)
|
|
|
|
|
{
|
|
|
|
@ -789,49 +676,106 @@ void CSVWorld::DialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::requestFocus (const std::string& id)
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::updateCurrentId()
|
|
|
|
|
{
|
|
|
|
|
changeCurrentId(id);
|
|
|
|
|
std::vector<std::string> selection;
|
|
|
|
|
selection.push_back (getUniversalId().getId());
|
|
|
|
|
mCommandDispatcher.setSelection(selection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
|
|
|
|
|
CSMDoc::Document& document, const CreatorFactoryBase& creatorFactory, bool sorting)
|
|
|
|
|
: SimpleDialogueSubView (id, document)
|
|
|
|
|
{
|
|
|
|
|
// bottom box
|
|
|
|
|
mBottom = new TableBottomBox (creatorFactory, document, id, this);
|
|
|
|
|
|
|
|
|
|
mBottom->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
|
|
|
|
this, SLOT (requestFocus (const std::string&)));
|
|
|
|
|
|
|
|
|
|
// button bar
|
|
|
|
|
mButtons = new RecordButtonBar (id, getTable(), mBottom,
|
|
|
|
|
&getCommandDispatcher(), this);
|
|
|
|
|
|
|
|
|
|
// layout
|
|
|
|
|
getMainLayout().addWidget (mButtons);
|
|
|
|
|
getMainLayout().addWidget (mBottom);
|
|
|
|
|
|
|
|
|
|
// connections
|
|
|
|
|
connect (mButtons, SIGNAL (showPreview()), this, SLOT (showPreview()));
|
|
|
|
|
connect (mButtons, SIGNAL (viewRecord()), this, SLOT (viewRecord()));
|
|
|
|
|
connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int)));
|
|
|
|
|
|
|
|
|
|
connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)),
|
|
|
|
|
mButtons, SLOT (universalIdChanged (const CSMWorld::UniversalId&)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mEditWidget->remake(mTable->getModelIndex (id, 0).row());
|
|
|
|
|
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
|
|
|
|
{
|
|
|
|
|
SimpleDialogueSubView::setEditLock (locked);
|
|
|
|
|
mButtons->setEditLock (locked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::cloneRequest ()
|
|
|
|
|
void CSVWorld::DialogueSubView::updateUserSetting (const QString& name, const QStringList& value)
|
|
|
|
|
{
|
|
|
|
|
mBottom->cloneRequest(mCurrentId, static_cast<CSMWorld::UniversalId::Type>(mTable->data(mTable->getModelIndex(mCurrentId, 2)).toInt()));
|
|
|
|
|
SimpleDialogueSubView::updateUserSetting (name, value);
|
|
|
|
|
mButtons->updateUserSetting (name, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::showPreview ()
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
mTable->getFeatures() & CSMWorld::IdTable::Feature_Preview &&
|
|
|
|
|
currentIndex.row() < mTable->rowCount())
|
|
|
|
|
getTable().getFeatures() & CSMWorld::IdTable::Feature_Preview &&
|
|
|
|
|
currentIndex.row() < getTable().rowCount())
|
|
|
|
|
{
|
|
|
|
|
emit focusId(CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Preview, mCurrentId), "");
|
|
|
|
|
emit focusId(CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Preview, getUniversalId().getId()), "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::viewRecord ()
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex (mCurrentId, 0));
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
currentIndex.row() < mTable->rowCount())
|
|
|
|
|
currentIndex.row() < getTable().rowCount())
|
|
|
|
|
{
|
|
|
|
|
std::pair<CSMWorld::UniversalId, std::string> params = mTable->view (currentIndex.row());
|
|
|
|
|
std::pair<CSMWorld::UniversalId, std::string> params = getTable().view (currentIndex.row());
|
|
|
|
|
|
|
|
|
|
if (params.first.getType()!=CSMWorld::UniversalId::Type_None)
|
|
|
|
|
emit focusId (params.first, params.second);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::changeCurrentId (const std::string& newId)
|
|
|
|
|
void CSVWorld::DialogueSubView::switchToRow (int row)
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> selection;
|
|
|
|
|
mCurrentId = std::string(newId);
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
std::string id = getTable().data (getTable().index (row, idColumn)).toString().toUtf8().constData();
|
|
|
|
|
|
|
|
|
|
selection.push_back(mCurrentId);
|
|
|
|
|
mCommandDispatcher.setSelection(selection);
|
|
|
|
|
int typeColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
|
|
|
|
CSMWorld::UniversalId::Type type = static_cast<CSMWorld::UniversalId::Type> (
|
|
|
|
|
getTable().data (getTable().index (row, typeColumn)).toInt());
|
|
|
|
|
|
|
|
|
|
setUniversalId (CSMWorld::UniversalId (type, id));
|
|
|
|
|
updateCurrentId();
|
|
|
|
|
|
|
|
|
|
getEditWidget().remake (row);
|
|
|
|
|
|
|
|
|
|
int stateColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
|
|
|
|
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State> (
|
|
|
|
|
getTable().data (getTable().index (row, stateColumn)).toInt());
|
|
|
|
|
|
|
|
|
|
getEditWidget().setDisabled (isLocked() || state==CSMWorld::RecordBase::State_Deleted);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::requestFocus (const std::string& id)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex index = getTable().getModelIndex (id, 0);
|
|
|
|
|
|
|
|
|
|
if (index.isValid())
|
|
|
|
|
switchToRow (index.row());
|
|
|
|
|
}
|
|
|
|
|