-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make EffectControlDialog
inherit PluginView
#7544
base: master
Are you sure you want to change the base?
Conversation
Before this commit, `EffectView` inherits `PluginView` and `EffectControlDialog` inherits `ModelView`. This commit switches those base classes. The reason is that we previously had no base class for the 2 classes `InstrumentView` and `EffectControlDialog`: `PluginView` was the base class for `InstrumentView`, which does not contain the models for e.g. the "Volume" knob, and for `EffectView`, which does contain models for e.g. the "D/W" knob. This makes it questionable whether it is good that `Effect` contains an `m_wetDryModel`, but `Instrument` contains no "volume model" - but this commit does not fix this. Notes: 1. This commit should be a no-op, but isn't exactly: While before, `EffectControlDialog` passed `EffectControls*` to the `ModelView`, now, it passes `Effect*` to the `PluginView`, which passes it directly to the `ModelView`. 2. The function `Effect::instantiateView(QWidget*)` seemed to be never executed. Nonetheless, it needs an implementation in order to provide a virtual method - we thus replace the content of this function with an `assert(false)`.
Note: I am not sure if this PR is a good idea. In my opinion, For more details about what the widgets mean, please check allejok's widget overview . |
For discussion: An alternative would be to not touch |
IMO it might help to think about how such a new base class would look like. What would be the functionality that's shared between Another aspect that might be worth considering is where |
Aside from The inconsistency currently ist that both EffectView (inside the EffectRackView) and EffectControlDialog (base class for the different Effect GUIs) have
For the "alternative" approach of adding an extra class, currently solely
Definitely yes. While some people say that all LMMS instruments should be rewritten to be resizable, we cannot control that behavior for Lv2 UIs, which can be both resizable or not. The same argument counts for effects, ofc.
Given my elaboration on the beginning of this comment: We have the commonalities "isResizing" and "ModelView". As they are both needed in both classes, IMO it comes naturally to have a base class. Concluding everything, I think this PR approach is correct, but a further approach should still separate |
I should then be considered to split the models. It sounds like the common parameters (D/W, Decay, Gain) should then get their own model. In the end they are applied as an "afterburner" after the processing of the actual effect, aren't they? |
Sounds reasonable to me (I hope I am not complicating things unnecessarily?). However, as he was very active at exactly that code, I would like to ask @messmerd for a second opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually refactors should offer a clear benefit though simplification, elegance, removal of duplicate code, etc. but this PR doesn't do that as far as I can tell.
I don't like how Effect::instantiateView
is now unused, which seems like a step back.
However, if multiple other PRs are waiting on this, I think it's okay to merge. A proper refactor of the instrument/effect views would take more time anyway.
I tested it and there do not seem to be any regressions.
{ | ||
Q_OBJECT | ||
public: | ||
EffectControlDialog( EffectControls * _controls ); | ||
EffectControlDialog(EffectControls *controls); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EffectControlDialog(EffectControls *controls); | |
EffectControlDialog(EffectControls* controls); |
style
protected: | ||
void closeEvent( QCloseEvent * _ce ) override; | ||
void closeEvent(QCloseEvent *closeEv) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void closeEvent(QCloseEvent *closeEv) override; | |
void closeEvent(QCloseEvent* closeEv) override; |
{ | ||
Q_OBJECT | ||
public: | ||
EffectView( Effect * _model, QWidget * _parent ); | ||
EffectView(Effect *model, QWidget *parent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EffectView(Effect *model, QWidget *parent); | |
EffectView(Effect* model, QWidget* parent); |
QWidget( nullptr ), | ||
ModelView( _controls, this ), | ||
m_effectControls( _controls ) | ||
EffectControlDialog::EffectControlDialog(EffectControls *controls) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EffectControlDialog::EffectControlDialog(EffectControls *controls) : | |
EffectControlDialog::EffectControlDialog(EffectControls* controls) : |
} | ||
|
||
|
||
|
||
|
||
void EffectControlDialog::closeEvent( QCloseEvent * _ce ) | ||
void EffectControlDialog::closeEvent(QCloseEvent *closeEv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void EffectControlDialog::closeEvent(QCloseEvent *closeEv) | |
void EffectControlDialog::closeEvent(QCloseEvent* closeEv) |
PluginView( _model, _parent ), | ||
m_bg( embed::getIconPixmap( "effect_plugin" ) ), | ||
m_subWindow( nullptr ), | ||
EffectView::EffectView(Effect * modelParam, QWidget *parent) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EffectView::EffectView(Effect * modelParam, QWidget *parent) : | |
EffectView::EffectView(Effect* modelParam, QWidget* parent) : |
They are not waiting because they need it, but only because their code would differ if that PR would be merged 😃
I am totally fine with this opinion (and not offended, I am happy about the honesty). This PR is not needed, so I am also fine with not finishing it. At least, we could finally continue with the other PRs 😆 @michaelgregorius What do you think? Let's move this PR to the archives and finally move on with our resize/maximize PRs? Or do you have a strong desire/dependency that I finish this PR? |
Before this commit,
EffectView
inheritsPluginView
andEffectControlDialog
inheritsModelView
. This commit switches those base classes.The reason is that we previously had no base class for the 2 classes
InstrumentView
andEffectControlDialog
:PluginView
was the base class forInstrumentView
, which does not contain the models for e.g. the "Volume" knob, and forEffectView
, which does contain models for e.g. the "D/W" knob. This makes it questionable whether it is good thatEffect
contains anm_wetDryModel
, butInstrument
contains no "volume model" - but this commit does not fix this.Notes:
EffectControlDialog
passedEffectControls*
to theModelView
, now, it passesEffect*
to thePluginView
, which passes it directly to theModelView
.Effect::instantiateView(QWidget*)
seemed to be never executed. Nonetheless, it needs an implementation in order to provide a virtual method - we thus replace the content of this function with anassert(false)
.