mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
added meta data dialogue sub view
This commit is contained in:
parent
57015f3666
commit
1e033fa8fe
7 changed files with 101 additions and 1 deletions
|
@ -2308,6 +2308,78 @@ namespace CSMWorld
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename ESXRecordT>
|
||||||
|
struct FormatColumn : public Column<ESXRecordT>
|
||||||
|
{
|
||||||
|
FormatColumn()
|
||||||
|
: Column<ESXRecordT> (Columns::ColumnId_FileFormat, ColumnBase::Display_Integer)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
|
{
|
||||||
|
return record.get().mFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool isEditable() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename ESXRecordT>
|
||||||
|
struct AuthorColumn : public Column<ESXRecordT>
|
||||||
|
{
|
||||||
|
AuthorColumn()
|
||||||
|
: Column<ESXRecordT> (Columns::ColumnId_Author, ColumnBase::Display_String)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
|
{
|
||||||
|
return QString::fromUtf8 (record.get().mAuthor.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||||
|
{
|
||||||
|
ESXRecordT record2 = record.get();
|
||||||
|
|
||||||
|
record2.mAuthor = data.toString().toUtf8().constData();
|
||||||
|
|
||||||
|
record.setModified (record2);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool isEditable() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename ESXRecordT>
|
||||||
|
struct FileDescriptionColumn : public Column<ESXRecordT>
|
||||||
|
{
|
||||||
|
FileDescriptionColumn()
|
||||||
|
: Column<ESXRecordT> (Columns::ColumnId_FileDescription, ColumnBase::Display_LongString)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
|
{
|
||||||
|
return QString::fromUtf8 (record.get().mDescription.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||||
|
{
|
||||||
|
ESXRecordT record2 = record.get();
|
||||||
|
|
||||||
|
record2.mDescription = data.toString().toUtf8().constData();
|
||||||
|
|
||||||
|
record.setModified (record2);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool isEditable() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -311,6 +311,10 @@ namespace CSMWorld
|
||||||
{ ColumnId_WaterLevel, "Water Level" },
|
{ ColumnId_WaterLevel, "Water Level" },
|
||||||
{ ColumnId_MapColor, "Map Color" },
|
{ ColumnId_MapColor, "Map Color" },
|
||||||
|
|
||||||
|
{ ColumnId_FileFormat, "File Format" },
|
||||||
|
{ ColumnId_FileDescription, "File Description" },
|
||||||
|
{ ColumnId_Author, "Author" },
|
||||||
|
|
||||||
{ ColumnId_UseValue1, "Use value 1" },
|
{ ColumnId_UseValue1, "Use value 1" },
|
||||||
{ ColumnId_UseValue2, "Use value 2" },
|
{ ColumnId_UseValue2, "Use value 2" },
|
||||||
{ ColumnId_UseValue3, "Use value 3" },
|
{ ColumnId_UseValue3, "Use value 3" },
|
||||||
|
|
|
@ -302,6 +302,10 @@ namespace CSMWorld
|
||||||
ColumnId_WaterLevel = 273,
|
ColumnId_WaterLevel = 273,
|
||||||
ColumnId_MapColor = 274,
|
ColumnId_MapColor = 274,
|
||||||
|
|
||||||
|
ColumnId_FileFormat = 275,
|
||||||
|
ColumnId_FileDescription = 276,
|
||||||
|
ColumnId_Author = 277,
|
||||||
|
|
||||||
// Allocated to a separate value range, so we don't get a collision should we ever need
|
// Allocated to a separate value range, so we don't get a collision should we ever need
|
||||||
// to extend the number of use values.
|
// to extend the number of use values.
|
||||||
ColumnId_UseValue1 = 0x10000,
|
ColumnId_UseValue1 = 0x10000,
|
||||||
|
|
|
@ -477,6 +477,12 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
||||||
|
|
||||||
mMetaData.appendBlankRecord ("sys::meta");
|
mMetaData.appendBlankRecord ("sys::meta");
|
||||||
|
|
||||||
|
mMetaData.addColumn (new StringIdColumn<MetaData> (true));
|
||||||
|
mMetaData.addColumn (new RecordStateColumn<MetaData>);
|
||||||
|
mMetaData.addColumn (new FormatColumn<MetaData>);
|
||||||
|
mMetaData.addColumn (new AuthorColumn<MetaData>);
|
||||||
|
mMetaData.addColumn (new FileDescriptionColumn<MetaData>);
|
||||||
|
|
||||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Global);
|
addModel (new IdTable (&mGlobals), UniversalId::Type_Global);
|
||||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmst);
|
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmst);
|
||||||
addModel (new IdTable (&mSkills), UniversalId::Type_Skill);
|
addModel (new IdTable (&mSkills), UniversalId::Type_Skill);
|
||||||
|
|
|
@ -70,6 +70,10 @@ void CSVDoc::View::setupFileMenu()
|
||||||
connect (loadErrors, SIGNAL (triggered()), this, SLOT (loadErrorLog()));
|
connect (loadErrors, SIGNAL (triggered()), this, SLOT (loadErrorLog()));
|
||||||
file->addAction (loadErrors);
|
file->addAction (loadErrors);
|
||||||
|
|
||||||
|
QAction *meta = new QAction (tr ("Meta Data"), this);
|
||||||
|
connect (meta, SIGNAL (triggered()), this, SLOT (addMetaDataSubView()));
|
||||||
|
file->addAction (meta);
|
||||||
|
|
||||||
QAction *close = new QAction (tr ("&Close"), this);
|
QAction *close = new QAction (tr ("&Close"), this);
|
||||||
connect (close, SIGNAL (triggered()), this, SLOT (close()));
|
connect (close, SIGNAL (triggered()), this, SLOT (close()));
|
||||||
file->addAction(close);
|
file->addAction(close);
|
||||||
|
@ -813,6 +817,11 @@ void CSVDoc::View::addSearchSubView()
|
||||||
addSubView (mDocument->newSearch());
|
addSubView (mDocument->newSearch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::View::addMetaDataSubView()
|
||||||
|
{
|
||||||
|
addSubView (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_MetaData, "sys::meta"));
|
||||||
|
}
|
||||||
|
|
||||||
void CSVDoc::View::abortOperation (int type)
|
void CSVDoc::View::abortOperation (int type)
|
||||||
{
|
{
|
||||||
mDocument->abortOperation (type);
|
mDocument->abortOperation (type);
|
||||||
|
|
|
@ -224,6 +224,8 @@ namespace CSVDoc
|
||||||
|
|
||||||
void addSearchSubView();
|
void addSearchSubView();
|
||||||
|
|
||||||
|
void addMetaDataSubView();
|
||||||
|
|
||||||
void toggleShowStatusBar (bool show);
|
void toggleShowStatusBar (bool show);
|
||||||
|
|
||||||
void loadErrorLog();
|
void loadErrorLog();
|
||||||
|
|
|
@ -170,6 +170,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
manager.add (CSMWorld::UniversalId::Type_Filter,
|
manager.add (CSMWorld::UniversalId::Type_Filter,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<GenericCreator, CSMWorld::Scope_Project | CSMWorld::Scope_Session> > (false));
|
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<GenericCreator, CSMWorld::Scope_Project | CSMWorld::Scope_Session> > (false));
|
||||||
|
|
||||||
|
manager.add (CSMWorld::UniversalId::Type_MetaData,
|
||||||
|
new CSVDoc::SubViewFactory<SimpleDialogueSubView >);
|
||||||
|
|
||||||
//preview
|
//preview
|
||||||
manager.add (CSMWorld::UniversalId::Type_Preview, new CSVDoc::SubViewFactory<PreviewSubView>);
|
manager.add (CSMWorld::UniversalId::Type_Preview, new CSVDoc::SubViewFactory<PreviewSubView>);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue