foxygit / TV-Launcher Log in
commits tags

/src/shell.h · 557 B

raw
#pragma once

#include <QJSValue>
#include <QObject>

// Kör systemkommandon asynkront åt inställningssidorna (wpctl, bluetoothctl,
// nmcli ...). Resultatet skickas till en JS-funktion:
//   shell.run("wpctl", ["status"], (code, out, err) => { ... })
class Shell : public QObject
{
    Q_OBJECT
public:
    using QObject::QObject;

    Q_INVOKABLE bool has(const QString &program) const;
    Q_INVOKABLE void run(const QString &program, const QStringList &args,
                         const QJSValue &callback = QJSValue(), int timeoutMs = 30000);
};