From aae6b39ca7296c7d343eaa24f51ce9da63d3557b Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Thu, 30 Dec 2021 10:27:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/databackupproxy.cpp | 3 +- backup-daemon/datarestoreproxy.cpp | 2 +- backup-daemon/datarestoreproxy.h | 2 - backup-daemon/deletebackupproxy.cpp | 4 + backup-daemon/deletebackupproxy.h | 2 + backup-daemon/systembackupproxy.cpp | 3 +- backup-daemon/systemrestoreproxy.cpp | 6 +- backup-daemon/udiskdatabackupproxy.cpp | 3 +- backup-daemon/udiskdatarestoreproxy.cpp | 2 +- backup-daemon/udiskdatarestoreproxy.h | 2 - backup-daemon/udisksystembackupproxy.cpp | 3 +- backup-daemon/udisksystemrestoreproxy.cpp | 6 +- backup-daemon/workerfactory.cpp | 3 - common/mydefine.h | 2 - common/utils.cpp | 14 +- kybackup/kybackup.pro | 2 + kybackup/maindialog.cpp | 5 + kybackup/module/operationlog.cpp | 180 ++++++++++++++++++++++ kybackup/module/operationlog.h | 24 +++ kybackup/module/systemrestore.cpp | 5 + kybackup/module/systemrestore.h | 1 + 21 files changed, 249 insertions(+), 25 deletions(-) create mode 100644 kybackup/module/operationlog.cpp create mode 100644 kybackup/module/operationlog.h diff --git a/backup-daemon/databackupproxy.cpp b/backup-daemon/databackupproxy.cpp index 23fe746..fb5627d 100644 --- a/backup-daemon/databackupproxy.cpp +++ b/backup-daemon/databackupproxy.cpp @@ -350,7 +350,8 @@ bool DataBackupProxy::backupData() Utils::writeBackupLog(m_backupPoint.m_time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + "," + m_backupWrapper.m_note + "," + m_backupPoint.m_size - + "," + QString::number(m_backupWrapper.m_frontUid)); + + "," + QString::number(m_backupWrapper.m_frontUid) + + "," + m_backupWrapper.m_backupName); Utils::update_backup_unique_settings(m_curUuid, m_backupPoint.m_backupName); m_bSuccess = true; } diff --git a/backup-daemon/datarestoreproxy.cpp b/backup-daemon/datarestoreproxy.cpp index 8ecb04f..90406e2 100644 --- a/backup-daemon/datarestoreproxy.cpp +++ b/backup-daemon/datarestoreproxy.cpp @@ -128,7 +128,7 @@ void DataRestoreProxy::restoreData() connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) { if (result) { QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); - Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)); + Utils::writeBackupLog(time + "," + m_backupWrapper.m_uuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)+ "," + m_backupWrapper.m_backupName); } emit this->workResult(result); }); diff --git a/backup-daemon/datarestoreproxy.h b/backup-daemon/datarestoreproxy.h index cbb1125..523cebf 100644 --- a/backup-daemon/datarestoreproxy.h +++ b/backup-daemon/datarestoreproxy.h @@ -45,8 +45,6 @@ private: // 是否还原成功 bool m_bSuccess; - // 当前备份uuid - QString m_curUuid; // 当前还原源目录 QString m_srcPath; // 还原进程 diff --git a/backup-daemon/deletebackupproxy.cpp b/backup-daemon/deletebackupproxy.cpp index 4c68020..04cd11b 100644 --- a/backup-daemon/deletebackupproxy.cpp +++ b/backup-daemon/deletebackupproxy.cpp @@ -1,5 +1,6 @@ #include "deletebackupproxy.h" #include +#include #include #include "../common/utils.h" @@ -66,5 +67,8 @@ void DeleteBackupProxy::deleteBackupPointDir() args << "-rf"; args << uuidPath; QProcess::execute("rm", args); + + QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); + Utils::writeBackupLog(time + "," + m_backupWrapper.m_uuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)+ "," + m_backupWrapper.m_backupName); } diff --git a/backup-daemon/deletebackupproxy.h b/backup-daemon/deletebackupproxy.h index c53f894..4153337 100644 --- a/backup-daemon/deletebackupproxy.h +++ b/backup-daemon/deletebackupproxy.h @@ -20,6 +20,8 @@ private: bool deleteXmlBackupPoint(); void deleteBackupPointDir(); + + ParseBackupList::BackupPoint m_backupPoint; }; #endif // DELETEBACKUPPROXY_H diff --git a/backup-daemon/systembackupproxy.cpp b/backup-daemon/systembackupproxy.cpp index 5bc3869..c940b65 100755 --- a/backup-daemon/systembackupproxy.cpp +++ b/backup-daemon/systembackupproxy.cpp @@ -434,7 +434,8 @@ bool SystemBackupProxy::backupSystem() // Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ","+ m_backupWrapper.m_note + "," + m_backupPoint.m_size+ "," + QString::number(m_backupWrapper.m_frontUid)); Utils::writeBackupLog(m_backupPoint.m_time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + "," - + m_backupWrapper.m_note + "," + m_backupPoint.m_size); + + m_backupWrapper.m_note + "," + m_backupPoint.m_size + + ",," + m_backupWrapper.m_backupName); Utils::update_backup_unique_settings(m_curUuid, m_backupPoint.m_backupName); m_bSuccess = true; } diff --git a/backup-daemon/systemrestoreproxy.cpp b/backup-daemon/systemrestoreproxy.cpp index 9662fa0..d2663f9 100644 --- a/backup-daemon/systemrestoreproxy.cpp +++ b/backup-daemon/systemrestoreproxy.cpp @@ -320,7 +320,9 @@ void SystemRestoreProxy::restoreSystem() } args << m_srcPath + "/"; - args << destPath + "/"; + destPath += "/"; + destPath.replace("//", "/"); + args << destPath; m_p = new RsyncPathToDirProcess(this); connect(m_p, &RsyncPathToDirProcess::progress, this, &SystemRestoreProxy::progress); @@ -328,7 +330,7 @@ void SystemRestoreProxy::restoreSystem() if (result) { QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); // Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)); - Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,,"); + Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,,," + m_backupWrapper.m_backupName); Utils::updateSyncFile(); QString fileIfSync = Utils::getSysRootPath() + FILE_IF_SYNC; diff --git a/backup-daemon/udiskdatabackupproxy.cpp b/backup-daemon/udiskdatabackupproxy.cpp index d048795..cc4c9bc 100644 --- a/backup-daemon/udiskdatabackupproxy.cpp +++ b/backup-daemon/udiskdatabackupproxy.cpp @@ -311,7 +311,8 @@ bool UDiskDataBackupProxy::backupDataToUdisk() Utils::writeBackupLog(m_backupPoint.m_time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + "," + m_backupWrapper.m_note + "," + m_backupPoint.m_size - + "," + QString::number(m_backupWrapper.m_frontUid)); + + "," + QString::number(m_backupWrapper.m_frontUid) + + "," + m_backupWrapper.m_backupName); Utils::update_backup_unique_settings(m_curUuid, m_backupPoint.m_backupName); m_bSuccess = true; } diff --git a/backup-daemon/udiskdatarestoreproxy.cpp b/backup-daemon/udiskdatarestoreproxy.cpp index 66bdd8d..04af6fe 100644 --- a/backup-daemon/udiskdatarestoreproxy.cpp +++ b/backup-daemon/udiskdatarestoreproxy.cpp @@ -129,7 +129,7 @@ void UDiskDataRestoreProxy::restoreData() m_isFinished = true; if (result) { QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); - Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)); + Utils::writeBackupLog(time + "," + m_backupWrapper.m_uuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)+ "," + m_backupWrapper.m_backupName); } emit this->workResult(result); }); diff --git a/backup-daemon/udiskdatarestoreproxy.h b/backup-daemon/udiskdatarestoreproxy.h index da4cbe3..bca65e9 100644 --- a/backup-daemon/udiskdatarestoreproxy.h +++ b/backup-daemon/udiskdatarestoreproxy.h @@ -50,8 +50,6 @@ private: bool m_bSuccess; // 是否完成 bool m_isFinished; - // 当前备份uuid - QString m_curUuid; // 当前还原源目录 QString m_srcPath; // 还原进程 diff --git a/backup-daemon/udisksystembackupproxy.cpp b/backup-daemon/udisksystembackupproxy.cpp index 804a3b9..5c02038 100755 --- a/backup-daemon/udisksystembackupproxy.cpp +++ b/backup-daemon/udisksystembackupproxy.cpp @@ -470,7 +470,8 @@ bool UDiskSystemBackupProxy::backup(const QStringList &args) // Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ","+ m_backupWrapper.m_note + "," + m_backupPoint.m_size+ "," + QString::number(m_backupWrapper.m_frontUid)); Utils::writeBackupLog(m_backupPoint.m_time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + "," - + m_backupWrapper.m_note + "," + m_backupPoint.m_size); + + m_backupWrapper.m_note + "," + m_backupPoint.m_size + + ",," + m_backupWrapper.m_backupName); Utils::update_backup_unique_settings(m_curUuid, m_backupPoint.m_backupName); m_bSuccess = true; diff --git a/backup-daemon/udisksystemrestoreproxy.cpp b/backup-daemon/udisksystemrestoreproxy.cpp index be5d82c..aa8636f 100644 --- a/backup-daemon/udisksystemrestoreproxy.cpp +++ b/backup-daemon/udisksystemrestoreproxy.cpp @@ -325,7 +325,9 @@ void UDiskSystemRestoreProxy::restoreSystem() QStringList args = getRsyncArgs(SystemRestoreScene::SYSTEM_RESTORE); args << m_srcPath + "/"; - args << destPath + "/"; + destPath += "/"; + destPath.replace("//", "/"); + args << destPath; m_p = new RsyncPathToDirProcess(this); connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskSystemRestoreProxy::progress); @@ -333,7 +335,7 @@ void UDiskSystemRestoreProxy::restoreSystem() if (result) { QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); // Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)); - Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,,"); + Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,,," + m_backupWrapper.m_backupName); Utils::updateSyncFile(); QString fileIfSync = Utils::getSysRootPath() + FILE_IF_SYNC; diff --git a/backup-daemon/workerfactory.cpp b/backup-daemon/workerfactory.cpp index 2a53acd..dc478bc 100755 --- a/backup-daemon/workerfactory.cpp +++ b/backup-daemon/workerfactory.cpp @@ -65,9 +65,6 @@ Worker * WorkerFactory::createWorker(int type, int position) className = "SystemBackupProxy"; } break; - case BackupType::AUTO_BACKUP_SYSTEM: - className = "AutoSystemBackupProxy"; - break; case BackupType::RESTORE_SYSTEM: case BackupType::RESTORE_SYSTEM_WITH_DATA: if (BackupPosition::UDISK == position) { diff --git a/common/mydefine.h b/common/mydefine.h index 2c7e18f..7e3ab73 100755 --- a/common/mydefine.h +++ b/common/mydefine.h @@ -76,8 +76,6 @@ enum BackupType { DELETE_BACKUP = 8, // ghost镜像 GHOST_IMAGE = 9, - // 自动升级模块的自动备份 - AUTO_BACKUP_SYSTEM = 10, // 仅仅初始化BackupType枚举类变量用,没有用于持久化,不用固定其值 BACKUP_TYPE_INIT, diff --git a/common/utils.cpp b/common/utils.cpp index 72460fa..b91dd19 100755 --- a/common/utils.cpp +++ b/common/utils.cpp @@ -619,7 +619,7 @@ bool Utils::writeBackupLog(QString line) std::fputs("#5:retaining user data\n", fp.get()); std::fputs("#6:restore data\n", fp.get()); std::fputs("#8:delete backup\n", fp.get()); - std::fputs("#for example: 17-04-25 10:43:56,{uuidxxxxx},0,this is a note\n", fp.get()); + std::fputs("#for example: 17-04-25 10:43:56,{uuidxxxxx},0,this is a note,21.19KB,userid-1000,备份名称\n", fp.get()); } std::fputs(line.toStdString().data(), fp.get()); std::fflush(fp.get()); @@ -938,13 +938,15 @@ QList Utils::getBackupLogList() } if (record.m_backupName.isEmpty()) { -// if (FACTORY_BACKUP_UUID == record.m_uuid) { -// record.m_backupName = QObject::tr("Factory Backup"); -// } else if (AUTO_BACKUP_UUID == record.m_uuid) { + if (FACTORY_BACKUP_UUID == record.m_uuid) { + record.m_backupName = QObject::tr("Factory Backup"); + } +// else if (AUTO_BACKUP_UUID == record.m_uuid) { // record.m_backupName = QObject::tr("Auto Backup"); -// } else { - record.m_backupName = record.m_uuid; // } + else { + record.m_backupName = record.m_uuid; + } } list << record; diff --git a/kybackup/kybackup.pro b/kybackup/kybackup.pro index 99b6d58..1d164fc 100755 --- a/kybackup/kybackup.pro +++ b/kybackup/kybackup.pro @@ -62,6 +62,7 @@ HEADERS += \ module/databackup.h \ module/datarestore.h \ module/managebackuppointlist.h \ + module/operationlog.h \ module/selectrestorepoint.h \ module/systembackup.h \ module/systemrestore.h \ @@ -102,6 +103,7 @@ SOURCES += \ module/databackup.cpp \ module/datarestore.cpp \ module/managebackuppointlist.cpp \ + module/operationlog.cpp \ module/selectrestorepoint.cpp \ module/systembackup.cpp \ module/systemrestore.cpp \ diff --git a/kybackup/maindialog.cpp b/kybackup/maindialog.cpp index c761dc1..b6a4530 100755 --- a/kybackup/maindialog.cpp +++ b/kybackup/maindialog.cpp @@ -12,6 +12,7 @@ #include "module/systemrestore.h" #include "module/databackup.h" #include "module/datarestore.h" +#include "module/operationlog.h" #include "backup_manager_interface.h" #include "globalbackupinfo.h" #include "messageboxutils.h" @@ -222,6 +223,10 @@ void MainDialog::selected(int func_type) m_stackedWidget = new DataRestore(ui->centralwidget); GlobelBackupInfo::inst().setFuncType(FuncTypeConverter::FunType::RESTORE_DATA); break; + case FuncTypeConverter::FunType::OPERATION_LOG: + m_stackedWidget = new OperationLog(ui->centralwidget); + GlobelBackupInfo::inst().setFuncType(FuncTypeConverter::FunType::OPERATION_LOG); + break; default: m_stackedWidget = new SystemBackup(ui->centralwidget); GlobelBackupInfo::inst().setFuncType(FuncTypeConverter::FunType::BACKUP_SYSTEM); diff --git a/kybackup/module/operationlog.cpp b/kybackup/module/operationlog.cpp new file mode 100644 index 0000000..d5215b3 --- /dev/null +++ b/kybackup/module/operationlog.cpp @@ -0,0 +1,180 @@ +#include "operationlog.h" +#include +#include +#include +#include +#include +#include + +OperationLog::OperationLog(QWidget *parent) : + QStackedWidget(parent) +{ + // 界面手写代码创建,作为练手 + initFirstWidget(); +} + +OperationLog::~OperationLog() +{} + +/** + * @brief 第一页 + */ +void OperationLog::initFirstWidget() +{ + QWidget *first = new QWidget; + + QVBoxLayout *vlayout = new QVBoxLayout; + vlayout->addSpacing(10); + + QHBoxLayout *hlayoutLine1 = new QHBoxLayout; + // 列表为空时展示图片 + QLabel *labelEmptyLogo = new QLabel(this); + QPixmap pixmap(":/images/empty.png"); + labelEmptyLogo->setPixmap(pixmap); + hlayoutLine1->addStretch(); + hlayoutLine1->addWidget(labelEmptyLogo); + hlayoutLine1->addStretch(); + vlayout->addLayout(hlayoutLine1); + + QHBoxLayout *hlayoutLine2 = new QHBoxLayout; + QLabel *labelEmptyText = new QLabel(tr("No operation log")); + labelEmptyText->setAlignment(Qt::AlignCenter); + labelEmptyText->setEnabled(false); + hlayoutLine2->addStretch(); + hlayoutLine2->addWidget(labelEmptyText); + hlayoutLine2->addStretch(); + vlayout->addLayout(hlayoutLine2); + + QHBoxLayout *hlayoutLine3 = new QHBoxLayout; + QStringList headerLabels; + headerLabels << tr("Backup Name") << tr("UUID") << tr("Operation") << tr("Operation Time"); + m_tableWidget = new QTableWidget; + m_tableWidget->setFixedSize(680, 560); + m_tableWidget->setColumnCount(headerLabels.size()); + m_tableWidget->setHorizontalHeaderLabels(headerLabels); + m_tableWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); + m_tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + m_tableWidget->horizontalHeader()->setTextElideMode(Qt::ElideRight); + m_tableWidget->horizontalHeader()->setFixedHeight(30); + m_tableWidget->verticalHeader()->setHidden(true); // 好像隐藏不掉 + m_tableWidget->verticalHeader()->setVisible(false); //左侧标题不可见 + m_tableWidget->verticalHeader()->setDefaultSectionSize(30); // 设置行高 + m_tableWidget->setSelectionMode(QAbstractItemView::NoSelection); + m_tableWidget->setSortingEnabled(false); // 等录入完数据后再排序 + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget->hideColumn(1); // 隐藏uuid + hlayoutLine3->addStretch(); + hlayoutLine3->addWidget(m_tableWidget); + hlayoutLine3->addStretch(); + vlayout->addLayout(hlayoutLine3); + + vlayout->addStretch(); + first->setLayout(vlayout); + + QList list = Utils::getBackupLogList(); + if (list.isEmpty()) { + labelEmptyLogo->setVisible(true); + labelEmptyText->setVisible(true); + m_tableWidget->setVisible(false); + } else { + labelEmptyLogo->setVisible(false); + labelEmptyText->setVisible(false); + m_tableWidget->setVisible(true); + initOperationLogs(list); + } + + addWidget(first); +} + +/** + * @brief 初始化操作日志表格 + */ +void OperationLog::initOperationLogs(const QList& list) +{ + m_tableWidget->clearContents(); + m_tableWidget->setRowCount(0); + m_tableWidget->setSortingEnabled(false); // 等录入完数据后再排序 + + int indexOfRow = 0; + for (const BackupWrapper& backupPoint : list) { + m_tableWidget->insertRow(indexOfRow); + setItem(indexOfRow, 0, backupPoint.m_backupName); + setItem(indexOfRow, 1, backupPoint.m_uuid); + setItem(indexOfRow, 2, castTypeToString(backupPoint.m_type)); + setItem(indexOfRow, 3, backupPoint.m_time); + ++indexOfRow; + } + + m_tableWidget->setSortingEnabled(true); // 等录入完数据后再排序 + m_tableWidget->sortItems(3, Qt::DescendingOrder); +} + +/** + * @brief 设置QTableWidget的单元格内容 + * @param row + * @param column + * @param text + */ +void OperationLog::setItem(int row, int column, const QString& text, int alignFlag) +{ + QTableWidgetItem *item = new QTableWidgetItem; + item->setText(text); + item->setToolTip(text); + item->setTextAlignment(alignFlag); + m_tableWidget->setItem(row, column, item); +} + +/** + * @brief 翻译操作类型 + * @param type + * @return + */ +QString OperationLog::castTypeToString(int type) +{ + QString name; + switch (type) { + case BackupType::BACKUP_SYSTEM : + name = tr("new system backup"); + + break; + case BackupType::INC_BACKUP_SYSTEM : + name = tr("udpate system backup"); + + break; + case BackupType::BACKUP_DATA : + name = tr("new data backup"); + + break; + case BackupType::INC_BACKUP_DATA : + name = tr("update data backup"); + + break; + case BackupType::RESTORE_SYSTEM : + name = tr("restore system"); + + break; + case BackupType::RESTORE_SYSTEM_WITH_DATA : + name = tr("restore retaining user data"); + + break; + case BackupType::RESTORE_DATA : + name = tr("restore data"); + + break; + case BackupType::DELETE_BACKUP : + name = tr("delete backup"); + + break; + case BackupType::GHOST_IMAGE : + name = tr("make ghost image"); + + break; + default: + break; + } + + return name; +} + + diff --git a/kybackup/module/operationlog.h b/kybackup/module/operationlog.h new file mode 100644 index 0000000..0827ed3 --- /dev/null +++ b/kybackup/module/operationlog.h @@ -0,0 +1,24 @@ +#ifndef OPERATIONLOG_H +#define OPERATIONLOG_H + +#include +#include +#include "../common/utils.h" + +class OperationLog : public QStackedWidget +{ + Q_OBJECT +public: + explicit OperationLog(QWidget* parent = nullptr); + virtual ~OperationLog(); + +private: + void initFirstWidget(); + void initOperationLogs(const QList& list); + void setItem(int row, int column, const QString& text, int alignFlag = Qt::AlignLeft | Qt::AlignVCenter); + QString castTypeToString(int type); + + QTableWidget *m_tableWidget; +}; + +#endif // OPERATIONLOG_H diff --git a/kybackup/module/systemrestore.cpp b/kybackup/module/systemrestore.cpp index 682ee65..b9fa829 100755 --- a/kybackup/module/systemrestore.cpp +++ b/kybackup/module/systemrestore.cpp @@ -190,6 +190,7 @@ void SystemRestore::on_button_beginRestore_clicked(bool checked) this->m_uuid = ""; this->m_devPath = ""; + this->m_backupName = ""; this->m_isOtherMachine = ""; // 出厂还原,不用去选择备份点 @@ -204,6 +205,7 @@ void SystemRestore::on_button_beginRestore_clicked(bool checked) //出厂还原 m_uuid = FACTORY_BACKUP_UUID; m_devPath = ""; + this->m_backupName = ""; this->m_isOtherMachine = false; } else { // 系统备份点列表中选择备份点 @@ -211,6 +213,7 @@ void SystemRestore::on_button_beginRestore_clicked(bool checked) connect(selectRestoreDialog, &SelectRestorePoint::selected, this, [=](ParseBackupList::BackupPoint backupPoint){ this->m_uuid = backupPoint.m_uuid; this->m_devPath = backupPoint.m_path; + this->m_backupName = backupPoint.m_backupName; this->m_isOtherMachine = backupPoint.m_iPosition == BackupPosition::OTHER ? true : false; }); @@ -483,6 +486,7 @@ void SystemRestore::on_checkEnv_start() backupWrapper.m_type = m_isRetainUserData ? BackupType::RESTORE_SYSTEM_WITH_DATA : BackupType::RESTORE_SYSTEM; backupWrapper.m_iPosition = m_devPath.isEmpty() ? BackupPosition::LOCAL : BackupPosition::UDISK; backupWrapper.m_uuid = m_uuid; + backupWrapper.m_backupName = m_backupName; backupWrapper.m_prefixDestPath = m_devPath; backupWrapper.m_isOtherMachine = m_isOtherMachine ? 1 : 0; backupWrapper.m_frontUid = getuid(); @@ -683,6 +687,7 @@ void SystemRestore::on_restore_start() backupWrapper.m_type = m_isRetainUserData ? BackupType::RESTORE_SYSTEM_WITH_DATA : BackupType::RESTORE_SYSTEM; backupWrapper.m_iPosition = m_devPath.isEmpty() ? BackupPosition::LOCAL : BackupPosition::UDISK; backupWrapper.m_uuid = m_uuid; + backupWrapper.m_backupName = m_backupName; backupWrapper.m_prefixDestPath = m_devPath; backupWrapper.m_isOtherMachine = m_isOtherMachine ? 1 : 0; backupWrapper.m_frontUid = getuid(); diff --git a/kybackup/module/systemrestore.h b/kybackup/module/systemrestore.h index feef8fe..db565fb 100755 --- a/kybackup/module/systemrestore.h +++ b/kybackup/module/systemrestore.h @@ -62,6 +62,7 @@ private: QString m_uuid; // 还原点的UUID QString m_devPath; // 如果是从移动设备进行还原,此中保存移动设备挂载路径 + QString m_backupName; // 还原点的备份点名称 bool m_isOtherMachine; // 是否异机备份点还原 // 系统备份状态 int m_systemRestoreState;