yhkylin-backup-tools/kybackup/module/datarestore.h

72 lines
2.0 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef DATARESTORE_H
#define DATARESTORE_H
#include <QStackedWidget>
#include "../backup_manager_interface.h"
#include "../backup-daemon/parsebackuplist.h"
class DataRestore : public QStackedWidget
{
Q_OBJECT
public:
enum DataRestoreState
{
IDEL = 0, // 空闲
CHECKING, // 环境校验中
RESTORING // 还原中
};
enum DataRestorePage
{
HOME_PAGE, // 首页
CHECK_ENV_PAGE, // 环境检测页
RESTORE_PAGE, // 还原中页
LAST_PAGE, // 结束页
};
public:
explicit DataRestore(QWidget *parent = nullptr);
virtual ~DataRestore();
private:
void initFirstWidget();
void initSecondWidget();
void initThirdWidget();
void initLastWidget();
bool checkIsNeedReboot();
signals:
void startCheckEnv();
void checkEnvResult(bool result, const QString &errMsg = "", const QString &errTip = "");
void startRestore();
void progress(int state, int rate);
void checkRestoreResult(bool result, const QString &errMsg = "", const QString &errTip = "");
public slots:
void on_pre_clicked(bool checked = false);
void on_next_clicked(bool checked = false);
void on_button_beginRestore_clicked(bool checked = false);
void on_checkEnv_start();
void on_checkEnv_end(int result);
void on_restore_start();
void on_checkRestore_end(int result);
void on_restore_end(bool result);
void reboot();
private:
// dbus接口
ComKylinBackupManagerInterface *m_pInterface;
QString m_uuid; // 还原点的UUID
QString m_devPath; // 如果是从移动设备进行还原,此中保存移动设备挂载路径
// 本地备份还是U盘备份: 0-本地备份1-移动设备备份2-异机备份仅用于业务场景标记不用于持久化记录3-自定义路径备份
int m_iPosition;
// 系统备份状态
int m_dataRestoreState;
// 是否需要重启
bool m_bNeedReboot;
};
#endif // DATARESTORE_H