forked from mirror/openmw-tes3mp
set dialogue type for newly created dialogue records
This commit is contained in:
parent
75c5316ad7
commit
0be157efea
6 changed files with 93 additions and 5 deletions
|
@ -66,7 +66,7 @@ opencs_units (view/world
|
|||
opencs_units_noqt (view/world
|
||||
dialoguesubview subviews
|
||||
enumdelegate vartypedelegate recordstatusdelegate idtypedelegate datadisplaydelegate
|
||||
scripthighlighter idvalidator
|
||||
scripthighlighter idvalidator dialoguecreator
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1288,8 +1288,9 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT>
|
||||
struct DialogueTypeColumn : public Column<ESXRecordT>
|
||||
{
|
||||
DialogueTypeColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_DialogueType, ColumnBase::Display_DialogueType)
|
||||
DialogueTypeColumn (bool hidden = false)
|
||||
: Column<ESXRecordT> (Columns::ColumnId_DialogueType, ColumnBase::Display_DialogueType,
|
||||
hidden ? 0 : ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
|
@ -1307,6 +1308,11 @@ namespace CSMWorld
|
|||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool isUserEditable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ CSMWorld::Data::Data() : mRefs (mCells)
|
|||
|
||||
mJournals.addColumn (new StringIdColumn<ESM::Dialogue>);
|
||||
mJournals.addColumn (new RecordStateColumn<ESM::Dialogue>);
|
||||
mJournals.addColumn (new DialogueTypeColumn<ESM::Dialogue> (true));
|
||||
|
||||
mCells.addColumn (new StringIdColumn<Cell>);
|
||||
mCells.addColumn (new RecordStateColumn<Cell>);
|
||||
|
|
35
apps/opencs/view/world/dialoguecreator.cpp
Normal file
35
apps/opencs/view/world/dialoguecreator.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
#include "dialoguecreator.hpp"
|
||||
|
||||
#include <components/esm/loaddial.hpp>
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
#include "../../model/world/commands.hpp"
|
||||
#include "../../model/world/columns.hpp"
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
||||
void CSVWorld::DialogueCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const
|
||||
{
|
||||
int index =
|
||||
dynamic_cast<CSMWorld::IdTable&> (*getData().getTableModel (getCollectionId())).
|
||||
findColumnIndex (CSMWorld::Columns::ColumnId_DialogueType);
|
||||
|
||||
command.addValue (index, mType);
|
||||
}
|
||||
|
||||
CSVWorld::DialogueCreator::DialogueCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id, int type)
|
||||
: GenericCreator (data, undoStack, id), mType (type)
|
||||
{}
|
||||
|
||||
CSVWorld::Creator *CSVWorld::TopicCreatorFactory::makeCreator (CSMWorld::Data& data,
|
||||
QUndoStack& undoStack, const CSMWorld::UniversalId& id) const
|
||||
{
|
||||
return new DialogueCreator (data, undoStack, id, ESM::Dialogue::Topic);
|
||||
}
|
||||
|
||||
CSVWorld::Creator *CSVWorld::JournalCreatorFactory::makeCreator (CSMWorld::Data& data,
|
||||
QUndoStack& undoStack, const CSMWorld::UniversalId& id) const
|
||||
{
|
||||
return new DialogueCreator (data, undoStack, id, ESM::Dialogue::Journal);
|
||||
}
|
41
apps/opencs/view/world/dialoguecreator.hpp
Normal file
41
apps/opencs/view/world/dialoguecreator.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef CSV_WORLD_DIALOGUECREATOR_H
|
||||
#define CSV_WORLD_DIALOGUECREATOR_H
|
||||
|
||||
#include "genericcreator.hpp"
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class DialogueCreator : public GenericCreator
|
||||
{
|
||||
int mType;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
|
||||
|
||||
public:
|
||||
|
||||
DialogueCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id, int type);
|
||||
};
|
||||
|
||||
class TopicCreatorFactory : public CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Creator *makeCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id) const;
|
||||
///< The ownership of the returned Creator is transferred to the caller.
|
||||
};
|
||||
|
||||
class JournalCreatorFactory : public CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Creator *makeCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id) const;
|
||||
///< The ownership of the returned Creator is transferred to the caller.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
#include "referenceablecreator.hpp"
|
||||
#include "referencecreator.hpp"
|
||||
#include "scenesubview.hpp"
|
||||
#include "dialoguecreator.hpp"
|
||||
|
||||
void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||
{
|
||||
|
@ -36,8 +37,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
CSMWorld::UniversalId::Type_Regions,
|
||||
CSMWorld::UniversalId::Type_Birthsigns,
|
||||
CSMWorld::UniversalId::Type_Spells,
|
||||
CSMWorld::UniversalId::Type_Topics,
|
||||
CSMWorld::UniversalId::Type_Journals,
|
||||
|
||||
CSMWorld::UniversalId::Type_None // end marker
|
||||
};
|
||||
|
@ -55,6 +54,12 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
manager.add (CSMWorld::UniversalId::Type_References,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<ReferenceCreator> >);
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Topics,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, TopicCreatorFactory>);
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Journal,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, JournalCreatorFactory>);
|
||||
|
||||
// Subviews for editing/viewing individual records
|
||||
manager.add (CSMWorld::UniversalId::Type_Script, new CSVDoc::SubViewFactory<ScriptSubView>);
|
||||
|
||||
|
|
Loading…
Reference in a new issue