From 438ad7d69d7349d5dc0468453ed1675a7d9b75fd Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 11 Sep 2014 10:36:59 +0400 Subject: [PATCH] The save returns the list of saved files --- src/Model/Model_Document.cpp | 5 +++-- src/Model/Model_Document.h | 3 ++- src/ModelAPI/ModelAPI_Document.h | 4 +++- src/XGUI/XGUI_Workshop.cpp | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index cfe40d5f7..cb1b6d307 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -148,7 +148,7 @@ bool Model_Document::load(const char* theFileName) return !isError; } -bool Model_Document::save(const char* theFileName) +bool Model_Document::save(const char* theFileName, std::list& theResults) { // create a directory in the root document if it is not yet exist if (this == Model_PluginManager::get()->rootDocument().get()) { @@ -186,9 +186,10 @@ bool Model_Document::save(const char* theFileName) } myTransactionsAfterSave = 0; if (isDone) { // save also sub-documents if any + theResults.push_back(TCollection_AsciiString(aPath).ToCString()); std::set::iterator aSubIter = mySubs.begin(); for (; aSubIter != mySubs.end() && isDone; aSubIter++) - isDone = subDocument(*aSubIter)->save(theFileName); + isDone = subDocument(*aSubIter)->save(theFileName, theResults); } return isDone; } diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 0a53b920c..7b4072520 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -40,8 +40,9 @@ class Model_Document : public ModelAPI_Document //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store + //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - MODEL_EXPORT virtual bool save(const char* theFileName); + MODEL_EXPORT virtual bool save(const char* theFileName, std::list& theResults); //! Removes document data MODEL_EXPORT virtual void close(); diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 5b1cfb0af..f6ed8c5ab 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -9,6 +9,7 @@ #include #include #include +#include class ModelAPI_Feature; class ModelAPI_Object; @@ -35,8 +36,9 @@ class ModelAPI_Document //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store + //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - virtual bool save(const char* theFileName) = 0; + virtual bool save(const char* theFileName, std::list& theResults) = 0; //! Removes document data virtual void close() = 0; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 0668917e2..4bd292de7 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -533,7 +533,8 @@ void XGUI_Workshop::saveDocument(QString theName) QApplication::restoreOverrideCursor(); PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); DocumentPtr aDoc = aMgr->rootDocument(); - aDoc->save(theName.toLatin1().constData()); + std::list aFileNames; + aDoc->save(theName.toLatin1().constData(), aFileNames); QApplication::restoreOverrideCursor(); } -- 2.39.2