|
|
|
@ -2,26 +2,32 @@
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
|
|
class Process : public QProcess {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Process(QObject *parent = 0) : QProcess(parent) { }
|
|
|
|
|
Process(QObject *parent = 0) : QProcess(parent) {}
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE void start(const QString &program, const QVariantList &arguments) {
|
|
|
|
|
QStringList args;
|
|
|
|
|
Q_INVOKABLE void start(const QString &program,
|
|
|
|
|
const QVariantList &arguments) {
|
|
|
|
|
QStringList args;
|
|
|
|
|
|
|
|
|
|
// convert QVariantList from QML to QStringList for QProcess
|
|
|
|
|
// convert QVariantList from QML to QStringList for QProcess
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < arguments.length(); i++)
|
|
|
|
|
args << arguments[i].toString();
|
|
|
|
|
for (int i = 0; i < arguments.length(); i++)
|
|
|
|
|
args << arguments[i].toString();
|
|
|
|
|
|
|
|
|
|
QProcess::start(program, args);
|
|
|
|
|
}
|
|
|
|
|
QProcess::start(program, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE QByteArray readAll() {
|
|
|
|
|
return QProcess::readAll();
|
|
|
|
|
}
|
|
|
|
|
Q_INVOKABLE QByteArray readAllStandardError() {
|
|
|
|
|
return QProcess::readAllStandardError();
|
|
|
|
|
}
|
|
|
|
|
Q_INVOKABLE QByteArray readAll() { return QProcess::readAll(); }
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE QByteArray readAllStandardError() {
|
|
|
|
|
return QProcess::readAllStandardError();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE QByteArray readAllStandardOutput() {
|
|
|
|
|
return QProcess::readAllStandardOutput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE QByteArray readLine() { return QProcess::readLine(); }
|
|
|
|
|
};
|
|
|
|
|