fix:修正配置删除不完全问题。
This commit is contained in:
@@ -3,21 +3,17 @@
|
||||
#include "public_def.h"
|
||||
#include "ui_conf_setting.h"
|
||||
|
||||
CGroupSetting::CGroupSetting(QWidget* parent, CGroupIni* oper)
|
||||
: QDialog(parent), ui(new Ui::CGroupSetting)
|
||||
CGroupSetting::CGroupSetting(QWidget* parent, CGroupIni* oper) : QDialog(parent), ui(new Ui::CGroupSetting)
|
||||
{
|
||||
ini_opr_ = oper;
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(u8"配置编辑");
|
||||
|
||||
connect(ui->btnAddConfig, &QPushButton::clicked, this,
|
||||
[&]() { add_item(); });
|
||||
connect(ui->btnDelConfig, &QPushButton::clicked, this,
|
||||
[&]() { del_item(); });
|
||||
connect(ui->btnAddConfig, &QPushButton::clicked, this, [&]() { add_item(); });
|
||||
connect(ui->btnDelConfig, &QPushButton::clicked, this, [&]() { del_item(); });
|
||||
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
|
||||
connect(ui->cbConfig, &QComboBox::currentTextChanged, this,
|
||||
[&](const QString& content) { change_ini(); });
|
||||
connect(ui->cbConfig, &QComboBox::currentTextChanged, this, [&](const QString& content) { change_ini(); });
|
||||
}
|
||||
|
||||
CGroupSetting::~CGroupSetting()
|
||||
@@ -33,13 +29,15 @@ void CGroupSetting::showEvent(QShowEvent* event)
|
||||
|
||||
void CGroupSetting::add_item()
|
||||
{
|
||||
if (!CUtil::affirm(this, u8"确认", u8"确认添加/更新吗?")) {
|
||||
return;
|
||||
}
|
||||
QString config_name = ui->edConfigName->text();
|
||||
config_name = config_name.trimmed();
|
||||
if (config_name.isEmpty()) {
|
||||
CUtil::msg(this, u8"配置名为空");
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证重名
|
||||
|
||||
// 添加
|
||||
@@ -63,6 +61,9 @@ void CGroupSetting::add_item()
|
||||
|
||||
void CGroupSetting::del_item()
|
||||
{
|
||||
if (!CUtil::affirm(this, u8"确认", u8"确认删除吗?")) {
|
||||
return;
|
||||
}
|
||||
std::string key = ui->cbConfig->currentText().toStdString();
|
||||
if (!ini_opr_->del_item(key)) {
|
||||
CUtil::msg(this, u8"失败");
|
||||
|
||||
Reference in New Issue
Block a user