Developer Documentation
|
The Backup interface can be used to manage backups within OpenFlipper. It provides abstractions for backup and redo operations which get managed by the backup plugin.
To generate a backup of a specific object, you just have to derive from the BackupInterface and emit the BackupInterface::createBackup() signal. A simple example looks like this:
We create a backup of the object with the given id. The Backup will be named "Smoothing" and the backup system is informed that only the geometry has changed.
It is also possible to create backup groups. This is required, if you change several objects at once and they should be restored only together.
Backups can be restored and re-applied. You can simply emit the BackupInterface::undo() signal and the last backup will be restored. BackupInterface::redo() will re apply the last operation stored. It is also possible to restore backups of a specific object via BackupInterface::undo(int) and BackupInterface::redo(int), if they are not blocked by a group backup which can only be reverted as one operation.
The other plugins will be informed about a restore operation by BackupInterface::slotAboutToRestore(int) and BackupInterface::slotRestored(int) which will be emitted directly before and after the restore operation.
To use the BackupInterface: