BackupInterface.hh 9.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*===========================================================================*\
 *                                                                           *
 *                              OpenFlipper                                  *
 *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
 *                           www.openflipper.org                             *
 *                                                                           *
 *---------------------------------------------------------------------------*
 *  This file is part of OpenFlipper.                                        *
 *                                                                           *
 *  OpenFlipper is free software: you can redistribute it and/or modify      *
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenFlipper is distributed in the hope that it will be useful,           *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenFlipper. If not,                                  *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Author$                                                      *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/
Jan Möbius's avatar
 
Jan Möbius committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67




//
// C++ Interface: Backup Interface
//
// Description: 
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

#ifndef BACKUPPLUGININTERFACE_HH 
#define BACKUPPLUGININTERFACE_HH 

 #include <QtGui>
 #include <QMenuBar>
 #include <OpenFlipper/common/Types.hh>
 
 /** \brief Create or restore backups 
  * 
  * Interface Class for Backup Plugins. The Backup Interface can be used to communicate with or write a backup plugin.
  * 
 */
class BackupInterface {
Jan Möbius's avatar
Jan Möbius committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  
  //===========================================================================
  /** @name Interface definition for general Plugins
  * @{ */
  //===========================================================================
  
  signals:
    /** \brief Tell Backup Plugin to create a backup
    *
    * Plugins which supports backups can call this function if they want to create backups.\n    
    * A Backup control Plugin will do the rest.
    * @param _objectid   Identifier of the object to create the backup
    * @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*/) {};

    /** \brief Tell Backup Plugin to create a backup but don't get the id of the object ( if you don't care )
    *
    * Plugins which supports backups can call this function if they want to create backups.\n    
    * A Backup control Plugin will do the rest.
    * @param _objectid   Identifier of the object to create the backup
    * @param _name       Name of the Backup, to show the user what can be recovered
    */
    virtual void createBackup( int /*_objectid*/, QString /*_name*/) {};    
    
Jan Möbius's avatar
Jan Möbius committed
94
95
96
97
98
99
100
101
    
    /** \brief Make a backup persistent. 
    *
    * A persistent backup will not be removed automatically by the backup plugin.
    * You have to remove it by yourself by calling removeBackup!
    */
    virtual void makeBackupPersistent(int /*_objectid*/, int /*_internalId*/){};
    
Jan Möbius's avatar
Jan Möbius committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
    /** \brief Tell Backup Plugin to restore a backup
    *
    * Plugins which supports backups can this function if they want to restore backups.\n    
    * 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) {};
  
  private slots:
    /** \brief Backup for an object requested
    * 
    * 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.
    * @param _id Identifier of the object to create the backup
    * @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. 
    */
    virtual void slotBackup( int /*_objectid*/ , QString /*_name*/ , int /*_internalId*/) {} ;    
    
    /** \brief A given object will be restored.
    *
    * This function is called before an object is restored from a backup.
    * perObjectDatas and the object will be reset to the backup state
    * after this function is called for all plugins.
    * If you have any pointers or references to the given object you have to
    * clean them up here.
    * @param _id         Identifier of the object which is about to be restored
    * @param _name       Name of the restore set
    * @param _internalId Unique Number of the Restore set 
    */
    virtual void slotAboutToRestore( int /*_objectid*/ , int /*_internalId*/) {};      
    
    /** \brief Restore Object
    *
    * This function is called after the main object is restored from a backup.
    * perObjectDatas and the object have been reset to the backup state.\n
    *
    * Here you can restore additional data which is not managed in perObjectDatas but
    * in your local plugin.\n
    *
    * @param _objectid   Identifier of the object which is about to be restored
    * @param _name       Name of the restore set
    * @param _internalId Unique Number of the Restore set 
    */
    virtual void slotRestore( int /*_objectid*/ , int /*_internalId*/) {};     
    
    /** \brief Object fully restored
    *
    * This function is called after an object and all data from other plugins
    * is restored from a backup.
    * perObjectDatas and the object have been reset to the backup state.    
    * @param _objectid   Identifier of the object which is about to be restored
    * @param _name       Name of the restore set
    * @param _internalId Unique Number of the Restore set 
    */
    virtual void slotRestored( int /*_objectid*/, int /*_internalId*/) {};      
Jan Möbius's avatar
 
Jan Möbius committed
159
160
161
162
163
   
   public : 
       
      /// Destructor
      virtual ~BackupInterface() {};
Jan Möbius's avatar
Jan Möbius committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
      
  //===========================================================================
  /** @name Interface definition for Backup Plugins
  *
  *  These signals and slots have to be implemented if you create a plugin managing 
  *  Backups ( A Backup plugin is already provided by OpenFlipper so you don't need
  *  to use these funcions).
  * @{ */
  //===========================================================================     
  
  signals: 
    /** \brief Backup Plugin tells other Plugins that a restore will happen
    *
    */
    virtual void aboutToRestore(int /*_objectid*/ , int /*_internalId*/) {};
  
    /** \brief Backup Plugin tells other Plugins that they should restore their own data
    *
    */
    virtual void restore(int /*_objectid*/ , int /*_internalId*/) {};
    
    /** \brief Backup Plugin tells other Plugins that a restore has happened
    *
    */
    virtual void restored( int /*_objectid*/ , int /*_internalId*/) {};
    
    
  private slots:
    /** \brief Restore the core object
    *
    * 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.
    *
    * @param _objectId Object to restore
    * 
    */
Jan Möbius's avatar
Jan Möbius committed
201
202
203
    virtual void slotRestoreObject(int /*_objectid*/ , QString /*_name*/ , int /*_internalId*/) {};
    
    virtual void slotMakeBackupPersistent(int /*_objectid*/, int /*_internalId*/) {};
Jan Möbius's avatar
Jan Möbius committed
204
205

    
Jan Möbius's avatar
 
Jan Möbius committed
206
207
};

Jan Möbius's avatar
Jan Möbius committed
208
Q_DECLARE_INTERFACE(BackupInterface,"GUI.BackupInterface/1.0")
Jan Möbius's avatar
 
Jan Möbius committed
209
210
      
#endif // BACKUPPLUGININTERFACE_HH