| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
#include "util/deviceinfo.h" |
| 7 |
|
| 8 |
#include <DSingleton> |
| 9 |
|
| 10 |
#include <QObject> |
| 11 |
#include <QScopedPointer> |
| 12 |
|
| 13 |
class BMInterfacePrivate; |
| 14 |
class BMInterface : public QObject, public Dtk::Core::DSingleton<BMInterface> |
| 15 |
{ |
| 16 |
Q_OBJECT |
| 17 |
public: |
| 18 |
explicit BMInterface(QObject *parent = nullptr); |
| 19 |
~BMInterface(); |
| 20 |
|
| 21 |
static void initResources() |
| 22 |
{ |
| 23 |
#if defined(STATIC_LIB) |
| 24 |
Q_INIT_RESOURCE(blob); |
| 25 |
#endif |
| 26 |
} |
| 27 |
|
| 28 |
signals: |
| 29 |
void deviceListChanged(const QList<DeviceInfo> &addlist, const QList<DeviceInfo> &dellist); |
| 30 |
void finished(int errcode, const QString &description); |
| 31 |
void reportProgress(int current, int total, const QString &title, const QString &description); |
| 32 |
void reportProgress1(int current, int total, const QString &title, const QString &description); |
| 33 |
void startInstall(const QString &image, |
| 34 |
const QString &device, |
| 35 |
const QString &partition, |
| 36 |
bool formatDevice); |
| 37 |
void startInstallRet(bool success); |
| 38 |
|
| 39 |
public slots: |
| 40 |
void start(); |
| 41 |
void stop(); |
| 42 |
void reboot(); |
| 43 |
QList<DeviceInfo> deviceList(); |
| 44 |
bool checkfile(const QString &filepath); |
| 45 |
|
| 46 |
private: |
| 47 |
bool install(const QString &image, |
| 48 |
const QString &device, |
| 49 |
const QString &partition, |
| 50 |
bool formatDevice); |
| 51 |
|
| 52 |
friend class Dtk::Core::DSingleton<BMInterface>; |
| 53 |
QScopedPointer<BMInterfacePrivate> d_ptr; |
| 54 |
Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_ptr), BMInterface) |
| 55 |
}; |
| 56 |
|