score::DocumentBackupManager Class Referencefinal

Handles document backup to allow restoring if there is a crash. More...

Inheritance diagram for score::DocumentBackupManager:

Detailed Description

Handles document backup to allow restoring if there is a crash.

Manages on-the-fly backup of documents to be able to restore gracefully in case of a crash.

There are two parts : one that replicates the on-disk part of a document when it was loaded, and one that saves all the command that have been applied.

TODO : update the document part each time the user saves the document. This way there will be much fewer operations to apply if there is a crash. However we have to be very careful in case of the user saving, and then going before his "saved" point in the undo / redo list. Maybe we should keep the previous document saves somewhere and reload from the correct document save according to our position in the command stack.

See also
score::OpenDocumentsFile
score::CommandBackupFile
score::DocumentBackups

Public Member Functions

 DocumentBackupManager (const QByteArray &data, Document &doc)
 
 DocumentBackupManager (const score::RestorableDocument &prev, Document &doc)
 
void saveModelData (const QByteArray &)
 
void updateBackupData ()
 

Constructor & Destructor Documentation

◆ DocumentBackupManager() [1/2]

score::DocumentBackupManager::DocumentBackupManager ( const QByteArray &  data,
score::Document doc 
)
explicit

Used when creating a new document or loading from disk, data is the document data.

◆ DocumentBackupManager() [2/2]

score::DocumentBackupManager::DocumentBackupManager ( const score::RestorableDocument prev,
Document doc 
)
explicit

Used when restoring a document after the crash so that we can reuse the data


The documentation for this class was generated from the following files: