forked from AdrianTM/mx-bootrepair
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcmd.h
31 lines (26 loc) · 1.07 KB
/
cmd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <QProcess>
class QTextStream;
class Cmd : public QProcess
{
Q_OBJECT
public:
explicit Cmd(QObject *parent = nullptr);
bool proc(const QString &cmd, const QStringList &args = {}, QString *output = nullptr,
const QByteArray *input = nullptr, bool quiet = false, bool elevate = false);
bool procAsRoot(const QString &cmd, const QStringList &args = {}, QString *output = nullptr,
const QByteArray *input = nullptr, bool quiet = false);
bool run(const QString &cmd, QString *output = nullptr, const QByteArray *input = nullptr, bool quiet = false,
bool elevate = false);
bool runAsRoot(const QString &cmd, QString *output = nullptr, const QByteArray *input = nullptr,
bool quiet = false);
[[nodiscard]] QString getCmdOut(const QString &cmd, bool quiet = false, bool elevate = false);
signals:
void done();
void errorAvailable(const QString &err);
void outputAvailable(const QString &out);
private:
QString out_buffer;
QString asRoot;
QString helper;
};