Only setup controller devices after UI has loaded to prevent control object dependency loop#4651
Conversation
…object dependency loop
|
I don't have qt6 working so I can't test with QML |
| &MixxxMainWindow::initializationProgressUpdate); | ||
| pCoreServices->initialize(pApp); | ||
| mainWindow.initialize(); | ||
| pCoreServices->getControllerManager()->setUpDevices(); |
There was a problem hiding this comment.
this line could alternatively go in mixxxmainwindow
There was a problem hiding this comment.
At least there is an asymetie for the QMl and widget case. Can we move both to main, or do we have a good reason for the current places?
|
Not that this does not solve the problem. It only works in certain circumstances, i.e. the skin in use needs to define the same COs that the mapping uses. Use a custom skin that doesn't support The same goes for the QML UI, which doesn't support skin-defined COs at all. IMHO, built-in mapping mustn't use any non-standard COs, so that they always work, regardless of the skin that is used. So we either need to make these COs official (as proposed in #4647) or we need to remove usage of non-standard COs like |
|
Couldn't get my controller working with the QML version so I cannot really comment on this PR. The legacy skins at least work. |
|
ok I see what you mean. Let's keep #4647 and make these official COs |
Please explain what "unusable" means @Holzhaus A would affect mappings that use unofficial skin COs for |
|
Besides: Also, I think we should have both |
|
A. Trying to use a non-existing CO from JavaScript results in a JS exception, making the whole mapping unusable. And even if we changed that and just logged a warning (which we shouldn't, because this really helps detecting mapping bugs), it would lead to weird behavior. Because if the CO doesn't exist when the mapping is loaded, then the script won't be notified when the CO is created. So even after switching skins, the button does not work unless the mapping is reloaded. |
I agree. #4651 is not a replacement for this PR, but it would fix the case that someone uses a custom skin + custom mapping and wants to use custom COs in both. |
IIRC thats only the case in controllerDebug mode, but the this solution suffers from other major issues so it doesn't matter. |
It's all about this, right? mixxx/src/controllers/scripting/legacy/controllerscriptinterfacelegacy.cpp Lines 230 to 241 in d0449ae Okay, log a warning (= popup message) would be plausible, as well as that particular control not working if there is no counterpart in Mixxx, that's natural. But the "rest" of the mapping should work -- compared to "control non-existant, mapping disabled", open the js file, fix/disable the respective part, save, reload mapping. What I'm trying to say: Note: it should still not be permitted to use 'inofficial' COs in built-in mappings because the UX could be impaired. |
|
I think I agree with ronso0 -- we should allow controllers to invent new control objects to easily enable new features. We could make sure that in debug or controller developer mode, we pop up a warning but continue to load the mapping. In release mode, it should be fine to silently create the control and log a warning. that would mean a little more work for this PR. So I think maybe we should include this fix as well as #4661 -- we have a new list of official GUI controls that should be fully supported, and we can make life easier for script developers. |
Controllers we never capable of inventing new control objects, only skins. I can see why someone thought it was a good idea to let skins create new COs, but this leads to all kinds of issues and also incompatibilities with controller mappings (skin lock-in). Anyway, now that we have that feature, we cannot remove it until we drop legacy skins.
It may be tempting to just log a warnings, but IMHO it would be wrong for 2 reasons:
So I think we should not change that.
If we really decide to change the JS exception to a log message, that should be a separate PR anyway.
Yes, fixing the dependency issue for people who want to use skins and mappings with custom, unofficial COs makes sense. |
|
I was only referring to the current state of this PR: skin controls available for mappings -- no new features. |
What does "something like this" refer to? If it refers to this PR (i.e. if you're asking if we should fix the initialization order to fix the dependency issues), then the answer is "yes we should fix it". Currently this PR does not build due to the issue that Uwe pointed out above. After that is fixed, I'd be in favor of merging it. |
Yes, I'd appreciate this fix here. It's very simple and I don't spot what could go wrong. Potential CON: |
|
ok I will fix the issue so we can merge this as well. I don't think the delay in controllers being available is particularly noticeable to the user. |
|
ping @ywwg |
|
ah I'll fix the build issue and repush |
|
confirmed builds with qt6 |
|
@ronso0 anything else needed for this? |
|
Code LGTM. |
|
This PR is marked as stale because it has been open 90 days with no activity. |
|
Appearantly also relevant for COs created by the preferences, for example Did someone test it with QML? (I can't, haven't setup Qt6 yet) |
|
This patch also fixes EQ parameter changes not going through when they're read from a controller on Mixxx startup. |
|
@robbert-vdh Thanks for testing. Could you also test with Qt 6, for sake of completeness? |
|
@ronso0 I'm using Qt 6.4.1. |
|
Wait, never mind, Mixxx is built against Qt5. Let me try building against Qt6. |
|
Mixxx doesn't build against Qt 6.4.3 for me. Form the 3000 lines of compiler errors it looks like something that previously implicitly converted no longer does, but I sadly don't have the time to decipher this right now. |
|
would be cool to get this merged in! This is tested with legacy skins, can someone check against QML? |
@mixxxdj/developers |
|
Hitting merge now, finally! Thanks for the fix. |
Alternative to #4647