itom
Loading...
Searching...
No Matches
ito::UiOrganizer Class Reference

The UiOrganizer is started as singleton instance within itom and organizes all main windows, dialogs, widgets,... which are currently loaded at runtime from any ui-file or from a widget, provided by any algorithm plugin. More...

Inheritance diagram for ito::UiOrganizer:

Public Types

enum  tPropertyFlags {
  propValid = 0x0001 , propConstant = 0x0002 , propFinal = 0x0004 , propReadable = 0x0008 ,
  propWritable = 0x0010 , propResettable = 0x0020
}
 
enum  tErrorCode {
  errorUiHandleInvalid = 0x1001 , errorObjDoesNotExist = 0x1002 , errorObjPropWrite = 0x1003 , errorObjPropRead = 0x1004 ,
  errorObjPropDoesNotExist = 0x1005 , errorUnregisteredType = 0x1006 , errorSlotDoesNotExist = 0x1007 , errorSignalDoesNotExist = 0x1008 ,
  errorConnectionError = 0x1009
}
 
enum  tWinType { typeDialog = 0x0000 , typeMainWindow = 0x0001 , typeDockWidget = 0x0002 , typeCentralWidget = 0x0003 }
 
enum  tObjectInfo { infoShowNoInheritance = 0x0001 , infoShowItomInheritance = 0x0002 , infoShowInheritanceUpToWidget = 0x0004 , infoShowAllInheritance =0x0008 }
 
typedef QList< ClassInfoContainerClassInfoContainerList
 

Public Slots

void pythonKeyboardInterrupt (bool checked)
 
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)
 
RetVal createNewDialog (const QString &filename, int uiDescription, const StringMap &dialogButtons, QSharedPointer< unsigned int > dialogHandle, QSharedPointer< unsigned int > objectID, QSharedPointer< QByteArray > className, ItomSharedSemaphore *semaphore=NULL)
 
RetVal deleteDialog (unsigned int handle, ItomSharedSemaphore *semaphore=NULL)
 
RetVal showDialog (unsigned int handle, int modalLevel, QSharedPointer< int > retCodeIfModal, ItomSharedSemaphore *semaphore=NULL)
 
RetVal hideDialog (unsigned int handle, ItomSharedSemaphore *semaphore=NULL)
 
RetVal setAttribute (unsigned int handle, Qt::WidgetAttribute attribute, bool on=true, ItomSharedSemaphore *semaphore=NULL)
 
RetVal isVisible (unsigned int handle, QSharedPointer< bool > visible, ItomSharedSemaphore *semaphore=NULL)
 
RetVal handleExist (unsigned int handle, QSharedPointer< bool > exist, ItomSharedSemaphore *semaphore=NULL)
 
UiContainergetUiDialogByHandle (unsigned int uiHandle)
 
RetVal getDockedStatus (unsigned int uiHandle, QSharedPointer< bool > docked, ItomSharedSemaphore *semaphore=NULL)
 
RetVal setDockedStatus (unsigned int uiHandle, bool docked, ItomSharedSemaphore *semaphore=NULL)
 
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)
 
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)
 
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)
 
RetVal showInputDialogGetText (unsigned int objectID, const QString &title, const QString &label, const QString &defaultString, QSharedPointer< bool > ok, QSharedPointer< QString > value, ItomSharedSemaphore *semaphore=NULL)
 
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)
 
RetVal showFileDialogExistingDir (unsigned int objectID, const QString &caption, QSharedPointer< QString > directory, int options=QFileDialog::ShowDirsOnly, ItomSharedSemaphore *semaphore=NULL)
 
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)
 
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)
 
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)
 
RetVal exists (unsigned int objectID, QSharedPointer< bool > exists, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getPropertyInfos (unsigned int objectID, QSharedPointer< QVariantMap > retPropertyMap, ItomSharedSemaphore *semaphore=NULL)
 
RetVal readProperties (unsigned int objectID, QSharedPointer< QVariantMap > properties, ItomSharedSemaphore *semaphore=NULL)
 
RetVal writeProperties (unsigned int objectID, const QVariantMap &properties, ItomSharedSemaphore *semaphore=NULL)
 
RetVal readProperties (unsigned int handle, const QString &widgetName, QSharedPointer< QVariantMap > properties, ItomSharedSemaphore *semaphore=NULL)
 
RetVal writeProperties (unsigned int handle, const QString &widgetName, const QVariantMap &properties, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getAttribute (unsigned int objectID, int attributeNumber, QSharedPointer< bool > value, ItomSharedSemaphore *semaphore=NULL)
 
RetVal setAttribute (unsigned int objectID, int attributeNumber, bool value, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getWindowFlags (unsigned int objectID, QSharedPointer< int > flags, ItomSharedSemaphore *semaphore=NULL)
 
RetVal setWindowFlags (unsigned int objectID, int flags, ItomSharedSemaphore *semaphore=NULL)
 
RetVal widgetMetaObjectCounts (unsigned int objectID, QSharedPointer< int > classInfoCount, QSharedPointer< int > enumeratorCount, QSharedPointer< int > methodCount, QSharedPointer< int > propertyCount, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getChildObject (unsigned int uiHandle, const QString &objectName, QSharedPointer< unsigned int > objectID, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getChildObject2 (unsigned int parentObjectID, const QString &objectName, QSharedPointer< unsigned int > objectID, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getChildObject3 (unsigned int parentObjectID, const QString &objectName, QSharedPointer< unsigned int > objectID, QSharedPointer< QByteArray > widgetClassName, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getLayout (unsigned int objectID, QSharedPointer< unsigned int > layoutObjectID, QSharedPointer< QByteArray > layoutClassName, QSharedPointer< QString > layoutObjectName, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getSignalIndex (unsigned int objectID, const QByteArray &signalSignature, QSharedPointer< int > signalIndex, QSharedPointer< QObject * > objPtr, QSharedPointer< IntList > argTypes, ItomSharedSemaphore *semaphore=NULL)
 
RetVal callSlotOrMethod (bool slotNotMethod, unsigned int objectID, int slotOrMethodIndex, QSharedPointer< FctCallParamContainer > args, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectInfo (const QString &classname, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectInfo (const QObject *obj, int type, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectInfo (unsigned int objectID, int type, bool pythonNotCStyle, ito::UiOrganizer::ClassInfoContainerList *objectInfo, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectAndWidgetName (unsigned int objectID, QSharedPointer< QByteArray > objectName, QSharedPointer< QByteArray > widgetClassName, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectChildrenInfo (unsigned int objectID, bool recursive, QSharedPointer< QStringList > objectNames, QSharedPointer< QStringList > classNames, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getObjectID (const QObject *obj, QSharedPointer< unsigned int > objectID, ItomSharedSemaphore *semaphore=NULL)
 
RetVal connectWithKeyboardInterrupt (unsigned int objectID, const QByteArray &signalSignature, ItomSharedSemaphore *semaphore=NULL)
 
RetVal connectProgressObserverInterrupt (unsigned int objectID, const QByteArray &signalSignature, QPointer< QObject > progressObserver, ItomSharedSemaphore *semaphore=NULL)
 
RetVal getMethodDescriptions (unsigned int objectID, QSharedPointer< MethodDescriptionList > methodList, ItomSharedSemaphore *semaphore=NULL)
 
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)
 
RetVal getSubplot (QSharedPointer< unsigned int > figHandle, unsigned int subplotIndex, QSharedPointer< unsigned int > objectID, QSharedPointer< QByteArray > objectName, QSharedPointer< QByteArray > widgetClassName, ItomSharedSemaphore *semaphore=NULL)
 
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)
 
RetVal figureLiveImage (AddInDataIO *dataIO, QSharedPointer< unsigned int > figHandle, QSharedPointer< unsigned int > objectID, int areaRow, int areaCol, QString className, QVariantMap properties, ItomSharedSemaphore *semaphore=NULL)
 
RetVal figureDesignerWidget (QSharedPointer< unsigned int > figHandle, QSharedPointer< unsigned int > objectID, int areaRow, int areaCol, QString className, QVariantMap properties, ItomSharedSemaphore *semaphore=NULL)
 
void figureAssureMinimalSize (ito::FigureWidget *fig)
 
RetVal figureClose (unsigned int figHandle, ItomSharedSemaphore *semaphore=NULL)
 
RetVal closeAllFloatableFigures (ItomSharedSemaphore *semaphore=NULL)
 
RetVal figureShow (const unsigned int &handle=0, ItomSharedSemaphore *semaphore=NULL)
 
RetVal figureMinimizeAll (ItomSharedSemaphore *semaphore=NULL)
 
RetVal figurePickPoints (unsigned int objectID, QSharedPointer< QVector< ito::Shape > > shapes, int maxNrPoints, ItomSharedSemaphore *semaphore)
 
RetVal figureDrawGeometricShapes (unsigned int objectID, QSharedPointer< QVector< ito::Shape > > shapes, int shapeType, int maxNrElements, ItomSharedSemaphore *semaphore)
 
RetVal figurePickPointsInterrupt (unsigned int objectID)
 
RetVal isFigureItem (unsigned int objectID, QSharedPointer< unsigned int > isFigureItem, ItomSharedSemaphore *semaphore)
 
RetVal getAllAvailableHandles (QSharedPointer< QList< unsigned int > > list, ItomSharedSemaphore *semaphore=NULL)
 getAllAvailableHandles ruturns all available figure handles
 
RetVal getPlotWindowTitlebyHandle (const unsigned int &objectID, QSharedPointer< QString > title, ItomSharedSemaphore *semaphore=NULL)
 
RetVal connectWidgetsToProgressObserver (bool hasProgressBar, unsigned int progressBarObjectID, bool hasLabel, unsigned int labelObjectID, QSharedPointer< ito::FunctionCancellationAndObserver > progressObserver, ItomSharedSemaphore *semaphore)
 
RetVal getAvailableWidgetNames (QSharedPointer< QStringList > widgetNames, ItomSharedSemaphore *semaphore)
 
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 the main window
 
RetVal copyStringToClipboard (const QString &text, ItomSharedSemaphore *semaphore)
 
void figureDestroyed (QObject *obj)
 

Public Member Functions

 UiOrganizer (ito::RetVal &retval)
 constructor
 
 ~UiOrganizer ()
 destructor
 
void showDialog (QWidget *parent)
 
QObject * getPluginReference (unsigned int objectID)
 
RetVal getNewPluginWindow (const QString &pluginName, unsigned int &objectID, QWidget **newWidget, QWidget *parent=NULL)
 
QWidget * loadDesignerPluginWidget (const QString &name, RetVal &retValue, AbstractFigure::WindowMode winMode, QWidget *parent=NULL)
 
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.
 
QWidget * loadUiFile (const QString &filename, RetVal &retValue, QWidget *parent=NULL, const QString &objectNameSuffix=QString())
 
TimerModelgetTimerModel () const
 returns the timer model that organizes all registered QTimer objects
 

Static Public Member Functions

static void parseUiDescription (int uiDescription, int *uiType=NULL, int *buttonBarType=NULL, bool *childOfMainWindow=NULL, bool *deleteOnClose=NULL, int *dockWidgetArea=NULL)
 
static int createUiDescription (int uiType, int buttonBarType, bool childOfMainWindow, bool deleteOnClose, int dockWidgetArea)
 

Protected Member Functions

void startGarbageCollectorTimer ()
 
RetVal addWidgetToOrganizer (QWidget *widget, int uiDescription, const StringMap &dialogButtons, QSharedPointer< unsigned int >dialogHandle, QSharedPointer< unsigned int > objectID, QSharedPointer< QByteArray > className)
 

Private Slots

void watcherThreadFinished ()
 

Private Member Functions

void execGarbageCollection ()
 executes the garbage collection process
 
unsigned int addObjectToList (QObject *objPtr)
 adds a given QObject* pointer to m_objectList if not yet available.
 
QObject * getWeakObjectReference (unsigned int objectID)
 
QByteArray getReadableMethodSignature (const QMetaMethod &method, bool pythonNotCStyle, QByteArray *methodName=NULL, bool *valid=NULL)
 
QByteArray getReadableParameter (const QByteArray &parameter, bool pythonNotCStyle, bool *valid=NULL)
 
ito::UiOrganizer::ClassInfoContainerList::Iterator parseMetaPropertyForEnumerationTypes (const QMetaProperty &meth, ClassInfoContainerList &currentPropList)
 
void timerEvent (QTimerEvent *event)
 method, called by garbage collection timer, in order to regularly start the garbage collection process
 
void setApiPointersToWidgetAndChildren (QWidget *widget)
 

Private Attributes

WidgetWrapperm_widgetWrapper
 
QHash< unsigned int, UiContainerItemm_dialogList
 
QHash< unsigned int, QPointer< QObject > > m_objectList
 
int m_garbageCollectorTimer
 
QMap< QObject *, QThread * > m_watcherThreads
 
QUiLoader * m_pUiLoader
 
QHash< QString, QTranslator * > m_transFiles
 
TimerModelm_pTimerModel
 

Static Private Attributes

static unsigned int autoIncUiDialogCounter = 99
 
static unsigned int autoIncObjectCounter = 1
 

Detailed Description

The UiOrganizer is started as singleton instance within itom and organizes all main windows, dialogs, widgets,... which are currently loaded at runtime from any ui-file or from a widget, provided by any algorithm plugin.

Member Enumeration Documentation

◆ tErrorCode

< enumeration with error numbers for different errors which may occur within the class UiOrganizer

◆ tPropertyFlags

< enumeration describing possible attributes of a property of type QMetaProperty

◆ tWinType

< enumeration describing the desired type of the user interface

Constructor & Destructor Documentation

◆ UiOrganizer()

ito::UiOrganizer::UiOrganizer ( ito::RetVal & retval)

constructor

creates the singleton instance of WidgetWrapper. The garbage collection timer is not started yet, since this is done if the first user interface becomes being organized by this class.

◆ ~UiOrganizer()

ito::UiOrganizer::~UiOrganizer ( )

destructor

Deletes all remaining user interfaces, by deleting the corresponding instances of UiDialogSet. Stops a possible garbage collection timer.

Member Function Documentation

◆ addObjectToList()

unsigned int ito::UiOrganizer::addObjectToList ( QObject * objPtr)
private

adds a given QObject* pointer to m_objectList if not yet available.

If objPtr already exists in m_objectList, the existing key (handle) is returned, else objPtr is added as new value in the hash table and an new, auto incremented handle is created and returned.

The hash table m_objectList is available, in order to increase the access to objects, which already have been used.

Parameters
[in]objPtris the pointer to an existing instance, which inherits QObject
Returns
the handle (key) of this QObject* in m_objectList

◆ execGarbageCollection()

void ito::UiOrganizer::execGarbageCollection ( )
private

executes the garbage collection process

both m_dialogList and m_objectList contain weak references to dialog, main windows or even widgets, which are contained in a dialog or something else. Since these widgets or windows can also be destroyed by the user, the UiOrganizer will not directly informed about this. Therefore, the garbage collection process will check both m_dialogList and m_objectList for objects, which already have been destroyed and delete these entries. Of course, we could also have established a connection to every widgets destroy-signal and delete the corresponding entry, when the destroy event will be fired. But these needs lots of connections in the Qt system, which is slower than checking for destroyed objects every 5 seconds or less. Due to the use of weak references, it is not dangerous to access an object which already has been destroyed.

◆ getAllAvailableHandles

RetVal ito::UiOrganizer::getAllAvailableHandles ( QSharedPointer< QList< unsigned int > > list,
ItomSharedSemaphore * semaphore = NULL )
slot

getAllAvailableHandles ruturns all available figure handles

This method is usually invoked by mainWindow.

Parameters
listis a shared pointer to to a QList of type unsigned int. Here the values will be placed in
semaphoreis the optional semaphore for thread-based calls (or NULL)
Returns
ito::retOk if a the list could be filled

◆ getTimerModel()

TimerModel * ito::UiOrganizer::getTimerModel ( ) const

returns the timer model that organizes all registered QTimer objects

Returns
TimerModel*

◆ registerActiveTimer

RetVal ito::UiOrganizer::registerActiveTimer ( const QWeakPointer< QTimer > & timer,
const QString & name )
slot

registerActiveTimer can be used to register a running timer instance for the 'active timer dialog' of the main window

This method is usually invoked by the Python class pyTimer such that the timer instance can be shown in the active timer dialog of the main window where it can also be stopped by the user.

Parameters
timeris the weak pointer to the active QTimer instance
nameis a name that describes the timer (e.g. its timer id)
Returns
ito::retOk if active timer was valid and could be registered (e.g. for active timer dialog), else ito::retError
See also
unregisterActiveTimer

◆ timerEvent()

void ito::UiOrganizer::timerEvent ( QTimerEvent * event)
private

method, called by garbage collection timer, in order to regularly start the garbage collection process

See also
execGarbageCollection

Member Data Documentation

◆ autoIncObjectCounter

unsigned int ito::UiOrganizer::autoIncObjectCounter = 1
staticprivate

auto incrementing counter for elements in m_objectList

◆ autoIncUiDialogCounter

unsigned int ito::UiOrganizer::autoIncUiDialogCounter = 99
staticprivate

auto incrementing counter for elements in m_dialogList

◆ m_dialogList

QHash<unsigned int, UiContainerItem> ito::UiOrganizer::m_dialogList
private

Hash-Table mapping a handle to an user interface to its corresponding instance of UiDialogSet

◆ m_garbageCollectorTimer

int ito::UiOrganizer::m_garbageCollectorTimer
private

ID of the garbage collection timer. This timer regularly calls timerEvent in order to check m_dialogList and m_objectList for objects, which already have been destroyed.

◆ m_objectList

QHash<unsigned int, QPointer<QObject> > ito::UiOrganizer::m_objectList
private

Hash-Table containing weak references to child-objects of any user interface which have recently been accessed. This hash-table helps for faster access to these objects

◆ m_watcherThreads

QMap<QObject*, QThread*> ito::UiOrganizer::m_watcherThreads
private

map with opened watcher threads and their containing objects (e.g. UserInteractionWatcher)

◆ m_widgetWrapper

WidgetWrapper* ito::UiOrganizer::m_widgetWrapper
private

singleton instance to WidgetWrapper in order to access some public methods of several widgets by python


The documentation for this class was generated from the following files: