mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:53:51 +00:00
preserve author/descriptin meta data
This commit is contained in:
parent
830530bd06
commit
96fd1c35bf
4 changed files with 41 additions and 3 deletions
|
@ -2158,6 +2158,12 @@ CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files,
|
|||
load (files.begin(), end, !new_);
|
||||
}
|
||||
|
||||
if (new_)
|
||||
{
|
||||
mData.setDescription ("");
|
||||
mData.setAuthor ("");
|
||||
}
|
||||
|
||||
addOptionalGmsts();
|
||||
addOptionalGlobals();
|
||||
|
||||
|
|
|
@ -45,9 +45,8 @@ void CSMDoc::WriteHeaderStage::perform (int stage, std::vector<std::string>& mes
|
|||
|
||||
mState.getWriter().setFormat (0);
|
||||
|
||||
/// \todo fill in missing header information
|
||||
mState.getWriter().setAuthor ("");
|
||||
mState.getWriter().setDescription ("");
|
||||
mState.getWriter().setAuthor (mDocument.getData().getAuthor());
|
||||
mState.getWriter().setDescription (mDocument.getData().getDescription());
|
||||
mState.getWriter().setRecordCount (
|
||||
mDocument.getData().count (CSMWorld::RecordBase::State_Modified) +
|
||||
mDocument.getData().count (CSMWorld::RecordBase::State_ModifiedOnly) +
|
||||
|
|
|
@ -395,6 +395,9 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
|||
|
||||
reader.open (path.string());
|
||||
|
||||
mAuthor = reader.getAuthor();
|
||||
mDescription = reader.getDesc();
|
||||
|
||||
// Note: We do not need to send update signals here, because at this point the model is not connected
|
||||
// to any view.
|
||||
while (reader.hasMoreRecs())
|
||||
|
@ -489,6 +492,26 @@ int CSMWorld::Data::count (RecordBase::State state) const
|
|||
count (state, mReferenceables);
|
||||
}
|
||||
|
||||
void CSMWorld::Data::setDescription (const std::string& description)
|
||||
{
|
||||
mDescription = description;
|
||||
}
|
||||
|
||||
std::string CSMWorld::Data::getDescription() const
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
void CSMWorld::Data::setAuthor (const std::string& author)
|
||||
{
|
||||
mAuthor = author;
|
||||
}
|
||||
|
||||
std::string CSMWorld::Data::getAuthor() const
|
||||
{
|
||||
return mAuthor;
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace CSMWorld
|
|||
IdCollection<CSMFilter::Filter> mFilters;
|
||||
std::vector<QAbstractItemModel *> mModels;
|
||||
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
||||
std::string mAuthor;
|
||||
std::string mDescription;
|
||||
|
||||
// not implemented
|
||||
Data (const Data&);
|
||||
|
@ -156,6 +158,14 @@ namespace CSMWorld
|
|||
int count (RecordBase::State state) const;
|
||||
///< Return number of top-level records with the given \a state.
|
||||
|
||||
void setDescription (const std::string& description);
|
||||
|
||||
std::string getDescription() const;
|
||||
|
||||
void setAuthor (const std::string& author);
|
||||
|
||||
std::string getAuthor() const;
|
||||
|
||||
signals:
|
||||
|
||||
void idListChanged();
|
||||
|
|
Loading…
Reference in a new issue