diff --git a/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.cpp b/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.cpp index 9c46fca5746daea2af6d67f8078e3cbf67ec57f9..0d7911871493b5d79b86678631914ffd9f17da2b 100644 --- a/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.cpp +++ b/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.cpp @@ -109,9 +109,9 @@ void RobotUnitPluginWidgetController::onConnectComponent() { robotUnitPrx = getProxy<RobotUnitInterfacePrx>(robotUnitProxyName); listenerTopicName = robotUnitPrx->getListenerTopicName(); - onConnectTimerId = startTimer(100); usingTopic(listenerTopicName); updateToolBarActionCheckedState(); + QMetaObject::invokeMethod(this, "startOnConnectTimer", Qt::QueuedConnection); } void RobotUnitPluginWidgetController::onDisconnectComponent() @@ -156,7 +156,7 @@ QPointer<QWidget> RobotUnitPluginWidgetController::getCustomTitlebarWidget(QWidg showCDevs = new QAction {"Control Devices", customToolbar}; showCDevs->setCheckable(true); showCDevs->setToolTip("Hide/Show the list of Control Devices"); - connect(showCDevs, SIGNAL(toggled(bool)), widget.groupBoxCDev, SLOT(setShown(bool))); + connect(showCDevs, SIGNAL(toggled(bool)), widget.groupBoxCDev, SLOT(setVisible(bool))); customToolbar->addAction(showCDevs); customToolbar->addSeparator(); @@ -165,7 +165,7 @@ QPointer<QWidget> RobotUnitPluginWidgetController::getCustomTitlebarWidget(QWidg showSDevs = new QAction {"Sensor Devices", customToolbar}; showSDevs->setCheckable(true); showSDevs->setToolTip("Hide/Show the list of Sensor Devices"); - connect(showSDevs, SIGNAL(toggled(bool)), widget.groupBoxSDev, SLOT(setShown(bool))); + connect(showSDevs, SIGNAL(toggled(bool)), widget.groupBoxSDev, SLOT(setVisible(bool))); customToolbar->addAction(showSDevs); customToolbar->addSeparator(); @@ -174,7 +174,7 @@ QPointer<QWidget> RobotUnitPluginWidgetController::getCustomTitlebarWidget(QWidg showNJoint = new QAction {"NJointControllers", customToolbar}; showNJoint->setCheckable(true); showNJoint->setToolTip("Hide/Show the list of NJointControllers"); - connect(showNJoint, SIGNAL(toggled(bool)), widget.groupBoxNJointCtrl, SLOT(setShown(bool))); + connect(showNJoint, SIGNAL(toggled(bool)), widget.groupBoxNJointCtrl, SLOT(setVisible(bool))); customToolbar->addAction(showNJoint); customToolbar->addSeparator(); @@ -183,7 +183,7 @@ QPointer<QWidget> RobotUnitPluginWidgetController::getCustomTitlebarWidget(QWidg showNJointClasses = new QAction {"NJointController Classes", customToolbar}; showNJointClasses->setCheckable(true); showNJointClasses->setToolTip("Hide/Show the list of NJointControllers Classes"); - connect(showNJointClasses, SIGNAL(toggled(bool)), widget.groupBoxNJointCtrlClasses, SLOT(setShown(bool))); + connect(showNJointClasses, SIGNAL(toggled(bool)), widget.groupBoxNJointCtrlClasses, SLOT(setVisible(bool))); customToolbar->addAction(showNJointClasses); customToolbar->addSeparator(); @@ -249,6 +249,11 @@ void RobotUnitPluginWidgetController::writeLogClicked() robotUnitPrx->writeRecentIterationsToFile("/tmp/RobotUnitLog-{DateTime}"); } +void RobotUnitPluginWidgetController::startOnConnectTimer() +{ + onConnectTimerId = startTimer(100); +} + void RobotUnitPluginWidgetController::updateToolBarActionCheckedState() { if (customToolbar) @@ -261,18 +266,18 @@ void RobotUnitPluginWidgetController::updateToolBarActionCheckedState() } -void armarx::RobotUnitPluginWidgetController::timerEvent(QTimerEvent *) +void armarx::RobotUnitPluginWidgetController::timerEvent(QTimerEvent*) { - if(!robotUnitPrx) + if (!robotUnitPrx) { killTimer(onConnectTimerId); } - if(robotUnitPrx->isRunning()) + if (robotUnitPrx->isRunning()) { - QMetaObject::invokeMethod(this, "refreshNJointControllersClicked", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "refreshNJointControllerClassesClicked", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "refreshControlDevicesClicked", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "refreshSensorDevicesClicked", Qt::QueuedConnection); + refreshNJointControllersClicked(); + refreshNJointControllerClassesClicked(); + refreshControlDevicesClicked(); + refreshSensorDevicesClicked(); killTimer(onConnectTimerId); } } diff --git a/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.h b/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.h index f5673acaad40bb761db47e5b8c4fcafb0db4a11d..094a95fc6f785af605f7016299e1fa8c62db188d 100644 --- a/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.h +++ b/source/RobotAPI/gui-plugins/RobotUnitPlugin/RobotUnitPlugin/RobotUnitPluginWidgetController.h @@ -136,6 +136,8 @@ namespace armarx void writeLogClicked(); + void startOnConnectTimer(); + private: virtual void timerEvent(QTimerEvent*) override; void updateToolBarActionCheckedState();