Basic CLI support

Closes #221
This commit is contained in:
Floris Bos 2021-05-06 01:47:34 +02:00
parent 258f9d77aa
commit 62e9969afb
9 changed files with 307 additions and 10 deletions

39
cli.h Normal file
View file

@ -0,0 +1,39 @@
#ifndef CLI_H
#define CLI_H
#include <QObject>
#include <QVariant>
class ImageWriter;
class QCoreApplication;
class Cli : public QObject
{
Q_OBJECT
public:
explicit Cli(int &argc, char *argv[]);
virtual ~Cli();
int main();
protected:
QCoreApplication *_app;
ImageWriter *_imageWriter;
int _lastPercent;
QByteArray _lastMsg;
bool _quiet;
void _printProgress(const QByteArray &msg, QVariant now, QVariant total);
void _clearLine();
protected slots:
void onSuccess();
void onError(QVariant msg);
void onDownloadProgress(QVariant dlnow, QVariant dltotal);
void onVerifyProgress(QVariant now, QVariant total);
void onPreparationStatusUpdate(QVariant msg);
signals:
};
#endif // CLI_H