Commit 7014b4bc authored by Dirk Wilden's avatar Dirk Wilden
Browse files

changed interfaces for backup and selection

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11274 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3d9b3ef3
...@@ -43,9 +43,8 @@ ...@@ -43,9 +43,8 @@
#ifndef BACKUPPLUGININTERFACE_HH #ifndef BACKUPPLUGININTERFACE_HH
#define BACKUPPLUGININTERFACE_HH #define BACKUPPLUGININTERFACE_HH
#include <QtGui> #include <QtGui>
#include <QMenuBar> #include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/common/Types.hh>
/** \brief Create or restore backups /** \brief Create or restore backups
* *
...@@ -63,61 +62,56 @@ class BackupInterface { ...@@ -63,61 +62,56 @@ class BackupInterface {
signals: signals:
/** \brief Tell Backup Plugin to create a backup group /** \brief Tell Backup Plugin to create a backup
* *
* A backup group can be used to combine multiple object backups into * Plugins which supports backups can call this function if they want to create backups.\n
* one backup group and undo all of them at once * A Backup control Plugin will do the rest.
* * @param _objectid Identifier of the object to create the backup
* @param _name Name of the Backup group, to show the user what can be recovered * @param _name Name of the Backup, to show the user what can be recovered
* @param _groupId A unique identifier for the created backup group
*/ */
virtual void createBackupGroup(QString /*_name*/, int& /*_groupId*/) {}; virtual void createBackup( int /*_objectid*/, QString /*_name*/, UpdateType /*_type*/ = UPDATE_ALL){};
/** \brief Tell Backup Plugin to create a backup /** \brief Tell Backup Plugin to create a backup
* *
* Plugins which supports backups can call this function if they want to create backups.\n * Plugins which supports backups can call this function if they want to create backups.\n
* A Backup control Plugin will do the rest. * A Backup control Plugin will do the rest.
* @param _objectid Identifier of the object to create the backup * @param _objectids Identifier of the object to create the backup
* @param _name Name of the Backup, to show the user what can be recovered * @param _name Name of the Backup, to show the user what can be recovered
* @param _internalId A unique identifier for the created backup
*/ */
virtual void createBackup( int /*_objectid*/, QString /*_name*/, int& /*_internalId*/, int /*_groupId*/ = -1) {}; virtual void createBackup( IdList /*_objectids*/, QString /*_name*/, std::vector<UpdateType> /*_types*/){};
/** \brief Tell Backup Plugin to create a backup but don't get the id of the object ( if you don't care ) /** \brief Tell Backup Plugin to undo the last action of an object
* *
* Plugins which supports backups can call this function if they want to create backups.\n * Plugins which supports backups can call this function if they want to restore backups.\n
* A Backup control Plugin will do the rest. * A Backup control Plugin will do the rest.
* @param _objectid Identifier of the object to create the backup * @param _objectid Identifier of the object to restore
* @param _name Name of the Backup, to show the user what can be recovered
*/ */
virtual void createBackup( int /*_objectid*/, QString /*_name*/) {}; virtual void undo(int /*_objectid*/) {};
/** \brief Tell Backup Plugin to redo the last action on an object
/** \brief Make a backup persistent.
* *
* A persistent backup will not be removed automatically by the backup plugin. * Plugins which supports backups can call this function if they want to restore backups.\n
* You have to remove it by yourself by calling removeBackup! * A Backup control Plugin will do the rest.
* @param _objectid Identifier of the object to restore
*/ */
virtual void makeBackupPersistent(int /*_objectid*/, int /*_internalId*/){}; virtual void redo(int /*_objectid*/) {};
/** \brief Tell Backup Plugin to restore a backup /** \brief Tell Backup Plugin to undo the last action
* *
* Plugins which supports backups can call this function if they want to restore backups.\n * Plugins which supports backups can call this function if they want to restore backups.\n
* A Backup control Plugin will do the rest. * A Backup control Plugin will do the rest.
* @param _objectid Identifier of the object to restore
* @param _internalId The unique identifier of the restore set (-1 for last backup)
*/ */
virtual void restoreObject( int /*_objectid*/, int /*_internalId*/ =-1) {}; virtual void undo(){};
/** \brief Tell Backup Plugin to restore a backup group /** \brief Tell Backup Plugin to redo the last action
* *
* Plugins which supports backups can call this function if they want to restore backups.\n * Plugins which supports backups can call this function if they want to restore backups.\n
* A Backup control Plugin will do the rest. * A Backup control Plugin will do the rest.
* @param _groupId Identifier of the group to restore
*/ */
virtual void restoreGroup( int /*_groupId*/ ) {}; virtual void redo(){};
private slots: private slots:
/** \brief Backup for an object requested /** \brief Backup for an object requested
* *
* This function will be called if a plugin requests a backup. You can * This function will be called if a plugin requests a backup. You can
...@@ -126,18 +120,18 @@ class BackupInterface { ...@@ -126,18 +120,18 @@ class BackupInterface {
* @param _name Name of the Backup, to show the user what can be recovered * @param _name Name of the Backup, to show the user what can be recovered
* @param _internalId Unique identifier of the backup. This number is generated by the core and returned by the original signal. * @param _internalId Unique identifier of the backup. This number is generated by the core and returned by the original signal.
*/ */
virtual void slotBackup( int /*_objectid*/ , QString /*_name*/ , int /*_internalId*/, int /*_groupId*/ = -1) {}; virtual void slotCreateBackup( int /*_objectid*/ , QString /*_name*/ , UpdateType /*_type*/ = UPDATE_ALL) {};
/** \brief Backup group requested /** \brief Backup for an object requested
* *
* This function will be called if a plugin requests a backup group. You can * This function will be called if a plugin requests a backup. You can
* also react on this event if you reimplement this function in your plugin. * also react on this event if you reimplement this function in your plugin.
* * @param _id Identifier of the object to create the backup
* @param _name Name of the Backup group, to show the user what can be recovered * @param _name Name of the Backup, to show the user what can be recovered
* @param _groupId Unique identifier of the backup group. This number is generated by the core and returned by the original signal. * @param _internalId Unique identifier of the backup. This number is generated by the core and returned by the original signal.
*/ */
virtual void slotBackupGroup( QString /*_name*/ , int /*_groupId*/) {}; virtual void slotCreateBackup( IdList /*_objectids*/ , QString /*_name*/ , std::vector<UpdateType> /*_types*/) {};
/** \brief A given object will be restored. /** \brief A given object will be restored.
* *
* This function is called before an object is restored from a backup. * This function is called before an object is restored from a backup.
...@@ -146,10 +140,9 @@ class BackupInterface { ...@@ -146,10 +140,9 @@ class BackupInterface {
* If you have any pointers or references to the given object you have to * If you have any pointers or references to the given object you have to
* clean them up here. * clean them up here.
* @param _id Identifier of the object which is about to be restored * @param _id Identifier of the object which is about to be restored
* @param _internalId Unique Number of the Restore set
*/ */
virtual void slotAboutToRestore( int /*_objectid*/ , int /*_internalId*/) {}; virtual void slotAboutToRestore( int /*_objectid*/, UpdateType /*_type*/ ) {};
/** \brief Restore Object /** \brief Restore Object
* *
* This function is called after the main object is restored from a backup. * This function is called after the main object is restored from a backup.
...@@ -159,25 +152,23 @@ class BackupInterface { ...@@ -159,25 +152,23 @@ class BackupInterface {
* in your local plugin.\n * in your local plugin.\n
* *
* @param _objectid Identifier of the object which is about to be restored * @param _objectid Identifier of the object which is about to be restored
* @param _internalId Unique Number of the Restore set
*/ */
virtual void slotRestore( int /*_objectid*/ , int /*_internalId*/) {}; virtual void slotRestore( int /*_objectid*/, UpdateType /*_type*/ ) {};
/** \brief Object fully restored /** \brief Object fully restored
* *
* This function is called after an object and all data from other plugins * This function is called after an object and all data from other plugins
* is restored from a backup. * is restored from a backup.
* perObjectDatas and the object have been reset to the backup state. * perObjectDatas and the object have been reset to the backup state.
* @param _objectid Identifier of the object which is about to be restored * @param _objectid Identifier of the object which is about to be restored
* @param _internalId Unique Number of the Restore set
*/ */
virtual void slotRestored( int /*_objectid*/, int /*_internalId*/) {}; virtual void slotRestored( int /*_objectid*/, UpdateType /*_type*/ ) {};
public : public:
/// Destructor /// Destructor
virtual ~BackupInterface() {}; virtual ~BackupInterface() {};
//=========================================================================== //===========================================================================
/** @name Interface definition for Backup Plugins /** @name Interface definition for Backup Plugins
* *
...@@ -191,45 +182,68 @@ class BackupInterface { ...@@ -191,45 +182,68 @@ class BackupInterface {
/** \brief Backup Plugin tells other Plugins that a restore will happen /** \brief Backup Plugin tells other Plugins that a restore will happen
* *
*/ */
virtual void aboutToRestore(int /*_objectid*/ , int /*_internalId*/) {}; virtual void aboutToRestore(int /*_objectid*/ , UpdateType /*_type*/ ) {};
/** \brief Backup Plugin tells other Plugins that they should restore their own data /** \brief Backup Plugin tells other Plugins that they should restore their own data
* *
*/ */
virtual void restore(int /*_objectid*/ , int /*_internalId*/) {}; virtual void restore(int /*_objectid*/ , UpdateType /*_type*/ ) {};
/** \brief Backup Plugin tells other Plugins that a restore has happened /** \brief Backup Plugin tells other Plugins that a restore has happened
* *
*/ */
virtual void restored( int /*_objectid*/ , int /*_internalId*/) {}; virtual void restored( int /*_objectid*/ , UpdateType /*_type*/ ) {};
private slots: private slots:
/** \brief Restore the core object
/** \brief Undo the last action of an object
* *
* This function has to be implemented in the backup management plugin. Normally * This function has to be implemented in the backup management plugin. Normally
* this function is provided by the default backup plugin and should not be used! * this function is provided by the default backup plugin and should not be used!
* To restore data in your plugin use the slotRestore above. * To restore data in your plugin use the slotRestore above.
* *
* @param _objectId Object to restore * @param _objectid Identifier of the object to restore
*
*/ */
virtual void slotRestoreObject(int /*_objectid*/, int /*_internalId*/) {}; virtual void slotUndo(int /*_objectid*/) {};
/** \brief Restore the a group /** \brief Redo the last action on an object
* *
* This function has to be implemented in the backup management plugin. Normally * This function has to be implemented in the backup management plugin. Normally
* this function is provided by the default backup plugin and should not be used! * this function is provided by the default backup plugin and should not be used!
* To restore data in your plugin use the slotRestore above. * To restore data in your plugin use the slotRestore above.
* *
* @param _groupId group to restore * @param _objectid Identifier of the object to restore
*
*/ */
virtual void slotRestoreGroup(int /*_groupid*/) {}; virtual void slotRedo(int /*_objectid*/) {};
virtual void slotMakeBackupPersistent(int /*_objectid*/, int /*_internalId*/) {}; /** \brief Undo the last action
*
* This function has to be implemented in the backup management plugin. Normally
* this function is provided by the default backup plugin and should not be used!
* To restore data in your plugin use the slotRestore above.
*
*/
virtual void slotUndo(){};
/** \brief Redo the last action
*
* This function has to be implemented in the backup management plugin. Normally
* this function is provided by the default backup plugin and should not be used!
* To restore data in your plugin use the slotRestore above.
*
*/
virtual void slotRedo(){};
signals:
/** \brief This signal is emitted by a BackupPlugin and tells a TypePlugin to generate a backup
*
* @param _id Id of the added object
* @param _type the type of backup that needs to be done
*/
virtual void generateBackup( int _id, QString _name, UpdateType _type ) {};
}; };
Q_DECLARE_INTERFACE(BackupInterface,"GUI.BackupInterface/1.0") Q_DECLARE_INTERFACE(BackupInterface,"GUI.BackupInterface/1.0")
......
...@@ -787,11 +787,11 @@ class SelectionInterface { ...@@ -787,11 +787,11 @@ class SelectionInterface {
* This connects to slotToggleSelection(QPoint,QString) which has to be implemented * This connects to slotToggleSelection(QPoint,QString) which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _position The 2-D position of the mouse cursor in local screen coordinates * @param _event The mouse event that currently is performed
* @param _currentType The currently active primitive type * @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected * @param _deselect True if entities should be deselected
*/ */
virtual void toggleSelection(QPoint _position, PrimitiveType _currentType, bool _deselect) {}; virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a lasso selection /** \brief Emitted by selection base plugin whenever the user performs a lasso selection
* *
...@@ -831,35 +831,35 @@ class SelectionInterface { ...@@ -831,35 +831,35 @@ class SelectionInterface {
* This connects to slotSphereSelection(QPoint,QString) which has to be implemented * This connects to slotSphereSelection(QPoint,QString) which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _position The 2-D position of the mouse cursor * @param _event The mouse event that currently is performed
* @param _radius The current radius of the selection sphere * @param _radius The current radius of the selection sphere
* @param _currentType The currently active primitive type * @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected * @param _deselect True if entities should be deselected
*/ */
virtual void sphereSelection(QPoint _position, double _radius, PrimitiveType _currentType, bool _deselect) {}; virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a closest boundary selection /** \brief Emitted by selection base plugin whenever the user performs a closest boundary selection
* *
* This connects to slotClosestBoundarySelection(QPoint,QString) which has to be implemented * This connects to slotClosestBoundarySelection(QPoint,QString) which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _position The 2-D position of the mouse cursor in local screen coordinates * @param _event The mouse event that currently is performed
* @param _currentType The currently active primitive type * @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected * @param _deselect True if entities should be deselected
*/ */
virtual void closestBoundarySelection(QPoint _position, PrimitiveType _currentType, bool _deselect) {}; virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a flood fill selection /** \brief Emitted by selection base plugin whenever the user performs a flood fill selection
* *
* This connects to slotFloodFillSelection(QPoint,QString) which has to be implemented * This connects to slotFloodFillSelection(QPoint,QString) which has to be implemented
* by each type selection plugin if this interactive selection mode should be provided. * by each type selection plugin if this interactive selection mode should be provided.
* *
* @param _position The 2-D position of the mouse cursor in local screen coordinates * @param _event The mouse event that currently is performed
* @param _maxAngle The maximum angle used for flood filling * @param _maxAngle The maximum angle used for flood filling
* @param _currentType The currently active primitive type * @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected * @param _deselect True if entities should be deselected
*/ */
virtual void floodFillSelection(QPoint _position, double _maxAngle, PrimitiveType _currentType, bool _deselect) {}; virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
/** \brief Emitted by selection base plugin whenever the user performs a custom selection /** \brief Emitted by selection base plugin whenever the user performs a custom selection
* *
......
...@@ -66,18 +66,18 @@ ...@@ -66,18 +66,18 @@
class TypeInterface { class TypeInterface {
signals: signals:
/** \brief Emit this signal if an empty object has been created /** \brief Emit this signal if an empty object has been created
* *
* @param _id Id of the added object * @param _id Id of the added object
*/ */
virtual void emptyObjectAdded( int _id ) {}; virtual void emptyObjectAdded( int _id ) {};
public: public:
/// Destructor /// Destructor
virtual ~TypeInterface() {}; virtual ~TypeInterface() {};
public slots: public slots:
virtual bool registerType() = 0; virtual bool registerType() = 0;
...@@ -95,6 +95,15 @@ class TypeInterface { ...@@ -95,6 +95,15 @@ class TypeInterface {
* a given dataType. If so, your addEmpty function will be invoked to create it. * a given dataType. If so, your addEmpty function will be invoked to create it.
*/ */
virtual DataType supportedType() = 0; virtual DataType supportedType() = 0;
/** \brief This slot should be implemented in a TypePlugin to generate type specific backups
*
* @param _id Id of the added object
* @param _name name of the backup
* @param _type the type of backup that needs to be done
*/
virtual void generateBackup( int _id, QString _name, UpdateType _type ){};
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment