From f164f7388865e89e18196c28639895c3cdef3a1f Mon Sep 17 00:00:00 2001
From: arm64v8a <48624112+arm64v8a@users.noreply.github.com>
Date: Sun, 28 May 2023 11:32:21 +0900
Subject: [PATCH] fix
---
libs/build_go.sh | 2 +-
main/GuiUtils.hpp | 14 ++++++++++++--
ui/dialog_vpn_settings.cpp | 8 ++++----
ui/dialog_vpn_settings.ui | 4 ++--
ui/edit/dialog_edit_group.cpp | 1 +
ui/edit/edit_custom.cpp | 8 ++++----
ui/edit/edit_custom.ui | 2 +-
7 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/libs/build_go.sh b/libs/build_go.sh
index 174346e..5c1dbc4 100755
--- a/libs/build_go.sh
+++ b/libs/build_go.sh
@@ -34,5 +34,5 @@ popd
#### Go: nekobox_core ####
pushd go/cmd/nekobox_core
-go build -v -o $DEST -trimpath -ldflags "-w -s -X $neko_common.Version_neko=$version_standalone" -tags "with_grpc,with_gvisor,with_quic,with_wireguard,with_utls,with_clash_api"
+go build -v -o $DEST -trimpath -ldflags "-w -s -X $neko_common.Version_neko=$version_standalone" -tags "with_gvisor,with_quic,with_wireguard,with_utls,with_clash_api"
popd
diff --git a/main/GuiUtils.hpp b/main/GuiUtils.hpp
index 6526eb2..82c729f 100644
--- a/main/GuiUtils.hpp
+++ b/main/GuiUtils.hpp
@@ -23,27 +23,37 @@
#define D_C_SAVE_STRING(a) NekoGui::dataStore->a = CACHE.a;
#define P_LOAD_STRING(a) ui->a->setText(bean->a);
+#define P_LOAD_STRING_PLAIN(a) ui->a->setPlainText(bean->a);
#define P_SAVE_STRING(a) bean->a = ui->a->text();
-#define P_SAVE_STRING_QTEXTEDIT(a) bean->a = ui->a->toPlainText();
+#define P_SAVE_STRING_PLAIN(a) bean->a = ui->a->toPlainText();
+
#define D_LOAD_STRING(a) ui->a->setText(NekoGui::dataStore->a);
+#define D_LOAD_STRING_PLAIN(a) ui->a->setPlainText(NekoGui::dataStore->a);
#define D_SAVE_STRING(a) NekoGui::dataStore->a = ui->a->text();
-#define D_SAVE_STRING_QTEXTEDIT(a) NekoGui::dataStore->a = ui->a->toPlainText();
+#define D_SAVE_STRING_PLAIN(a) NekoGui::dataStore->a = ui->a->toPlainText();
+
#define P_LOAD_INT(a) \
ui->a->setText(Int2String(bean->a)); \
ui->a->setValidator(QRegExpValidator_Number);
#define P_SAVE_INT(a) bean->a = ui->a->text().toInt();
+
#define D_LOAD_INT(a) \
ui->a->setText(Int2String(NekoGui::dataStore->a)); \
ui->a->setValidator(QRegExpValidator_Number);
#define D_SAVE_INT(a) NekoGui::dataStore->a = ui->a->text().toInt();
+
#define P_LOAD_COMBO_STRING(a) ui->a->setCurrentText(bean->a);
#define P_SAVE_COMBO_STRING(a) bean->a = ui->a->currentText();
+
#define D_LOAD_COMBO_STRING(a) ui->a->setCurrentText(NekoGui::dataStore->a);
#define D_SAVE_COMBO_STRING(a) NekoGui::dataStore->a = ui->a->currentText();
+
#define P_LOAD_COMBO_INT(a) ui->a->setCurrentIndex(bean->a);
#define P_SAVE_COMBO_INT(a) bean->a = ui->a->currentIndex();
+
#define D_LOAD_BOOL(a) ui->a->setChecked(NekoGui::dataStore->a);
#define D_SAVE_BOOL(a) NekoGui::dataStore->a = ui->a->isChecked();
+
#define P_LOAD_BOOL(a) ui->a->setChecked(bean->a);
#define P_SAVE_BOOL(a) bean->a = ui->a->isChecked();
diff --git a/ui/dialog_vpn_settings.cpp b/ui/dialog_vpn_settings.cpp
index 919ce86..8143291 100644
--- a/ui/dialog_vpn_settings.cpp
+++ b/ui/dialog_vpn_settings.cpp
@@ -25,8 +25,8 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) : QDialog(parent), ui(new
ui->single_core->setVisible(IS_NEKO_BOX);
ui->single_core->setChecked(NekoGui::dataStore->vpn_internal_tun);
//
- D_LOAD_STRING(vpn_rule_cidr)
- D_LOAD_STRING(vpn_rule_process)
+ D_LOAD_STRING_PLAIN(vpn_rule_cidr)
+ D_LOAD_STRING_PLAIN(vpn_rule_process)
//
connect(ui->whitelist_mode, &QCheckBox::stateChanged, this, [=](int state) {
if (state == Qt::Checked) {
@@ -57,8 +57,8 @@ void DialogVPNSettings::accept() {
NekoGui::dataStore->vpn_rule_white = ui->whitelist_mode->isChecked();
NekoGui::dataStore->vpn_internal_tun = ui->single_core->isChecked();
//
- D_SAVE_STRING_QTEXTEDIT(vpn_rule_cidr)
- D_SAVE_STRING_QTEXTEDIT(vpn_rule_process)
+ D_SAVE_STRING_PLAIN(vpn_rule_cidr)
+ D_SAVE_STRING_PLAIN(vpn_rule_process)
//
MW_dialog_message("", "UpdateDataStore,VPNChanged");
QDialog::accept();
diff --git a/ui/dialog_vpn_settings.ui b/ui/dialog_vpn_settings.ui
index 3959bb6..33a2e87 100644
--- a/ui/dialog_vpn_settings.ui
+++ b/ui/dialog_vpn_settings.ui
@@ -144,7 +144,7 @@ This needs to be run NekoBox with administrator privileges.
-
-
+
@@ -156,7 +156,7 @@ This needs to be run NekoBox with administrator privileges.
-
-
+
diff --git a/ui/edit/dialog_edit_group.cpp b/ui/edit/dialog_edit_group.cpp
index c52f44d..e86f002 100644
--- a/ui/edit/dialog_edit_group.cpp
+++ b/ui/edit/dialog_edit_group.cpp
@@ -32,6 +32,7 @@ DialogEditGroup::DialogEditGroup(const std::shared_ptr &ent, QWi
} else { // new group
ui->front_proxy->hide();
ui->front_proxy_l->hide();
+ ui->front_proxy_clear->hide();
}
CACHE.front_proxy = ent->front_proxy_id;
diff --git a/ui/edit/edit_custom.cpp b/ui/edit/edit_custom.cpp
index 97f71e9..1d75ad4 100644
--- a/ui/edit/edit_custom.cpp
+++ b/ui/edit/edit_custom.cpp
@@ -28,7 +28,7 @@ EditCustom::~EditCustom() {
#define SAVE_CUSTOM_BEAN \
P_SAVE_COMBO_STRING(core) \
bean->command = ui->command->text().split(" "); \
- P_SAVE_STRING_QTEXTEDIT(config_simple) \
+ P_SAVE_STRING_PLAIN(config_simple) \
P_SAVE_COMBO_STRING(config_suffix) \
P_SAVE_INT(mapping_port) \
P_SAVE_INT(socks_port)
@@ -62,7 +62,7 @@ void EditCustom::onStart(std::shared_ptr _ent) {
// load core ui
P_LOAD_COMBO_STRING(core)
ui->command->setText(bean->command.join(" "));
- P_LOAD_STRING(config_simple)
+ ui->config_simple->setPlainText(bean->config_simple);
P_LOAD_COMBO_STRING(config_suffix)
P_LOAD_INT(mapping_port)
P_LOAD_INT(socks_port)
@@ -75,7 +75,7 @@ void EditCustom::onStart(std::shared_ptr _ent) {
ui->core->setDisabled(true);
ui->core->setCurrentText(preset_core);
ui->command->setText(preset_command);
- ui->config_simple->setText(preset_config);
+ ui->config_simple->setPlainText(preset_config);
}
// custom internal
@@ -145,6 +145,6 @@ void EditCustom::on_as_json_clicked() {
auto editor = new JsonEditor(QString2QJsonObject(ui->config_simple->toPlainText()), this);
auto result = editor->OpenEditor();
if (!result.isEmpty()) {
- ui->config_simple->setText(QJsonObject2QString(result, false));
+ ui->config_simple->setPlainText(QJsonObject2QString(result, false));
}
}
diff --git a/ui/edit/edit_custom.ui b/ui/edit/edit_custom.ui
index 4083657..cb1fa41 100644
--- a/ui/edit/edit_custom.ui
+++ b/ui/edit/edit_custom.ui
@@ -183,7 +183,7 @@
-
-
+
0