|
|
|
@ -740,13 +740,15 @@ CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::Universa
|
|
|
|
|
mMainLayout = new QVBoxLayout(mainWidget);
|
|
|
|
|
setWidget (mainWidget);
|
|
|
|
|
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
|
|
|
|
|
mEditWidget = new EditWidget(mainWidget,
|
|
|
|
|
mTable->getModelIndex(getUniversalId().getId(), 0).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
|
mTable->getModelIndex(getUniversalId().getId(), idColumn).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
|
|
|
|
|
|
mMainLayout->addWidget(mEditWidget);
|
|
|
|
|
mEditWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
|
|
|
|
|
|
dataChanged(mTable->getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
dataChanged(mTable->getModelIndex (getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
connect(mEditWidget,
|
|
|
|
|
SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)),
|
|
|
|
@ -759,8 +761,9 @@ void CSVWorld::SimpleDialogueSubView::setEditLock (bool locked)
|
|
|
|
|
if (!mEditWidget) // hack to indicate that getUniversalId().getId() is no longer valid
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
mLocked = locked;
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid())
|
|
|
|
|
{
|
|
|
|
@ -775,7 +778,8 @@ void CSVWorld::SimpleDialogueSubView::setEditLock (bool locked)
|
|
|
|
|
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::dataChanged (const QModelIndex & index)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
(index.parent().isValid() ? index.parent().row() : index.row()) == currentIndex.row())
|
|
|
|
@ -808,7 +812,8 @@ void CSVWorld::SimpleDialogueSubView::dataChanged (const QModelIndex & index)
|
|
|
|
|
|
|
|
|
|
void CSVWorld::SimpleDialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), 0));
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
QModelIndex currentIndex(mTable->getModelIndex(getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
if (!currentIndex.isValid())
|
|
|
|
|
{
|
|
|
|
@ -906,7 +911,8 @@ void CSVWorld::DialogueSubView::updateUserSetting (const QString& name, const QS
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::showPreview ()
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
getTable().getFeatures() & CSMWorld::IdTable::Feature_Preview &&
|
|
|
|
@ -918,7 +924,8 @@ void CSVWorld::DialogueSubView::showPreview ()
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::viewRecord ()
|
|
|
|
|
{
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), 0));
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
QModelIndex currentIndex (getTable().getModelIndex (getUniversalId().getId(), idColumn));
|
|
|
|
|
|
|
|
|
|
if (currentIndex.isValid() &&
|
|
|
|
|
currentIndex.row() < getTable().rowCount())
|
|
|
|
@ -953,7 +960,8 @@ void CSVWorld::DialogueSubView::switchToRow (int row)
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DialogueSubView::requestFocus (const std::string& id)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex index = getTable().getModelIndex (id, 0);
|
|
|
|
|
int idColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
QModelIndex index = getTable().getModelIndex (id, idColumn);
|
|
|
|
|
|
|
|
|
|
if (index.isValid())
|
|
|
|
|
switchToRow (index.row());
|
|
|
|
|