EDIT: I will redo this work on top of 13220 instead.
This is a code quality improvement PR.
There is a lot of code duplication in the waveform widget classes. This PR proposes a way to reduce this by introducing the WaveformWidgetInfo class which contains the information for each WaveformWidgetType, rather than having this information in concrete WaveformWidget classes. The WaveformWidgetInfo class also serves as a factory (creator) for the WaveformWidget class.
I have so far implemented this for the allshader widgets only, but this can easily be extended to the rest of the code.
Apart from the code duplication reduction, other advantages are that: it removes the need for huge switches in WaveformWidgetFactory, it replaces the need to use ifdefs with registered WaveformWidgetInfo's, and allows to obtain info directly based on the WaveformWidgetType instead of having to know the concrete WaveformWidget class.
EDIT: I will redo this work on top of 13220 instead.
This is a code quality improvement PR.
There is a lot of code duplication in the waveform widget classes. This PR proposes a way to reduce this by introducing the WaveformWidgetInfo class which contains the information for each WaveformWidgetType, rather than having this information in concrete WaveformWidget classes. The WaveformWidgetInfo class also serves as a factory (creator) for the WaveformWidget class.
I have so far implemented this for the allshader widgets only, but this can easily be extended to the rest of the code.
Apart from the code duplication reduction, other advantages are that: it removes the need for huge switches in WaveformWidgetFactory, it replaces the need to use ifdefs with registered WaveformWidgetInfo's, and allows to obtain info directly based on the WaveformWidgetType instead of having to know the concrete WaveformWidget class.