diff --git a/backup-daemon/mybackupmanager.cpp b/backup-daemon/mybackupmanager.cpp index 71bca02..20d9535 100755 --- a/backup-daemon/mybackupmanager.cpp +++ b/backup-daemon/mybackupmanager.cpp @@ -266,8 +266,8 @@ int MyBackupManager::ghostBackup(const BackupWrapper& backupWrapper) switch (result) { case int(BackupResult::CHECK_ENV_SUCCESS) : - case int(BackupResult::MKSQUASHFS_START_SUCCESS) : case int(BackupResult::GHOST_START_SUCCESS) : + case int(BackupResult::MKSQUASHFS_DO_SUCCESS) : case int(BackupResult::START_CANCEL) : break; default: diff --git a/backup-daemon/udiskghostImageproxy.cpp b/backup-daemon/udiskghostImageproxy.cpp index f9d9074..b6e4f7b 100755 --- a/backup-daemon/udiskghostImageproxy.cpp +++ b/backup-daemon/udiskghostImageproxy.cpp @@ -84,7 +84,7 @@ bool UDiskGhostImageProxy::checkEnvEx() m_destPath = m_backupWrapper.m_prefixDestPath + GHOST_PATH; m_destPath.replace("//", "/"); Utils::mkpath(m_destPath); - m_kyimg = Utils::getSysRootPath() + GHOST_PATH + "/" + m_backupWrapper.m_backupName; + m_kyimg = m_destPath + "/" + m_backupWrapper.m_backupName; m_kyimg.replace("//", "/"); QFile kyimg(m_kyimg); if (kyimg.exists()) @@ -103,6 +103,7 @@ bool UDiskGhostImageProxy::checkEnvEx() QString path = it.key(); qint64 leftSize = it.value(); if (itotalSize < leftSize / 2) { + Utils::mkpath(path + GHOST_PATH); m_kyimg = path + GHOST_PATH + "/" + m_backupWrapper.m_backupName; m_kyimg.replace("//", "/"); QFile kyimg(m_kyimg); @@ -190,6 +191,7 @@ void UDiskGhostImageProxy::doGhostImage() // 同步到U盘 m_p = new RsyncPathToDirProcess(this); + connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskGhostImageProxy::progress); connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool resultRsync) { // 如果是取消了操作,则不再发送其它信息 if (m_bCancel) @@ -214,10 +216,13 @@ void UDiskGhostImageProxy::doGhostImage() }); QStringList arguments; - arguments << "-a"; + arguments << "-av"; + arguments << "--info=progress2"; arguments << m_kyimg; arguments << m_destPath + "/"; m_p->start(arguments, false); + emit this->checkResult(int(BackupResult::MKSQUASHFS_DO_SUCCESS)); + emit this->progress(0); } else { m_isFinished = true; emit this->workResult(false); @@ -227,6 +232,7 @@ void UDiskGhostImageProxy::doGhostImage() m_bSuccess = false; m_isFinished = false; m_mksquashfs->start(args); + emit checkResult(int(BackupResult::GHOST_START_SUCCESS)); QTimer::singleShot(1*1000, this, &UDiskGhostImageProxy::checkDestDirExists); } diff --git a/common/mydefine.h b/common/mydefine.h index 3838b96..fdec964 100755 --- a/common/mydefine.h +++ b/common/mydefine.h @@ -267,6 +267,8 @@ enum class BackupResult { MKSQUASHFS_START_SUCCESS, // mksquashfs压缩img文件失败 MKSQUASHFS_DO_FAIL, + // mksquashfs压缩img文件成功,开始转移img文件到u盘 + MKSQUASHFS_DO_SUCCESS, // 开始取消操作 START_CANCEL, // 取消操作成功 diff --git a/kybackup/module/databackup.cpp b/kybackup/module/databackup.cpp index 8f74fb9..8abe81c 100755 --- a/kybackup/module/databackup.cpp +++ b/kybackup/module/databackup.cpp @@ -1277,7 +1277,7 @@ void DataBackup::initFifthWidget() progressBar->setPersent(0); movie->start(); // 不要使用电脑,以防数据丢失 - labelTip->setDeplayText(tr("Do not use computers in case of data loss")); + labelTip->setDeplayText(tr("Do not use computer in case of data loss")); cancel->setEnabled(true); // 开始备份 diff --git a/kybackup/module/datarestore.cpp b/kybackup/module/datarestore.cpp index 44bd37c..27eca03 100755 --- a/kybackup/module/datarestore.cpp +++ b/kybackup/module/datarestore.cpp @@ -399,7 +399,7 @@ void DataRestore::initSecondWidget() // 检测成功 bigTitle->setDeplayText(tr("Succeeded to check the environment")); // 不要使用电脑,以防数据丢失 - labelCheck1->setDeplayText(tr("Do not use computers in case of data loss")); + labelCheck1->setDeplayText(tr("Do not use computer in case of data loss")); dot2->setBackgroundColor(COLOR_YELLOW); labelCheck2->setFontColor(COLOR_YELLOW); labelCheck2->setFontWordWrap(true); @@ -596,7 +596,7 @@ void DataRestore::initThirdWidget() labelTip->setIsOriginal(true); labelTip->setFontWordWrap(true); // 不要使用电脑,以防数据丢失 - labelTip->setDeplayText(tr("Do not use computers in case of data loss")); + labelTip->setDeplayText(tr("Do not use computer in case of data loss")); hlayoutCenterFont2->addStretch(); hlayoutCenterFont2->addWidget(labelTip); hlayoutCenterFont2->addStretch(); diff --git a/kybackup/module/ghostimage.cpp b/kybackup/module/ghostimage.cpp index 306bcd7..ed1fd01 100755 --- a/kybackup/module/ghostimage.cpp +++ b/kybackup/module/ghostimage.cpp @@ -749,7 +749,7 @@ void GhostImage::initForthWidget() progressBar->setPersent(0); movie->start(); // 不要使用电脑,以防数据丢失 - labelTip->setDeplayText(tr("Do not use computers in case of data loss")); + labelTip->setDeplayText(tr("Do not use computer in case of data loss")); labelTip_1->setVisible(false); labelTip_1->setDeplayText(""); cancel->setEnabled(true); @@ -758,6 +758,11 @@ void GhostImage::initForthWidget() this->on_ghost_start(); }); + connect(this, &GhostImage::backupWarnning, labelTip_1, [=](const QString& msg) { + labelTip_1->setVisible(true); + labelTip_1->setDeplayText(msg); + }); + // 进度 connect(this, &GhostImage::progress, this, [=](int state, int rate) { Q_UNUSED(state) @@ -875,6 +880,16 @@ void GhostImage::on_checkGhost_end(int result) // 请检查刚刚是否有删除备份点操作 errTip = tr("Check whether the backup point has been deleted"); break; + case int(BackupResult::GHOST_START_SUCCESS): + // 正压缩数据到本地磁盘,请耐心等待... + errTip = tr("The data is being compressed to the local disk, please wait patiently..."); + emit this->backupWarnning(errTip); + return; + case int(BackupResult::MKSQUASHFS_DO_SUCCESS): + // 正在传输image文件到移动设备,即将完成... + errTip = tr("Transferring image file to mobile device, about to be completed..."); + emit this->backupWarnning(errTip); + return; case int(BackupResult::CANCEL_SUCCESS): // 已经取消本次镜像制作 errMsg = tr("The image creation had been canceled"); diff --git a/kybackup/module/ghostimage.h b/kybackup/module/ghostimage.h index 5c72487..71d8d42 100755 --- a/kybackup/module/ghostimage.h +++ b/kybackup/module/ghostimage.h @@ -44,6 +44,7 @@ signals: void startGhost(); void progress(int state, int rate); void checkGhostResult(bool result, const QString &errMsg = "", const QString &errTip = ""); + void backupWarnning(const QString &warnning); public slots: void on_pre_clicked(bool checked = false); diff --git a/kybackup/module/systembackup.cpp b/kybackup/module/systembackup.cpp index 4f73ea0..f381228 100755 --- a/kybackup/module/systembackup.cpp +++ b/kybackup/module/systembackup.cpp @@ -879,7 +879,7 @@ void SystemBackup::initFifthWidget() progressBar->setPersent(0); movie->start(); // 不要使用电脑,以防数据丢失 - labelTip->setDeplayText(tr("Do not use computers in case of data loss")); + labelTip->setDeplayText(tr("Do not use computer in case of data loss")); labelTip_1->setVisible(false); labelTip_1->setDeplayText(""); cancel->setEnabled(true); @@ -998,8 +998,8 @@ void SystemBackup::on_checkBackup_end(int result) emit this->backupWarnning(errTip); return; case int(BackupResult::BACKUP_START_SUCCESS): - // 正在传输备份文件到移动设备,即将完成... - errTip = tr("Transferring backup files to mobile device, about to be completed..."); + // 正在传输image文件到移动设备,即将完成... + errTip = tr("Transferring image file to mobile device, about to be completed..."); emit this->backupWarnning(errTip); return; case int(BackupResult::CANCEL_SUCCESS): diff --git a/kybackup/module/systemrestore.cpp b/kybackup/module/systemrestore.cpp index 0d4f931..e0cb19f 100755 --- a/kybackup/module/systemrestore.cpp +++ b/kybackup/module/systemrestore.cpp @@ -622,7 +622,7 @@ void SystemRestore::initThirdWidget() labelTip->setIsOriginal(true); labelTip->setFontWordWrap(true); // 不要使用电脑,以防数据丢失 - labelTip->setDeplayText(tr("Do not use computers in case of data loss")); + labelTip->setDeplayText(tr("Do not use computer in case of data loss")); hlayoutCenterFont2->addStretch(); hlayoutCenterFont2->addWidget(labelTip); hlayoutCenterFont2->addStretch();