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
45
46
47 //=============================================================================
48 //
49 // CLASS Core
50 //
51 //=============================================================================
52
58 #ifndef MVIEWWIDGET_HH
59 #define MVIEWWIDGET_HH
60
61
62 //== INCLUDES =================================================================
63
64 #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
65
66 // QT INCLUDES
67 #include <QVariant>
68 #include <QMainWindow>
69 #include <QToolBox>
70 #include <QStackedWidget>
71 #include <QSplashScreen>
72
73 #include <QDockWidget>
74 #include <QVector>
75 #include <QProgressDialog>
76
77 #include <QtScript/QScriptEngine>
78 #include <QtScript/QtScript>
79
80 #include "OpenFlipper/INIFile/INIFile.hh"
81
82 #include "OpenFlipper/Logging/PluginLogging.hh"
83 #include "OpenFlipper/Scripting/ScriptingWrapper.hh"
84
85 // Prototypes for scripting
86 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec3d.hh"
87 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec4d.hh"
88 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeMatrix4x4.hh"
89 #include "OpenFlipper/Scripting/scriptPrototypes/prototypeDataType.hh"
90 #include <OpenFlipper/Scripting/scriptWrappers/vec3dWrapper.hh>
91 #include <OpenFlipper/Scripting/scriptWrappers/vec4dWrapper.hh>
92 #include <OpenFlipper/Scripting/scriptWrappers/matrix4x4Wrapper.hh>
93 #include <OpenFlipper/Scripting/scriptWrappers/DataTypeWrapper.hh>
94 // #include <OpenFlipper/Scripting/scriptWrappers/ObjectIdWrapper.hh>
95
96 // Required Interface definition ( Some variables were defined there )
97 #include "OpenFlipper/BasePlugin/BaseInterface.hh"
98 #include "OpenFlipper/BasePlugin/FileInterface.hh"
99 #include "OpenFlipper/BasePlugin/TypeInterface.hh"
100 #include "OpenFlipper/BasePlugin/MenuInterface.hh"
101 #include "OpenFlipper/BasePlugin/InformationInterface.hh"
102 #include "OpenFlipper/BasePlugin/SelectionInterface.hh" // -> for SelectionInterface::PrimitiveType
103 #include "OpenFlipper/BasePlugin/ContextMenuInterface.hh"
104
105 #include <OpenFlipper/widgets/coreWidget/CoreWidget.hh>
106
107 // Process manager widget
108 #include <OpenFlipper/widgets/processManagerWidget/processManagerWidget.hh>
109
110 #include <OpenFlipper/common/GlobalOptions.hh>
111
112 #include <OpenFlipper/Core/PluginInfo.hh>
113
114 #include <ACG/Scenegraph/CoordsysNode.hh>
115
116 #include <OpenFlipper/threads/JobInfo.hh>
117
118 #include <OpenFlipper/common/InformationPlugins.hh>
119 #include "SpinBoxEventFilter.hh"
120
121 //== CLASS DEFINITION =========================================================
122
123
124 struct dataTypes {
125 QString name;
126 DataType type;
127 TypeInterface* plugin;
128 };
129
132 class Core : public QObject
133 {
134 Q_OBJECT
135
136 public:
137
139 Core();
140
141 void init();
142
144 ~Core();
145
147 bool add_sync_host(const QString& _name);
148
149
150 private slots:
151
153 void slotMouseEventIdentify( QMouseEvent* _event );
154
156 void slotMouseEventLight( QMouseEvent* _event );
157
158 protected:
159
160 //===========================================================================
163 //===========================================================================
164 signals:
166 void allCleared();
167
169 void signalObjectUpdated(int);
170
172 void signalObjectUpdated(int, const UpdateType&);
173
175 void PluginWheelEvent(QWheelEvent * , const std::string & );
176
178 void PluginMouseEvent(QMouseEvent* );
179
181 void PluginMouseEventLight( QMouseEvent* );
182
184 void objectSelectionChanged( int );
185
187 void pluginViewChanged();
188
190 void pluginSceneDrawn();
191
193 void addTexture( QString, QString , uint, int );
194
196 void addTexture( QString, QImage , uint, int );
197
199 void addTexture( QString, QString , uint );
200
202 void addTexture( QString, QImage , uint );
203
205 void addMultiTexture( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );
206
208 void addMultiTexture( QString _textureGroup , QString _name , QImage _image , int _id , int& _textureId );
209
211 void updateTexture( QString , int );
212
214 void updateAllTextures( );
215
217 void updatedTextures( QString , int );
218
220 void setTextureMode(QString _textureName ,QString _mode, int _id);
221
223 void setTextureMode(QString _textureName ,QString _mode);
224
226 void switchTexture( QString, int );
227
229 void switchTexture( QString );
230
232 void textureChangeImage( QString _textureName , QImage& _image );
233
235 void textureChangeImage( QString _textureName , QImage& _image , int _id );
236
238 void textureGetImage( QString _textureName , QImage& _image );
239
241 void textureGetImage( QString _textureName , QImage& _image , int _id );
242
244 void textureIndex( QString _textureName, int _id, int& _index);
245
247 void textureIndexPropertyName( int _id, QString& _propertyName);
248
250 void textureName( int _id, int _textureIndex, QString& _textureName);
251
253 void textureFilename( int _id, QString _textureName, QString& _textureFilename);
254
256 void getCurrentTexture( int _id, QString& _textureName );
257
259 void getSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
260
262 void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
263
265 void registerType(QString _handleName, DataType _type);
266
268 void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
269
271 void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
272 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
273 void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
274 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
275 DataType _objectTypeRestriction);
276
278 void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
279
281 void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
282
284 void selectionOperation(QString _operation);
285
287 void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
288
290 void showLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
291
293 void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
294
296 void showSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
297
299 void showSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
300
302 void showClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
303
305 void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
306
308 void showComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
309
311 void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
312
314 void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
315
317 void volumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
318
320 void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
321
323 void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
324
326 void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
327
329 void floodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
330
332 void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
333
335 void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
336
338 void getActiveDataTypes(SelectionInterface::TypeList& _types);
339
341 void getActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
342
344 void targetObjectsOnly(bool& _targetsOnly);
345
347 void loadSelection(const INIFile& _file);
348
350 void saveSelection(INIFile& _file);
351
353 void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
354
356 void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
357
359 void iniLoad( INIFile&, int );
360
362 void iniSave( INIFile& _ini ,int _id );
363
365 void iniSaveOptions( INIFile& _ini );
366
368 void iniLoadOptions( INIFile& _ini );
369
371 void iniLoadOptionsLast( INIFile& _ini );
372
374 void saveOnExit( INIFile& _ini );
375
377 void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
378 void createBackup( IdList _objectids, QString _name, std::vector<UpdateType> _types);
379
381 void undo(int _objectid);
382 void redo(int _objectid);
383 void undo();
384 void redo();
385
387 void aboutToRestore(int _objectId);
388
390 void restored( int _objectId);
391
393 void openedFile( int _id );
394
396 void emptyObjectAdded( int _id);
397
399 void pluginsInitialized();
400
402 void pluginsInitialized(QVector<QPair<QString, QString>> const&);
403
405 void visibilityChanged(int _id);
406
408 void objectPropertiesChanged( int _id );
409
411 void objectDeleted( int );
412
415 //===========================================================================
418 //===========================================================================
419 public slots :
420
422 void slotObjectUpdated(int _identifier, const UpdateType& _type = UPDATE_ALL);
423
424 private slots:
426 void slotVisibilityChanged(int _id);
427
429 void slotObjectPropertiesChanged( int _id );
430
432 void slotObjectSelectionChanged( int _id);
433
435 void slotAddPickMode( const std::string& _mode );
436
438 void slotAddHiddenPickMode( const std::string& _mode );
439
441 void slotAddTexture( QString _textureName , QString _filename , uint _dimension , int _id );
442
444 void slotAddTexture( QString _textureName , QImage _image , uint _dimension , int _id );
445
447 void slotAddTexture( QString _textureName , QString _filename , uint _dimension );
448
450 void slotAddTexture( QString _textureName , QImage _image , uint _dimension );
451
453 void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );
454 void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int* _textureId );
455
457 void slotMultiTextureAdded( QString _textureGroup , QString _name , QImage _image , int _id , int& _textureId );
458
460 void slotUpdateTexture( QString _name , int _identifier);
461
463 void slotUpdateAllTextures( );
464
466 void slotTextureUpdated( QString _textureName , int _identifier );
467
469 void slotSetTextureMode(QString _textureName ,QString _mode, int _id);
470
472 void slotSetTextureMode(QString _textureName ,QString _mode);
473
475 void slotSwitchTexture( QString _textureName, int _id );
476
478 void slotSwitchTexture( QString _textureName );
479
481 void slotTextureChangeImage( QString _textureName , QImage& _image );
482
484 void slotTextureChangeImage( QString _textureName , QImage& _image , int _id );
485
487 void slotTextureGetImage( QString _textureName , QImage& _image );
488
490 void slotTextureGetImage( QString _textureName , QImage& _image , int _id );
491
493 void slotTextureIndex( QString _textureName, int _id, int& _index);
494
496 void slotTextureIndexPropertyName( int _id, QString& _propertyName);
497
499 void slotTextureName( int _id, int _textureIndex, QString& _textureName);
500
502 void slotTextureFilename( int _id, QString _textureName, QString& _textureFilename);
503
505 void slotGetCurrentTexture( int _id, QString& _textureName );
506
508 void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
509
511 void slotLoad(QString _filename, DataType _type, int& _id);
512
514 void slotLoad(QStringList _filenames, IdList _pluginIDs);
515
517 void slotFileOpened ( int _id );
518
520 void slotEmptyObjectAdded ( int _id );
521
523 void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
524
526 void slotRegisterType(QString _handleName, DataType _type);
527
529 void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
530
540 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
541 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
542
553 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
554 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
555 DataType _objectTypeRestriction);
556
558 void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
559
561 void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
562
564 void slotSelectionOperation(QString _operation);
565
567 void slotShowToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
568
570 void slotShowLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
571
573 void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
574
576 void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
577
579 void slotShowSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
580
582 void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
583
585 void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
586
588 void slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
589
591 void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
592
594 void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
595
597 void slotVolumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
598
600 void slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
601
603 void slotSphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
604
606 void slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
607
609 void slotFloodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
610
612 void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
613
615 void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
616
618 void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);
619
621 void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
622
624 void slotTargetObjectsOnly(bool& _targetsOnly);
625
627 void slotLoadSelection(const INIFile& _file);
628
630 void slotSaveSelection(INIFile& _file);
631
633 void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
634
636 void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
637
645 void slotGetAllFilters ( QStringList& _list);
646
647
649 void slotDeleteAllObjects( );
650
652 void slotCrossPluginConnect( QString _pluginName1, const char* _signal, QString _pluginName2, const char* _slot);
653
655 void slotCrossPluginConnectQueued( QString _pluginName1, const char* _signal, QString _pluginName2, const char* _slot);
656
658 void slotSetRenderer(unsigned int _viewer, QString _rendererName);
659
661 void slotGetCurrentRenderer(unsigned int _viewer, QString& _rendererName);
662
664 // void slotGetPlugin(QString _name, QObject* & _plugin );
665
668 //===========================================================================
671 //===========================================================================
672 public slots:
673
675 void updateView();
676
678 void blockScenegraphUpdates(bool _block);
679
681 void updateUI();
682
684 void clearAll();
685
687 void deleteObject( int _id );
688
689 void setObjectComment(int objId, QString key, QString comment);
690 void clearObjectComment(int objId, QString key);
691 void clearAllComments(int objId);
692
694 void fullscreen( bool _state );
695
697 void showViewModeControls( bool _show );
698
700 void loggerState(int _state);
701
703 void enableOpenMeshErrorLog(bool _state);
704
706 void showToolbox( bool _state );
707
709 void showStatusBar( bool _state );
710
712 void multiViewMode( int _mode );
713
715 void restrictFrameRate( bool _enable );
716
718 void setMaxFrameRate( int _rate );
719
722 void snapshotBaseFileName(QString _fname, unsigned int _viewerId = 0);
723
725 void snapshotFileType(QString _type, unsigned int _viewerId = 0);
726
728 void snapshotCounterStart(const int _counter, unsigned int _viewerId = 0);
729
735 void snapshot(unsigned int _viewerId = 0, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int _numSamples = 1);
736
738 void applicationSnapshot();
739
741 void applicationSnapshotName(QString _name);
742
744 void viewerSnapshot();
745
747 void viewerSnapshot(QString file_name, bool store_comments,
748 bool comments_visible_only, bool comments_targeted_only,
749 bool store_material_info, int snapshot_width, int snapshot_height,
750 bool snapshot_transparent, bool hide_coord_sys,
751 int snapshot_multisampling, bool store_view);
752
754 void resizeViewers(int _width, int _height );
755
757 void resizeApplication(int _width, int _height );
758
760 void writeVersionNumbers(QString _filename);
761
763 QList<int> objectList (QString _selection, QStringList _types);
764
766 void blockSceneGraphUpdates();
767
769 void unblockSceneGraphUpdates();
770
771 void setView(QString view);
772 void setViewAndWindowGeometry(QString view);
773
776 //===========================================================================
779 //===========================================================================
780
781 public slots:
787 void addViewModeToolboxes(QString _modeName, QString _toolboxList);
788
795 void addViewModeToolbars(QString _modeName, QString _toolbarList);
796
802 void addViewModeContextMenus(QString _modeName, QString _contextMenuList);
803
808 void addViewModeIcon(QString _modeName, QString _iconName);
809
814 void setToolBoxSide(QString _side);
815
821 void setToolBoxActive(QString _toolBoxName, bool _active);
822
825 //===========================================================================
828 //===========================================================================
829 public slots:
838 int loadObject ( QString _filename );
839
840 private slots:
841 void loadObjectFinished(QString _filename);
842
847 void resetScenegraph( bool _resetTrackBall );
848
849 public :
850
862 void commandLineOpen(const QString& _filename, bool _asPolyMesh );
863
874 void commandLineScript(const QString& _filename );
875
876 private slots:
877
884 void slotExecuteAfterStartup();
885
886 private:
888 std::vector< std::pair < QString , bool > > commandLineFileNames_;
889
891 std::vector< QString > commandLineScriptNames_;
892
893 public:
894
898 int addEmptyObject( DataType _type );
899
907 int loadObject( DataType _type, QString _filename);
908
911 //===========================================================================
914 //===========================================================================
915 private slots:
917 void viewUpdated();
918
920 void captureVideo();
921
922 public slots:
923
925 void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
926
928 void stopVideoCapture();
929
930 private:
931 QTimer videoTimer_;
932 QTime lastVideoTime_;
933
934 int captureType_;
935
936 bool capture_;
937
938 int lastWidth_;
939 int lastHeight_;
940
942 //===========================================================================
945 //===========================================================================
946
947 public slots:
948
952 bool saveObject( int _id, QString _filename );
953
954 void saveObject( int _id, QString _filename, int _pluginID );
955
956 void saveObjects( IdList _ids, QString _filename, int _pluginID );
957
962 bool saveObjectTo( int _id, QString _filename );
963
964 bool saveObjectsTo( IdList _ids, QString _filename );
965
967 void saveAllObjects();
968
970 void saveAllObjectsTo();
971
973 void saveSettings();
974
976 void saveSettings(QString filePath, bool is_saveObjectInfo, bool is_targetOnly, bool is_saveAll,
977 bool is_askOverwrite, bool is_saveProgramSettings, bool is_savePluginSettings);
978
980 void loadObject();
981
983 void loadSettings();
984
986 void loadSettings(QString _filename);
987
989 int getObjectId(QString _filename);
990
996 void deserializeMaterialProperties(int _objId, QString _props);
997
1003 QString serializeMaterialProperties(int _objId);
1004
1007 //===========================================================================
1010 //===========================================================================
1011 private slots :
1012
1014 void slotMouseEvent( QMouseEvent* _event );
1015
1017 void slotWheelEvent( QWheelEvent * _event, const std::string & _mode);
1018
1023 void slotAddEmptyObjectMenu();
1024
1026 void slotAddEmptyObject( DataType _type , int& _id );
1027 void slotAddEmptyObject( DataType _type, int* _id);
1028
1030 void slotCopyObject( int _oldId , int& _newId );
1031
1033 void slotExit();
1034
1036 void slotRecentOpen(QAction* _action);
1037
1039 void slotGenerateBackup( int _id, QString _name, UpdateType _type );
1040
1041 public slots:
1042
1044 void addToolbox(QString _name ,QWidget* _widget);
1045
1047 void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon);
1048
1050 void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon,
1051 QWidget* _headerAreaWidget);
1052
1060 QWidget *getToolbox(QString _pluginName, QString _toolboxName);
1061
1068 void activateToolbox(QString _pluginName, QString _toolboxName, bool activate);
1069
1070 private :
1071
1072 //===========================================================================
1075 //===========================================================================
1076
1077 private:
1079 SeparatorNode* root_node_scenegraph_;
1080
1082 SeparatorNode* root_node_scenegraph_global_;
1083
1085 SeparatorNode* core_nodes_;
1086
1087
1089 SeparatorNode* dataSeparatorNode_;
1090
1092 SeparatorNode* dataRootNode_;
1093
1095 ACG::SceneGraph::MaterialNode* coordsysMaterialNode_;
1096
1098 ACG::SceneGraph::CoordsysNode* coordsysNode_;
1099
1102 //===========================================================================
1105 //===========================================================================
1106
1108 void setupOptions();
1109
1111 void readGUIOptions(INIFile& _ini);
1112
1114 void readApplicationOptions(INIFile& _ini);
1115
1117 void writeApplicationOptions(INIFile& _ini);
1118
1120 void restoreKeyBindings();
1121
1122 public slots:
1123
1125 void saveOptions();
1126
1128 void applyOptions();
1129
1140 void openIniFile( QString _filename,
1141 bool _coreSettings ,
1142 bool _perPluginSettings,
1143 bool _loadObjects );
1144
1145 private:
1146
1159 void writeIniFile( QString _filename,
1160 bool _relativePaths,
1161 bool _targetOnly,
1162 bool _saveSystemSettings,
1163 bool _savePluginSettings ,
1164 bool _saveObjectInfo,
1165 std::map<int,QString>& _fileMapping);
1166
1171 void writeObjFile(QString _filename, bool _relativePaths, bool _targetOnly, std::map<int,QString>& _fileMapping);
1172
1174 void writeOnExit();
1175
1179 //===========================================================================
1182 //===========================================================================
1183
1184 signals:
1186 void log(Logtype _type , QString _message );
1187
1189 void log(QString _message );
1190
1192 void scriptLog(QString _message);
1193
1195 void externalLog(Logtype _type , QString _message);
1196
1197 private slots:
1198
1200 void slotLog(Logtype _type, QString _message);
1201
1203 void slotLogToFile(Logtype _type, QString _message);
1204
1205 private:
1207 QTextStream* logStream_;
1208
1210 QFile* logFile_;
1211
1212 public :
1213 void scriptLogFunction( QString _output);
1214
1218 //===========================================================================
1221 //===========================================================================
1222
1223 private :
1225 bool checkSlot(QObject* _plugin , const char* _slotSignature);
1226
1228 bool checkSignal(QObject* _plugin , const char* _signalSignature);
1229
1232 //===========================================================================
1235 //===========================================================================
1236
1237 public :
1238 std::vector<PluginInfo>& plugins();
1239
1240 private:
1241
1243 int toolboxindex_;
1244
1246 void loadPlugins();
1247
1249 void printPluginLoadLog(const QString& errors,const QString& warnings);
1250
1251 private slots:
1253 void slotShowPlugins();
1254
1256 void loadPlugin(const QString& _filename,const bool _silent, QString& _licenseErrors , QObject* _plugin = 0 );
1257
1259 void slotLoadPlugin();
1260
1262 void slotBlockPlugin(const QString &_rpcName);
1263
1265 void slotUnBlockPlugin(const QString &_rpcName);
1266
1269 //===========================================================================
1272 //===========================================================================
1273 signals:
1274 void genericMetadataDeserialized(QString key, QString value);
1275 void objectMetadataDeserialized(QString object_name, QString value);
1276 void objectMetadataDeserializedJson(
1277 QString object_name, QJsonDocument value);
1278
1279 private slots:
1280 void slotMetadataDeserialized( const QVector<QPair<QString, QString> > &data);
1281
1285 //===========================================================================
1288 //===========================================================================
1289
1290 signals:
1291
1292 void scriptInfo( QString _pluginName , QString _functionName );
1293
1294 void executeScript( QString _script );
1295
1296 void executeFileScript( QString _filename );
1297
1298 void setSlotDescription(QString _slotName, QString _slotDescription,
1299 QStringList _parameters, QStringList _descriptions);
1300
1301 public slots:
1309 void createWidget(QString _objectName, QString _uiFilename, bool _show = true);
1310
1312 void setViewMode(QString _viewMode);
1313
1315 QString getCurrentViewMode();
1316
1318 void setViewModeIcon(QString _mode, QString _iconName);
1319
1321 void moveToolBoxToTop(QString _name);
1322
1324 void moveToolBoxToBottom(QString _name);
1325
1326 void showReducedMenuBar(bool reduced);
1327
1332 void executePythonScriptFile(QString _filename);
1333
1338 void executePythonScript(QString _script);
1339
1340 private :
1342 QScriptEngine scriptEngine_;
1343
1345 std::vector<ScriptingWrapper*> scriptingWrappers_;
1346
1348 QStringList scriptingFunctions_;
1349
1351 prototypeVec3d vec3dPrototype_;
1352
1354 prototypeVec4d vec4dPrototype_;
1355
1357 prototypeDataType DataTypePrototype_;
1358
1360 prototypeMatrix4x4 matrix4x4Prototype_;
1361
1362
1363 private slots:
1364 void slotScriptInfo( QString _pluginName , QString _functionName );
1365
1366
1371 void slotExecuteScript( QString _script );
1372
1377 void slotExecuteFileScript( QString _filename );
1378
1379 void slotGetScriptingEngine( QScriptEngine*& _engine );
1380
1381 void slotGetAllAvailableFunctions( QStringList& _functions );
1382
1384 void slotSetSlotDescription(QString _slotName, QString _slotDescription,
1385 QStringList _parameters, QStringList _descriptions);
1386
1388 void slotSetSlotDescriptionGlobalFunction(QString _functionName, QString _slotDescription,
1389 QStringList _parameters, QStringList _descriptions);
1390
1391
1392 void slotScriptError(const QScriptValue &error);
1393
1394 public slots:
1395
1397 void slotGetDescription(QString _function, QString& _fnDescription,
1398 QStringList& _parameters, QStringList& _descriptions );
1399
1400 private:
1401
1402 QList< SlotInfo > coreSlots_;
1403 QList< SlotInfo > globalFunctions_;
1404
1405 void setDescriptions();
1406
1409 //===========================================================================
1412 //===========================================================================
1413 private slots:
1414
1420 void slotPluginExists( QString _pluginName , bool& _exists );
1421
1428 void slotFunctionExists( QString _pluginName , QString _functionName , bool& _exists );
1429
1436 void slotCall( QString _pluginName , QString _functionName , bool& _success );
1437
1443 void slotCall( QString _expression , bool& _success );
1444
1455 void slotGetValue(QString _expression, QVariant& _result );
1456
1459 //===========================================================================
1462 //===========================================================================
1463
1464 private slots:
1465
1467 void checkScenegraphDirty();
1468
1469 private:
1470
1472 QTimer *scenegraphCheckTimer_;
1473
1475 QTime *redrawTime_;
1476
1480 //===========================================================================
1483 //===========================================================================
1484
1485 private:
1486
1487 QList< JobInfo > currentJobs;
1488
1489 ProcessManagerWidget* processManager_;
1490
1492 bool getJob(QString _jobId, int& _index);
1493
1494 private slots:
1495
1497 void slotStartJob( QString _jobId, QString _description , int _min , int _max,bool _blocking );
1498
1500 void slotSetJobState(QString _jobId, int _value );
1501
1503 void slotSetJobName(QString _jobId, QString _name );
1504
1506 void slotSetJobDescription(QString _jobId, QString _text );
1507
1509 void slotCancelJob(QString _jobId );
1510
1512 void slotFinishJob(QString _jobId );
1513
1515 void slotJobCancelRequested(QString _jobId);
1516
1517 signals:
1518
1519 void jobCanceled( QString _jobId );
1520
1523 //===========================================================================
1526 //===========================================================================
1527
1528 private slots:
1529
1531 void newObject(int _objectId);
1532
1534 void deletedObject(int _objectId);
1535
1538 //===========================================================================
1541 //===========================================================================
1542
1543 public slots:
1544
1546 void exitApplication();
1547
1553 void exitFailure();
1554
1555 void finishSplash();
1556
1557
1560 private:
1566 bool checkOpenGLCapabilities();
1567
1572 bool checkLibraryVersions();
1573
1574 void hookUpEventFilter(QWidget *widget);
1575
1576
1577 private :
1578
1580 int nextBackupId_;
1581
1583 int nextBackupGroupId_;
1584
1586 std::vector<PluginLogger*> loggers_;
1587
1589 std::vector<dataTypes> supportedDataTypes_;
1590
1591 private :
1593 BaseObject* objectRoot_;
1594
1596 CoreWidget* coreWidget_;
1597
1599 QSplashScreen* splash_;
1600
1602 QString splashMessage_;
1603
1605 QVector<ViewMode*> viewModes_;
1606
1608 QTimer* redrawTimer_;
1609
1610 SpinBoxEventFilter spinBoxEventFilter_;
1611
1612
1613 };
1614
1616 QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine);
1617
1619 QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine);
1620
1622 QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine);
1623
1624 //=============================================================================
1625 #endif // MVIEWWIDGET_HH defined
1626 //=============================================================================
1627
Core::toolboxindex_
int toolboxindex_
Index of Plugins toolbox widget.
Definition: Core.hh:1243
Core::capture_
bool capture_
Slot called everytime the view is updated.
Definition: Core.hh:936
Core::commandLineFileNames_
std::vector< std::pair< QString, bool > > commandLineFileNames_
Vector storing filenames from commandline to be opened after application startup (objects) ...
Definition: Core.hh:888
Core::scriptingFunctions_
QStringList scriptingFunctions_
List of all registered scripting functions.
Definition: Core.hh:1348
CoreWidget
Definition: CoreWidget.hh:279
Core::scriptingWrappers_
std::vector< ScriptingWrapper * > scriptingWrappers_
Wrappers for plugin scripting.
Definition: Core.hh:1345
prototypeMatrix4x4
Definition: prototypeMatrix4x4.hh:70
UpdateType
Update type class.
Definition: UpdateType.hh:60
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
Core::coordsysNode_
ACG::SceneGraph::CoordsysNode * coordsysNode_
Node for the coordinate system.
Definition: Core.hh:1098
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
printToFileFunction
QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for sending output to a file.
Definition: scripting.cc:354
Core::dataSeparatorNode_
SeparatorNode * dataSeparatorNode_
Toplevel Nodes for data objects.
Definition: Core.hh:1089
Core::processManager_
ProcessManagerWidget * processManager_
A job has been started by a plugin.
Definition: Core.hh:1489
Core::logStream_
QTextStream * logStream_
stream for logging to file
Definition: Core.hh:1207
Core::lastWidth_
int lastWidth_
Slot called everytime the view is updated.
Definition: Core.hh:938
Core::root_node_scenegraph_
SeparatorNode * root_node_scenegraph_
Scenegraphs root node.
Definition: Core.hh:1079
InformationInterface.hh
Core::splash_
QSplashScreen * splash_
SplashScreen, only used in gui mode.
Definition: Core.hh:1599
Core::DataTypePrototype_
prototypeDataType DataTypePrototype_
Prototype for the DataType.
Definition: Core.hh:1357
TypeInterface
Interface class for type definitions.
Definition: TypeInterface.hh:63
Core
Definition: Core.hh:132
Core::dataRootNode_
SeparatorNode * dataRootNode_
Root Node for data objects.
Definition: Core.hh:1092
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:338
Core::coreWidget_
CoreWidget * coreWidget_
The main applications widget ( only created in gui mode )
Definition: Core.hh:1596
Core::lastVideoTime_
QTime lastVideoTime_
Slot called everytime the view is updated.
Definition: Core.hh:932
MenuInterface.hh
Core::scriptEngine_
QScriptEngine scriptEngine_
Core scripting engine.
Definition: Core.hh:1342
CoreWidget.hh
GlobalOptions.hh
Core::globalFunctions_
QList< SlotInfo > globalFunctions_
Core scripting engine.
Definition: Core.hh:1403
BaseInterface.hh
Core::core_nodes_
SeparatorNode * core_nodes_
Separator Node holding all core scenegraph nodes.
Definition: Core.hh:1085
Core::objectRoot_
BaseObject * objectRoot_
Pointer to the data rootNode;.
Definition: Core.hh:1593
Core::splashMessage_
QString splashMessage_
Last Splash message;.
Definition: Core.hh:1602
Core::videoTimer_
QTimer videoTimer_
Slot called everytime the view is updated.
Definition: Core.hh:931
Core::redrawTimer_
QTimer * redrawTimer_
If enabled, this timer will block screen refresh if done more then 30 times per second.
Definition: Core.hh:1608
Core::logFile_
QFile * logFile_
logfile
Definition: Core.hh:1210
Core::lastHeight_
int lastHeight_
Slot called everytime the view is updated.
Definition: Core.hh:939
ContextMenuInterface.hh
myPrintFunction
QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for core logger.
Definition: scripting.cc:336
IdList
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:179
dataTypes
Definition: Core.hh:124
Core::captureType_
int captureType_
Slot called everytime the view is updated.
Definition: Core.hh:934
Core::matrix4x4Prototype_
prototypeMatrix4x4 matrix4x4Prototype_
Prototype for the Matrix type.
Definition: Core.hh:1360
FileInterface.hh
prototypeVec4d
Definition: prototypeVec4d.hh:85
Core::coordsysMaterialNode_
ACG::SceneGraph::MaterialNode * coordsysMaterialNode_
Node for coordsys Material.
Definition: Core.hh:1095
Core::nextBackupGroupId_
int nextBackupGroupId_
Id for the next backup group.
Definition: Core.hh:1583
Core::redrawTime_
QTime * redrawTime_
Holds the time since last redraw.
Definition: Core.hh:1475
SelectionInterface.hh
ACG::SceneGraph::CoordsysNode
Definition: CoordsysNode.hh:82
Core::loggers_
std::vector< PluginLogger * > loggers_
Logger interfaces between plugins and core logger.
Definition: Core.hh:1586
helpFunction
QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine)
Function to print help about scripting functions.
Definition: scripting.cc:380
TypeInterface.hh
ProcessManagerWidget
Definition: processManagerWidget.hh:71
Core::currentJobs
QList< JobInfo > currentJobs
A job has been started by a plugin.
Definition: Core.hh:1487
DataType
Predefined datatypes.
Definition: DataTypes.hh:83
SpinBoxEventFilter
Definition: SpinBoxEventFilter.hh:49
BaseObject
Definition: BaseObject.hh:82
Core::vec3dPrototype_
prototypeVec3d vec3dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1351
Core::supportedDataTypes_
std::vector< dataTypes > supportedDataTypes_
Type-Plugins.
Definition: Core.hh:1589
Core::vec4dPrototype_
prototypeVec4d vec4dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1354
Core::root_node_scenegraph_global_
SeparatorNode * root_node_scenegraph_global_
Seperator node for global nodes.
Definition: Core.hh:1082
Core::viewModes_
QVector< ViewMode * > viewModes_
List of available draw modes.
Definition: Core.hh:1605
prototypeVec3d
Definition: prototypeVec3d.hh:86
Core::scenegraphCheckTimer_
QTimer * scenegraphCheckTimer_
Timer that starts scenegraph check.
Definition: Core.hh:1472
Core::commandLineScriptNames_
std::vector< QString > commandLineScriptNames_
Vector storing filenames from commandline to be opened after application startup (script files) ...
Definition: Core.hh:891
prototypeDataType
Definition: prototypeDataType.hh:53
ACG::SceneGraph::SeparatorNode
Definition: SeparatorNode.hh:78
INIFile
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
Core::nextBackupId_
int nextBackupId_
Id for the next backup.
Definition: Core.hh:1580
Core::coreSlots_
QList< SlotInfo > coreSlots_
Core scripting engine.
Definition: Core.hh:1402