itom 2.2.0
|
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...
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, infoShowInheritanceUpToWidget = 0x0004, infoShowAllInheritance = 0x0008 } |
typedef QList< ClassInfoContainer > | ClassInfoContainerList |
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 >initSlotCount, 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 > 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) |
RetVal | handleExist (unsigned int handle, QSharedPointer< bool > exist, ItomSharedSemaphore *semaphore=NULL) |
UiContainer * | getUiDialogByHandle (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 | 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 | 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, 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, 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) |
RetVal | figureClose (unsigned int figHandle, 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 | getAvailableWidgetNames (QSharedPointer< QStringList > widgetNames, ItomSharedSemaphore *semaphore) |
RetVal | registerActiveTimer (const QPointer< QTimer > &timer, const QString &name, ItomSharedSemaphore *semaphore=NULL) |
registerActiveTimer can be used to register a running timer instance for the 'active timer dialog' of the main window | |
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) |
QList< TimerContainer > | getRegisteredTimers () |
returns a QList with the TimerContainers inside. This function is for instance by 'timer dialog' | |
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 >initSlotCount, QSharedPointer< unsigned int > objectID, QSharedPointer< QByteArray > className) |
Private Slots | |
void | watcherThreadFinished () |
RetVal | unregisterActiveTimer (ItomSharedSemaphore *semaphore=NULL) |
unregisterActiveTimer scans the m_timers qList for NULL pointers | |
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 ¶meter, bool pythonNotCStyle, bool *valid=NULL) |
ito::UiOrganizer::ClassInfoContainerList::Iterator | parseMetaPropertyForEnumerationTypes (const QMetaProperty &meth, ClassInfoContainerList ¤tPropList) |
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 | |
WidgetWrapper * | m_widgetWrapper |
QHash< unsigned int, UiContainerItem > | m_dialogList |
QHash< unsigned int, QPointer < QObject > > | m_objectList |
int | m_garbageCollectorTimer |
QMap< QObject *, QThread * > | m_watcherThreads |
QUiLoader * | m_pUiLoader |
QHash< QString, QTranslator * > | m_transFiles |
QList< TimerContainer > | m_timers |
Static Private Attributes | |
static unsigned int | autoIncUiDialogCounter = 99 |
static unsigned int | autoIncObjectCounter = 1 |
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.
< 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
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.
ito::UiOrganizer::~UiOrganizer | ( | ) |
destructor
Deletes all remaining user interfaces, by deleting the corresponding instances of UiDialogSet. Stops a possible garbage collection timer.
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.
[in] | objPtr | is the pointer to an existing instance, which inherits QObject |
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.
QList< TimerContainer > ito::UiOrganizer::getRegisteredTimers | ( | ) |
returns a QList with the TimerContainers inside. This function is for instance by 'timer dialog'
This method is usually called by the Python 'active timer dialog' and is rquired for updating the sialog
RetVal ito::UiOrganizer::registerActiveTimer | ( | const QPointer< QTimer > & | timer, |
const QString & | name, | ||
ItomSharedSemaphore * | semaphore = NULL |
||
) | [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.
timer | is the weak pointer to the active QTimer instance |
name | is a name that describes the timer (e.g. its timer id) |
semaphore | is the optional semaphore for thread-based calls (or NULL) |
void ito::UiOrganizer::timerEvent | ( | QTimerEvent * | event | ) | [private] |
method, called by garbage collection timer, in order to regularly start the garbage collection process
RetVal ito::UiOrganizer::unregisterActiveTimer | ( | ItomSharedSemaphore * | semaphore = NULL | ) | [private, slot] |
unregisterActiveTimer scans the m_timers qList for NULL pointers
This private slot is usually connected to the destroyed signal of a timer registered in m_timers. mTimers provides the active timers which are needed for the timer manager. If a timer is deleted the pointer in m_timers will be NULL. In this slot the list is scanned for pointers equal to NULL.
semaphore | is the optional semaphore for thread-based calls (or NULL) |
unsigned int ito::UiOrganizer::autoIncObjectCounter = 1 [static, private] |
auto incrementing counter for elements in m_objectList
unsigned int ito::UiOrganizer::autoIncUiDialogCounter = 99 [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
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.
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)
WidgetWrapper* ito::UiOrganizer::m_widgetWrapper [private] |
singleton instance to WidgetWrapper in order to access some public methods of several widgets by python