From afca57cce6064f066bf7fb06cccc0fac218c2d01 Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Sat, 11 Dec 2021 15:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/systembackupproxy.cpp | 1 + backup-daemon/systemrestoreproxy.cpp | 5 ++++- backup-daemon/udisksystembackupproxy.cpp | 1 + backup-daemon/udisksystemrestoreproxy.cpp | 14 +++++++++----- kybackup/module/managebackuppointlist.cpp | 2 +- kybackup/module/systembackup.cpp | 2 ++ kybackup/module/systemrestore.cpp | 11 ++++++++--- 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/backup-daemon/systembackupproxy.cpp b/backup-daemon/systembackupproxy.cpp index cec3764..7774d2e 100755 --- a/backup-daemon/systembackupproxy.cpp +++ b/backup-daemon/systembackupproxy.cpp @@ -430,6 +430,7 @@ bool SystemBackupProxy::backupSystem() ParseBackupList parse(xmlPath); parse.updateItem(m_backupPoint); + // 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); diff --git a/backup-daemon/systemrestoreproxy.cpp b/backup-daemon/systemrestoreproxy.cpp index b3c4e03..9662fa0 100644 --- a/backup-daemon/systemrestoreproxy.cpp +++ b/backup-daemon/systemrestoreproxy.cpp @@ -61,6 +61,8 @@ bool SystemRestoreProxy::checkEnvEx() return false; } + emit checkResult(int(BackupResult::CHECK_ENV_SUCCESS)); + qDebug() << "SystemRestoreProxy::checkEnvEx invoke end"; return true; } @@ -325,7 +327,8 @@ void SystemRestoreProxy::restoreSystem() 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_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::updateSyncFile(); QString fileIfSync = Utils::getSysRootPath() + FILE_IF_SYNC; diff --git a/backup-daemon/udisksystembackupproxy.cpp b/backup-daemon/udisksystembackupproxy.cpp index 1d08e92..e19e433 100755 --- a/backup-daemon/udisksystembackupproxy.cpp +++ b/backup-daemon/udisksystembackupproxy.cpp @@ -463,6 +463,7 @@ bool UDiskSystemBackupProxy::backup(const QStringList &args) ParseBackupList parse(xmlPath); parse.updateItem(m_backupPoint); + // 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); diff --git a/backup-daemon/udisksystemrestoreproxy.cpp b/backup-daemon/udisksystemrestoreproxy.cpp index 8f6b07c..4c75fa4 100644 --- a/backup-daemon/udisksystemrestoreproxy.cpp +++ b/backup-daemon/udisksystemrestoreproxy.cpp @@ -63,6 +63,8 @@ bool UDiskSystemRestoreProxy::checkEnvEx() return false; } + emit checkResult(int(BackupResult::CHECK_ENV_SUCCESS)); + qDebug() << "UDiskSystemRestoreProxy::checkEnvEx invoke end"; return true; } @@ -330,7 +332,8 @@ void UDiskSystemRestoreProxy::restoreSystem() 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_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::updateSyncFile(); QString fileIfSync = Utils::getSysRootPath() + FILE_IF_SYNC; @@ -353,16 +356,17 @@ void UDiskSystemRestoreProxy::restoreSystem() sync(); Utils::wait(5); } - - emit this->workResult(result); - Utils::wait(2); - reboot(RB_AUTOBOOT); } if (Utils::isDirEmpty(m_backupPath)) result = false; emit this->workResult(result); m_isFinished = true; + + if (result) { + Utils::wait(2); + reboot(RB_AUTOBOOT); + } }); QTimer::singleShot(1*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists); diff --git a/kybackup/module/managebackuppointlist.cpp b/kybackup/module/managebackuppointlist.cpp index cc4da7d..de38c3f 100644 --- a/kybackup/module/managebackuppointlist.cpp +++ b/kybackup/module/managebackuppointlist.cpp @@ -27,7 +27,7 @@ ManageBackupPointList::ManageBackupPointList(QWidget *parent, BackupPointType ba MyLabel *labelTips = new MyLabel; labelTips->setIsOriginal(true); labelTips->setWordWrap(true); - //labelTips->adjustSize(); + labelTips->setMinimumWidth(600); labelTips->setDeplayText(tr("You can delete the backup that is't needed, refer operation logs for more details")); MyPushButton * buttonDelete = new MyPushButton; diff --git a/kybackup/module/systembackup.cpp b/kybackup/module/systembackup.cpp index c121b64..d6ade03 100755 --- a/kybackup/module/systembackup.cpp +++ b/kybackup/module/systembackup.cpp @@ -402,6 +402,8 @@ void SystemBackup::initThirdWidget() bigTitle->setDeplayText(tr("Checking, wait a moment ...")); dot1->setBackgroundColor(Qt::black); dot2->setBackgroundColor(Qt::black); + labelCheck1->setFontColor(Qt::black); + labelCheck2->setFontColor(Qt::black); // 备份过程中不要做其它操作,以防数据丢失 labelCheck1->setDeplayText(tr("Do not perform other operations during backup to avoid data loss")); if (this->m_isLocal) { diff --git a/kybackup/module/systemrestore.cpp b/kybackup/module/systemrestore.cpp index 29627e5..87fed71 100755 --- a/kybackup/module/systemrestore.cpp +++ b/kybackup/module/systemrestore.cpp @@ -200,6 +200,7 @@ void SystemRestore::on_button_beginRestore_clicked(bool checked) //出厂还原 m_uuid = FACTORY_BACKUP_UUID; m_devPath = ""; + this->m_isOtherMachine = false; } else { // 系统备份点列表中选择备份点 SelectRestorePoint *selectRestoreDialog = new SelectRestorePoint(this); @@ -378,6 +379,8 @@ void SystemRestore::initSecondWidget() bigTitle->setDeplayText(tr("Checking, wait a moment ...")); dot1->setBackgroundColor(Qt::black); dot2->setBackgroundColor(Qt::black); + labelCheck1->setFontColor(Qt::black); + labelCheck2->setFontColor(Qt::black); // 还原过程中不要做其它操作,以防数据丢失 labelCheck1->setDeplayText(tr("Check whether the restore environment meets the requirements")); // 检测还原环境是否满足 @@ -471,6 +474,7 @@ void SystemRestore::on_checkEnv_start() BackupWrapper backupWrapper; 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_prefixDestPath = m_devPath; backupWrapper.m_isOtherMachine = m_isOtherMachine ? 1 : 0; backupWrapper.m_frontUid = getuid(); @@ -629,12 +633,12 @@ void SystemRestore::initThirdWidget() vlayout->addStretch(); third->setLayout(vlayout); - // 开始备份 + // 开始还原 connect(this, &SystemRestore::startRestore, this, [=] { - progressBar->setPersent(20); + progressBar->setPersent(0); movie->start(); - // 开始备份 + // 开始还原 this->on_restore_start(); }); @@ -670,6 +674,7 @@ void SystemRestore::on_restore_start() BackupWrapper backupWrapper; 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_prefixDestPath = m_devPath; backupWrapper.m_isOtherMachine = m_isOtherMachine ? 1 : 0; backupWrapper.m_frontUid = getuid();