itom 1.3.0
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...

List of all members.

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 }
enum  tObjectInfo { infoShowNoInheritance = 0x0001, infoShowItomInheritance = 0x0002, infoShowAllInheritance = 0x0004 | infoShowItomInheritance }
typedef QMap< QString, QString > tQMapArg

Public Slots

void pythonKeyboardInterrupt (bool checked)
RetVal loadPluginWidget (void *algoWidgetFunc, 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)
RetVal addWidgetToOrganizer (QWidget *widget, QSharedPointer< unsigned int >dialogHandle, QSharedPointer< unsigned int >initSlotCount, QWidget *parent=NULL, ItomSharedSemaphore *semaphore=NULL)
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)
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)
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 (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 (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 (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 (const QString &title, const QString &label, const QString &defaultString, QSharedPointer< bool > ok, QSharedPointer< QString > value, ItomSharedSemaphore *semaphore=NULL)
RetVal showMessageBox (unsigned int uiHandle, 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 uiHandle, const QString &caption, QSharedPointer< QString > directory, int options=QFileDialog::ShowDirsOnly, ItomSharedSemaphore *semaphore=NULL)
RetVal showFileOpenDialog (unsigned int uiHandle, const QString &caption, const QString &directory, const QString &filter, QSharedPointer< QString > file, int selectedFilterIndex=0, int options=0, ItomSharedSemaphore *semaphore=NULL)
RetVal showFileSaveDialog (unsigned int uiHandle, const QString &caption, const QString &directory, const QString &filter, QSharedPointer< QString > file, int selectedFilterIndex=0, int options=0, 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 getSignalIndex (unsigned int objectID, const QString &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, ito::UiOrganizer::tQMapArg *objInfo, ItomSharedSemaphore *semaphore=NULL)
RetVal getObjectInfo (const QObject *obj, int type, ito::UiOrganizer::tQMapArg *propMap, ItomSharedSemaphore *semaphore=NULL)
RetVal getObjectInfo (unsigned int objectID, int type, ito::UiOrganizer::tQMapArg *propMap, ItomSharedSemaphore *semaphore=NULL)
RetVal getObjectInfo (unsigned int objectID, QSharedPointer< QByteArray > objectName, QSharedPointer< QByteArray > widgetClassName, ItomSharedSemaphore *semaphore=NULL)
RetVal connectWithKeyboardInterrupt (unsigned int objectID, const QString &signalSignature, ItomSharedSemaphore *semaphore=NULL)
RetVal getMethodDescriptions (unsigned int objectID, QSharedPointer< MethodDescriptionList > methodList, ItomSharedSemaphore *semaphore=NULL)
RetVal createFigure (QSharedPointer< QSharedPointer< unsigned int > > guardedFigureHandle, QSharedPointer< unsigned int > initSlotCount, QSharedPointer< unsigned int > objectID, QSharedPointer< int > rows, QSharedPointer< int > cols, 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, 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 figureRemoveGuardedHandle (unsigned int figHandle, ItomSharedSemaphore *semaphore=NULL)
RetVal figureClose (unsigned int figHandle, ItomSharedSemaphore *semaphore=NULL)
RetVal figurePickPoints (unsigned int objectID, QSharedPointer< ito::DataObject > coords, int maxNrPoints, ItomSharedSemaphore *semaphore)
RetVal figureDrawGeometricElements (unsigned int objectID, QSharedPointer< ito::DataObject > coords, int elementType, int maxNrElements, ItomSharedSemaphore *semaphore)
RetVal figurePickPointsInterrupt (unsigned int objectID)
void figureDestroyed (QObject *obj)

Public Member Functions

 UiOrganizer ()
 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)

Static Public Member Functions

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

Protected Member Functions

void startGarbageCollectorTimer ()

Static Protected Member Functions

static void threadSafeDeleteUi (unsigned int *handle)

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)
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,
UiContainerItem
m_dialogList
QHash< unsigned int, QPointer
< QObject > > 
m_objectList
int m_garbageCollectorTimer
QMap< QObject *, QThread * > m_watcherThreads
QUiLoader m_uiLoader

Static Private Attributes

static unsigned int autoIncUiDialogCounter = 1
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

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

< enumeration describing possible attributes of a property of type QMetaProperty

< enumeration describing the desired type of the user interface


Constructor & Destructor Documentation

ito::UiOrganizer::UiOrganizer ( )

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.

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

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
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.

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

unsigned int ito::UiOrganizer::autoIncObjectCounter = 1 [static, private]

auto incrementing counter for elements in m_objectList

unsigned int ito::UiOrganizer::autoIncUiDialogCounter = 1 [static, private]

auto incrementing counter for elements in 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

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.

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

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

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

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:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends