109348 【备份还原4.0.14】选择在移动设备上备份的系统进行系统还原时,在到还原中的步骤时,拔出移动设备,进度卡在100%不动
This commit is contained in:
parent
4c80ddfbde
commit
5db97cf5f4
|
@ -18,6 +18,7 @@ UDiskDataRestoreProxy::UDiskDataRestoreProxy()
|
||||||
m_bSuccess = false;
|
m_bSuccess = false;
|
||||||
m_isFinished = false;
|
m_isFinished = false;
|
||||||
m_p = nullptr;
|
m_p = nullptr;
|
||||||
|
m_isForce = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,6 +137,7 @@ void UDiskDataRestoreProxy::restoreData()
|
||||||
m_p = new RsyncPathToDirProcess(this);
|
m_p = new RsyncPathToDirProcess(this);
|
||||||
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskDataRestoreProxy::progress);
|
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskDataRestoreProxy::progress);
|
||||||
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
|
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
|
||||||
|
m_isForce = false;
|
||||||
m_bSuccess = result;
|
m_bSuccess = result;
|
||||||
m_isFinished = true;
|
m_isFinished = true;
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -158,11 +160,20 @@ void UDiskDataRestoreProxy::restoreData()
|
||||||
bool UDiskDataRestoreProxy::checkUdiskExists()
|
bool UDiskDataRestoreProxy::checkUdiskExists()
|
||||||
{
|
{
|
||||||
if (!m_isFinished) {
|
if (!m_isFinished) {
|
||||||
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr)
|
// 拔掉U盘后,没有响应的场景(怀疑可能是某应用程序关闭引起,希望不是dbus服务关掉了)
|
||||||
|
if (m_isForce) {
|
||||||
|
emit this->workResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {
|
||||||
m_p->stop();
|
m_p->stop();
|
||||||
else
|
// 10s钟后如果还没有退出,则强制退出
|
||||||
|
QTimer::singleShot(10*1000, this, &UDiskDataRestoreProxy::checkUdiskExists);
|
||||||
|
m_isForce = true;
|
||||||
|
} else {
|
||||||
QTimer::singleShot(1*1000, this, &UDiskDataRestoreProxy::checkUdiskExists);
|
QTimer::singleShot(1*1000, this, &UDiskDataRestoreProxy::checkUdiskExists);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ private:
|
||||||
RsyncPathToDirProcess *m_p;
|
RsyncPathToDirProcess *m_p;
|
||||||
// 当前备份节点
|
// 当前备份节点
|
||||||
ParseBackupList::BackupPoint m_backupPoint;
|
ParseBackupList::BackupPoint m_backupPoint;
|
||||||
|
// 强制结束标志(stop后没反应的情况,系统处于睡眠状态)
|
||||||
|
bool m_isForce;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UDISKDATARESTOREPROXY_H
|
#endif // UDISKDATARESTOREPROXY_H
|
||||||
|
|
|
@ -18,6 +18,7 @@ UDiskSystemRestoreProxy::UDiskSystemRestoreProxy()
|
||||||
{
|
{
|
||||||
m_isFinished = false;
|
m_isFinished = false;
|
||||||
m_p = nullptr;
|
m_p = nullptr;
|
||||||
|
m_isForce = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -378,6 +379,7 @@ void UDiskSystemRestoreProxy::restoreSystem()
|
||||||
m_p = new RsyncPathToDirProcess(this);
|
m_p = new RsyncPathToDirProcess(this);
|
||||||
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskSystemRestoreProxy::progress);
|
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskSystemRestoreProxy::progress);
|
||||||
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
|
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
|
||||||
|
m_isForce = false;
|
||||||
if (result) {
|
if (result) {
|
||||||
QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss");
|
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));
|
||||||
|
@ -451,7 +453,6 @@ void UDiskSystemRestoreProxy::updateGrubUUid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 监控移动设备是否还在
|
* @brief 监控移动设备是否还在
|
||||||
* @return true-在;false-不在
|
* @return true-在;false-不在
|
||||||
|
@ -459,11 +460,20 @@ void UDiskSystemRestoreProxy::updateGrubUUid()
|
||||||
bool UDiskSystemRestoreProxy::checkUdiskExists()
|
bool UDiskSystemRestoreProxy::checkUdiskExists()
|
||||||
{
|
{
|
||||||
if (!m_isFinished) {
|
if (!m_isFinished) {
|
||||||
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr)
|
// 拔掉U盘后,没有响应的场景(怀疑可能是某应用程序关闭引起,希望不是dbus服务关掉了)
|
||||||
|
if (m_isForce) {
|
||||||
|
emit this->workResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {
|
||||||
m_p->stop();
|
m_p->stop();
|
||||||
else
|
// 10s钟后如果还没有退出,则强制退出
|
||||||
|
QTimer::singleShot(10*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists);
|
||||||
|
m_isForce = true;
|
||||||
|
} else {
|
||||||
QTimer::singleShot(1*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists);
|
QTimer::singleShot(1*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ private:
|
||||||
RsyncPathToDirProcess *m_p;
|
RsyncPathToDirProcess *m_p;
|
||||||
// 当前备份节点
|
// 当前备份节点
|
||||||
ParseBackupList::BackupPoint m_backupPoint;
|
ParseBackupList::BackupPoint m_backupPoint;
|
||||||
|
// 强制结束标志(stop后没反应的情况,系统处于睡眠状态)
|
||||||
|
bool m_isForce;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UDISKSYSTEMRESTOREPROXY_H
|
#endif // UDISKSYSTEMRESTOREPROXY_H
|
||||||
|
|
Loading…
Reference in New Issue