Debian Codegraph @

src/libdbm/backend/bmhandler.h

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: GPL-3.0-only
4
5 #pragma once
6 #include "../util/deviceinfo.h"
7
8 #include <QObject>
9
10 class BMHandler : public QObject
11 {
12 Q_OBJECT
13 public:
14 enum ErrorType {
15 NoError = 0,
16 SyscExecFailed,
17 USBFormatError,
18 USBSizeError,
19 USBMountFailed,
20 USBNotMountFailed,
21 UMountUSBFailed,
22 CheckImageIntegrityFailed,
23 ExtractImgeFailed,
24 InstallBootloaderFailed,
25 GetUsbInstallDirFailed,
26 SyncIOFailed,
27 UnDefinedError
28 };
29
30 explicit BMHandler(QObject *parent = nullptr): QObject(parent)
31 {
32 connect(this, &BMHandler::startInstall,
33 this, &BMHandler::install);
34 connect(this, &BMHandler::startCheckfile,
35 this, &BMHandler::checkfile);
36 }
37
38 virtual ~BMHandler() {
39
40 }
41 static const QString errorString(BMHandler::ErrorType et);
42 signals:
43 void startInstall(const QString &, const QString &, const QString &, bool);
44 void startCheckfile(const QString &filepath);
45 void removablePartitionsChanged(const QList<DeviceInfo> &addlist, const QList<DeviceInfo>& reducelist);
46 void finished(int errcode, const QString &description);
47 void reportProgress(int current, int error, const QString &title, const QString &description);
48 void reportProgress1(int current, int error, const QString &title, const QString &description);
49 void startInstallRet(bool success);
50
51 public slots:
52 virtual void reboot() = 0;
53 virtual void start() = 0;
54 virtual void stop() = 0;
55 virtual const QList<DeviceInfo> deviceList() const = 0;
56 virtual bool checkfile(const QString &filepath) = 0;
57
58 protected:
59 virtual bool install(const QString &image,
60 const QString &device,
61 const QString &partition,
62 bool formatDevice) = 0;
63 };
64
65