mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.43k stars 1.27k forks source link

use single class for all allshader waveformwidget types with info class #13249

Closed m0dB closed 4 months ago

m0dB commented 4 months ago

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.

m0dB commented 4 months ago

This has been replaced with https://github.com/acolombier/mixxx/pull/2 , which is on top of @acolombier PR https://github.com/mixxxdj/mixxx/pull/13220