27 #include "../python/pythonItomMetaObject.h"
31 #include "../common/sharedStructuresQt.h"
32 #include "../common/functionCancellationAndObserver.h"
34 #include "../DataObject/dataobj.h"
35 #if ITOM_POINTCLOUDLIBRARY > 0
36 #include "../../PointCloud/pclStructures.h"
39 #include "../widgets/userUiDialog.h"
40 #include "../widgets/figureWidget.h"
42 #include "../global.h"
43 #include "../common/sharedStructuresGraphics.h"
44 #include "../common/addInInterface.h"
45 #include "../common/shape.h"
47 #include "../../plot/AbstractFigure.h"
50 #include <qsharedpointer.h>
55 #include <qfiledialog.h>
56 #include <qmainwindow.h>
58 #include <qtranslator.h>
79 uiTypeUiDialog = 0x0001,
80 uiTypeQDialog = 0x0002,
81 uiTypeQMainWindow = 0x0003,
82 uiTypeQDockWidget = 0x0004,
83 uiTypeFigure = 0x0005,
174 if(
m_type == uiTypeUiDialog)
208 guardedHandle = cpy.guardedHandle;
209 container = cpy.container;
212 QWeakPointer< unsigned int > guardedHandle;
220 QSharedPointer<ito::DataObject> m_dObjPtr;
221 #if ITOM_POINTCLOUDLIBRARY > 0
222 QSharedPointer<ito::PCLPointCloud> m_dPCPtr;
223 QSharedPointer<ito::PCLPolygonMesh> m_dPMPtr;
230 #if ITOM_POINTCLOUDLIBRARY > 0
234 inline UiDataContainer & operator = (QSharedPointer<ito::PCLPointCloud> sharedPointCloud)
237 m_dPCPtr = sharedPointCloud;
243 inline UiDataContainer & operator = (QSharedPointer<ito::PCLPolygonMesh> sharedPolygonMesh)
246 m_dPMPtr = sharedPolygonMesh;
253 inline UiDataContainer & operator = (QSharedPointer<ito::DataObject> sharedDataObject)
256 m_dObjPtr = sharedDataObject;
257 #if ITOM_POINTCLOUDLIBRARY > 0
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; }
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)
278 if (m_description ==
"")
280 m_description = m_shortDescription;
286 QString m_shortDescription;
287 QString m_description;
294 class QT_DEPRECATED_X("Use std::less") qLess<ito::ClassInfoContainer>
299 return (t1.m_name < t2.m_name);
313 propConstant = 0x0002,
315 propReadable = 0x0008,
316 propWritable = 0x0010,
317 propResettable = 0x0020
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
336 typeMainWindow = 0x0001,
337 typeDockWidget = 0x0002,
338 typeCentralWidget = 0x0003
343 infoShowNoInheritance = 0x0001,
344 infoShowItomInheritance = 0x0002,
345 infoShowInheritanceUpToWidget = 0x0004,
346 infoShowAllInheritance =0x0008
349 typedef QList<ClassInfoContainer> ClassInfoContainerList;
354 void showDialog(QWidget *parent);
355 inline QObject *getPluginReference(
unsigned int objectID) {
return getWeakObjectReference(objectID); }
357 static inline void parseUiDescription(
int uiDescription,
int* uiType = NULL,
int* buttonBarType = NULL,
bool* childOfMainWindow = NULL,
bool* deleteOnClose = NULL,
int* dockWidgetArea = NULL)
359 if(uiType) *uiType = (uiDescription & 0x000000FF);
360 if(buttonBarType) *buttonBarType = ((uiDescription & 0x0000FF00) >> 8);
361 if(childOfMainWindow) *childOfMainWindow = ((uiDescription & 0x000F0000) > 0);
362 if(deleteOnClose) *deleteOnClose = ((uiDescription & 0x00F00000) > 0);
363 if(dockWidgetArea) *dockWidgetArea = ((uiDescription & 0xFF000000) >> 24);
366 static inline int createUiDescription(
int uiType,
int buttonBarType,
bool childOfMainWindow,
bool deleteOnClose,
int dockWidgetArea)
368 int v = uiType & 0x000000FF;
369 v += (buttonBarType << 8);
370 if(childOfMainWindow) v += (1 << 16);
371 if(deleteOnClose) v+= (1 << 20);
372 v += (dockWidgetArea << 24);
377 RetVal getNewPluginWindow(
const QString &pluginName,
unsigned int &objectID, QWidget** newWidget, QWidget *parent = NULL);
379 QWidget* loadDesignerPluginWidget(
const QString &name, RetVal &retValue, AbstractFigure::WindowMode winMode, QWidget *parent = NULL);
381 QWidget*
createWidget(
const QString &className, RetVal &retValue, QWidget *parent = NULL,
const QString &objectName = QString());
384 QWidget* loadUiFile(
const QString &filename, RetVal &retValue, QWidget *parent = NULL,
const QString &objectNameSuffix = QString());
392 void startGarbageCollectorTimer();
394 RetVal addWidgetToOrganizer(QWidget *widget,
int uiDescription,
const StringMap &dialogButtons,
395 QSharedPointer<unsigned int>dialogHandle,
396 QSharedPointer<unsigned int> objectID,
397 QSharedPointer<QByteArray> className);
403 QObject *getWeakObjectReference(
unsigned int objectID);
405 QByteArray getReadableMethodSignature(
const QMetaMethod &method,
bool pythonNotCStyle, QByteArray *methodName = NULL,
bool *valid = NULL);
406 QByteArray getReadableParameter(
const QByteArray ¶meter,
bool pythonNotCStyle,
bool *valid = NULL);
407 ito::UiOrganizer::ClassInfoContainerList::Iterator parseMetaPropertyForEnumerationTypes(
const QMetaProperty &meth, ClassInfoContainerList ¤tPropList);
421 void setApiPointersToWidgetAndChildren(QWidget *widget);
424 QUiLoader *m_pUiLoader;
425 QHash<QString, QTranslator*> m_transFiles;
431 void pythonKeyboardInterrupt(
bool checked);
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);
436 RetVal showDialog(
unsigned int handle,
int modalLevel, QSharedPointer<int> retCodeIfModal,
ItomSharedSemaphore *semaphore = NULL);
438 RetVal setAttribute(
unsigned int handle, Qt::WidgetAttribute attribute,
bool on =
true,
ItomSharedSemaphore *semaphore = NULL);
442 UiContainer* getUiDialogByHandle(
unsigned int uiHandle);
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 );
453 RetVal showFileDialogExistingDir(
unsigned int objectID,
const QString &caption, QSharedPointer<QString> directory,
int options = QFileDialog::ShowDirsOnly,
ItomSharedSemaphore *semaphore = NULL);
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);
459 RetVal getPropertyInfos(
unsigned int objectID, QSharedPointer<QVariantMap> retPropertyMap,
ItomSharedSemaphore *semaphore = NULL);
460 RetVal readProperties(
unsigned int objectID, QSharedPointer<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);
468 RetVal widgetMetaObjectCounts(
unsigned int objectID, QSharedPointer<int> classInfoCount, QSharedPointer<int> enumeratorCount, QSharedPointer<int> methodCount, QSharedPointer<int> propertyCount,
ItomSharedSemaphore *semaphore = NULL );
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);
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);
480 inline RetVal getObjectInfo(
unsigned int objectID,
int type,
bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo,
ItomSharedSemaphore *semaphore = NULL)
482 return getObjectInfo(getWeakObjectReference(objectID), type, pythonNotCStyle, objectInfo, semaphore);
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);
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);
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);
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);
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);
511 RetVal getPlotWindowTitlebyHandle(
const unsigned int& objectID, QSharedPointer<QString> title,
ItomSharedSemaphore * semaphore = NULL);
513 RetVal connectWidgetsToProgressObserver(
bool hasProgressBar,
unsigned int progressBarObjectID,
bool hasLabel,
unsigned int labelObjectID, QSharedPointer<ito::FunctionCancellationAndObserver> progressObserver,
ItomSharedSemaphore *semaphore);
521 void figureDestroyed(QObject *obj);
524 void watcherThreadFinished();
530 Q_DECLARE_METATYPE(ito::UiOrganizer::ClassInfoContainerList*)
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
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
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