On Sun, 2009-01-18 at 09:25 -0500, Sean M. Pappalardo wrote:
> Hi again.
> 
> Scratch that last request. Garth joined IRC and we settles on making a
> QList of QHashes available via a getter function.
> 

Yeah, something like that. The basic idea is you want the dialog to say
"hey, give me your list of stuff I need to throw in this table. In this
case, it's a list of the underlying datatype that represents the data in
the table. (So a QList of QHashes might be the right thing, but I can't
comment further without actually looking at the code.)

errr... Look at this call:

   // Construct row in table
   addRow(device, group, key, controltype, miditype, midino, midichan, option);

You basically need to pass the information in those parameters back from
MidiMapping somehow. Perhaps that information should be contained in a
struct, so you'd pass back a (pointer or reference to a) QList of some
"struct MidiMappingThingy".

What's in your QHash? I don't quite understand what a QHash would do for
you...

Actually, perhaps the information in those parameters already IS in a
data structure - It's in the XML. I think this is the thing that I've
been struggling with conceptually with the MIDI code. The XML is both
the data structure in which the MIDI mappings are stored at runtime as
well as a natural format for serialization.

So perhaps what you should do is just return "controller", ie. the
QDomElement corresponding to the entire <controller> block in the XML
and contains all the <controls> information.

The reason I woudln't want to do it this way is because you "pollute"
your codebase with XML parsing crap everywhere. Instead of going
structFoobar->midi_note, you have to walk through this XML tree. 
    
I'm forwarding this to mixxx-devel to see if anyone has any thoughts
about which approach would be better. It's a simple thing, but I'm not
entirely convinced that I know the best way to do this.

Thanks,
Albert

P.S.
> Now, do I return the actual QList or a reference or a pointer to
> dlgprefmidibindings?
> 

If the QList is created locally inside "getListOfMidiThings()", then you
can't return a pointer or reference because they will point to bad
memory when the function returns. If you're returning the "controller"
XML element, you can return a pointer or reference. Your other option is
to make QList<blah> m_qListOfMidiThings a private member variable of the
MidiMapping class. It won't get deleted when the getListOfMidiThings()
function returns.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to