This commit is contained in:
zhaominyong 2021-12-11 15:10:58 +08:00
parent c1e7f440bd
commit afca57cce6
7 changed files with 26 additions and 10 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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();