Developer Documentation
Backup Interface


BackupInterface.png


Overview

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.

Generating Backups

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:

emit createBackup(object->id(),"Smoothing", UPDATE_GEOMETRY );

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.

Restoring Backups

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.

Usage

To use the BackupInterface:

  • include BackupInterface.hh in your plugins header file
  • derive your plugin from the class BackupInterface
  • add Q_INTERFACES(BackupInterface) to your plugin class
  • And implement the required slots and functions