-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Create wmainmenubar controls in coreservices so they are available to controllers on startup #4647
Conversation
I agree that something like this is necessary. With QML, all mappings that use those COs throw an error because they don't exist. However, currently the menu bar checks if the COs exist and Grey out the corresponding menu option if not. I think this is unreliable already (e. g. if you switch from a skin that has these COs to one that doesn't, the COs persist anyway). Maybe we can add an XML element to @ronso0 what do you think? In any case, the issue with broken mappings is arguably worse than the non-working menu bar items with certain skins, so I think this does not have to be fixed in this PR. |
could we detect support during skin creation, in the code that hooks up the COs, but testing to see if that CO is in a given list? Then skin authors wouldn't have to remember to add another item. Agree that this is best done in a followup |
Not sure, that sounds pretty complex and I'm unsure if it's worth to put that much work into this when the only downside is that the menu entry is greyed out when the skin designer forgets to add it. |
I think we should merge this. Though, for me neither this PR nor the feature list approach would work because in my mapping I use a few skin-specific controls (toggle mixxer, toggle waveforms, ...). If I get it right the core issue is the race condition between loading skins and loading mappings, right? Really clumsy idea: have a prepared controls list per skin? |
The issue is not a race condition, it's a dependency loop. mainwindow depends on coreservices, so coreservices is created first. But the COs that the controllers want to connect to are created in the main window. lmk if I can merge or if I should wait for someone else to do so |
Ah right, that's why I did #4355 as I did : ) What do you think about my proposal of having a prepared controls list to create the controls in coreservices? |
@Holzhaus LGTY? |
src/coreservices.cpp
Outdated
@@ -422,6 +422,21 @@ void CoreServices::initialize(QApplication* pApp) { | |||
|
|||
m_pTouchShift = std::make_unique<ControlPushButton>(ConfigKey("[Controls]", "touch_shift")); | |||
|
|||
// The following wmainmenubar controls must be created here so that controllers can bind to them | |||
// on startup. | |||
m_pSkinSettingsControl = std::make_unique<ControlPushButton>( |
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.
This is a binary flag, not a button, right? Shouldn't this be
m_pSkinSettingsControl = std::make_unique<ControlPushButton>( | |
m_pSkinSettingsControl = std::make_unique<ControlObject>( |
?
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.
good catch thanks
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.
Ping
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.
I don't understand the difference between [Master],skin_settings
and [Microphone],show_microphone
for example. All those are used for binary pushbuttons.
May someone please elaborate?
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.
This makes a difference when linking a midi button and is also used for the default behavior in skins.
A plain ControlObject has no hints how to link a midi button and should be only used for internal 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.
Thank you!
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.
so is skin_settings not triggered by midi? Is that the only reason not to set as a pushbutton?
I do, but this doesn't need to happen in this PR IMHO. As of now, it's an unofficial CO. Before making it "official", we should rename it. |
let me see if this will work -- I agree it makes sense to reuse that mechanism. (I'll try to look at this tomorrow / this weekend) |
Yes, it works. The tedious part is to set up the file im/export parser. |
I don't understand how this approach is supposed to work tbh. |
¹ for custom skins that file export can be triggered with Make sure |
Hmm, this still doesn't fix the issue that any controller mapping that uses those COs will not work when a skin is used that doesn't support all of those COs. In that case, I think we need to remove usage of those COs in built-in skins then. This also doesn't solve the issue for the QML UI which doesn't support skin-defined COs. What is the problem with the simple solution in this PR? |
No problem, it works for the menu bar controls. Thus my proposal (some months ago) to create all major skin controls in C++, e.g. show_mixer, show_samplers, show_waveforms etc. |
I see what you are saying but this solution seems over-complicated for this particular problem. And there are issues like these items are created by the menu system, not the skin, so it's not quite the right fit. Let's merge this fix and we can iterate on it later, especially as QML becomes more mature. |
(I also don't like the idea of saving a list to a file... I think there could be a more robust solution like moving controller loading after skin creation) |
Okay. I already approved this PR, so I thought we were just discussing my proposal which is only for the skin COs.
Sure, that's the most obvious solution, though no one worked on it, yet. |
so are we self-merging PRs now? I let people do that with my approvals but I wasn't sure if it was reciprocal. I will poke to see if we can init controllers after skins |
oh, pushed the controlobject type fix |
oh I think I might have a simpler fix #4651 |
Changed to draft to defer merging. Will test #4651. |
@Holzhaus makes a good point that it's probably better to make these COs official, in which case coreservices is a good place to put them |
effectrack show/hide is just [EffectRack1],show. I am unable to figure out where EffectRack1 is even created so I can't figure out if that CO is generated by code. |
… controllers on startup
Add remaining skin controls
I think we obsoleted effectracks, so it's correct to just create this CO manually |
Converted to a vector of pointers since the objects themselves don't need to be individually referenced anywhere. This makes Skin Settings a controlpushbutton again, which based on the discussion I think is correct. A user might have a midi button to open the skin settings in which case we'd want it to be a toggle like the others |
Co-authored-by: Daniel Schürmann <daschuer@mixxx.org>
@daschuer please mark as approved if you're satisfied |
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.
LGTM, Thank you for taking care.
This is broken for some reason -- when I start mixxx the mixer doesn't show up. reverting. |
The coreservices refactor broke controllers that bind a button to maximize_library. This is because controllers are initialized before the main window, because main window initialization depends on core services, and core services sets up controllers. So it's a catch-22.
I have solved this by creating those controls in coreservices, much like touch_shift is created. This solves the problem with my S3 controller.