(ui): IAction harmonisation and modernisation
Description
IAction
uses a different vocabulary in its functions and its signals/slots to name the same concepts:
- executable -> enable
- active -> check
We should opt for one or the other.
Also, we miss signals with a boolean state as a parameter. This would help replace SBooleanSlotCaller
in many places.
Functional specifications
- Use "enable" instead of "executable" and "check" instead of "active".
- We do not want to break the existing API. There is too much to change. We should use a proper deprecation phase (Sight 23.0). Each function using the old vocabulary should be marked as deprecated.
Technical specifications
- Copy existing methods mentioning "executable" and "active" and modify them with the new vocabulary. Use a single method as a setter with a default boolean parameter, i.e.:
void enable(bool _value = true);
void disable();
void check(bool _value = true);
void uncheck();
To avoid any confusion, implement getters as:
[[nodiscard]] bool enabled() const;
[[nodiscard]] bool checked() const;
- Update the
initialize
method to support old and previous vocabulary. Warn about deprecation with the old vocabulary. Take the opportunity to switch toboost::property_tree
. - Use [[deprecated]] C++17 attribute on old functions.
- Add the new signals with the new vocabulary and emit them at the appropriate places.
- Switch to the new API in
SightViewer
and/or some tutorials- Try to replace
SSlotCaller
andSBooleanSlotCaller
occurrences.
- Try to replace
- Deprecate
SSlotCaller
,SBooleanSlotCaller
andSTimestampSlotCaller
with a message indicating to use signals/slots connections instead.
Test plan
- Implement the interface in a test (simple derivation, taking
SDefaultAction
as example) and test it (actually this should be the first thing to do when starting working on the task) - Test SightViewer (since you modified it). Also take care about GUI tests, they should still succeed.