Developer Documentation
Loading...
Searching...
No Matches
DataControlPlugin.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
45
46
47#ifndef DATACONTROLPLUGIN_HH
48#define DATACONTROLPLUGIN_HH
49
50
57#include <OpenFlipper/BasePlugin/INIInterface.hh>
62#include "Toolbox.hh"
63
64#include "TreeModel.hh"
65#include "DefaultObjectMarker.hh"
66
67
71{
72 Q_OBJECT
73 Q_INTERFACES(BaseInterface)
74 Q_INTERFACES(ToolboxInterface)
75 Q_INTERFACES(KeyInterface)
76 Q_INTERFACES(LoggingInterface)
77 Q_INTERFACES(INIInterface)
78 Q_INTERFACES(ContextMenuInterface)
79 Q_INTERFACES(ScriptInterface)
80 Q_INTERFACES(LoadSaveInterface)
81 Q_INTERFACES(PythonInterface)
82
83 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-DataControl")
84
85 signals:
86 // BaseInterface
87 void updateView();
88 void updatedObject(int _it, const UpdateType& _type);
89
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 // ContextMenuInterface
98 void addContextMenuItem(QAction* _action , ContextMenuType _type);
99 void addContextMenuItem(QAction* _action , DataType _objectType , ContextMenuType _type );
100
101 // LoadSaveInterface
102 void deleteObject( int _id );
103 void emptyObjectAdded( int _id );
104 void copyObject( int _oldId, int& _newId);
105
106 // ToolboxInterface
107 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon, QWidget *_headerAreaWidget);
108
109 void objectsGrouped(IdList);
110
111 private slots :
112 // BaseInterface
113 void initializePlugin();
114 void pluginsInitialized();
115 void slotVisibilityChanged ( int _identifier );
116 void slotObjectSelectionChanged ( int _identifier );
117 void slotObjectPropertiesChanged( int _identifier );
118 void slotObjectUpdated( int _identifier, const UpdateType& _type );
119
120 // KeyInterface
121 void slotKeyEvent( QKeyEvent* _event );
122
123 // INIInterface
124 void loadIniFileOptionsLast( INIFile& _ini );
125 void saveIniFileOptions( INIFile& _ini );
126 void saveOnExit(INIFile& _ini );
127
128 // LoadSaveInterface
129 void fileOpened(int _id);
130 void addedEmptyObject(int _id);
131 void objectDeleted(int _id);
132
133 // Tell system that this plugin runs without ui
134 void noguiSupported( ) {} ;
135
136 void slotObjectsGrouped(IdList _lst);
137
138 public :
139
142
145
147 QString name(){ return (QString("DataControl")); };
148
150 QString description() { return (QString(tr("Manages Data Objects"))); };
151
152 private :
155 QIcon* toolIcon_;
156
158 QGridLayout* MeshDialogLayout_;
159
161 QTableWidget* objectList_;
162
164 bool locked;
165
168
170 QTreeView* view_;
171
173 QHeaderView * viewHeader_;
174
177
178
179//===========================================================================
182//===========================================================================
183
184 private slots:
185
187 void slotDataChanged (int _id, int _column, const QVariant& _value);
188
190 void slotMoveBaseObject (int _id, int _newParentId);
191
192 private:
193 void propagateDownwards(BaseObject* _obj, int _column );
194 void propagateUpwards(BaseObject* _obj, int _column );
195
196 //variables to restrict propagation direction
199 //defines, which selection column needs an update if not -1
200 // 2: source 3: target
202
205//===========================================================================
208//===========================================================================
209 private slots:
211 void slotCustomContextMenuRequested ( const QPoint & _pos );
212
214 void slotPopupRemove( );
215
217 void slotUngroup ( );
218
220 void slotGroup ( );
221
223 void slotCopy();
224
226 void slotRename ( );
227
229 void slotZoomTo();
230
232 void slotSwitchLight();
233
235 void slotEditLight();
236
239
242
245
248
254
256 void slotShowLightSources( bool _state );
258
259 private :
261 QModelIndex popupIndex_;
262
263 private slots:
264
266 void slotHeaderCustomContextMenuRequested ( const QPoint & _pos );
267
268 private:
271
274//===========================================================================
277//===========================================================================
278
279 private slots:
280
282 void slotContextMenuHide( );
283
285 void slotContextMenuTarget( );
286
288 void slotContextMenuSource( );
289
291 void slotContextMenuRemove( );
292
294 void slotUpdateContextMenu( int _objectId);
295
296 private :
300
301 QAction* material_;
305
307
310//===========================================================================
313//===========================================================================
314
315 private slots:
316
318 void slotBoundingBoxChange( );
319
320 private:
321
324
327//===========================================================================
330//===========================================================================
331
332 private slots:
333
337 void setDescriptions();
338
339 public slots:
341 QString getObjectName( int objectId );
342
344 void objectDelete(int objectId);
345
347 int copyObject( int objectId );
348
350 int getObject( QString _name );
351
353 DataType dataType( int objectId );
354
356 void hideObject( int objectId );
357
359 void showObject( int objectId );
360
362 void setTarget( int objectId, bool _target );
363
365 void setSource( int objectId, bool _source );
366
368 void setObjectName( int objectId, QString _name );
369
371 void setAllTarget();
372
374 void setAllSource();
375
377 void clearAllTarget();
378
380 void clearAllSource();
381
383 void showAll();
384
386 void hideAll();
387
397 int addEmptyGroup(QString _groupName = "", int _parentGroupId = 0);
398
403 int groupObjects(IdList _objectIDs, const QString &_groupName = "");
404
406 bool addObjectToGroup(int _objectId, int _groupId);
407
412 bool unGroupObject(int _id);
413
416
419
421 unsigned int groupCount() const;
422
424 QString availableDataTypeNames() const;
425
428
430 IdList getGroupElements(int _groupId);
431
433 void showReducedUi(bool reduced);
434
437 public slots:
438 QString version() { return QString("1.03"); };
439};
440
441#endif //DATACONTROLPLUGIN_HH
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition DataTypes.hh:181
Logtype
Log types for Message Window.
Interface class from which all plugins have to be created.
Interface class for creating custom context menus.
void slotKeyEvent(QKeyEvent *_event)
a key event occurred
void setAllTarget()
Makes all available objects target.
QModelIndex popupIndex_
Index where a popup has been opened.
void slotCustomContextMenuRequested(const QPoint &_pos)
Display a custom context window for the TreeView.
Definition Popup.cc:179
void showAll()
Shows all objects.
void objectDeleted(int _id)
an object was deleted. delete it internally
void objectDelete(int objectId)
Delete the given object.
DefaultObjectMarker objectMarker
Default marker to visualize "source" and "target" object flags.
QString description()
Description of the Plugin.
void slotMoveBaseObject(int _id, int _newParentId)
Gets called when an object was moved via drag n drop.
void slotCopy()
Called by the popup menu to copy items.
Definition Popup.cc:122
IdList getGroupElements(int _groupId)
Get all elements of the given group.
void addedEmptyObject(int _id)
Update the model if an empty object has been added.
void slotSwitchLight()
Called by the popup menu in order to turn lights on/off.
Definition Popup.cc:634
void clearAllSource()
remove source selection from all objects
void showObject(int objectId)
Show the given Object.
void slotUpdateContextMenu(int _objectId)
Update the context Menus for the given id.
void slotShowLightSources()
Index where a popup has been opened.
bool locked
Flag set to true if meshlist is updated, preventing signal for list udate to be called.
DatacontrolToolboxWidget * tool_
Widget for Toolbox.
int headerPopupType_
Defines the section of the Popup.
void slotEditLight()
Called by the popup menu in order to edit lights.
Definition Popup.cc:664
void slotZoomTo()
Called by the popup menu to zoom to an object.
Definition Popup.cc:692
void setTarget(int objectId, bool _target)
set the given Object as target
QAction * removeAction_
Hide an object.
void slotUngroup()
Called by the popup menu to ungroup items.
Definition Popup.cc:105
QHeaderView * viewHeader_
Pointer to the header to the view widget.
QAction * targetAction_
Hide an object.
void slotMaterialProperties()
Called by the popup menu to set material properties.
Definition Popup.cc:573
void hideObject(int objectId)
Hide the given Object.
void slotHeaderCustomContextMenuRequested(const QPoint &_pos)
Display a custom context window for the TreeViews header.
Definition Popup.cc:313
void slotContextMenuRemove()
Remove Selected Item.
void clearAllTarget()
Unselect all objects.
void fileOpened(int _id)
Update the model if a file has been opened.
QToolButton * advancedSettingsBtn_
Hide an object.
void propagateDownwards(BaseObject *_obj, int _column)
Recursively update a column up to the root of the tree.
~DataControlPlugin()
Destructor.
void propagateUpwards(BaseObject *_obj, int _column)
Recursively update a column up to the root of the tree.
void slotRename()
Called by the popup menu to rename items.
Definition Popup.cc:415
void hideAll()
Hides all objects.
int columnFromGUI_
Gets called when the data in the table has changed.
void slotBoundingBoxChange()
Bounding box selection changed.
void pluginsInitialized()
Plugin initialization.
void setObjectName(int objectId, QString _name)
set the name of the given object
int getObject(QString _name)
Get the id of an object by its name.
void saveIniFileOptions(INIFile &_ini)
Save groups to ini file.
QAction * material_
Hide an object.
IdList getSourceObjects(DataType _type)
Get all source objects of given type.
QGridLayout * MeshDialogLayout_
Layout for Toolbox.
QTreeView * view_
Tree view.
void slotVisibilityChanged(int _identifier)
Update the model if the visibility of an object changed.
void slotContextMenuSource()
Source Selection.
void slotPopupRemove()
Called by the popup menu to remove an object/group.
Definition Popup.cc:62
TreeModel * model_
The Treemodel organizing the data.
DataControlPlugin()
Constructor.
void slotObjectSelectionChanged(int _identifier)
update drawing of objects when the active object changed
void saveOnExit(INIFile &_ini)
Save settings before application is closed.
int onlyDown_
Gets called when the data in the table has changed.
void showReducedUi(bool reduced)
Show or hide the extended ui interface in the datacontrol toolbox.
void setAllSource()
Makes all available objects source.
QString name()
Name of the Plugin.
int onlyUp_
Gets called when the data in the table has changed.
QString availableDataTypeNames() const
Returns a list of all available DataTypes.
QString getObjectName(int objectId)
Get the Objects name from the id.
QAction * pasteMaterialFromClipboard_
Hide an object.
int groupObjects(IdList _objectIDs, const QString &_groupName="")
Group given Objects together.
void printObjectInfoToLog()
Print information about all open objects to the console.
void slotGroup()
Called by the popup menu to group items.
Definition Popup.cc:152
void slotCopyMaterialToClipboard()
Called by the popup menu to copy material properties to clipboard.
Definition Popup.cc:492
IdList getTargetObjects(DataType _type)
Get all target objects of given type.
QAction * copyMaterial_
Hide an object.
QAction * copyMaterialToClipboard_
Hide an object.
void updateBoundingBox(BaseObjectData *_obj)
Updates bounding box.
void slotCopyMaterialToTargeted()
Called by the popup menu to copy material properties.
Definition Popup.cc:445
void slotObjectsGrouped(IdList _lst)
update objects when they have been grouped
void slotObjectPropertiesChanged(int _identifier)
Update the model if properties of an object changed.
void setSource(int objectId, bool _source)
set the given Object as source
void loadIniFileOptionsLast(INIFile &_ini)
Load Groups from ini file.
unsigned int groupCount() const
Returns the number of groups.
int addEmptyGroup(QString _groupName="", int _parentGroupId=0)
Create new empty group.
void slotContextMenuTarget()
Target Selection.
QAction * sourceAction_
Hide an object.
QTableWidget * objectList_
Table containing Mesh information and status.
bool addObjectToGroup(int _objectId, int _groupId)
add an object to an existing group
void slotNodeChanged(ACG::SceneGraph::BaseNode *_node)
Called when the material properties were changed inside the material dialog.
Definition Popup.cc:625
void slotContextMenuHide()
Hide an object.
void slotPasteMaterialFromClipboard()
Called by the popup menu to paste material properties from clipboard.
Definition Popup.cc:532
DataType dataType(int objectId)
Get the DataType of a given object.
void slotDataChanged(int _id, int _column, const QVariant &_value)
Gets called when the data in the table has changed.
Predefined datatypes.
Definition DataTypes.hh:83
Class for the handling of simple configuration files.
Definition INIFile.hh:100
Interface class for Plugins which have to store information in ini files.
Keyboard Event Interface.
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for exporting functions to python.
Interface for all Plugins which provide scriptable Functions.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
Update type class.
Definition UpdateType.hh:59