27 #include "../python/pythonItomMetaObject.h" 31 #include "../common/sharedStructuresQt.h" 32 #include "../DataObject/dataobj.h" 33 #if ITOM_POINTCLOUDLIBRARY > 0 34 #include "../../PointCloud/pclStructures.h" 37 #include "../widgets/userUiDialog.h" 38 #include "../widgets/figureWidget.h" 40 #include "../global.h" 41 #include "../common/sharedStructuresGraphics.h" 42 #include "../common/addInInterface.h" 43 #include "../common/shape.h" 45 #include "../../plot/AbstractFigure.h" 48 #include <qsharedpointer.h> 53 #include <qfiledialog.h> 54 #include <qmainwindow.h> 56 #include <qtranslator.h> 76 uiTypeUiDialog = 0x0001,
77 uiTypeQDialog = 0x0002,
78 uiTypeQMainWindow = 0x0003,
79 uiTypeQDockWidget = 0x0004,
170 if(
m_type == uiTypeUiDialog)
204 guardedHandle = cpy.guardedHandle;
205 container = cpy.container;
208 QWeakPointer< unsigned int > guardedHandle;
215 ito::ParamBase::Type m_dataType;
216 QSharedPointer<ito::DataObject> m_dObjPtr;
217 #if ITOM_POINTCLOUDLIBRARY > 0 218 QSharedPointer<ito::PCLPointCloud> m_dPCPtr;
219 QSharedPointer<ito::PCLPolygonMesh> m_dPMPtr;
225 UiDataContainer(
const QSharedPointer<ito::DataObject> &sharedDataObject) : m_dataType(ito::ParamBase::DObjPtr), m_dObjPtr(sharedDataObject) {}
226 #if ITOM_POINTCLOUDLIBRARY > 0 227 UiDataContainer(
const QSharedPointer<ito::PCLPointCloud> &sharedPointCloud) : m_dataType(ito::ParamBase::PointCloudPtr), m_dPCPtr(sharedPointCloud) {}
228 UiDataContainer(
const QSharedPointer<ito::PCLPolygonMesh> &sharedPolygonMesh) : m_dataType(ito::ParamBase::PolygonMeshPtr), m_dPMPtr(sharedPolygonMesh) {}
230 inline UiDataContainer & operator = (QSharedPointer<ito::PCLPointCloud> sharedPointCloud)
232 m_dataType = ito::ParamBase::PointCloudPtr;
233 m_dPCPtr = sharedPointCloud;
239 inline UiDataContainer & operator = (QSharedPointer<ito::PCLPolygonMesh> sharedPolygonMesh)
241 m_dataType = ito::ParamBase::PolygonMeshPtr;
242 m_dPMPtr = sharedPolygonMesh;
249 inline UiDataContainer & operator = (QSharedPointer<ito::DataObject> sharedDataObject)
251 m_dataType = ito::ParamBase::DObjPtr;
252 m_dObjPtr = sharedDataObject;
253 #if ITOM_POINTCLOUDLIBRARY > 0 260 inline ito::ParamBase::Type
getType()
const {
return m_dataType; }
261 inline QSharedPointer<ito::DataObject> getDataObject()
const {
return m_dObjPtr; }
262 #if ITOM_POINTCLOUDLIBRARY > 0 263 inline QSharedPointer<ito::PCLPointCloud> getPointCloud()
const {
return m_dPCPtr; }
264 inline QSharedPointer<ito::PCLPolygonMesh> getPolygonMesh()
const {
return m_dPMPtr; }
270 enum Type {TypeClassInfo, TypeSlot, TypeSignal, TypeProperty, TypeEnum, TypeFlag, TypeInheritance};
271 ClassInfoContainer(Type type,
const QString &name,
const QString &shortDescription =
"",
const QString &description =
"") :
272 m_type(type), m_name(name), m_shortDescription(shortDescription), m_description(description)
274 if (m_description ==
"")
276 m_description = m_shortDescription;
282 QString m_shortDescription;
283 QString m_description;
288 QPointer<QTimer> timer;
299 propConstant = 0x0002,
301 propReadable = 0x0008,
302 propWritable = 0x0010,
303 propResettable = 0x0020
308 errorUiHandleInvalid = 0x1001,
309 errorObjDoesNotExist = 0x1002,
310 errorObjPropWrite = 0x1003,
311 errorObjPropRead = 0x1004,
312 errorObjPropDoesNotExist = 0x1005,
313 errorUnregisteredType = 0x1006,
314 errorSlotDoesNotExist = 0x1007,
315 errorSignalDoesNotExist = 0x1008,
316 errorConnectionError = 0x1009
322 typeMainWindow = 0x0001,
323 typeDockWidget = 0x0002
328 infoShowNoInheritance = 0x0001,
329 infoShowItomInheritance = 0x0002,
330 infoShowInheritanceUpToWidget = 0x0004,
331 infoShowAllInheritance =0x0008
334 typedef QList<ClassInfoContainer> ClassInfoContainerList;
339 void showDialog(QWidget *parent);
340 inline QObject *getPluginReference(
unsigned int objectID) {
return getWeakObjectReference(objectID); }
342 static inline void parseUiDescription(
int uiDescription,
int* uiType = NULL,
int* buttonBarType = NULL,
bool* childOfMainWindow = NULL,
bool* deleteOnClose = NULL,
int* dockWidgetArea = NULL)
344 if(uiType) *uiType = (uiDescription & 0x000000FF);
345 if(buttonBarType) *buttonBarType = ((uiDescription & 0x0000FF00) >> 8);
346 if(childOfMainWindow) *childOfMainWindow = ((uiDescription & 0x000F0000) > 0);
347 if(deleteOnClose) *deleteOnClose = ((uiDescription & 0x00F00000) > 0);
348 if(dockWidgetArea) *dockWidgetArea = ((uiDescription & 0xFF000000) >> 24);
351 static inline int createUiDescription(
int uiType,
int buttonBarType,
bool childOfMainWindow,
bool deleteOnClose,
int dockWidgetArea)
353 int v = uiType & 0x000000FF;
354 v += (buttonBarType << 8);
355 if(childOfMainWindow) v += (1 << 16);
356 if(deleteOnClose) v+= (1 << 20);
357 v += (dockWidgetArea << 24);
362 RetVal getNewPluginWindow(
const QString &pluginName,
unsigned int &objectID, QWidget** newWidget, QWidget *parent = NULL);
364 QWidget* loadDesignerPluginWidget(
const QString &name,
RetVal &retValue, AbstractFigure::WindowMode winMode, QWidget *parent = NULL);
366 QList<TimerContainer> getRegisteredTimers();
372 void startGarbageCollectorTimer();
374 RetVal addWidgetToOrganizer(QWidget *widget,
int uiDescription,
const StringMap &dialogButtons, QSharedPointer<unsigned int>dialogHandle, QSharedPointer<unsigned int>initSlotCount, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> className);
377 void execGarbageCollection();
379 unsigned int addObjectToList(QObject* objPtr);
380 QObject *getWeakObjectReference(
unsigned int objectID);
382 QByteArray getReadableMethodSignature(
const QMetaMethod &method,
bool pythonNotCStyle, QByteArray *methodName = NULL,
bool *valid = NULL);
383 QByteArray getReadableParameter(
const QByteArray ¶meter,
bool pythonNotCStyle,
bool *valid = NULL);
384 ito::UiOrganizer::ClassInfoContainerList::Iterator parseMetaPropertyForEnumerationTypes(
const QMetaProperty &meth, ClassInfoContainerList ¤tPropList);
386 void timerEvent(QTimerEvent *event);
398 void setApiPointersToWidgetAndChildren(QWidget *widget);
401 QUiLoader *m_pUiLoader;
402 QHash<QString, QTranslator*> m_transFiles;
403 QList<TimerContainer> m_timers;
408 void pythonKeyboardInterrupt(
bool checked);
410 RetVal loadPluginWidget(
void* algoWidgetFunc,
int uiDescription,
const StringMap &dialogButtons, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, QSharedPointer<unsigned int>dialogHandle, QSharedPointer<unsigned int>initSlotCount, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> className,
ItomSharedSemaphore *semaphore = NULL);
411 RetVal createNewDialog(
const QString &filename,
int uiDescription,
const StringMap &dialogButtons, QSharedPointer<unsigned int> dialogHandle, QSharedPointer<unsigned int> initSlotCount, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> className,
ItomSharedSemaphore *semaphore = NULL);
413 RetVal showDialog(
unsigned int handle,
int modalLevel, QSharedPointer<int> retCodeIfModal,
ItomSharedSemaphore *semaphore = NULL);
415 RetVal setAttribute(
unsigned int handle, Qt::WidgetAttribute attribute,
bool on =
true,
ItomSharedSemaphore *semaphore = NULL);
419 UiContainer* getUiDialogByHandle(
unsigned int uiHandle);
424 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 );
425 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 );
426 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 );
427 RetVal showInputDialogGetText(
unsigned int objectID,
const QString &title,
const QString &label,
const QString &defaultString, QSharedPointer<bool> ok, QSharedPointer<QString> value,
ItomSharedSemaphore *semaphore = NULL );
428 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 );
430 RetVal showFileDialogExistingDir(
unsigned int objectID,
const QString &caption, QSharedPointer<QString> directory,
int options = QFileDialog::ShowDirsOnly,
ItomSharedSemaphore *semaphore = NULL);
431 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);
432 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);
433 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);
436 RetVal getPropertyInfos(
unsigned int objectID, QSharedPointer<QVariantMap> retPropertyMap,
ItomSharedSemaphore *semaphore = NULL);
437 RetVal readProperties(
unsigned int objectID, QSharedPointer<QVariantMap> properties,
ItomSharedSemaphore *semaphore = NULL);
439 RetVal readProperties(
unsigned int handle,
const QString &widgetName, QSharedPointer<QVariantMap> properties,
ItomSharedSemaphore *semaphore = NULL);
440 RetVal writeProperties(
unsigned int handle,
const QString &widgetName,
const QVariantMap &properties,
ItomSharedSemaphore *semaphore = NULL);
441 RetVal getAttribute(
unsigned int objectID,
int attributeNumber, QSharedPointer<bool> value,
ItomSharedSemaphore *semaphore = NULL);
445 RetVal widgetMetaObjectCounts(
unsigned int objectID, QSharedPointer<int> classInfoCount, QSharedPointer<int> enumeratorCount, QSharedPointer<int> methodCount, QSharedPointer<int> propertyCount,
ItomSharedSemaphore *semaphore = NULL );
447 RetVal getChildObject(
unsigned int uiHandle,
const QString &objectName, QSharedPointer<unsigned int> objectID,
ItomSharedSemaphore *semaphore = NULL);
448 RetVal getChildObject2(
unsigned int parentObjectID,
const QString &objectName, QSharedPointer<unsigned int> objectID,
ItomSharedSemaphore *semaphore = NULL);
449 RetVal getChildObject3(
unsigned int parentObjectID,
const QString &objectName, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> widgetClassName,
ItomSharedSemaphore *semaphore = NULL);
450 RetVal getSignalIndex(
unsigned int objectID,
const QByteArray &signalSignature, QSharedPointer<int> signalIndex, QSharedPointer<QObject*> objPtr, QSharedPointer<IntList> argTypes,
ItomSharedSemaphore *semaphore = NULL);
451 RetVal callSlotOrMethod(
bool slotNotMethod,
unsigned int objectID,
int slotOrMethodIndex, QSharedPointer<FctCallParamContainer> args,
ItomSharedSemaphore *semaphore = NULL);
453 RetVal getObjectInfo(
const QString &classname,
bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo,
ItomSharedSemaphore *semaphore = NULL);
454 RetVal getObjectInfo(
const QObject *obj,
int type,
bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList* objectInfo,
ItomSharedSemaphore *semaphore = NULL);
455 inline RetVal getObjectInfo(
unsigned int objectID,
int type,
bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo,
ItomSharedSemaphore *semaphore = NULL)
457 return getObjectInfo(getWeakObjectReference(objectID), type, pythonNotCStyle, objectInfo, semaphore);
460 RetVal getObjectAndWidgetName(
unsigned int objectID, QSharedPointer<QByteArray> objectName, QSharedPointer<QByteArray> widgetClassName,
ItomSharedSemaphore *semaphore = NULL);
461 RetVal getObjectChildrenInfo(
unsigned int objectID,
bool recursive, QSharedPointer<QStringList> objectNames, QSharedPointer<QStringList> classNames,
ItomSharedSemaphore *semaphore = NULL);
465 RetVal connectWithKeyboardInterrupt(
unsigned int objectID,
const QByteArray &signalSignature,
ItomSharedSemaphore *semaphore = NULL);
466 RetVal getMethodDescriptions(
unsigned int objectID, QSharedPointer<MethodDescriptionList> methodList,
ItomSharedSemaphore *semaphore = NULL);
468 RetVal createFigure(QSharedPointer< QSharedPointer<unsigned int> > guardedFigureHandle, QSharedPointer<unsigned int> initSlotCount, QSharedPointer<unsigned int> objectID, QSharedPointer<int> rows, QSharedPointer<int> cols, QPoint offset = QPoint(), QSize size = QSize(),
ItomSharedSemaphore *semaphore = NULL);
469 RetVal getSubplot(QSharedPointer<unsigned int> figHandle,
unsigned int subplotIndex, QSharedPointer<unsigned int> objectID, QSharedPointer<QByteArray> objectName, QSharedPointer<QByteArray> widgetClassName,
ItomSharedSemaphore *semaphore = NULL);
471 RetVal figurePlot(
ito::UiDataContainer &dataCont, QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID,
int areaRow,
int areaCol, QString className, QVariantMap properties,
ItomSharedSemaphore *semaphore = NULL);
472 RetVal figureLiveImage(
AddInDataIO* dataIO, QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID,
int areaRow,
int areaCol, QString className, QVariantMap properties,
ItomSharedSemaphore *semaphore = NULL);
473 RetVal figureDesignerWidget(QSharedPointer<unsigned int> figHandle, QSharedPointer<unsigned int> objectID,
int areaRow,
int areaCol, QString className, QVariantMap properties,
ItomSharedSemaphore *semaphore = NULL);
476 RetVal figurePickPoints(
unsigned int objectID, QSharedPointer<QVector<ito::Shape> > shapes,
int maxNrPoints,
ItomSharedSemaphore *semaphore);
477 RetVal figureDrawGeometricShapes(
unsigned int objectID, QSharedPointer<QVector<ito::Shape> > shapes,
int shapeType,
int maxNrElements,
ItomSharedSemaphore *semaphore);
478 RetVal figurePickPointsInterrupt(
unsigned int objectID);
487 void figureDestroyed(QObject *obj);
490 void watcherThreadFinished();
497 Q_DECLARE_METATYPE(ito::UiOrganizer::ClassInfoContainerList*)
tUiType m_type
Definition: uiOrganizer.h:194
The UiOrganizer is started as singleton instance within itom and organizes all main windows...
Definition: uiOrganizer.h:292
tPropertyFlags
Definition: uiOrganizer.h:296
Definition: uiOrganizer.h:286
UiContainer(QMainWindow *mainWindow)
creates new UiContainer from instance of QMainWindow
Definition: uiOrganizer.h:113
tUiType
Definition: uiOrganizer.h:74
Class for managing status values (like errors or warning)
Definition: retVal.h:54
tErrorCode
Definition: uiOrganizer.h:306
base class for all dataIO plugin classes
Definition: addInInterface.h:633
~UiContainer()
destructor
Definition: uiOrganizer.cpp:73
UiContainer(QWidget *widget, tUiType type)
general constructor to create an instance of UiContainer from given QWidget*-pointer and type ...
Definition: uiOrganizer.h:150
static unsigned int autoIncUiDialogCounter
Definition: uiOrganizer.h:395
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:168
UiContainer(QDialog *dialog)
creates new UiContainer from instance of QDialog
Definition: uiOrganizer.h:101
UiContainer(FigureWidget *figureWidget)
creates new UiContainer from instance of QMainWindow
Definition: uiOrganizer.h:125
Definition: apiFunctionsGraph.cpp:39
QHash< unsigned int, UiContainerItem > m_dialogList
Definition: uiOrganizer.h:390
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:193
Definition: uiOrganizer.h:268
tWinType
Definition: uiOrganizer.h:319
tUiType getType() const
returns type of the guarded user interface
Definition: uiOrganizer.h:190
WidgetWrapper * m_widgetWrapper
Definition: uiOrganizer.h:388
Definition: uiOrganizer.h:197
Definition: userUiDialog.h:44
QMap< QObject *, QThread * > m_watcherThreads
Definition: uiOrganizer.h:393
QHash< unsigned int, QPointer< QObject > > m_objectList
Definition: uiOrganizer.h:391
UiContainer(const UiContainer &cpy)
copy constructor
Definition: uiOrganizer.h:157
static unsigned int autoIncObjectCounter
Definition: uiOrganizer.h:396
Every instance of this class contains information about one user interface (main window, dialog, dock widget...) which is organized by UiOrganizer.
Definition: uiOrganizer.h:71
Definition: uiOrganizer.h:212
int m_garbageCollectorTimer
Definition: uiOrganizer.h:392
QWidget * getUiWidget() const
returns instance of Widget or NULL, if the widget is not longer available.
Definition: uiOrganizer.h:183
UiContainer(QDockWidget *dockWidget)
creates new UiContainer from instance of QDockWidget
Definition: uiOrganizer.h:137
UiContainer(UserUiDialog *uiDialog)
creates new UiContainer from instance of dialog-widget UserUiDialog
Definition: uiOrganizer.h:89