QML Help
I'd be very grateful if someone could skim over the JavaScript bit of my MIDISightReader plugin and give me some clues as to how to upgrade it to the new QML framework.
Specifically:
- Get the plugin directory.
- Get the directory for temp files.
- Save a score as a MIDI file.
- Pop up a dialog who's text is read from a file, or is generated in the JavaScript.
- Set the stdout of a process to write to a file.
- Trigger a piece of JavaScript code from the stderr of a process run by the plugin.
I had a look at the built-in manual, but many of these methods seem to be missing.
Thanks.
Comments
The new plugin framework is still under development.
Go to Plugins -> Plugin creator and press the help button (with the rubber ring), you will find some help
Interesting reading :
Answers to your questions.
writeScore(Score*, const QString& name, const QString& ext)
should do it.readAllStandardOutput
without passing via a file. You need to create the process withnewProcess
. Check the run example packaged in the current nightlies.In reply to The new plugin framework is by [DELETED] 5
Thanks. I will peruse the tutorials.
Sounds like some of the features I need are not there yet.
Dialog box - I did find some QML to display warning message boxes, but it did not work.
Trigger JavaScript from stderr - this was a bit of a bodge! I think in the old plugin framework, the plugin was run in the GUI thread, as the GUI "hung" while the plugin was running. I need to display a results dialog when the Java bit of the plugin has completed. The only way I found to do this was for the Java to write the results to a file (.msg). When that completed, the Java wrote to stderr and this triggered the JavaScript to read the message file and display it. Naff, but it worked. You can see the JavaScript bit of the plugin that sets up this trigger:
midiSightReader.readyReadStandardError.connect(logMessage);
The logMessage() function then reads the file and shows a dialog with the message.
In reply to The new plugin framework is by [DELETED] 5
An alternative to the dialog issue may be to enable this through the OSC interface...?
In reply to The new plugin framework is by [DELETED] 5
I looked at your new FileIO interface example.
FileIO {
id: myFile
source: tempPath() + "/my_file.xml"
onError: console.log(msg)
}
Using the above, how do I get the string which represents myFile? I need to pass the string to my plugin code.
Thanks.
In reply to tempFile() by DonH
I guess with
myFile.source
In reply to I guess with myFile.source by [DELETED] 5
Great - that works.
I used to be able to do this in the old plugin framework:
midiSightReader.setStandardOutputFile(pluginPath+"/MIDISightReader/MIDISightReader.log");
Is there an equivalent in QML?
In reply to Stdout by DonH
No. At least not yet, the only way to read the output is readAllStandardOutput() and it will act on process completion.