Skip to content

Commit

Permalink
fix #289553: expose QProcess to plugin API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Jun 20, 2019
1 parent 1aa445e commit dea0a38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mscore/plugin/api/qmlpluginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void PluginAPI::registerQmlTypes()
return;

const char* enumErr = "You can't create an enumeration";
//TODO-ws qmlRegisterType<MsProcess> ("MuseScore", 3, 0, "QProcess");
qmlRegisterType<MsProcess> ("MuseScore", 3, 0, "QProcess");
qmlRegisterType<FileIO, 1> ("FileIO", 3, 0, "FileIO");
//-----------mscore bindings
qmlRegisterUncreatableMetaObject(Ms::staticMetaObject, "MuseScore", 3, 0, "Ms", enumErr);
Expand Down
8 changes: 4 additions & 4 deletions mscore/plugin/api/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ class FileIO : public QObject {
QString mSource;
};

// These classes usage in plugins is anyway disabled
// so exclude them from documentation too
/// \cond MS_INTERNAL
//---------------------------------------------------------
// MsProcess
// @@ QProcess
Expand All @@ -127,7 +124,10 @@ class MsProcess : public QProcess {
Q_INVOKABLE QByteArray readAllStandardOutput() { return QProcess::readAllStandardOutput(); }
};

//---------------------------------------------------------
// These classes usage in plugins is anyway disabled
// so exclude them from documentation too
/// \cond MS_INTERNAL
/// //---------------------------------------------------------
// @@ ScoreView
/// This is an GUI element to show a score.
//---------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions share/plugins/run.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import MuseScore 3.0
MuseScore {
menuPath: "Plugins.run"
version: "3.0"
description: "This demo plugin runs an external command. Probably this will only work on Linux."
description: "This demo plugin runs an external command."
requiresScore: false

QProcess {
Expand All @@ -36,7 +36,8 @@ MuseScore {

onRun: {
console.log("run ls");
proc.start("/bin/ls");
//proc.start("/bin/ls"); // Linux, Mac(?)
proc.start("cmd.exe /c dir"); // Windows
var val = proc.waitForFinished(30000);
if (val)
console.log(proc.readAllStandardOutput());
Expand Down

0 comments on commit dea0a38

Please sign in to comment.