1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 10:49:57 +00:00

correcting problems

This commit is contained in:
Marek Kochanowicz 2014-06-09 13:16:10 +02:00
parent 649ce54369
commit c8458654ac

View file

@ -20,7 +20,6 @@
#include <QPushButton> #include <QPushButton>
#include <QToolButton> #include <QToolButton>
#include <QTableView> #include <QTableView>
#include <QDebug>
#include "../../model/world/columnbase.hpp" #include "../../model/world/columnbase.hpp"
#include "../../model/world/idtable.hpp" #include "../../model/world/idtable.hpp"
@ -375,22 +374,21 @@ void CSVWorld::EditWidget::remake(int row)
{ {
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display>
(mTable->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt()); (mTable->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
/* commented out for now TODO
if (display == CSMWorld::ColumnBase::Display_Nested) if (display == CSMWorld::ColumnBase::Display_Nested)
{ {
const QModelIndex& parent = mTable->index(row, i); const QModelIndex& parent = mTable->index(row, i);
if (parent.data().isValid() && mTable->hasChildren(parent)) if (parent.data().isValid() && mTable->hasChildren(parent))
{ {
/*
qDebug()<<row; qDebug()<<row;
qDebug()<<i; qDebug()<<i;
qDebug()<<"nested!"; qDebug()<<"nested!";
QTableView* table = new QTableView(this); QTableView* table = new QTableView(this);
table->setModel(mTable); table->setModel(mTable);
table->setRootIndex(mTable->index(row, i)); table->setRootIndex(mTable->index(row, i));
*/
} }
} else } else */
{ {
mDispatcher.makeDelegate (display); mDispatcher.makeDelegate (display);
QWidget* editor = mDispatcher.makeEditor (display, (mTable->index (row, i))); QWidget* editor = mDispatcher.makeEditor (display, (mTable->index (row, i)));
@ -583,40 +581,28 @@ void CSVWorld::DialogueSubView::nextId()
void CSVWorld::DialogueSubView::setEditLock (bool locked) void CSVWorld::DialogueSubView::setEditLock (bool locked)
{ {
mLocked = locked; mLocked = locked;
QModelIndex index(mTable->getModelIndex(mCurrentId, 0)); QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (index.row(), 1)).toInt());
if (state == CSMWorld::RecordBase::State_Deleted)
{
mEditWidget->setDisabled(true);
} else
{
mEditWidget->setDisabled(mLocked);
}
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (mRow, 1)).toInt());
mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || locked); mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || locked);
if (currentIndex.isValid())
{
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (currentIndex.row(), 1)).toInt());
mCommandDispatcher.setEditLock (locked); mCommandDispatcher.setEditLock (locked);
}
} }
void CSVWorld::DialogueSubView::dataChanged(const QModelIndex & index) void CSVWorld::DialogueSubView::dataChanged(const QModelIndex & index)
{ {
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0)); QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
if (!currentIndex.isValid() && index.row() == currentIndex.row()) mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || mLocked);
if (currentIndex.isValid() && index.row() == currentIndex.row())
{ {
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (currentIndex.row(), 1)).toInt()); CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (currentIndex.row(), 1)).toInt());
if (state == CSMWorld::RecordBase::State_Deleted)
{
mEditWidget->setDisabled(true);
} else
{
mEditWidget->setDisabled(mLocked);
}
mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || mLocked);
} }
} }
@ -719,7 +705,6 @@ void CSVWorld::DialogueSubView::showPreview ()
if (currentIndex.isValid() && if (currentIndex.isValid() &&
mTable->getFeatures() & CSMWorld::IdTable::Feature_Preview && mTable->getFeatures() & CSMWorld::IdTable::Feature_Preview &&
mTable->hasPreview() &&
currentIndex.row() < mTable->rowCount()) currentIndex.row() < mTable->rowCount())
{ {
emit focusId(CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Preview, mCurrentId), ""); emit focusId(CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Preview, mCurrentId), "");