Hi,

Unfortunately I don't have time to write this code at the moment, so
any or all of it that you're capable of doing yourself will speed
things up a lot. I'll explain what I think needs to be done.

So basically this needs to be done in two stages.

First of all you need to create a QScriptEngine and read in the
defined functions. You'll need a QScriptEngine that hangs around for
the whole time that Mixxx is running, see how I did this in script/
for an example. Then you basically need to open whatever our global
function definitions file was going to be called and call .evaluate()
on the engine with the contents. Then you should have an engine with
everything defined in.

Then the second stage is the dispatch. Here you have some function
name and your QScriptEngine, you use
QScriptEngine.globalObject().property(functionname) to get an object
representing the function and then you .call(...) on that with the
arguments you want to send.

It would be good if the dispatch part was done through some kind of
ScriptDispatchManager or some more suitable name. Which has some
function like call(enum source, string func, args...). Where this enum
allows us to hook in a map of strings to C++ functions at some point
in the future. For now it would just always be set to like
SOURCE_QTSCRIPT or something.

Level 76 of the fancypants school of code writing would be to create
CallableFunction objects which have a call() function which uses
varargs to allow us to retrieve functions from arbitrary sources and
then transparently call into C++/QtScript with any signature.

Feel free to ask infinitely more questions.

Adam

2008/12/8 Sean M. Pappalardo <[EMAIL PROTECTED]>:
> Hello.
>
> Attached is a patch that detects the <Script-Binding/> tag in the XML
> and makes a spot to call the QtScript function given in the <key> tag. I
> don't know how to actually do that, so it's just a qDebug and a
> pseudocode comment for now, so if someone who knows how to handle
> QtScript could fill that in, that'd be great.
>
> Sincerely,
> Sean M. Pappalardo
> "D.J. Pegasus"
>
> <<--------------------------------------------------------------------------------->>
> This E-Mail message has been scanned for viruses
> and cleared by >>SmartMail<< from Smarter Technology, Inc.
> <<--------------------------------------------------------------------------------->>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Mixxx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mixxx-devel
>
>

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to