Closed letsfindaway closed 1 year ago
Note that the second point needs careful evaluation for several reasons:
So I think it would be too dangerous to do this optimization. And then also the first step is not needed. So finally we would end up with the last step doing a cleanup of unreferenced files.
For the third point note that there is no "save document" function. The UBPersistenceManager
only handles scenes, not documents for saving. An idea is to execute this function on the very first call to UBPersistenceManager::persistDocumentScene
for a document. This would need a flag in the UBDocumentProxy
to mark whether the cleanup was already performed. Implementation of the operation should be in the UBPersistenceManager
. It knows about the naming of scene files and already has the private: static QStringList getSceneFileNames(const QString& folder)
function, which is very helpful for this.
As discussed above, a Foreign object manager will not be implemented.
To solve issue https://github.com/OpenBoard-org/OpenBoard/issues/671, problem 2 I propose to add a
ForeignObjectManager
, which keeps track of the objects in a document and their usage. It could probably do the following:objects
,videos
andaudios
directories and creates a list of UUIDs and document sizes (as a very first rough and easy to collect identifier).page<nnn>.svg
files for any referenced UUIDs. This creates a list of referenced objects. All existing, but not referred objects are then deleted from the document.