fix(core): parameter replace doesn't work if uid was first declared in signal/slot or menuItem
Description
When using parameter in AppConfig through replace="someOtherUID" by="someLocalUID"
if someLocalUID
is first declared in a signal/slot (SSlotCaller for example) or in a menuItem (menu, toolbar). XML parsing step doesn't prefix someLocalUID
with the corresponding generic_UID.
This leads to error (most of the time it will do nothing) when trying to use an UID in the main xml, but service UID is really declared in a sub config.
Since most of the time nothing happens, it is very difficult to identify an error in our current config. But it seems that in sightCalibrator why have an issue. When opening CalibrationEdition activity, after loading a calibration file we cannot start videoGrabber.
from calibrationEdition.xml
:
...
<service uid="startVideoAct" type="sight::module::ui::base::com::SSlotCaller">
<slots>
<slot>videoGrabber1Srv/startCamera</slot>
<slot>videoGrabber2Srv/startCamera</slot>
</slots>
</service>
...
a SSlotCaller tries to startCamera on grabbers.
Grabbers UID are used later in the same file to start a sub-config:
...
<service uid="camera0LauncherCfg" type="sight::service::SConfigController">
<appConfig id="videoEdition" />
<inout key="camera" uid="camera0" />
<parameter replace="WID_PARENT" by="camera0View" />
<parameter replace="videoGrabber" by="videoGrabber1Srv" />
<parameter replace="grabberProxyGuiTitle" by="Please select the first video grabber" />
<parameter replace="cameraModifiedChannel" by="cameraModified" />
<parameter replace="videoPositionChangedChannel" by="videoPositionChanged" />
<parameter replace="videoPositionModifiedChannel" by="videoPositionModified" />
<parameter replace="videoDurationModifiedChannel" by="videoDurationModified" />
</service>
...
At the end the videoEdition.xml
configuration really declare the grabber service:
<extension implements="sight::service::extension::AppConfig">
<id>videoEdition</id>
<parameters>
<param name="WID_PARENT" />
<param name="camera" />
<param name="videoGrabber" />
...
<service uid="${videoGrabber}" type="sight::module::io::video::SGrabberProxy">
<in key="camera" uid="${camera}" />
<inout key="frameTL" uid="timeLine" />
<config>
<gui title="${grabberProxyGuiTitle}" />
</config>
</service>
...
Replacement is working but the first declaration of the UID (in the SSlotCaller in this example) does not prefix the Generic_UID part.
Closes #780 (closed)
How to test it?
Without this MR:
- Open SightCalibrator
- Go to Calibration Edition activity
- Load a calibration file
- Try to launch a camera
- --> Nothing
Try the same with the MR