Skip to content

Instantly share code, notes, and snippets.

@lasconic
Created July 15, 2012 09:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lasconic/3116132 to your computer and use it in GitHub Desktop.
Save lasconic/3116132 to your computer and use it in GitHub Desktop.
import QtQuick 1.0
import MuseScore 1.0
import QtWebKit 1.0
import FileIO 1.0
MuseScore {
menuPath: "Plugins.ABC Web"
onRun: {
}
FileIO {
id: myFile
source: tempPath() + "/my_file.xml"
onError: console.log(msg)
}
WebView {
javaScriptWindowObjects: QtObject {
WebView.windowObjectName: "qml"
function qmlCall(abc) {
var doc = new XMLHttpRequest()
var url = "http://abc2musicxml.appspot.com/abcrenderer?abc=" + encodeURIComponent(abc);
doc.onreadystatechange = function() {
if (doc.readyState == XMLHttpRequest.DONE) {
var a = doc.responseText;
myFile.write(a);
readScore(myFile.source);
Qt.quit();
}
}
doc.open("GET", url);
doc.send()
}
}
preferredWidth: 490
preferredHeight: 400
settings.javascriptEnabled:true
html: "<html><head></head><body>Enter your ABC below <br/><div><textarea id='content' name='content' rows='15' cols='60'></textarea></div><div><a href='#' onClick=\"window.qml.qmlCall(document.getElementById('content').value);\">Convert</a></div></body></html>"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment