forked from zwpwjwtz/f3-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
f3_launcher.h
91 lines (81 loc) · 2.07 KB
/
f3_launcher.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef F3_LAUNCHER_H
#define F3_LAUNCHER_H
#include <QProcess>
#include <QTimer>
#include <QMap>
enum f3_launcher_status
{
f3_launcher_ready = 0,
f3_launcher_running = 1,
f3_launcher_finished = 2,
f3_launcher_stopped = 3,
f3_launcher_staged = 4,
f3_launcher_progressed = 5,
};
enum f3_launcher_error_code
{
f3_launcher_ok = 0,
f3_launcher_path_incorrect = 128,
f3_launcher_no_cui = 129,
f3_launcher_no_permission = 130,
f3_launcher_no_space = 131,
f3_launcher_no_progress = 132,
f3_launcher_no_quick = 133,
f3_launcher_cache_nofound = 134,
f3_launcher_no_memory = 135,
f3_launcher_not_directory = 136,
f3_launcher_not_disk = 137,
f3_launcher_not_USB = 138,
f3_launcher_unknownError = 255,
};
struct f3_launcher_report
{
bool success;
QString ReadingSpeed;
QString WritingSpeed;
QString ReportedFree;
QString ActualFree;
QString LostSpace;
float availability;
QString ModuleSize;
QString BlockSize;
};
class f3_launcher : public QObject
{
Q_OBJECT
public:
f3_launcher();
~f3_launcher();
f3_launcher_status getStatus();
f3_launcher_error_code getErrCode();
void startCheck(QString devPath);
void stopCheck();
f3_launcher_report getReport();
int getStage();
bool setOption(QString key, QString value);
QString getOption(QString key);
QString f3_cui_output;
int progress;
signals:
void f3_launcher_status_changed(f3_launcher_status status);
void f3_launcher_error(f3_launcher_error_code errCode);
private:
QProcess f3_cui;
f3_launcher_status status;
f3_launcher_error_code errCode;
bool showProgress;
QString devPath;
int stage;
QTimer timer;
QMap<QString,QString> options;
void emitError(f3_launcher_error_code errorCode);
bool probeCommand(QString command);
float probeVersion();
bool probeDiskFull(QString& devPath);
bool probeCacheFile(QString& devPath);
int parseOutput();
private slots:
void on_f3_cui_finished();
void on_timer_timeout();
};
#endif // F3_LAUNCHER_H