Bug #16
transform/ModelTransformerFactory needs refactoring to remove dependency on svgui
Status: | Closed | Start date: | 2010-10-04 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | - | |||
Target version: | - |
Description
Opening disclaimer: This is a no-fun bit of work that you probably don't want to do; I'll probably end up assigning it straight back to myself (and it would serve me right because it's my bug in the first place). But just in case you do:
There is something rather nasty that remains to be fixed, from the bit of modularisation work that created the SV libraries: svcore still has a dependency on svgui, in transform/ModelTransformerFactory.cpp. This should not happen; the dependency should be strictly the other way around.
If you look at ModelTransformerFactory, you'll see a #ifndef NO_SV_GUI near the top and some more further down. This allows compilation to skip the bits that depend on svgui, if that flag is set.
Previously this file of code appeared in two places -- once in Sonic Visualiser and once in Sonic Annotator. The SV version was compiled without NO_SV_GUI, and the Sonic Annotator version was compiled with it. Unfortunately this won't work now that the code only appears once, in a library that has to be used by both.
If we don't define NO_SV_GUI, then Sonic Annotator (which requires ModelTransformerFactory) won't link unless we pull in svgui and QtGui, which is highly undesirable. If we do define NO_SV_GUI, then Sonic Visualiser won't be able to show the plugin configuration dialog that should otherwise appear when you call up a plugin from the Transform menu (you can verify that this is indeed the case by comparing the behaviour of SV compiled from SourceForge with that compiled from the sonic-visualiser repository on this server).
Therefore, we need to refactor ModelTransformerFactory so that it never refers to QtGui. This probably means the code that is currently guarded by NO_SV_GUI needs to be pulled out into the place that calls ModelTransformerFactory when a GUI is present (which is Document::addDerivedModel in svapp/framework/Document.cpp), and registered with the factory via a callback (the place that calls it when no GUI is present then sets no callback).
But the code in ModelTransformerFactory is extremely laboured -- this is a real example of cramming something together to get it to work on an admittedly self-imposed deadline. In particular, there's no very effective encapsulation of the set of data that would need to be passed to such a callback. Whether to add such an encapsulation, or continue to work around the lack of one, is open to analysis.
Success criterion: Sonic Annotator should build and run as normal; Sonic Visualiser should build from the same libraries, and should show the proper transform configuration dialog when a plugin is invoked from the Transform menu.
History
#1
Updated by Chris Cannam almost 15 years ago
- Status changed from New to Closed
- Assignee changed from Luis Figueira to Chris Cannam
Closed with addition of a completely gross callback interface.