itom  4.1.0
uiOrganizer.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef UIORGANIZER_H
24 #define UIORGANIZER_H
25 
26 //#include "../python/pythonQtConversion.h"
27 #include "../python/pythonItomMetaObject.h"
28 
29 #include <qwidget.h>
30 
31 #include "../common/sharedStructuresQt.h"
32 #include "../common/functionCancellationAndObserver.h"
33 
34 #include "../DataObject/dataobj.h"
35 #if ITOM_POINTCLOUDLIBRARY > 0
36 #include "../../PointCloud/pclStructures.h"
37 #endif
38 
39 #include "../widgets/userUiDialog.h"
40 #include "../widgets/figureWidget.h"
41 
42 #include "../global.h"
43 #include "../common/sharedStructuresGraphics.h"
44 #include "../common/addInInterface.h"
45 #include "../common/shape.h"
46 
47 #include "../../plot/AbstractFigure.h"
48 
49 #include <qmap.h>
50 #include <qsharedpointer.h>
51 #include <qstring.h>
52 #include <qvariant.h>
53 #include <qhash.h>
54 #include <qtimer.h>
55 #include <qfiledialog.h>
56 #include <qmainwindow.h>
57 #include <qthread.h>
58 #include <qtranslator.h>
59 #include <qpoint.h>
60 #include <qsize.h>
61 
62 class QUiLoader; //forward declaration
63 
64 namespace ito
65 {
66 class WidgetWrapper; //forward declaration
67 class TimerModel; //forward declaration
68 
75 {
76 public:
77  enum tUiType
78  {
79  uiTypeUiDialog = 0x0001,
80  uiTypeQDialog = 0x0002,
81  uiTypeQMainWindow = 0x0003,
82  uiTypeQDockWidget = 0x0004,
83  uiTypeFigure = 0x0005,
84  uiTypeWidget = 0x0006
85  };
86 
88 
93  UiContainer(UserUiDialog *uiDialog) :
94  m_type(uiTypeUiDialog)
95  {
96  m_weakDialog = QPointer<QWidget>(uiDialog);
97  }
98 
100 
105  UiContainer(QDialog *dialog) :
106  m_type(uiTypeQDialog)
107  {
108  m_weakDialog = QPointer<QDialog>(dialog);
109  }
110 
112 
117  UiContainer(QMainWindow *mainWindow) :
118  m_type(uiTypeQMainWindow)
119  {
120  m_weakDialog = QPointer<QWidget>(mainWindow);
121  }
122 
124 
129  UiContainer(FigureWidget *figureWidget) :
130  m_type(uiTypeFigure)
131  {
132  m_weakDialog = QPointer<QWidget>(figureWidget);
133  }
134 
136 
141  UiContainer(QDockWidget *dockWidget) :
142  m_type(uiTypeQDockWidget)
143  {
144  m_weakDialog = QPointer<QWidget>(dockWidget);
145  }
146 
148 
154  UiContainer(QWidget *widget, tUiType type) :
155  m_type(type)
156  {
157  m_weakDialog = QPointer<QWidget>(widget);
158  }
159 
162  {
163  m_weakDialog = QPointer<QWidget>(cpy.getUiWidget());
164  m_type = cpy.m_type;
165  }
166 
167 
168  ~UiContainer(); //comment in source file
169 
170 
172  inline UserUiDialog *getUiDialog() const
173  {
174  if(m_type == uiTypeUiDialog)
175  {
176  if(m_weakDialog.isNull()) return NULL;
177  return qobject_cast<UserUiDialog*>(m_weakDialog.data());
178  }
179  return NULL;
180  }
181 
183 
187  inline QWidget *getUiWidget() const
188  {
189  if(m_weakDialog.isNull()) return NULL;
190  return m_weakDialog.data();
191  }
192 
194  inline tUiType getType() const { return m_type; }
195 
196 private:
197  QPointer<QWidget> m_weakDialog;
199 };
200 
202 {
203 public:
204  UiContainerItem() : container(NULL) {}
205 
206  UiContainerItem(const UiContainerItem &cpy)
207  {
208  guardedHandle = cpy.guardedHandle;
209  container = cpy.container;
210  }
211 
212  QWeakPointer< unsigned int > guardedHandle;
213  UiContainer *container;
214 };
215 
217 {
218 private:
219  ito::ParamBase::Type m_dataType;
220  QSharedPointer<ito::DataObject> m_dObjPtr;
221 #if ITOM_POINTCLOUDLIBRARY > 0
222  QSharedPointer<ito::PCLPointCloud> m_dPCPtr;
223  QSharedPointer<ito::PCLPolygonMesh> m_dPMPtr;
224 #endif
225 
226 public:
227  UiDataContainer() : m_dataType(ito::ParamBase::DObjPtr) {};
228  ~UiDataContainer() {};
229  UiDataContainer(const QSharedPointer<ito::DataObject> &sharedDataObject) : m_dataType(ito::ParamBase::DObjPtr), m_dObjPtr(sharedDataObject) {}
230 #if ITOM_POINTCLOUDLIBRARY > 0
231  UiDataContainer(const QSharedPointer<ito::PCLPointCloud> &sharedPointCloud) : m_dataType(ito::ParamBase::PointCloudPtr), m_dPCPtr(sharedPointCloud) {}
232  UiDataContainer(const QSharedPointer<ito::PCLPolygonMesh> &sharedPolygonMesh) : m_dataType(ito::ParamBase::PolygonMeshPtr), m_dPMPtr(sharedPolygonMesh) {}
233 
234  inline UiDataContainer & operator = (QSharedPointer<ito::PCLPointCloud> sharedPointCloud)
235  {
236  m_dataType = ito::ParamBase::PointCloudPtr;
237  m_dPCPtr = sharedPointCloud;
238  m_dObjPtr.clear();
239  m_dPMPtr.clear();
240  return *this;
241  }
242 
243  inline UiDataContainer & operator = (QSharedPointer<ito::PCLPolygonMesh> sharedPolygonMesh)
244  {
245  m_dataType = ito::ParamBase::PolygonMeshPtr;
246  m_dPMPtr = sharedPolygonMesh;
247  m_dObjPtr.clear();
248  m_dPCPtr.clear();
249  return *this;
250  }
251 #endif
252 
253  inline UiDataContainer & operator = (QSharedPointer<ito::DataObject> sharedDataObject)
254  {
255  m_dataType = ito::ParamBase::DObjPtr;
256  m_dObjPtr = sharedDataObject;
257 #if ITOM_POINTCLOUDLIBRARY > 0
258  m_dPCPtr.clear();
259  m_dPMPtr.clear();
260 #endif
261  return *this;
262  }
263 
264  inline ito::ParamBase::Type getType() const { return m_dataType; }
265  inline QSharedPointer<ito::DataObject> getDataObject() const { return m_dObjPtr; }
266 #if ITOM_POINTCLOUDLIBRARY > 0
267  inline QSharedPointer<ito::PCLPointCloud> getPointCloud() const { return m_dPCPtr; }
268  inline QSharedPointer<ito::PCLPolygonMesh> getPolygonMesh() const { return m_dPMPtr; }
269 #endif
270 };
271 
273 {
274  enum Type {TypeClassInfo, TypeSlot, TypeSignal, TypeProperty, TypeEnum, TypeFlag, TypeInheritance};
275  ClassInfoContainer(Type type, const QString &name, const QString &shortDescription = "", const QString &description = "") :
276  m_type(type), m_name(name), m_shortDescription(shortDescription), m_description(description)
277  {
278  if (m_description == "")
279  {
280  m_description = m_shortDescription;
281  }
282  }
283 
284  Type m_type;
285  QString m_name;
286  QString m_shortDescription;
287  QString m_description;
288 };
289 
290 } // namespace ito
291 
292 QT_BEGIN_NAMESPACE
293 template <>
294 class QT_DEPRECATED_X("Use std::less") qLess<ito::ClassInfoContainer>
295 {
296 public:
297  inline bool operator()(const ito::ClassInfoContainer &t1, const ito::ClassInfoContainer &t2) const
298  {
299  return (t1.m_name < t2.m_name);
300  }
301 };
302 QT_END_NAMESPACE
303 
304 namespace ito {
305 
306 class UiOrganizer : public QObject
307 {
308  Q_OBJECT
309 public:
311  {
312  propValid = 0x0001,
313  propConstant = 0x0002,
314  propFinal = 0x0004,
315  propReadable = 0x0008,
316  propWritable = 0x0010,
317  propResettable = 0x0020
318  };
319 
321  {
322  errorUiHandleInvalid = 0x1001,
323  errorObjDoesNotExist = 0x1002,
324  errorObjPropWrite = 0x1003,
325  errorObjPropRead = 0x1004,
326  errorObjPropDoesNotExist = 0x1005,
327  errorUnregisteredType = 0x1006,
328  errorSlotDoesNotExist = 0x1007,
329  errorSignalDoesNotExist = 0x1008,
330  errorConnectionError = 0x1009
331  };
332 
333  enum tWinType
334  {
335  typeDialog = 0x0000,
336  typeMainWindow = 0x0001,
337  typeDockWidget = 0x0002,
338  typeCentralWidget = 0x0003
339  };
340 
341  enum tObjectInfo
342  {
343  infoShowNoInheritance = 0x0001,
344  infoShowItomInheritance = 0x0002,
345  infoShowInheritanceUpToWidget = 0x0004,
346  infoShowAllInheritance =0x0008
347  };
348 
349  typedef QList<ClassInfoContainer> ClassInfoContainerList;
350 
351  UiOrganizer(ito::RetVal &retval);
352  ~UiOrganizer();
353 
354  void showDialog(QWidget *parent);
355  inline QObject *getPluginReference(unsigned int objectID) { return getWeakObjectReference(objectID); }
356 
357  static inline void parseUiDescription(int uiDescription, int* uiType = NULL, int* buttonBarType = NULL, bool* childOfMainWindow = NULL, bool* deleteOnClose = NULL, int* dockWidgetArea = NULL)
358  {
359  if(uiType) *uiType = (uiDescription & 0x000000FF); //bits 1-8
360  if(buttonBarType) *buttonBarType = ((uiDescription & 0x0000FF00) >> 8); //bits 9-16
361  if(childOfMainWindow) *childOfMainWindow = ((uiDescription & 0x000F0000) > 0); //bits 17-20
362  if(deleteOnClose) *deleteOnClose = ((uiDescription & 0x00F00000) > 0); //bits 21-24
363  if(dockWidgetArea) *dockWidgetArea = ((uiDescription & 0xFF000000) >> 24); //bits 25-32
364  }
365 
366  static inline int createUiDescription(int uiType, int buttonBarType, bool childOfMainWindow, bool deleteOnClose, int dockWidgetArea)
367  {
368  int v = uiType & 0x000000FF; //bits 1-8
369  v += (buttonBarType << 8); //bits 9-16
370  if(childOfMainWindow) v += (1 << 16); //bits 17-24
371  if(deleteOnClose) v+= (1 << 20); //bits 21-24
372  v += (dockWidgetArea << 24); //bits 25-32
373 
374  return v;
375  }
376 
377  RetVal getNewPluginWindow(const QString &pluginName, unsigned int &objectID, QWidget** newWidget, QWidget *parent = NULL);
378 
379  QWidget* loadDesignerPluginWidget(const QString &name, RetVal &retValue, AbstractFigure::WindowMode winMode, QWidget *parent = NULL);
380 
381  QWidget* createWidget(const QString &className, RetVal &retValue, QWidget *parent = NULL, const QString &objectName = QString());
382 
384  QWidget* loadUiFile(const QString &filename, RetVal &retValue, QWidget *parent = NULL, const QString &objectNameSuffix = QString());
385 
386  TimerModel* getTimerModel() const;
387 
388 protected:
389 
390  //static void threadSafeDeleteUi(unsigned int *handle);
391 
392  void startGarbageCollectorTimer();
393 
394  RetVal addWidgetToOrganizer(QWidget *widget, int uiDescription, const StringMap &dialogButtons,
395  QSharedPointer<unsigned int>dialogHandle,
396  QSharedPointer<unsigned int> objectID,
397  QSharedPointer<QByteArray> className);
398 
399 private:
400  void execGarbageCollection();
401 
402  unsigned int addObjectToList(QObject* objPtr);
403  QObject *getWeakObjectReference(unsigned int objectID);
404 
405  QByteArray getReadableMethodSignature(const QMetaMethod &method, bool pythonNotCStyle, QByteArray *methodName = NULL, bool *valid = NULL);
406  QByteArray getReadableParameter(const QByteArray &parameter, bool pythonNotCStyle, bool *valid = NULL);
407  ito::UiOrganizer::ClassInfoContainerList::Iterator parseMetaPropertyForEnumerationTypes(const QMetaProperty &meth, ClassInfoContainerList &currentPropList);
408 
409  void timerEvent(QTimerEvent *event);
410 
413  QHash<unsigned int, UiContainerItem> m_dialogList;
414  QHash<unsigned int, QPointer<QObject> > m_objectList;
416  QMap<QObject*, QThread*> m_watcherThreads;
418  static unsigned int autoIncUiDialogCounter;
419  static unsigned int autoIncObjectCounter;
421  void setApiPointersToWidgetAndChildren(QWidget *widget);
422  //moved the uiLoader object to here from loadDesignerPluginWidget and createNewDialog methods as according
423  //to valgrind it causes memory leaks. So better have only one instance created and maintain mem leaks low ;-)
424  QUiLoader *m_pUiLoader;
425  QHash<QString, QTranslator*> m_transFiles;
426  TimerModel *m_pTimerModel;
427 
428 signals:
429 
430 public slots:
431  void pythonKeyboardInterrupt(bool checked);
432 
433  RetVal loadPluginWidget(void* algoWidgetFunc, int uiDescription, const StringMap &dialogButtons, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, QSharedPointer<unsigned int>dialogHandle, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> className, ItomSharedSemaphore *semaphore = NULL);
434  RetVal createNewDialog(const QString &filename, int uiDescription, const StringMap &dialogButtons, QSharedPointer<unsigned int> dialogHandle, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> className, ItomSharedSemaphore *semaphore = NULL);
435  RetVal deleteDialog(unsigned int handle, ItomSharedSemaphore *semaphore = NULL);
436  RetVal showDialog(unsigned int handle, int modalLevel, QSharedPointer<int> retCodeIfModal, ItomSharedSemaphore *semaphore = NULL);
437  RetVal hideDialog(unsigned int handle, ItomSharedSemaphore *semaphore = NULL);
438  RetVal setAttribute(unsigned int handle, Qt::WidgetAttribute attribute, bool on = true, ItomSharedSemaphore *semaphore = NULL);
439  RetVal isVisible(unsigned int handle, QSharedPointer<bool> visible, ItomSharedSemaphore *semaphore = NULL);
440  RetVal handleExist(unsigned int handle, QSharedPointer<bool> exist, ItomSharedSemaphore *semaphore = NULL);
441 
442  UiContainer* getUiDialogByHandle(unsigned int uiHandle);
443 
444  RetVal getDockedStatus(unsigned int uiHandle, QSharedPointer<bool> docked, ItomSharedSemaphore *semaphore = NULL);
445  RetVal setDockedStatus(unsigned int uiHandle, bool docked, ItomSharedSemaphore *semaphore = NULL);
446 
447  RetVal showInputDialogGetDouble(unsigned int objectID, const QString &title, const QString &label, double defaultValue, QSharedPointer<bool> ok, QSharedPointer<double> value, double min = -2147483647, double max = 2147483647, int decimals = 1, ItomSharedSemaphore *semaphore = NULL );
448  RetVal showInputDialogGetInt(unsigned int objectID, const QString &title, const QString &label, int defaultValue, QSharedPointer<bool> ok, QSharedPointer<int> value, int min = -2147483647, int max = 2147483647, int step = 1, ItomSharedSemaphore *semaphore = NULL );
449  RetVal showInputDialogGetItem(unsigned int objectID, const QString &title, const QString &label, const QStringList &stringList, QSharedPointer<bool> ok, QSharedPointer<QString> value, int currentIndex = 0, bool editable = false, ItomSharedSemaphore *semaphore = NULL );
450  RetVal showInputDialogGetText(unsigned int objectID, const QString &title, const QString &label, const QString &defaultString, QSharedPointer<bool> ok, QSharedPointer<QString> value, ItomSharedSemaphore *semaphore = NULL );
451  RetVal showMessageBox(unsigned int objectID, int type, const QString &title, const QString &text, int buttons, int defaultButton, QSharedPointer<int> retButton, QSharedPointer<QString> retButtonText, ItomSharedSemaphore *semaphore = NULL );
452 
453  RetVal showFileDialogExistingDir(unsigned int objectID, const QString &caption, QSharedPointer<QString> directory, int options = QFileDialog::ShowDirsOnly, ItomSharedSemaphore *semaphore = NULL); //options are of type QFileDialog::Options
454  RetVal showFileOpenDialog(unsigned int objectID, const QString &caption, const QString &directory, const QString &filter, QSharedPointer<QString> file, int selectedFilterIndex = 0, int options = 0, ItomSharedSemaphore *semaphore = NULL);
455  RetVal showFilesOpenDialog(unsigned int objectID, const QString &caption, const QString &directory, const QString &filter, QSharedPointer<QStringList> files, int selectedFilterIndex = 0, int options = 0, ItomSharedSemaphore *semaphore = NULL);
456  RetVal showFileSaveDialog(unsigned int objectID, const QString &caption, const QString &directory, const QString &filter, QSharedPointer<QString> file, int selectedFilterIndex = 0, int options = 0, ItomSharedSemaphore *semaphore = NULL);
457 
458  RetVal exists(unsigned int objectID, QSharedPointer<bool> exists, ItomSharedSemaphore *semaphore = NULL);
459  RetVal getPropertyInfos(unsigned int objectID, QSharedPointer<QVariantMap> retPropertyMap, ItomSharedSemaphore *semaphore = NULL);
460  RetVal readProperties(unsigned int objectID, QSharedPointer<QVariantMap> properties, ItomSharedSemaphore *semaphore = NULL);
461  RetVal writeProperties(unsigned int objectID, const QVariantMap &properties, ItomSharedSemaphore *semaphore = NULL);
462  RetVal readProperties(unsigned int handle, const QString &widgetName, QSharedPointer<QVariantMap> properties, ItomSharedSemaphore *semaphore = NULL);
463  RetVal writeProperties(unsigned int handle, const QString &widgetName, const QVariantMap &properties, ItomSharedSemaphore *semaphore = NULL);
464  RetVal getAttribute(unsigned int objectID, int attributeNumber, QSharedPointer<bool> value, ItomSharedSemaphore *semaphore = NULL);
465  RetVal setAttribute(unsigned int objectID, int attributeNumber, bool value, ItomSharedSemaphore *semaphore = NULL);
466  RetVal getWindowFlags(unsigned int objectID, QSharedPointer<int> flags, ItomSharedSemaphore *semaphore = NULL);
467  RetVal setWindowFlags(unsigned int objectID, int flags, ItomSharedSemaphore *semaphore = NULL);
468  RetVal widgetMetaObjectCounts(unsigned int objectID, QSharedPointer<int> classInfoCount, QSharedPointer<int> enumeratorCount, QSharedPointer<int> methodCount, QSharedPointer<int> propertyCount, ItomSharedSemaphore *semaphore = NULL );
469 
470  RetVal getChildObject(unsigned int uiHandle, const QString &objectName, QSharedPointer<unsigned int> objectID, ItomSharedSemaphore *semaphore = NULL);
471  RetVal getChildObject2(unsigned int parentObjectID, const QString &objectName, QSharedPointer<unsigned int> objectID, ItomSharedSemaphore *semaphore = NULL);
472  RetVal getChildObject3(unsigned int parentObjectID, const QString &objectName, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> widgetClassName, ItomSharedSemaphore *semaphore = NULL);
473  RetVal getLayout(unsigned int objectID, QSharedPointer<unsigned int> layoutObjectID, QSharedPointer<QByteArray> layoutClassName, QSharedPointer<QString> layoutObjectName, ItomSharedSemaphore *semaphore = NULL);
474  RetVal getSignalIndex(unsigned int objectID, const QByteArray &signalSignature, QSharedPointer<int> signalIndex, QSharedPointer<QObject*> objPtr, QSharedPointer<IntList> argTypes, ItomSharedSemaphore *semaphore = NULL);
475  RetVal callSlotOrMethod(bool slotNotMethod, unsigned int objectID, int slotOrMethodIndex, QSharedPointer<FctCallParamContainer> args, ItomSharedSemaphore *semaphore = NULL);
476 
477  RetVal getObjectInfo(const QString &classname, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo, ItomSharedSemaphore *semaphore = NULL);
478  RetVal getObjectInfo(const QObject *obj, int type, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList* objectInfo, ItomSharedSemaphore *semaphore = NULL);
479 
480  inline RetVal getObjectInfo(unsigned int objectID, int type, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo, ItomSharedSemaphore *semaphore = NULL)
481  {
482  return getObjectInfo(getWeakObjectReference(objectID), type, pythonNotCStyle, objectInfo, semaphore);
483  }
484 
485  RetVal getObjectAndWidgetName(unsigned int objectID, QSharedPointer<QByteArray> objectName, QSharedPointer<QByteArray> widgetClassName, ItomSharedSemaphore *semaphore = NULL);
486  RetVal getObjectChildrenInfo(unsigned int objectID, bool recursive, QSharedPointer<QStringList> objectNames, QSharedPointer<QStringList> classNames, ItomSharedSemaphore *semaphore = NULL);
487 
488  RetVal getObjectID(const QObject *obj, QSharedPointer<unsigned int> objectID, ItomSharedSemaphore *semaphore = NULL);
489 
490  RetVal connectWithKeyboardInterrupt(unsigned int objectID, const QByteArray &signalSignature, ItomSharedSemaphore *semaphore = NULL);
491  RetVal connectProgressObserverInterrupt(unsigned int objectID, const QByteArray &signalSignature, QPointer<QObject> progressObserver, ItomSharedSemaphore *semaphore = NULL);
492  RetVal getMethodDescriptions(unsigned int objectID, QSharedPointer<MethodDescriptionList> methodList, ItomSharedSemaphore *semaphore = NULL);
493 
494  RetVal createFigure(QSharedPointer< QSharedPointer<unsigned int> > guardedFigureHandle, QSharedPointer<unsigned int> objectID, QSharedPointer<int> rows, QSharedPointer<int> cols, QPoint offset = QPoint(), QSize size = QSize(), ItomSharedSemaphore *semaphore = NULL);
495  RetVal getSubplot(QSharedPointer<unsigned int> figHandle, unsigned int subplotIndex, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> objectName, QSharedPointer<QByteArray> widgetClassName, ItomSharedSemaphore *semaphore = NULL);
496 
497  RetVal figurePlot(ito::UiDataContainer &dataCont, ito::UiDataContainer &xAxisCont,QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID, int areaRow, int areaCol, QString className, QVariantMap properties, ItomSharedSemaphore *semaphore = NULL);
498  RetVal figureLiveImage(AddInDataIO* dataIO, QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID, int areaRow, int areaCol, QString className, QVariantMap properties, ItomSharedSemaphore *semaphore = NULL);
499  RetVal figureDesignerWidget(QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID, int areaRow, int areaCol, QString className, QVariantMap properties, ItomSharedSemaphore *semaphore = NULL);
500  void figureAssureMinimalSize(ito::FigureWidget* fig);
501 
502  RetVal figureClose(unsigned int figHandle, ItomSharedSemaphore *semaphore = NULL);
503  RetVal closeAllFloatableFigures(ItomSharedSemaphore *semaphore = NULL);
504  RetVal figureShow(const unsigned int& handle = 0, ItomSharedSemaphore *semaphore = NULL);
505  RetVal figureMinimizeAll(ItomSharedSemaphore *semaphore = NULL);
506  RetVal figurePickPoints(unsigned int objectID, QSharedPointer<QVector<ito::Shape> > shapes, int maxNrPoints, ItomSharedSemaphore *semaphore);
507  RetVal figureDrawGeometricShapes(unsigned int objectID, QSharedPointer<QVector<ito::Shape> > shapes, int shapeType, int maxNrElements, ItomSharedSemaphore *semaphore);
508  RetVal figurePickPointsInterrupt(unsigned int objectID);
509  RetVal isFigureItem(unsigned int objectID, QSharedPointer<unsigned int> isFigureItem, ItomSharedSemaphore *semaphore);
510  RetVal getAllAvailableHandles(QSharedPointer<QList<unsigned int> > list, ItomSharedSemaphore *semaphore = NULL);
511  RetVal getPlotWindowTitlebyHandle(const unsigned int& objectID, QSharedPointer<QString> title, ItomSharedSemaphore * semaphore = NULL);
512 
513  RetVal connectWidgetsToProgressObserver(bool hasProgressBar, unsigned int progressBarObjectID, bool hasLabel, unsigned int labelObjectID, QSharedPointer<ito::FunctionCancellationAndObserver> progressObserver, ItomSharedSemaphore *semaphore);
514 
515  RetVal getAvailableWidgetNames(QSharedPointer<QStringList> widgetNames, ItomSharedSemaphore *semaphore);
516 
517  RetVal registerActiveTimer(const QWeakPointer<QTimer> &timer, const QString &name);
518 
519 
520 
521  void figureDestroyed(QObject *obj);
522 
523 private slots:
524  void watcherThreadFinished();
525 
526 };
527 
528 } //namespace ito
529 
530 Q_DECLARE_METATYPE(ito::UiOrganizer::ClassInfoContainerList*)
531 
532 #endif
tUiType m_type
Definition: uiOrganizer.h:198
The UiOrganizer is started as singleton instance within itom and organizes all main windows...
Definition: uiOrganizer.h:306
tPropertyFlags
Definition: uiOrganizer.h:310
model for management of all timer objects. This model will be is used as model for the view in the ti...
Definition: timerModel.h:41
Definition: figureWidget.h:46
UiContainer(QMainWindow *mainWindow)
creates new UiContainer from instance of QMainWindow
Definition: uiOrganizer.h:117
void execGarbageCollection()
executes the garbage collection process
Definition: uiOrganizer.cpp:188
tUiType
Definition: uiOrganizer.h:77
Class for managing status values (like errors or warning)
Definition: retVal.h:54
tErrorCode
Definition: uiOrganizer.h:320
base class for all dataIO plugin classes
Definition: addInInterface.h:661
~UiContainer()
destructor
Definition: uiOrganizer.cpp:69
UiContainer(QWidget *widget, tUiType type)
general constructor to create an instance of UiContainer from given QWidget*-pointer and type ...
Definition: uiOrganizer.h:154
static unsigned int autoIncUiDialogCounter
Definition: uiOrganizer.h:418
UserUiDialog * getUiDialog() const
returns instance of UiDialog or NULL, if the widget is not longer available of the type is not uiType...
Definition: uiOrganizer.h:172
UiContainer(QDialog *dialog)
creates new UiContainer from instance of QDialog
Definition: uiOrganizer.h:105
unsigned int addObjectToList(QObject *objPtr)
adds a given QObject* pointer to m_objectList if not yet available.
Definition: uiOrganizer.cpp:231
UiContainer(FigureWidget *figureWidget)
creates new UiContainer from instance of QMainWindow
Definition: uiOrganizer.h:129
TimerModel * getTimerModel() const
returns the timer model that organizes all registered QTimer objects
Definition: uiOrganizer.cpp:4214
polygon mesh parameter (pointer, no auto-safe possible)
Definition: param.h:138
Definition: apiFunctionsGraph.cpp:39
QHash< unsigned int, UiContainerItem > m_dialogList
Definition: uiOrganizer.h:413
UiOrganizer(ito::RetVal &retval)
constructor
Definition: uiOrganizer.cpp:113
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
QPointer< QWidget > m_weakDialog
Definition: uiOrganizer.h:197
~UiOrganizer()
destructor
Definition: uiOrganizer.cpp:145
Definition: uiOrganizer.h:272
One instance of this class acts as wrapper for several import public methods of classes, derived from QObject, which should be made available by the call-method in python.
Definition: widgetWrapper.h:55
tWinType
Definition: uiOrganizer.h:333
tUiType getType() const
returns type of the guarded user interface
Definition: uiOrganizer.h:194
WidgetWrapper * m_widgetWrapper
Definition: uiOrganizer.h:411
point cloud parameter (pointer, no auto-safe possible)
Definition: param.h:136
Definition: uiOrganizer.h:201
RetVal registerActiveTimer(const QWeakPointer< QTimer > &timer, const QString &name)
registerActiveTimer can be used to register a running timer instance for the 'active timer dialog' of...
Definition: uiOrganizer.cpp:4192
Definition: userUiDialog.h:44
QMap< QObject *, QThread * > m_watcherThreads
Definition: uiOrganizer.h:416
QHash< unsigned int, QPointer< QObject > > m_objectList
Definition: uiOrganizer.h:414
UiContainer(const UiContainer &cpy)
copy constructor
Definition: uiOrganizer.h:161
static unsigned int autoIncObjectCounter
Definition: uiOrganizer.h:419
Every instance of this class contains information about one user interface (main window, dialog, dock widget...) which is organized by UiOrganizer.
Definition: uiOrganizer.h:74
Definition: uiOrganizer.h:216
RetVal getAllAvailableHandles(QSharedPointer< QList< unsigned int > > list, ItomSharedSemaphore *semaphore=NULL)
getAllAvailableHandles ruturns all available figure handles
Definition: uiOrganizer.cpp:4228
int m_garbageCollectorTimer
Definition: uiOrganizer.h:415
Type
Definition: param.h:83
QWidget * getUiWidget() const
returns instance of Widget or NULL, if the widget is not longer available.
Definition: uiOrganizer.h:187
QWidget * createWidget(const QString &className, RetVal &retValue, QWidget *parent=NULL, const QString &objectName=QString())
loads a widget from an ui file (including its optional translation) and returns it.
Definition: uiOrganizer.cpp:989
dataObject parameter (pointer, no auto-save possible)
Definition: param.h:129
UiContainer(QDockWidget *dockWidget)
creates new UiContainer from instance of QDockWidget
Definition: uiOrganizer.h:141
void timerEvent(QTimerEvent *event)
method, called by garbage collection timer, in order to regularly start the garbage collection proces...
Definition: uiOrganizer.cpp:266
UiContainer(UserUiDialog *uiDialog)
creates new UiContainer from instance of dialog-widget UserUiDialog
Definition: uiOrganizer.h:93