bug修复
This commit is contained in:
parent
26a86d60ea
commit
e25679a409
|
@ -132,7 +132,7 @@ int MyBackupManager::goBackup(const BackupWrapper& backupWrapper)
|
|||
emit this->progress(int(BackupState::WORKING), rate);
|
||||
});
|
||||
connect(worker, &Worker::workResult, this, [&] (bool result) {
|
||||
emit this->sendBackupResult(result);
|
||||
emit this->backupFinished(result);
|
||||
this->finished();
|
||||
});
|
||||
worker->moveToThread(&workerThread);
|
||||
|
|
|
@ -180,27 +180,27 @@ QStringList SystemBackupProxy::getRsyncArgs(SystemBackupScene scene)
|
|||
|
||||
switch (scene) {
|
||||
case SystemBackupScene::SYSTEM_BACKUP :
|
||||
args << "-avAHXW";
|
||||
args << "--progress";
|
||||
args << "-avAHXr";
|
||||
args << "--info=progress2";
|
||||
args << "--no-inc-recursive";
|
||||
args << "--ignore-missing-args";
|
||||
break ;
|
||||
case SystemBackupScene::INC_SYSTEM_BACKUP :
|
||||
args << "-avAXr";
|
||||
args << "--progress";
|
||||
args << "--info=progress2";
|
||||
args << "--no-inc-recursive";
|
||||
args << "--ignore-missing-args";
|
||||
args << QString("--link-dest=../../%1/data").arg(m_backupWrapper.m_baseUuid);
|
||||
break ;
|
||||
case SystemBackupScene::INC_SYSTEM_BACKUP_AT_BASE :
|
||||
args << "-avAHXr";
|
||||
args << "--progress";
|
||||
args << "--info=progress2";
|
||||
args << "--no-inc-recursive";
|
||||
args << "--ignore-missing-args";
|
||||
args << "--delete";
|
||||
break ;
|
||||
case SystemBackupScene::TRY_SYSTEM_BACKUP :
|
||||
args << "-aAHXWn";
|
||||
args << "-aAHXrn";
|
||||
args << "--stats";
|
||||
args << "--ignore-missing-args";
|
||||
break ;
|
||||
|
@ -218,7 +218,7 @@ QStringList SystemBackupProxy::getRsyncArgs(SystemBackupScene scene)
|
|||
break ;
|
||||
case SystemBackupScene::EFI_BACKUP :
|
||||
args << "-avAHXr";
|
||||
args << "--progress";
|
||||
args << "--info=progress2";
|
||||
args << "--ignore-missing-args";
|
||||
break ;
|
||||
default:
|
||||
|
|
|
@ -168,13 +168,13 @@ QStringList UDiskSystemBackupProxy::getRsyncArgs(UDiskSystemBackupScene scene)
|
|||
|
||||
switch (scene) {
|
||||
case UDiskSystemBackupScene::SYSTEM_BACKUP :
|
||||
args << "-avAHXW";
|
||||
args << "--progress";
|
||||
args << "-avAHXr";
|
||||
args << "--info=progress2";
|
||||
args << "--no-inc-recursive";
|
||||
args << "--ignore-missing-args";
|
||||
break ;
|
||||
case UDiskSystemBackupScene::TRY_SYSTEM_BACKUP :
|
||||
args << "-aAHXWn";
|
||||
args << "-aAHXrn";
|
||||
args << "--stats";
|
||||
args << "--ignore-missing-args";
|
||||
break ;
|
||||
|
@ -182,6 +182,11 @@ QStringList UDiskSystemBackupProxy::getRsyncArgs(UDiskSystemBackupScene scene)
|
|||
return args;
|
||||
}
|
||||
|
||||
// --exclude=排除路径设置
|
||||
for (const QString & item : m_backupWrapper.m_backupExcludePaths) {
|
||||
args << QString("--exclude=%1").arg(item);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
QDBusArgument &operator<<(QDBusArgument &argument, const BackupWrapper &backupWrapper)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << backupWrapper.m_type << backupWrapper.m_comment << backupWrapper.m_backupName
|
||||
<< backupWrapper.m_uuid << backupWrapper.m_backupPaths << backupWrapper.m_backupExcludePaths
|
||||
argument << backupWrapper.m_type << backupWrapper.m_iPosition << backupWrapper.m_comment << backupWrapper.m_backupName
|
||||
<< backupWrapper.m_uuid << backupWrapper.m_backupPaths << backupWrapper.m_backupExcludePaths << backupWrapper.m_prefixDestPath
|
||||
<< backupWrapper.m_note << backupWrapper.m_frontUserName << backupWrapper.m_frontUid
|
||||
<< backupWrapper.m_gid;
|
||||
argument.endStructure();
|
||||
|
@ -17,8 +17,8 @@ QDBusArgument &operator<<(QDBusArgument &argument, const BackupWrapper &backupWr
|
|||
const QDBusArgument &operator>>(const QDBusArgument &argument, BackupWrapper &backupWrapper)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> backupWrapper.m_type >> backupWrapper.m_comment >> backupWrapper.m_backupName
|
||||
>> backupWrapper.m_uuid >> backupWrapper.m_backupPaths >> backupWrapper.m_backupExcludePaths
|
||||
argument >> backupWrapper.m_type >> backupWrapper.m_iPosition >> backupWrapper.m_comment >> backupWrapper.m_backupName
|
||||
>> backupWrapper.m_uuid >> backupWrapper.m_backupPaths >> backupWrapper.m_backupExcludePaths >> backupWrapper.m_prefixDestPath
|
||||
>> backupWrapper.m_note >> backupWrapper.m_frontUserName >> backupWrapper.m_frontUid
|
||||
>> backupWrapper.m_gid;
|
||||
argument.endStructure();
|
||||
|
|
|
@ -80,9 +80,9 @@ enum BackupType {
|
|||
*/
|
||||
struct BackupWrapper {
|
||||
// 操作类型,如:系统备份, 系统还原
|
||||
int m_type = 0;
|
||||
int m_type = -1;
|
||||
// 本地备份还是U盘备份: 0-本地备份;1-移动设备备份
|
||||
int m_iPosition = 0;
|
||||
int m_iPosition = -1;
|
||||
// 备份名称,用于识别备份的,默认是时间
|
||||
QString m_comment;
|
||||
// 备份名称,用来替换m_comment
|
||||
|
@ -103,6 +103,8 @@ struct BackupWrapper {
|
|||
int m_frontUid = -1;
|
||||
// 备份用户所属组id
|
||||
int m_gid = -1;
|
||||
|
||||
// follow are not input parameters
|
||||
// 是否增量备份
|
||||
bool m_bIncrement = false;
|
||||
// 新增备份点时增量备份的基准uuid
|
||||
|
|
|
@ -56,7 +56,7 @@ public Q_SLOTS: // METHODS
|
|||
return asyncCallWithArgumentList(QStringLiteral("autoBackUpForSystemUpdate_noreturn"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<int> checkEnv(BackupWrapper backupWrapper)
|
||||
inline QDBusPendingReply<int> checkEnv(const BackupWrapper& backupWrapper)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(backupWrapper);
|
||||
|
|
|
@ -319,9 +319,8 @@ void SystemBackup::initThirdWidget()
|
|||
recheck->setEnabled(true);
|
||||
recheck->setAutoRepeat(true);
|
||||
connect(recheck, &MyPushButton::clicked, this, [=](bool checked) {
|
||||
// 为测试下一步骤,这里暂时先改为下一步
|
||||
// emit this->startCheckEnv();
|
||||
this->on_next_clicked(checked);
|
||||
Q_UNUSED(checked)
|
||||
emit this->startCheckEnv();
|
||||
});
|
||||
|
||||
// 开始检测
|
||||
|
@ -432,6 +431,7 @@ void SystemBackup::on_checkEnv_start()
|
|||
backupPath.replace("//", "/");
|
||||
backupWrapper.m_backupPaths << backupPath;
|
||||
backupWrapper.m_prefixDestPath = m_prefixDestPath;
|
||||
backupWrapper.m_backupExcludePaths.append(Utils::getFromExcludePathsFile());
|
||||
backupWrapper.m_frontUid = getuid();
|
||||
backupWrapper.m_gid = getgid();
|
||||
m_pInterface->checkEnv(backupWrapper);
|
||||
|
@ -485,7 +485,8 @@ void SystemBackup::on_checkEnv_end(int result)
|
|||
emit checkEnvResult(bRst, errMsg, errTip);
|
||||
GlobelBackupInfo::inst().setIsBusy(false);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkEnv_end);
|
||||
m_pInterface->deleteLater();
|
||||
delete m_pInterface;
|
||||
m_pInterface = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,6 +724,7 @@ void SystemBackup::initFifthWidget()
|
|||
void SystemBackup::on_backup_start()
|
||||
{
|
||||
GlobelBackupInfo::inst().setIsBusy(true);
|
||||
m_systemBackupState = SystemBackupState::BACKUPING;
|
||||
m_pInterface = new ComKylinBackupManagerInterface("com.kylin.backup", "/", QDBusConnection::systemBus(), this);
|
||||
connect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkBackup_end);
|
||||
connect(m_pInterface, &ComKylinBackupManagerInterface::progress, this, &SystemBackup::progress);
|
||||
|
@ -744,6 +746,7 @@ void SystemBackup::on_backup_start()
|
|||
backupPath.replace("//", "/");
|
||||
backupWrapper.m_backupPaths << backupPath;
|
||||
backupWrapper.m_prefixDestPath = m_prefixDestPath;
|
||||
backupWrapper.m_backupExcludePaths.append(Utils::getFromExcludePathsFile());
|
||||
backupWrapper.m_frontUid = getuid();
|
||||
backupWrapper.m_gid = getgid();
|
||||
m_pInterface->goBackup(backupWrapper);
|
||||
|
@ -755,7 +758,6 @@ void SystemBackup::on_backup_start()
|
|||
*/
|
||||
void SystemBackup::on_checkBackup_end(int result)
|
||||
{
|
||||
m_systemBackupState = SystemBackupState::IDEL;
|
||||
bool bRst = false;
|
||||
QString errMsg, errTip;
|
||||
switch (result) {
|
||||
|
@ -802,13 +804,17 @@ void SystemBackup::on_checkBackup_end(int result)
|
|||
break;
|
||||
}
|
||||
|
||||
this->on_next_clicked(true);
|
||||
emit checkEnvResult(bRst, errMsg, errTip);
|
||||
GlobelBackupInfo::inst().setIsBusy(false);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkEnv_end);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::progress, this, &SystemBackup::progress);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::backupFinished, this, &SystemBackup::on_backup_end);
|
||||
m_pInterface->deleteLater();
|
||||
if (!bRst) {
|
||||
GlobelBackupInfo::inst().setIsBusy(false);
|
||||
m_systemBackupState = SystemBackupState::IDEL;
|
||||
this->on_next_clicked(true);
|
||||
emit checkBackupResult(bRst, errMsg, errTip);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkEnv_end);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::progress, this, &SystemBackup::progress);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::backupFinished, this, &SystemBackup::on_backup_end);
|
||||
delete m_pInterface;
|
||||
m_pInterface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -821,19 +827,21 @@ void SystemBackup::on_backup_end(bool result)
|
|||
|
||||
this->on_next_clicked(true);
|
||||
if (result) {
|
||||
emit checkEnvResult(result);
|
||||
emit checkBackupResult(result);
|
||||
} else {
|
||||
// 备份过程中出现错误
|
||||
QString errMsg = tr("An error occurred during backup");
|
||||
// 错误信息参考日志文件:/var/log/backup.log
|
||||
QString errTip = tr("Error messages refer to log file : /var/log/backup.log");
|
||||
emit checkEnvResult(result, errMsg, errTip);
|
||||
emit checkBackupResult(result, errMsg, errTip);
|
||||
}
|
||||
|
||||
GlobelBackupInfo::inst().setIsBusy(false);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::sendEnvCheckResult, this, &SystemBackup::on_checkEnv_end);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::progress, this, &SystemBackup::progress);
|
||||
disconnect(m_pInterface, &ComKylinBackupManagerInterface::backupFinished, this, &SystemBackup::on_backup_end);
|
||||
m_pInterface->deleteLater();
|
||||
delete m_pInterface;
|
||||
m_pInterface = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -902,13 +910,13 @@ void SystemBackup::initLastWidget()
|
|||
// --------------成功界面--------------
|
||||
// 返回首页
|
||||
MyPushButton *homePage = new MyPushButton(last);
|
||||
homePage->setGeometry(310, 330, 97, 36);
|
||||
homePage->setGeometry(310, 240, 97, 36);
|
||||
homePage->setText(tr("home page"));
|
||||
homePage->setEnabled(true);
|
||||
homePage->setAutoRepeat(true);
|
||||
|
||||
// 备份检测结果
|
||||
connect(this, &SystemBackup::checkEnvResult, this, [=](bool result, const QString &errMsg, const QString &errTip) {
|
||||
connect(this, &SystemBackup::checkBackupResult, this, [=](bool result, const QString &errMsg, const QString &errTip) {
|
||||
if (result) {
|
||||
QIcon icon = QIcon::fromTheme("ukui-dialog-success", QIcon(":/symbos/ukui-dialog-success.png"));
|
||||
resultLogo->setPixmap(icon.pixmap(QSize(20,20)));
|
||||
|
@ -929,6 +937,8 @@ void SystemBackup::initLastWidget()
|
|||
resultLogo->setVisible(true);
|
||||
// 环境校验失败
|
||||
bigTitle->setDeplayText(tr("The backup is failed"));
|
||||
dot1->setVisible(true);
|
||||
dot2->setVisible(true);
|
||||
labelError1->setDeplayText(errMsg);
|
||||
labelError2->setDeplayText(errTip);
|
||||
retry->setVisible(true);
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
signals:
|
||||
void startCheckEnv();
|
||||
void checkEnvResult(bool result, const QString &errMsg = "", const QString &errTip = "");
|
||||
void checkBackupResult(bool result, const QString &errMsg = "", const QString &errTip = "");
|
||||
void startBackup();
|
||||
void progress(int state, int rate);
|
||||
|
||||
|
|
Loading…
Reference in New Issue