From 2ada4e6e8d37c67a0b9d9ab0acfd387752d214cd Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Sat, 11 Dec 2021 15:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/systembackupproxy.cpp | 2 +- kybackup/module/systembackup.cpp | 67 +++++++++++++++++++++++------ 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/backup-daemon/systembackupproxy.cpp b/backup-daemon/systembackupproxy.cpp index 7774d2e..4815237 100755 --- a/backup-daemon/systembackupproxy.cpp +++ b/backup-daemon/systembackupproxy.cpp @@ -424,7 +424,7 @@ bool SystemBackupProxy::backupSystem() connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) { if (result) { 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; xmlPath.replace("//", "/"); ParseBackupList parse(xmlPath); diff --git a/kybackup/module/systembackup.cpp b/kybackup/module/systembackup.cpp index d6ade03..60ce30a 100755 --- a/kybackup/module/systembackup.cpp +++ b/kybackup/module/systembackup.cpp @@ -765,34 +765,76 @@ void SystemBackup::initFifthWidget() MyLabel *label4 = new MyLabel(tr("finished"), fifth); 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->setGeometry(260, 190, 20, 20); - + loadingGif->setFixedSize(20,20); // 进度条 - RingsProgressbar *progressBar = new RingsProgressbar(fifth); - progressBar->setGeometry(301, 151, 100, 100); + RingsProgressbar *progressBar = new RingsProgressbar(centerFont); + progressBar->setFixedSize(100, 100); + hlayoutCenterFont1->addStretch(); + hlayoutCenterFont1->addWidget(loadingGif); + hlayoutCenterFont1->addWidget(progressBar); + hlayoutCenterFont1->addStretch(); + // 第二行 + QHBoxLayout *hlayoutCenterFont2 = new QHBoxLayout; // 提醒 - MyLabel *labelTip = new MyLabel(fifth); - labelTip->setGeometry(101, 261, 520, 30); + MyLabel *labelTip = new MyLabel(centerFont); labelTip->setAlignment(Qt::AlignCenter); + labelTip->setIsOriginal(true); labelTip->setFontWordWrap(true); + labelTip->setMinimumWidth(700); // 不要使用电脑,以防数据丢失 labelTip->setDeplayText(tr("Do not use computers in case of data loss")); - connect(this, &SystemBackup::backupWarnning, labelTip, [=](const QString& msg) { - labelTip->setDeplayText(msg); - }); + hlayoutCenterFont2->addStretch(); + hlayoutCenterFont2->addWidget(labelTip); + hlayoutCenterFont2->addStretch(); + // 第三行 + QHBoxLayout *hlayoutCenterFont3 = new QHBoxLayout; // 取消按钮 MyPushButton *cancel = new MyPushButton(fifth); - cancel->setGeometry(310, 330, 97, 36); + cancel->setFixedSize(97, 36); cancel->setText(tr("cancel")); cancel->setEnabled(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, [=] { @@ -1071,7 +1113,6 @@ void SystemBackup::initLastWidget() hlayoutCenterFont5->addStretch(); vlayoutCenterFont->addLayout(hlayoutCenterFont5); - centerFont->setLayout(vlayoutCenterFont); hlayout->addWidget(centerFont); hlayout->addStretch();