Developer Documentation
Core.hh
Go to the documentation of this file.
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 
51 
52 
53 //=============================================================================
54 //
55 // CLASS Core
56 //
57 //=============================================================================
58 
64 #ifndef MVIEWWIDGET_HH
65 #define MVIEWWIDGET_HH
66 
67 
68 //== INCLUDES =================================================================
69 
70 #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
71 
72 // QT INCLUDES
73 #include <QVariant>
74 #include <QMainWindow>
75 #include <QToolBox>
76 #include <QStackedWidget>
77 #include <QSplashScreen>
78 
79 #include <QDockWidget>
80 #include <QVector>
81 #include <QProgressDialog>
82 
83 #include <QtScript/QScriptEngine>
84 #include <QtScript/QtScript>
85 
86 #include "OpenFlipper/INIFile/INIFile.hh"
87 
90 
91 // Prototypes for scripting
92 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec3d.hh"
93 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec4d.hh"
94 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeMatrix4x4.hh"
95 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeDataType.hh"
96 #include <OpenFlipper/Scripting/scriptWrappers/vec3dWrapper.hh>
97 #include <OpenFlipper/Scripting/scriptWrappers/vec4dWrapper.hh>
98 #include <OpenFlipper/Scripting/scriptWrappers/matrix4x4Wrapper.hh>
99 #include <OpenFlipper/Scripting/scriptWrappers/DataTypeWrapper.hh>
100 // #include <OpenFlipper/Scripting/scriptWrappers/ObjectIdWrapper.hh>
101 
102 // Required Interface definition ( Some variables were defined there )
108 #include "OpenFlipper/BasePlugin/SelectionInterface.hh" // -> for SelectionInterface::PrimitiveType
110 
112 
113 // Process manager widget
114 #include <OpenFlipper/widgets/processManagerWidget/processManagerWidget.hh>
115 
117 
118 #include <OpenFlipper/Core/PluginInfo.hh>
119 
120 #include <ACG/Scenegraph/CoordsysNode.hh>
121 
122 #include <OpenFlipper/threads/JobInfo.hh>
123 
125 #include <OpenFlipper/common/InformationPlugins.hh>
126 #include "SpinBoxEventFilter.hh"
127 
128 //== CLASS DEFINITION =========================================================
129 
130 
131 struct dataTypes {
132  QString name;
133  DataType type;
134  TypeInterface* plugin;
135 };
136 
139 class Core : public QObject
140 {
141  Q_OBJECT
142 
143 public:
144 
146  Core();
147 
148  void init();
149 
151  ~Core();
152 
154  bool add_sync_host(const QString& _name);
155 
156 
157 private slots:
158 
160  void slotMouseEventIdentify( QMouseEvent* _event );
161 
163  void slotMouseEventLight( QMouseEvent* _event );
164 
165 protected:
166 
167  //===========================================================================
170  //===========================================================================
171 signals:
173  void allCleared();
174 
176  void signalObjectUpdated(int);
177 
179  void signalObjectUpdated(int, const UpdateType&);
180 
182  void PluginWheelEvent(QWheelEvent * , const std::string & );
183 
185  void PluginMouseEvent(QMouseEvent* );
186 
188  void PluginMouseEventLight( QMouseEvent* );
189 
191  void objectSelectionChanged( int );
192 
194  void pluginViewChanged();
195 
197  void pluginSceneDrawn();
198 
200  void addTexture( QString, QString , uint, int );
201 
203  void addTexture( QString, QString , uint );
204 
206  void addMultiTexture( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );
207 
209  void updateTexture( QString , int );
210 
212  void updateAllTextures( );
213 
215  void updatedTextures( QString , int );
216 
218  void setTextureMode(QString _textureName ,QString _mode, int _id);
219 
221  void setTextureMode(QString _textureName ,QString _mode);
222 
224  void switchTexture( QString, int );
225 
227  void switchTexture( QString );
228 
230  void textureChangeImage( QString _textureName , QImage& _image );
231 
233  void textureChangeImage( QString _textureName , QImage& _image , int _id );
234 
236  void textureGetImage( QString _textureName , QImage& _image );
237 
239  void textureGetImage( QString _textureName , QImage& _image , int _id );
240 
242  void textureIndex( QString _textureName, int _id, int& _index);
243 
245  void textureIndexPropertyName( int _id, QString& _propertyName);
246 
248  void textureName( int _id, int _textureIndex, QString& _textureName);
249 
251  void textureFilename( int _id, QString _textureName, QString& _textureFilename);
252 
254  void getCurrentTexture( int _id, QString& _textureName );
255 
257  void getSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
258 
260  void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
261 
263  void registerType(QString _handleName, DataType _type);
264 
266  void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
267 
269  void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
270  SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
271  void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
272  SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
273  DataType _objectTypeRestriction);
274 
276  void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
277 
279  void selectionOperation(QString _operation);
280 
282  void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
283 
285  void showLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
286 
288  void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
289 
291  void showSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
292 
294  void showSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
295 
297  void showClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
298 
300  void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
301 
303  void showComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
304 
306  void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
307 
309  void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
310 
312  void volumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
313 
315  void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
316 
318  void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
319 
321  void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
322 
324  void floodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
325 
327  void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
328 
330  void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
331 
333  void getActiveDataTypes(SelectionInterface::TypeList& _types);
334 
336  void getActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
337 
339  void targetObjectsOnly(bool& _targetsOnly);
340 
342  void loadSelection(const INIFile& _file);
343 
345  void saveSelection(INIFile& _file);
346 
348  void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
349 
351  void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
352 
354  void iniLoad( INIFile&, int );
355 
357  void iniSave( INIFile& _ini ,int _id );
358 
360  void iniSaveOptions( INIFile& _ini );
361 
363  void iniLoadOptions( INIFile& _ini );
364 
366  void iniLoadOptionsLast( INIFile& _ini );
367 
369  void saveOnExit( INIFile& _ini );
370 
372  void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
373  void createBackup( IdList _objectids, QString _name, std::vector<UpdateType> _types);
374 
376  void undo(int _objectid);
377  void redo(int _objectid);
378  void undo();
379  void redo();
380 
382  void aboutToRestore(int _objectId);
383 
385  void restored( int _objectId);
386 
388  void openedFile( int _id );
389 
391  void emptyObjectAdded( int _id);
392 
394  void pluginsInitialized();
395 
397  void visibilityChanged(int _id);
398 
400  void objectPropertiesChanged( int _id );
401 
403  void objectDeleted( int );
404 
407  //===========================================================================
410  //===========================================================================
411  private slots :
412 
414  void slotObjectUpdated(int _identifier, const UpdateType& _type = UPDATE_ALL);
415 
417  void slotVisibilityChanged(int _id);
418 
420  void slotObjectPropertiesChanged( int _id );
421 
423  void slotObjectSelectionChanged( int _id);
424 
426  void slotAddPickMode( const std::string& _mode );
427 
429  void slotAddHiddenPickMode( const std::string& _mode );
430 
432  void slotAddTexture( QString _textureName , QString _filename , uint _dimension , int _id );
433 
435  void slotAddTexture( QString _textureName , QString _filename , uint _dimension );
436 
438  void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );
439  void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int* _textureId );
440 
442  void slotUpdateTexture( QString _name , int _identifier);
443 
445  void slotUpdateAllTextures( );
446 
448  void slotTextureUpdated( QString _textureName , int _identifier );
449 
451  void slotSetTextureMode(QString _textureName ,QString _mode, int _id);
452 
454  void slotSetTextureMode(QString _textureName ,QString _mode);
455 
457  void slotSwitchTexture( QString _textureName, int _id );
458 
460  void slotSwitchTexture( QString _textureName );
461 
463  void slotTextureChangeImage( QString _textureName , QImage& _image );
464 
466  void slotTextureChangeImage( QString _textureName , QImage& _image , int _id );
467 
469  void slotTextureGetImage( QString _textureName , QImage& _image );
470 
472  void slotTextureGetImage( QString _textureName , QImage& _image , int _id );
473 
475  void slotTextureIndex( QString _textureName, int _id, int& _index);
476 
478  void slotTextureIndexPropertyName( int _id, QString& _propertyName);
479 
481  void slotTextureName( int _id, int _textureIndex, QString& _textureName);
482 
484  void slotTextureFilename( int _id, QString _textureName, QString& _textureFilename);
485 
487  void slotGetCurrentTexture( int _id, QString& _textureName );
488 
490  void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
491 
493  void slotLoad(QString _filename, DataType _type, int& _id);
494 
496  void slotLoad(QStringList _filenames, IdList _pluginIDs);
497 
499  void slotFileOpened ( int _id );
500 
502  void slotEmptyObjectAdded ( int _id );
503 
505  void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
506 
508  void slotRegisterType(QString _handleName, DataType _type);
509 
511  void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
512 
522  void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
523  SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
524 
535  void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
536  SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
537  DataType _objectTypeRestriction);
538 
540  void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
541 
543  void slotSelectionOperation(QString _operation);
544 
546  void slotShowToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
547 
549  void slotShowLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
550 
552  void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
553 
555  void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
556 
558  void slotShowSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
559 
561  void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
562 
564  void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
565 
567  void slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
568 
570  void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
571 
573  void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
574 
576  void slotVolumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
577 
579  void slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
580 
582  void slotSphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
583 
585  void slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
586 
588  void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, SelectionInterface::PrimitiveType _currentType, bool _deselect);
589 
591  void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
592 
594  void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
595 
597  void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);
598 
600  void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
601 
603  void slotTargetObjectsOnly(bool& _targetsOnly);
604 
606  void slotLoadSelection(const INIFile& _file);
607 
609  void slotSaveSelection(INIFile& _file);
610 
612  void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
613 
615  void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
616 
624  void slotGetAllFilters ( QStringList& _list);
625 
626 
628  void slotDeleteAllObjects( );
629 
631  void slotCrossPluginConnect( QString _pluginName1, const char* _signal, QString _pluginName2, const char* _slot);
632 
634  void slotSetRenderer(unsigned int _viewer, QString _rendererName);
635 
637  void slotGetCurrentRenderer(unsigned int _viewer, QString& _rendererName);
638 
640  // void slotGetPlugin(QString _name, QObject* & _plugin );
641 
644  //===========================================================================
647  //===========================================================================
648 public slots:
649 
651  void updateView();
652 
654  void blockScenegraphUpdates(bool _block);
655 
657  void updateUI();
658 
660  void clearAll();
661 
663  void deleteObject( int _id );
664 
665  void setObjectComment(int objId, QString key, QString comment);
666  void clearObjectComment(int objId, QString key);
667  void clearAllComments(int objId);
668 
670  void fullscreen( bool _state );
671 
673  void showViewModeControls( bool _show );
674 
676  void loggerState(int _state);
677 
679  void enableOpenMeshErrorLog(bool _state);
680 
682  void showToolbox( bool _state );
683 
685  void showStatusBar( bool _state );
686 
688  void multiViewMode( int _mode );
689 
691  void restrictFrameRate( bool _enable );
692 
694  void setMaxFrameRate( int _rate );
695 
698  void snapshotBaseFileName(QString _fname, unsigned int _viewerId = 0);
699 
701  void snapshotFileType(QString _type, unsigned int _viewerId = 0);
702 
704  void snapshotCounterStart(const int _counter, unsigned int _viewerId = 0);
705 
711  void snapshot(unsigned int _viewerId = 0, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int _numSamples = 1);
712 
714  void applicationSnapshot();
715 
717  void applicationSnapshotName(QString _name);
718 
720  void viewerSnapshot();
721 
723  void viewerSnapshot(QString file_name, bool store_comments,
724  bool comments_visible_only, bool comments_targeted_only,
725  bool store_material_info, int snapshot_width, int snapshot_height,
726  bool snapshot_transparent, bool hide_coord_sys,
727  int snapshot_multisampling, bool store_view);
728 
730  void resizeViewers(int _width, int _height );
731 
733  void resizeApplication(int _width, int _height );
734 
736  void writeVersionNumbers(QString _filename);
737 
739  QList<int> objectList (QString _selection, QStringList _types);
740 
742  void blockSceneGraphUpdates();
743 
745  void unblockSceneGraphUpdates();
746 
747  void setView(QString view);
748  void setViewAndWindowGeometry(QString view);
749 
752  //===========================================================================
755  //===========================================================================
756 
757 public slots:
763  void addViewModeToolboxes(QString _modeName, QString _toolboxList);
764 
771  void addViewModeToolbars(QString _modeName, QString _toolbarList);
772 
778  void addViewModeContextMenus(QString _modeName, QString _contextMenuList);
779 
784  void addViewModeIcon(QString _modeName, QString _iconName);
785 
790  void setToolBoxSide(QString _side);
791 
797  void setToolBoxActive(QString _toolBoxName, bool _active);
798 
801  //===========================================================================
804  //===========================================================================
805 public slots:
814  int loadObject ( QString _filename );
815 
816 private slots:
817  void loadObjectFinished(QString _filename);
818 
823  void resetScenegraph( bool _resetTrackBall );
824 
825  public :
826 
838  void commandLineOpen(const char* _filename, bool _asPolyMesh );
839 
850  void commandLineScript(const char* _filename );
851 
852  private slots:
853 
860  void slotExecuteAfterStartup();
861 
862  private:
864  std::vector< std::pair < std::string , bool > > commandLineFileNames_;
865 
867  std::vector< std::string > commandLineScriptNames_;
868 
869  public:
870 
874  int addEmptyObject( DataType _type );
875 
883  int loadObject( DataType _type, QString _filename);
884 
887  //===========================================================================
890  //===========================================================================
891  private slots:
893  void viewUpdated();
894 
896  void captureVideo();
897 
898  public slots:
899 
901  void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
902 
904  void stopVideoCapture();
905 
906  private:
907  QTimer videoTimer_;
909 
911 
912  bool capture_;
913 
916 
918  //===========================================================================
921  //===========================================================================
922 
923  public slots:
924 
928  bool saveObject( int _id, QString _filename );
929 
930  void saveObject( int _id, QString _filename, int _pluginID );
931 
932  void saveObjects( IdList _ids, QString _filename, int _pluginID );
933 
938  bool saveObjectTo( int _id, QString _filename );
939 
940  bool saveObjectsTo( IdList _ids, QString _filename );
941 
943  void saveAllObjects();
944 
946  void saveAllObjectsTo();
947 
949  void saveSettings();
950 
952  void saveSettings(QString filePath, bool is_saveObjectInfo, bool is_targetOnly, bool is_saveAll,
953  bool is_askOverwrite, bool is_saveProgramSettings, bool is_savePluginSettings);
954 
956  void loadObject();
957 
959  void loadSettings();
960 
962  void loadSettings(QString _filename);
963 
965  int getObjectId(QString _filename);
966 
972  void deserializeMaterialProperties(int _objId, QString _props);
973 
979  QString serializeMaterialProperties(int _objId);
980 
983  //===========================================================================
986  //===========================================================================
987  private slots :
988 
990  void slotMouseEvent( QMouseEvent* _event );
991 
993  void slotWheelEvent( QWheelEvent * _event, const std::string & _mode);
994 
999  void slotAddEmptyObjectMenu();
1000 
1002  void slotAddEmptyObject( DataType _type , int& _id );
1003  void slotAddEmptyObject( DataType _type, int* _id);
1004 
1006  void slotCopyObject( int _oldId , int& _newId );
1007 
1009  void slotExit();
1010 
1012  void slotRecentOpen(QAction* _action);
1013 
1015  void slotGenerateBackup( int _id, QString _name, UpdateType _type );
1016 
1017  public slots:
1018 
1020  void addToolbox(QString _name ,QWidget* _widget);
1021 
1023  void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon);
1024 
1026  void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon,
1027  QWidget* _headerAreaWidget);
1028 
1036  QWidget *getToolbox(QString _pluginName, QString _toolboxName);
1037 
1038  void activateToolbox(QString _pluginName, QString _toolboxName, bool activate);
1039 
1040  private :
1041 
1042  //===========================================================================
1045  //===========================================================================
1046 
1047  private:
1050 
1053 
1056 
1057 
1060 
1063 
1066 
1069 
1072  //===========================================================================
1075  //===========================================================================
1076 
1078  void setupOptions();
1079 
1081  void readGUIOptions(INIFile& _ini);
1082 
1084  void readApplicationOptions(INIFile& _ini);
1085 
1087  void writeApplicationOptions(INIFile& _ini);
1088 
1090  void restoreKeyBindings();
1091 
1092  public slots:
1093 
1095  void saveOptions();
1096 
1098  void applyOptions();
1099 
1110  void openIniFile( QString _filename,
1111  bool _coreSettings ,
1112  bool _perPluginSettings,
1113  bool _loadObjects );
1114 
1115  private:
1116 
1129  void writeIniFile( QString _filename,
1130  bool _relativePaths,
1131  bool _targetOnly,
1132  bool _saveSystemSettings,
1133  bool _savePluginSettings ,
1134  bool _saveObjectInfo,
1135  std::map<int,QString>& _fileMapping);
1136 
1141  void writeObjFile(QString _filename, bool _relativePaths, bool _targetOnly, std::map<int,QString>& _fileMapping);
1142 
1144  void writeOnExit();
1145 
1149  //===========================================================================
1152  //===========================================================================
1153 
1154  signals:
1156  void log(Logtype _type , QString _message );
1157 
1159  void log(QString _message );
1160 
1162  void scriptLog(QString _message);
1163 
1165  void externalLog(Logtype _type , QString _message);
1166 
1167  private slots:
1168 
1170  void slotLog(Logtype _type, QString _message);
1171 
1173  void slotLogToFile(Logtype _type, QString _message);
1174 
1175  private:
1177  QTextStream* logStream_;
1178 
1180  QFile* logFile_;
1181 
1182  public :
1183  void scriptLogFunction( QString _output);
1184 
1188  //===========================================================================
1191  //===========================================================================
1192 
1193  private :
1195  bool checkSlot(QObject* _plugin , const char* _slotSignature);
1196 
1198  bool checkSignal(QObject* _plugin , const char* _signalSignature);
1199 
1202  //===========================================================================
1205  //===========================================================================
1206 
1207  public :
1208  const std::vector<PluginInfo> plugins() const {return plugins_; };
1209 
1210  private:
1212  std::vector<PluginInfo> plugins_;
1213 
1216 
1218  void loadPlugins();
1219  private slots:
1221  void slotShowPlugins();
1222 
1224  void loadPlugin(const QString& _filename,const bool _silent, QString& _licenseErrors , QObject* _plugin = 0 );
1225 
1227  void slotLoadPlugin();
1228 
1230  void slotBlockPlugin(const QString &_rpcName);
1231 
1233  void slotUnBlockPlugin(const QString &_rpcName);
1234 
1237  //===========================================================================
1240  //===========================================================================
1241  signals:
1242  void genericMetadataDeserialized(QString key, QString value);
1243  void objectMetadataDeserialized(QString object_name, QString value);
1244 #if QT_VERSION >= 0x050000
1245  void objectMetadataDeserializedJson(
1246  QString object_name, QJsonDocument value);
1247 #endif
1248 
1249  private slots:
1250  void slotMetadataDeserialized( const QVector<QPair<QString, QString> > &data);
1251 
1255  //===========================================================================
1258  //===========================================================================
1259 
1260  signals:
1261 
1262  void scriptInfo( QString _pluginName , QString _functionName );
1263 
1264  void executeScript( QString _script );
1265 
1266  void executeFileScript( QString _filename );
1267 
1268  void setSlotDescription(QString _slotName, QString _slotDescription,
1269  QStringList _parameters, QStringList _descriptions);
1270 
1271  public slots:
1279  void createWidget(QString _objectName, QString _uiFilename, bool _show = true);
1280 
1282  void setViewMode(QString _viewMode);
1283 
1285  QString getCurrentViewMode();
1286 
1288  void setViewModeIcon(QString _mode, QString _iconName);
1289 
1291  void moveToolBoxToTop(QString _name);
1292 
1294  void moveToolBoxToBottom(QString _name);
1295 
1296  void showReducedMenuBar(bool reduced);
1297 
1298 
1299 
1300  private :
1302  QScriptEngine scriptEngine_;
1303 
1305  std::vector<ScriptingWrapper*> scriptingWrappers_;
1306 
1308  QStringList scriptingFunctions_;
1309 
1312 
1315 
1318 
1321 
1322 
1323  private slots:
1324  void slotScriptInfo( QString _pluginName , QString _functionName );
1325 
1326 
1331  void slotExecuteScript( QString _script );
1332 
1337  void slotExecuteFileScript( QString _filename );
1338 
1339  void slotGetScriptingEngine( QScriptEngine*& _engine );
1340 
1341  void slotGetAllAvailableFunctions( QStringList& _functions );
1342 
1344  void slotSetSlotDescription(QString _slotName, QString _slotDescription,
1345  QStringList _parameters, QStringList _descriptions);
1346 
1348  void slotSetSlotDescriptionGlobalFunction(QString _functionName, QString _slotDescription,
1349  QStringList _parameters, QStringList _descriptions);
1350 
1352  void slotGetDescription(QString _function, QString& _fnDescription,
1353  QStringList& _parameters, QStringList& _descriptions );
1354 
1355  void slotScriptError(const QScriptValue &error);
1356 
1357  private:
1358 
1359  QList< SlotInfo > coreSlots_;
1360  QList< SlotInfo > globalFunctions_;
1361 
1362  void setDescriptions();
1363 
1366  //===========================================================================
1369  //===========================================================================
1370  private slots:
1371 
1377  void slotPluginExists( QString _pluginName , bool& _exists );
1378 
1385  void slotFunctionExists( QString _pluginName , QString _functionName , bool& _exists );
1386 
1393  void slotCall( QString _pluginName , QString _functionName , bool& _success );
1394 
1400  void slotCall( QString _expression , bool& _success );
1401 
1412  void slotGetValue(QString _expression, QVariant& _result );
1413 
1416  //===========================================================================
1419  //===========================================================================
1420 
1421  private slots:
1422 
1424  void checkScenegraphDirty();
1425 
1426  private:
1427 
1430 
1432  QTime *redrawTime_;
1433 
1437  //===========================================================================
1440  //===========================================================================
1441 
1442  private:
1443 
1444  QList< JobInfo > currentJobs;
1445 
1447 
1449  bool getJob(QString _jobId, int& _index);
1450 
1451  private slots:
1452 
1454  void slotStartJob( QString _jobId, QString _description , int _min , int _max,bool _blocking );
1455 
1457  void slotSetJobState(QString _jobId, int _value );
1458 
1460  void slotSetJobName(QString _jobId, QString _name );
1461 
1463  void slotSetJobDescription(QString _jobId, QString _text );
1464 
1466  void slotCancelJob(QString _jobId );
1467 
1469  void slotFinishJob(QString _jobId );
1470 
1472  void slotJobCancelRequested(QString _jobId);
1473 
1474  signals:
1475 
1476  void jobCanceled( QString _jobId );
1477 
1480  //===========================================================================
1483  //===========================================================================
1484 
1485  private slots:
1486 
1488  void newObject(int _objectId);
1489 
1491  void deletedObject(int _objectId);
1492 
1495  //===========================================================================
1498  //===========================================================================
1499 
1500  public slots:
1501 
1503  void exitApplication();
1504 
1510  void exitFailure();
1511 
1512  void finishSplash();
1513 
1514 
1517  private:
1523  bool checkOpenGLCapabilities();
1524 
1529  bool checkLibraryVersions();
1530 
1531  void hookUpEventFilter(QWidget *widget);
1532 
1533 
1534  private :
1535 
1538 
1541 
1543  std::vector<PluginLogger*> loggers_;
1544 
1546  std::vector<dataTypes> supportedDataTypes_;
1547 
1548  private :
1551 
1554 
1556  QSplashScreen* splash_;
1557 
1560 
1562  QVector<ViewMode*> viewModes_;
1563 
1565  QTimer* redrawTimer_;
1566 
1567  SpinBoxEventFilter spinBoxEventFilter_;
1568 
1569 
1570 };
1571 
1573 QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine);
1574 
1576 QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine);
1577 
1579 QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine);
1580 
1581 //=============================================================================
1582 #endif // MVIEWWIDGET_HH defined
1583 //=============================================================================
1584 
QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for sending output to a file.
Definition: scripting.cc:357
QStringList scriptingFunctions_
List of all registered scripting functions.
Definition: Core.hh:1308
QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine)
Function to print help about scripting functions.
Definition: scripting.cc:383
Predefined datatypes.
Definition: DataTypes.hh:96
std::vector< PluginInfo > plugins_
List of all loaded plugins_.
Definition: Core.hh:1208
int captureType_
Slot called everytime the view is updated.
Definition: Core.hh:910
Logtype
Log types for Message Window.
CoreWidget * coreWidget_
The main applications widget ( only created in gui mode )
Definition: Core.hh:1553
std::vector< dataTypes > supportedDataTypes_
Type-Plugins.
Definition: Core.hh:1546
QTimer videoTimer_
Slot called everytime the view is updated.
Definition: Core.hh:907
ProcessManagerWidget * processManager_
A job has been started by a plugin.
Definition: Core.hh:1446
prototypeMatrix4x4 matrix4x4Prototype_
Prototype for the Matrix type.
Definition: Core.hh:1320
prototypeVec4d vec4dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1314
QTextStream * logStream_
stream for logging to file
Definition: Core.hh:1177
int nextBackupId_
Id for the next backup.
Definition: Core.hh:1537
Interface class for type definitions.
std::vector< std::string > commandLineScriptNames_
Vector storing filenames from commandline to be opened after application startup (script files) ...
Definition: Core.hh:867
int lastHeight_
Slot called everytime the view is updated.
Definition: Core.hh:915
Update type class.
Definition: UpdateType.hh:70
QTime * redrawTime_
Holds the time since last redraw.
Definition: Core.hh:1432
QString splashMessage_
Last Splash message;.
Definition: Core.hh:1559
std::vector< ScriptingWrapper * > scriptingWrappers_
Wrappers for plugin scripting.
Definition: Core.hh:1305
QVector< ViewMode * > viewModes_
List of available draw modes.
Definition: Core.hh:1562
prototypeVec3d vec3dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1311
QList< SlotInfo > globalFunctions_
Core scripting engine.
Definition: Core.hh:1360
prototypeDataType DataTypePrototype_
Prototype for the DataType.
Definition: Core.hh:1317
SeparatorNode * dataRootNode_
Root Node for data objects.
Definition: Core.hh:1062
Definition: Core.hh:139
QTimer * scenegraphCheckTimer_
Timer that starts scenegraph check.
Definition: Core.hh:1429
QFile * logFile_
logfile
Definition: Core.hh:1180
BaseObject * objectRoot_
Pointer to the data rootNode;.
Definition: Core.hh:1550
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
QTime lastVideoTime_
Slot called everytime the view is updated.
Definition: Core.hh:908
int toolboxindex_
Index of Plugins toolbox widget.
Definition: Core.hh:1215
SeparatorNode * root_node_scenegraph_
Scenegraphs root node.
Definition: Core.hh:1049
SeparatorNode * dataSeparatorNode_
Toplevel Nodes for data objects.
Definition: Core.hh:1059
std::vector< PluginLogger * > loggers_
Logger interfaces between plugins and core logger.
Definition: Core.hh:1543
QScriptEngine scriptEngine_
Core scripting engine.
Definition: Core.hh:1302
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:192
SeparatorNode * core_nodes_
Separator Node holding all core scenegraph nodes.
Definition: Core.hh:1055
QList< JobInfo > currentJobs
A job has been started by a plugin.
Definition: Core.hh:1444
ACG::SceneGraph::CoordsysNode * coordsysNode_
Node for the coordinate system.
Definition: Core.hh:1068
int lastWidth_
Slot called everytime the view is updated.
Definition: Core.hh:914
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
QTimer * redrawTimer_
If enabled, this timer will block screen refresh if done more then 30 times per second.
Definition: Core.hh:1565
int nextBackupGroupId_
Id for the next backup group.
Definition: Core.hh:1540
QSplashScreen * splash_
SplashScreen, only used in gui mode.
Definition: Core.hh:1556
SeparatorNode * root_node_scenegraph_global_
Seperator node for global nodes.
Definition: Core.hh:1052
bool capture_
Slot called everytime the view is updated.
Definition: Core.hh:912
std::vector< std::pair< std::string, bool > > commandLineFileNames_
Vector storing filenames from commandline to be opened after application startup (objects) ...
Definition: Core.hh:864
QList< SlotInfo > coreSlots_
Core scripting engine.
Definition: Core.hh:1359
ACG::SceneGraph::MaterialNode * coordsysMaterialNode_
Node for coordsys Material.
Definition: Core.hh:1065
QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for core logger.
Definition: scripting.cc:339