| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include "bmhandler.h" |
| 8 |
#include "../installer/qtbaseinstaller.h" |
| 9 |
#include "../util/devicemonitor.h" |
| 10 |
#include <istream> |
| 11 |
|
| 12 |
class DeviceMonitor; |
| 13 |
class BootMaker : public BMHandler |
| 14 |
{ |
| 15 |
Q_OBJECT |
| 16 |
public: |
| 17 |
explicit BootMaker(QObject *parent = nullptr); |
| 18 |
virtual ~BootMaker() override |
| 19 |
{ |
| 20 |
if (m_pInstaller != nullptr) { |
| 21 |
delete m_pInstaller; |
| 22 |
m_pInstaller = nullptr; |
| 23 |
} |
| 24 |
|
| 25 |
if (m_monitorWork != nullptr) { |
| 26 |
m_monitorWork->quit(); |
| 27 |
m_monitorWork->wait(); |
| 28 |
m_monitorWork->deleteLater(); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
public slots: |
| 33 |
void reboot() override; |
| 34 |
void start() override; |
| 35 |
void stop() override; |
| 36 |
const QList<DeviceInfo> deviceList() const override; |
| 37 |
bool install(const QString &image, const QString &device, const QString &partition, bool formatDevice) override; |
| 38 |
bool checkfile(const QString &filepath) override; |
| 39 |
|
| 40 |
private: |
| 41 |
DeviceMonitor *m_usbDeviceMonitor = nullptr; |
| 42 |
QtBaseInstaller *m_pInstaller = nullptr; |
| 43 |
QThread *m_monitorWork = nullptr; |
| 44 |
}; |