This commit is contained in:
zhaominyong 2021-12-11 15:59:38 +08:00
parent 44aa5419b3
commit 2ada4e6e8d
2 changed files with 55 additions and 14 deletions

View File

@ -424,7 +424,7 @@ bool SystemBackupProxy::backupSystem()
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) { connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
if (result) { if (result) {
m_backupPoint.m_state = BACKUP_PARSE_STATE_SUCCESS_STRTING; m_backupPoint.m_state = BACKUP_PARSE_STATE_SUCCESS_STRTING;
m_backupPoint.m_size = Utils::StringBySize(Utils::getDirOrFileSize(m_destPath)); // m_backupPoint.m_size = Utils::StringBySize(Utils::getDirOrFileSize(m_destPath));
QString xmlPath = Utils::getSysRootPath() + BACKUP_XML_PATH; QString xmlPath = Utils::getSysRootPath() + BACKUP_XML_PATH;
xmlPath.replace("//", "/"); xmlPath.replace("//", "/");
ParseBackupList parse(xmlPath); ParseBackupList parse(xmlPath);

View File

@ -765,34 +765,76 @@ void SystemBackup::initFifthWidget()
MyLabel *label4 = new MyLabel(tr("finished"), fifth); MyLabel *label4 = new MyLabel(tr("finished"), fifth);
label4->setGeometry(551, 72, 164, 30); label4->setGeometry(551, 72, 164, 30);
// ------------ 中部布局begin-------------
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->addSpacing(180);
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addStretch();
QWidget *centerFont = new QWidget(fifth);
QVBoxLayout *vlayoutCenterFont = new QVBoxLayout;
// 中部第一行
QHBoxLayout *hlayoutCenterFont1 = new QHBoxLayout;
// 检测等待图标 // 检测等待图标
QLabel *loadingGif = new QLabel(fifth); QLabel *loadingGif = new QLabel(centerFont);
// 环境检测等待动画 // 环境检测等待动画
QMovie *movie = new QMovie(":/images/loading.gif", QByteArray(), fifth); QMovie *movie = new QMovie(":/images/loading.gif", QByteArray(), centerFont);
loadingGif->setMovie(movie); loadingGif->setMovie(movie);
loadingGif->setGeometry(260, 190, 20, 20); loadingGif->setFixedSize(20,20);
// 进度条 // 进度条
RingsProgressbar *progressBar = new RingsProgressbar(fifth); RingsProgressbar *progressBar = new RingsProgressbar(centerFont);
progressBar->setGeometry(301, 151, 100, 100); progressBar->setFixedSize(100, 100);
hlayoutCenterFont1->addStretch();
hlayoutCenterFont1->addWidget(loadingGif);
hlayoutCenterFont1->addWidget(progressBar);
hlayoutCenterFont1->addStretch();
// 第二行
QHBoxLayout *hlayoutCenterFont2 = new QHBoxLayout;
// 提醒 // 提醒
MyLabel *labelTip = new MyLabel(fifth); MyLabel *labelTip = new MyLabel(centerFont);
labelTip->setGeometry(101, 261, 520, 30);
labelTip->setAlignment(Qt::AlignCenter); labelTip->setAlignment(Qt::AlignCenter);
labelTip->setIsOriginal(true);
labelTip->setFontWordWrap(true); labelTip->setFontWordWrap(true);
labelTip->setMinimumWidth(700);
// 不要使用电脑,以防数据丢失 // 不要使用电脑,以防数据丢失
labelTip->setDeplayText(tr("Do not use computers in case of data loss")); labelTip->setDeplayText(tr("Do not use computers in case of data loss"));
connect(this, &SystemBackup::backupWarnning, labelTip, [=](const QString& msg) { hlayoutCenterFont2->addStretch();
labelTip->setDeplayText(msg); hlayoutCenterFont2->addWidget(labelTip);
}); hlayoutCenterFont2->addStretch();
// 第三行
QHBoxLayout *hlayoutCenterFont3 = new QHBoxLayout;
// 取消按钮 // 取消按钮
MyPushButton *cancel = new MyPushButton(fifth); MyPushButton *cancel = new MyPushButton(fifth);
cancel->setGeometry(310, 330, 97, 36); cancel->setFixedSize(97, 36);
cancel->setText(tr("cancel")); cancel->setText(tr("cancel"));
cancel->setEnabled(true); cancel->setEnabled(true);
cancel->setAutoRepeat(true); cancel->setAutoRepeat(true);
hlayoutCenterFont3->addStretch();
hlayoutCenterFont3->addWidget(cancel);
hlayoutCenterFont3->addStretch();
vlayoutCenterFont->addLayout(hlayoutCenterFont1);
vlayoutCenterFont->addLayout(hlayoutCenterFont2);
vlayoutCenterFont->addSpacing(60);
vlayoutCenterFont->addLayout(hlayoutCenterFont3);
vlayoutCenterFont->addStretch();
centerFont->setLayout(vlayoutCenterFont);
centerFont->setLayout(vlayoutCenterFont);
hlayout->addWidget(centerFont);
hlayout->addStretch();
vlayout->addLayout(hlayout);
vlayout->addStretch();
fifth->setLayout(vlayout);
// ------------ 中部布局end-------------
connect(this, &SystemBackup::backupWarnning, labelTip, [=](const QString& msg) {
labelTip->setDeplayText(msg);
});
// 开始备份 // 开始备份
connect(this, &SystemBackup::startBackup, this, [=] { connect(this, &SystemBackup::startBackup, this, [=] {
@ -1071,7 +1113,6 @@ void SystemBackup::initLastWidget()
hlayoutCenterFont5->addStretch(); hlayoutCenterFont5->addStretch();
vlayoutCenterFont->addLayout(hlayoutCenterFont5); vlayoutCenterFont->addLayout(hlayoutCenterFont5);
centerFont->setLayout(vlayoutCenterFont); centerFont->setLayout(vlayoutCenterFont);
hlayout->addWidget(centerFont); hlayout->addWidget(centerFont);
hlayout->addStretch(); hlayout->addStretch();