-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSysCommand.h
32 lines (24 loc) · 941 Bytes
/
SysCommand.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
32
//
// Created by marcus on 2024-07-18.
//
#ifndef SYSCOMMAND_H
#define SYSCOMMAND_H
#include <QObject>
#include <QProcess>
class SysCommand : public QObject
{
Q_OBJECT
public:
void refreshDns();
void makeDir(const QString& path, bool usePkExec = false);
void mountFs(const QString& remote, const QString& path, const QString& fsType, const QString& options = "", bool usePkExec = false);
[[nodiscard]] QString readFile(const QString& filePath, bool usePkExec = false);
[[nodiscard]] bool copyFile(const QString& fromFile, const QString& toFile, bool usePkExec = false);
[[nodiscard]] int waitForFinished(int msecs = 30000) const { return pProcess->waitForFinished(msecs); }
signals:
void commandFinished(int exitCode);
private:
std::unique_ptr<QProcess> pProcess;
void runCommand(const QString& cmd, QStringList args, bool jsonResult = false, bool usePkExec = false);
};
#endif //SYSCOMMAND_H