This commit is contained in:
zhaominyong 2021-12-11 18:32:29 +08:00
parent 3fd680fc28
commit 9c0fa26b9d
2 changed files with 21 additions and 3 deletions

View File

@ -367,6 +367,7 @@ void SystemBackup::initThirdWidget()
nextStep->setAutoRepeat(true);
connect(nextStep, &MyPushButton::clicked, this, [=](bool checked) {
this->on_next_clicked(checked);
emit this->clearBackupName();
});
hlayoutCenterFont5->addWidget(nextStep);
// 重新检测按钮
@ -625,7 +626,7 @@ void SystemBackup::initForthWidget()
labelError->setFontColor(Qt::red);
labelError->setVisible(false);
connect(editBackupName, &MyLineEdit::textChanged, this, [=](const QString &text) {
if (this->isExistsBackupName(text)) {
if (!text.isEmpty() && this->isExistsBackupName(text)) {
labelError->setDeplayText(tr("Name already exists"));
labelError->setVisible(true);
} else {
@ -633,6 +634,14 @@ void SystemBackup::initForthWidget()
labelError->setVisible(false);
}
});
connect(this, &SystemBackup::clearBackupName, this, [=]() {
this->m_backupName = "";
editBackupName->setText("");
editBackupName->setPlaceholderText(QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"));
editBackupName->setFocus();
labelError->setDeplayText("");
labelError->setVisible(false);
});
// 上一步按钮
MyPushButton *preStep = new MyPushButton(forth);
@ -657,8 +666,16 @@ void SystemBackup::initForthWidget()
if (this->m_backupName.isEmpty()) {
this->m_backupName = editBackupName->placeholderText();
}
this->on_next_clicked(checked);
emit this->startBackup();
if (this->isExistsBackupName(this->m_backupName)) {
labelError->setDeplayText(tr("Name already exists"));
labelError->setVisible(true);
this->m_backupName = "";
editBackupName->setFocus();
} else {
this->on_next_clicked(checked);
emit this->startBackup();
}
}
});

View File

@ -48,6 +48,7 @@ signals:
void checkBackupResult(bool result, const QString &errMsg = "", const QString &errTip = "");
void startBackup();
void progress(int state, int rate);
void clearBackupName();
public slots:
void on_pre_clicked(bool checked = false);