Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BackupPlugin.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50 #ifndef BACKUPPLUGIN_HH
51 #define BACKUPPLUGIN_HH
52
53 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
54 #include <OpenFlipper/BasePlugin/KeyInterface.hh>
55 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
56 #include <OpenFlipper/BasePlugin/MenuInterface.hh>
57 #include <OpenFlipper/BasePlugin/BackupInterface.hh>
58 #include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
59 #include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
60 #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
61 #include <OpenFlipper/BasePlugin/OptionsInterface.hh>
62 #include <OpenFlipper/common/Types.hh>
63
64 #include <QObject>
65 #include <QMenuBar>
66
67 #include "GroupData.hh"
68
69 class BackupPlugin : public QObject, BaseInterface , KeyInterface, MenuInterface, BackupInterface, LoggingInterface, ToolbarInterface, LoadSaveInterface, ContextMenuInterface, OptionsInterface
70 {
71 Q_OBJECT
72 Q_INTERFACES(BaseInterface)
73 Q_INTERFACES(KeyInterface)
74 Q_INTERFACES(MenuInterface)
75 Q_INTERFACES(BackupInterface)
76 Q_INTERFACES(LoggingInterface)
77 Q_INTERFACES(ToolbarInterface)
78 Q_INTERFACES(LoadSaveInterface)
79 Q_INTERFACES(ContextMenuInterface)
80 Q_INTERFACES(OptionsInterface)
81
82 #if QT_VERSION >= 0x050000
83 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Backup")
84 #endif
85
86 signals:
87 // BaseInterface
88 void updateView();
89 void updatedObject(int _identifier, const UpdateType& _type);
90 void setSlotDescription(QString _slotName , QString _slotDescription,
91 QStringList _parameters , QStringList _descriptions);
92
93 // LoggingInterface
94 void log(Logtype _type, QString _message);
95 void log(QString _message);
96
97 // MenuInterface
98 void getMenubarMenu (QString _name, QMenu *& _menu, bool _create);
99
100 // BackupInterface
101 void undo(int _objectid);
102 void undo();
103 void redo(int _objectid);
104 void redo();
105 void aboutToRestore(int _objectid);
106 void restored(int _objectid);
107 void generateBackup( int _id, QString _name, UpdateType _type);
108
109 // ToolBarInterface
110 void addToolbar(QToolBar* _toolbar);
111 void getToolBar( QString _name, QToolBar*& _toolbar);
112
113 //KeyInterface
114 void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
115
116 //ContextMenuInterface
117 void addContextMenuItem(QAction* _action , DataType _objectType, ContextMenuType _type);
118
119 private slots:
120
121 // BaseInterface
122 void initializePlugin();
123 void pluginsInitialized();
124
125 void slotAllCleared();
126
127 // KeyInterface
128 void slotKeyEvent( QKeyEvent* _event );
129
130 // LoadSaveInterface
131 void objectDeleted (int _objectid);
132
133 // Backup Interface
134 void slotCreateBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
135 void slotCreateBackup( IdList _objectids , QString _name, std::vector<UpdateType> _types);
136 void slotUndo(int _objectid);
137 void slotRedo(int _objectid);
138 void slotUndo();
139 void slotRedo();
140
141 //ContextMenuInterface
142 void slotUpdateContextMenu( int _objectId );
143
144 // OptionsInterface
145 bool initializeOptionsWidget(QWidget*& _widget);
146 void applyOptions();
147
148 private slots:
149
150 void updateButtons();
151
153 void slotEnableDisableBackups();
154
155 void slotObjectUndo();
156 void slotObjectRedo();
157
158 public slots:
159 QString version() { return QString("0.1"); };
160
161 void createBackup(int _objectId, QString _name, UpdateType _type= UPDATE_ALL);
162
163 public:
164 ~BackupPlugin() {};
165 BackupPlugin();
166
167 QString name() { return (QString("Backup")); };
168 QString description( ) { return (QString("Creates Backups of objects when supported by plugins")); };
169
170 private :
171 GroupData globalBackup_;
172
174 QMenu* backupMenu_;
175
176 QAction* backupsEnabledAction_;
177
178 QAction* undoMenuAction_;
179 QAction* redoMenuAction_;
180
181 QAction* undoToolAction_;
182 QAction* redoToolAction_;
183
184 QAction* undoContextAction_;
185 QAction* redoContextAction_;
186
187 QSpinBox* maxBackupSpinBox_;
188 };
189
190 #endif //BACKUPPLUGIN_HH
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:76
KeyInterface
Keyboard Event Interface.
Definition: KeyInterface.hh:76
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:103
OptionsInterface.hh
ToolbarInterface.hh
BackupInterface.hh
UpdateType
Update type class.
Definition: UpdateType.hh:70
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
GroupData
Class that is used to store global(group) backups.
Definition: GroupData.hh:60
LoggingInterface.hh
BackupPlugin::slotEnableDisableBackups
void slotEnableDisableBackups()
Backups enabled or disabled checkbox.
Definition: BackupPlugin.cc:208
KeyInterface.hh
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:123
BackupPlugin::backupMenu_
QMenu * backupMenu_
The backup Menu.
Definition: BackupPlugin.hh:174
OptionsInterface
Options Dialog interface.
Definition: OptionsInterface.hh:74
BackupPlugin
Definition: BackupPlugin.hh:69
LoadSaveInterface.hh
IdList
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:192
BackupPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: BackupPlugin.hh:168
ContextMenuType
ContextMenuType
Definition: ContextMenuInterface.hh:72
ToolbarInterface
Add a toolbox to OpenFlipper.
Definition: ToolbarInterface.hh:79
ContextMenuInterface.hh
LoadSaveInterface
Interface for all plugins which want to Load or Save files and create Objects.
Definition: LoadSaveInterface.hh:68
BackupInterface
Interface class for backup handling.
Definition: BackupInterface.hh:75
BaseInterface.hh
ContextMenuInterface
Interface class for creating custom context menus.
Definition: ContextMenuInterface.hh:101
BackupPlugin::name
QString name()
Return a name for the plugin.
Definition: BackupPlugin.hh:167
DataType
Predefined datatypes.
Definition: DataTypes.hh:96
Types.hh
MenuInterface.hh
MenuInterface
Interface for all plugins which provide entries to the main menubar.
Definition: MenuInterface.hh:91
BackupPlugin::createBackup
void createBackup(int _objectId, QString _name, UpdateType _type=UPDATE_ALL)
Tell Backup Plugin to create a backup.
Definition: BackupPlugin.cc:435