This commit is contained in:
arm64v8a
2023-05-28 11:32:21 +09:00
parent 22f912e0f8
commit f164f73888
7 changed files with 25 additions and 14 deletions

View File

@@ -34,5 +34,5 @@ popd
#### Go: nekobox_core #### #### Go: nekobox_core ####
pushd go/cmd/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 popd

View File

@@ -23,27 +23,37 @@
#define D_C_SAVE_STRING(a) NekoGui::dataStore->a = CACHE.a; #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(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(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(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(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) \ #define P_LOAD_INT(a) \
ui->a->setText(Int2String(bean->a)); \ ui->a->setText(Int2String(bean->a)); \
ui->a->setValidator(QRegExpValidator_Number); ui->a->setValidator(QRegExpValidator_Number);
#define P_SAVE_INT(a) bean->a = ui->a->text().toInt(); #define P_SAVE_INT(a) bean->a = ui->a->text().toInt();
#define D_LOAD_INT(a) \ #define D_LOAD_INT(a) \
ui->a->setText(Int2String(NekoGui::dataStore->a)); \ ui->a->setText(Int2String(NekoGui::dataStore->a)); \
ui->a->setValidator(QRegExpValidator_Number); ui->a->setValidator(QRegExpValidator_Number);
#define D_SAVE_INT(a) NekoGui::dataStore->a = ui->a->text().toInt(); #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_LOAD_COMBO_STRING(a) ui->a->setCurrentText(bean->a);
#define P_SAVE_COMBO_STRING(a) bean->a = ui->a->currentText(); #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_LOAD_COMBO_STRING(a) ui->a->setCurrentText(NekoGui::dataStore->a);
#define D_SAVE_COMBO_STRING(a) NekoGui::dataStore->a = ui->a->currentText(); #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_LOAD_COMBO_INT(a) ui->a->setCurrentIndex(bean->a);
#define P_SAVE_COMBO_INT(a) bean->a = ui->a->currentIndex(); #define P_SAVE_COMBO_INT(a) bean->a = ui->a->currentIndex();
#define D_LOAD_BOOL(a) ui->a->setChecked(NekoGui::dataStore->a); #define D_LOAD_BOOL(a) ui->a->setChecked(NekoGui::dataStore->a);
#define D_SAVE_BOOL(a) NekoGui::dataStore->a = ui->a->isChecked(); #define D_SAVE_BOOL(a) NekoGui::dataStore->a = ui->a->isChecked();
#define P_LOAD_BOOL(a) ui->a->setChecked(bean->a); #define P_LOAD_BOOL(a) ui->a->setChecked(bean->a);
#define P_SAVE_BOOL(a) bean->a = ui->a->isChecked(); #define P_SAVE_BOOL(a) bean->a = ui->a->isChecked();

View File

@@ -25,8 +25,8 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) : QDialog(parent), ui(new
ui->single_core->setVisible(IS_NEKO_BOX); ui->single_core->setVisible(IS_NEKO_BOX);
ui->single_core->setChecked(NekoGui::dataStore->vpn_internal_tun); ui->single_core->setChecked(NekoGui::dataStore->vpn_internal_tun);
// //
D_LOAD_STRING(vpn_rule_cidr) D_LOAD_STRING_PLAIN(vpn_rule_cidr)
D_LOAD_STRING(vpn_rule_process) D_LOAD_STRING_PLAIN(vpn_rule_process)
// //
connect(ui->whitelist_mode, &QCheckBox::stateChanged, this, [=](int state) { connect(ui->whitelist_mode, &QCheckBox::stateChanged, this, [=](int state) {
if (state == Qt::Checked) { if (state == Qt::Checked) {
@@ -57,8 +57,8 @@ void DialogVPNSettings::accept() {
NekoGui::dataStore->vpn_rule_white = ui->whitelist_mode->isChecked(); NekoGui::dataStore->vpn_rule_white = ui->whitelist_mode->isChecked();
NekoGui::dataStore->vpn_internal_tun = ui->single_core->isChecked(); NekoGui::dataStore->vpn_internal_tun = ui->single_core->isChecked();
// //
D_SAVE_STRING_QTEXTEDIT(vpn_rule_cidr) D_SAVE_STRING_PLAIN(vpn_rule_cidr)
D_SAVE_STRING_QTEXTEDIT(vpn_rule_process) D_SAVE_STRING_PLAIN(vpn_rule_process)
// //
MW_dialog_message("", "UpdateDataStore,VPNChanged"); MW_dialog_message("", "UpdateDataStore,VPNChanged");
QDialog::accept(); QDialog::accept();

View File

@@ -144,7 +144,7 @@ This needs to be run NekoBox with administrator privileges.</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTextEdit" name="vpn_rule_cidr"/> <widget class="QPlainTextEdit" name="vpn_rule_cidr"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -156,7 +156,7 @@ This needs to be run NekoBox with administrator privileges.</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QTextEdit" name="vpn_rule_process"/> <widget class="QPlainTextEdit" name="vpn_rule_process"/>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@@ -32,6 +32,7 @@ DialogEditGroup::DialogEditGroup(const std::shared_ptr<NekoGui::Group> &ent, QWi
} else { // new group } else { // new group
ui->front_proxy->hide(); ui->front_proxy->hide();
ui->front_proxy_l->hide(); ui->front_proxy_l->hide();
ui->front_proxy_clear->hide();
} }
CACHE.front_proxy = ent->front_proxy_id; CACHE.front_proxy = ent->front_proxy_id;

View File

@@ -28,7 +28,7 @@ EditCustom::~EditCustom() {
#define SAVE_CUSTOM_BEAN \ #define SAVE_CUSTOM_BEAN \
P_SAVE_COMBO_STRING(core) \ P_SAVE_COMBO_STRING(core) \
bean->command = ui->command->text().split(" "); \ 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_COMBO_STRING(config_suffix) \
P_SAVE_INT(mapping_port) \ P_SAVE_INT(mapping_port) \
P_SAVE_INT(socks_port) P_SAVE_INT(socks_port)
@@ -62,7 +62,7 @@ void EditCustom::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
// load core ui // load core ui
P_LOAD_COMBO_STRING(core) P_LOAD_COMBO_STRING(core)
ui->command->setText(bean->command.join(" ")); 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_COMBO_STRING(config_suffix)
P_LOAD_INT(mapping_port) P_LOAD_INT(mapping_port)
P_LOAD_INT(socks_port) P_LOAD_INT(socks_port)
@@ -75,7 +75,7 @@ void EditCustom::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
ui->core->setDisabled(true); ui->core->setDisabled(true);
ui->core->setCurrentText(preset_core); ui->core->setCurrentText(preset_core);
ui->command->setText(preset_command); ui->command->setText(preset_command);
ui->config_simple->setText(preset_config); ui->config_simple->setPlainText(preset_config);
} }
// custom internal // custom internal
@@ -145,6 +145,6 @@ void EditCustom::on_as_json_clicked() {
auto editor = new JsonEditor(QString2QJsonObject(ui->config_simple->toPlainText()), this); auto editor = new JsonEditor(QString2QJsonObject(ui->config_simple->toPlainText()), this);
auto result = editor->OpenEditor(); auto result = editor->OpenEditor();
if (!result.isEmpty()) { if (!result.isEmpty()) {
ui->config_simple->setText(QJsonObject2QString(result, false)); ui->config_simple->setPlainText(QJsonObject2QString(result, false));
} }
} }

View File

@@ -183,7 +183,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="config_simple"> <widget class="QPlainTextEdit" name="config_simple">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>