forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'cc9cii/selective-refresh'
This commit is contained in:
commit
ae1a606876
9 changed files with 52 additions and 24 deletions
|
@ -138,8 +138,8 @@ bool CSMWorld::NestableColumn::hasChildren() const
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::NestedChildColumn::NestedChildColumn (int id,
|
CSMWorld::NestedChildColumn::NestedChildColumn (int id,
|
||||||
CSMWorld::ColumnBase::Display display, bool isEditable)
|
CSMWorld::ColumnBase::Display display, int flags, bool isEditable)
|
||||||
: NestableColumn (id, display, CSMWorld::ColumnBase::Flag_Dialogue) , mIsEditable(isEditable)
|
: NestableColumn (id, display, flags) , mIsEditable(isEditable)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool CSMWorld::NestedChildColumn::isEditable () const
|
bool CSMWorld::NestedChildColumn::isEditable () const
|
||||||
|
|
|
@ -25,7 +25,8 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
Flag_Table = 1, // column should be displayed in table view
|
Flag_Table = 1, // column should be displayed in table view
|
||||||
Flag_Dialogue = 2, // column should be displayed in dialogue view
|
Flag_Dialogue = 2, // column should be displayed in dialogue view
|
||||||
Flag_Dialogue_List = 4 // column should be diaplyed in dialogue view
|
Flag_Dialogue_List = 4, // column should be diaplyed in dialogue view
|
||||||
|
Flag_Dialogue_Refresh = 8 // refresh dialogue view if this column is modified
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Display
|
enum Display
|
||||||
|
@ -200,7 +201,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
struct NestedChildColumn : public NestableColumn
|
struct NestedChildColumn : public NestableColumn
|
||||||
{
|
{
|
||||||
NestedChildColumn (int id, Display display, bool isEditable = true);
|
NestedChildColumn (int id,
|
||||||
|
Display display, int flags = ColumnBase::Flag_Dialogue, bool isEditable = true);
|
||||||
|
|
||||||
virtual bool isEditable() const;
|
virtual bool isEditable() const;
|
||||||
|
|
||||||
|
|
|
@ -467,8 +467,9 @@ namespace CSMWorld
|
||||||
int mMask;
|
int mMask;
|
||||||
bool mInverted;
|
bool mInverted;
|
||||||
|
|
||||||
FlagColumn (int columnId, int mask, bool inverted = false)
|
FlagColumn (int columnId, int mask,
|
||||||
: Column<ESXRecordT> (columnId, ColumnBase::Display_Boolean), mMask (mask),
|
int flags = ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, bool inverted = false)
|
||||||
|
: Column<ESXRecordT> (columnId, ColumnBase::Display_Boolean, flags), mMask (mask),
|
||||||
mInverted (inverted)
|
mInverted (inverted)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
index = mRaces.getColumns()-1;
|
index = mRaces.getColumns()-1;
|
||||||
mRaces.addAdapter (std::make_pair(&mRaces.getColumn(index), new RaceAttributeAdapter()));
|
mRaces.addAdapter (std::make_pair(&mRaces.getColumn(index), new RaceAttributeAdapter()));
|
||||||
mRaces.getNestableColumn(index)->addColumn(
|
mRaces.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_RaceAttributes, ColumnBase::Display_String, false));
|
new NestedChildColumn (Columns::ColumnId_RaceAttributes, ColumnBase::Display_String,
|
||||||
|
ColumnBase::Flag_Dialogue, false));
|
||||||
mRaces.getNestableColumn(index)->addColumn(
|
mRaces.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_RaceMaleValue, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_RaceMaleValue, ColumnBase::Display_Integer));
|
||||||
mRaces.getNestableColumn(index)->addColumn(
|
mRaces.getNestableColumn(index)->addColumn(
|
||||||
|
@ -287,8 +288,10 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
mCells.addColumn (new FixedRecordTypeColumn<Cell> (UniversalId::Type_Cell));
|
mCells.addColumn (new FixedRecordTypeColumn<Cell> (UniversalId::Type_Cell));
|
||||||
mCells.addColumn (new NameColumn<Cell>);
|
mCells.addColumn (new NameColumn<Cell>);
|
||||||
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_SleepForbidden, ESM::Cell::NoSleep));
|
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_SleepForbidden, ESM::Cell::NoSleep));
|
||||||
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorWater, ESM::Cell::HasWater));
|
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorWater, ESM::Cell::HasWater,
|
||||||
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorSky, ESM::Cell::QuasiEx));
|
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh));
|
||||||
|
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorSky, ESM::Cell::QuasiEx,
|
||||||
|
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh));
|
||||||
mCells.addColumn (new RegionColumn<Cell>);
|
mCells.addColumn (new RegionColumn<Cell>);
|
||||||
mCells.addColumn (new RefNumCounterColumn<Cell>);
|
mCells.addColumn (new RefNumCounterColumn<Cell>);
|
||||||
// Misc Cell data
|
// Misc Cell data
|
||||||
|
@ -297,7 +300,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
index = mCells.getColumns()-1;
|
index = mCells.getColumns()-1;
|
||||||
mCells.addAdapter (std::make_pair(&mCells.getColumn(index), new CellListAdapter ()));
|
mCells.addAdapter (std::make_pair(&mCells.getColumn(index), new CellListAdapter ()));
|
||||||
mCells.getNestableColumn(index)->addColumn(
|
mCells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_Interior, ColumnBase::Display_Boolean));
|
new NestedChildColumn (Columns::ColumnId_Interior, ColumnBase::Display_Boolean,
|
||||||
|
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh));
|
||||||
mCells.getNestableColumn(index)->addColumn(
|
mCells.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_Ambient, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_Ambient, ColumnBase::Display_Integer));
|
||||||
mCells.getNestableColumn(index)->addColumn(
|
mCells.getNestableColumn(index)->addColumn(
|
||||||
|
@ -346,7 +350,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
mBodyParts.addColumn (new BodyPartTypeColumn<ESM::BodyPart>);
|
mBodyParts.addColumn (new BodyPartTypeColumn<ESM::BodyPart>);
|
||||||
mBodyParts.addColumn (new VampireColumn<ESM::BodyPart>);
|
mBodyParts.addColumn (new VampireColumn<ESM::BodyPart>);
|
||||||
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Female, ESM::BodyPart::BPF_Female));
|
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Female, ESM::BodyPart::BPF_Female));
|
||||||
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Playable, ESM::BodyPart::BPF_NotPlayable, true));
|
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Playable,
|
||||||
|
ESM::BodyPart::BPF_NotPlayable, ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, true));
|
||||||
mBodyParts.addColumn (new MeshTypeColumn<ESM::BodyPart>);
|
mBodyParts.addColumn (new MeshTypeColumn<ESM::BodyPart>);
|
||||||
mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>);
|
mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>);
|
||||||
mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>);
|
mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>);
|
||||||
|
@ -393,7 +398,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
// new objects deleted in dtor of NestableColumn
|
// new objects deleted in dtor of NestableColumn
|
||||||
// WARNING: The order of the columns below are assumed in PathgridPointListAdapter
|
// WARNING: The order of the columns below are assumed in PathgridPointListAdapter
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_PathgridIndex, ColumnBase::Display_Integer, false));
|
new NestedChildColumn (Columns::ColumnId_PathgridIndex, ColumnBase::Display_Integer,
|
||||||
|
ColumnBase::Flag_Dialogue, false));
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_PathgridPosX, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_PathgridPosX, ColumnBase::Display_Integer));
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
|
@ -405,7 +411,8 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
index = mPathgrids.getColumns()-1;
|
index = mPathgrids.getColumns()-1;
|
||||||
mPathgrids.addAdapter (std::make_pair(&mPathgrids.getColumn(index), new PathgridEdgeListAdapter ()));
|
mPathgrids.addAdapter (std::make_pair(&mPathgrids.getColumn(index), new PathgridEdgeListAdapter ()));
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_PathgridEdgeIndex, ColumnBase::Display_Integer, false));
|
new NestedChildColumn (Columns::ColumnId_PathgridEdgeIndex, ColumnBase::Display_Integer,
|
||||||
|
ColumnBase::Flag_Dialogue, false));
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
new NestedChildColumn (Columns::ColumnId_PathgridEdge0, ColumnBase::Display_Integer));
|
new NestedChildColumn (Columns::ColumnId_PathgridEdge0, ColumnBase::Display_Integer));
|
||||||
mPathgrids.getNestableColumn(index)->addColumn(
|
mPathgrids.getNestableColumn(index)->addColumn(
|
||||||
|
|
|
@ -74,8 +74,7 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
|
||||||
{
|
{
|
||||||
mIdCollection->setData (index.row(), index.column(), value);
|
mIdCollection->setData (index.row(), index.column(), value);
|
||||||
|
|
||||||
emit dataChanged (CSMWorld::IdTable::index (index.row(), 0),
|
emit dataChanged (index, index);
|
||||||
CSMWorld::IdTable::index (index.row(), mIdCollection->getColumns()-1));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ QVariant CSMWorld::IdTree::nestedHeaderData(int section, int subSection, Qt::Ori
|
||||||
return tr(parentColumn->nestedColumn(subSection).getTitle().c_str());
|
return tr(parentColumn->nestedColumn(subSection).getTitle().c_str());
|
||||||
|
|
||||||
if (role==ColumnBase::Role_Flags)
|
if (role==ColumnBase::Role_Flags)
|
||||||
return idCollection()->getColumn (section).mFlags;
|
return parentColumn->nestedColumn(subSection).mFlags;
|
||||||
|
|
||||||
if (role==ColumnBase::Role_Display)
|
if (role==ColumnBase::Role_Display)
|
||||||
return parentColumn->nestedColumn(subSection).mDisplayType;
|
return parentColumn->nestedColumn(subSection).mDisplayType;
|
||||||
|
@ -92,8 +92,8 @@ bool CSMWorld::IdTree::setData (const QModelIndex &index, const QVariant &value,
|
||||||
|
|
||||||
mNestedCollection->setNestedData(parentAddress.first, parentAddress.second, value, index.row(), index.column());
|
mNestedCollection->setNestedData(parentAddress.first, parentAddress.second, value, index.row(), index.column());
|
||||||
|
|
||||||
emit dataChanged (CSMWorld::IdTree::index (parentAddress.first, 0),
|
emit dataChanged (index, index);
|
||||||
CSMWorld::IdTree::index (parentAddress.first, idCollection()->getColumns()-1));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1976,7 +1976,7 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
switch (subColIndex)
|
switch (subColIndex)
|
||||||
{
|
{
|
||||||
case 0: return QVariant(QVariant::UserType); // disable the checkbox editor
|
case 0: return QVariant(); // disable the checkbox editor
|
||||||
case 1: return record.get().mFlags & ESM::CreatureLevList::AllLevels;
|
case 1: return record.get().mFlags & ESM::CreatureLevList::AllLevels;
|
||||||
case 2: return static_cast<int> (record.get().mChanceNone);
|
case 2: return static_cast<int> (record.get().mChanceNone);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -245,7 +245,8 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
||||||
actorsColumns.mServices.insert (std::make_pair (&mColumns.back(), sServiceTable[i].mFlag));
|
actorsColumns.mServices.insert (std::make_pair (&mColumns.back(), sServiceTable[i].mFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
mColumns.push_back (RefIdColumn (Columns::ColumnId_AutoCalc, ColumnBase::Display_Boolean));
|
mColumns.push_back (RefIdColumn (Columns::ColumnId_AutoCalc, ColumnBase::Display_Boolean,
|
||||||
|
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh));
|
||||||
const RefIdColumn *autoCalc = &mColumns.back();
|
const RefIdColumn *autoCalc = &mColumns.back();
|
||||||
|
|
||||||
mColumns.push_back (RefIdColumn (Columns::ColumnId_ApparatusType,
|
mColumns.push_back (RefIdColumn (Columns::ColumnId_ApparatusType,
|
||||||
|
|
|
@ -787,15 +787,33 @@ 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())
|
if (currentIndex.isValid() &&
|
||||||
|
(index.parent().isValid() ? index.parent().row() : 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());
|
||||||
|
|
||||||
mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || mLocked);
|
mEditWidget->setDisabled (state==CSMWorld::RecordBase::State_Deleted || mLocked);
|
||||||
|
|
||||||
|
// Check if the changed data should force refresh (rebuild) the dialogue subview
|
||||||
|
int flags = 0;
|
||||||
|
if (index.parent().isValid()) // TODO: check that index is topLeft
|
||||||
|
{
|
||||||
|
flags = static_cast<CSMWorld::IdTree *>(mTable)->nestedHeaderData (index.parent().column(),
|
||||||
|
index.column(), Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags = mTable->headerData (index.column(),
|
||||||
|
Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & CSMWorld::ColumnBase::Flag_Dialogue_Refresh)
|
||||||
|
{
|
||||||
int y = mEditWidget->verticalScrollBar()->value();
|
int y = mEditWidget->verticalScrollBar()->value();
|
||||||
mEditWidget->remake (index.row());
|
mEditWidget->remake (index.parent().isValid() ? index.parent().row() : index.row());
|
||||||
mEditWidget->verticalScrollBar()->setValue(y);
|
mEditWidget->verticalScrollBar()->setValue(y);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
void CSVWorld::DialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
||||||
|
|
Loading…
Reference in a new issue