Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed May 28, 2023
1 parent 22f912e commit f164f73
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libs/build_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 12 additions & 2 deletions main/GuiUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions ui/dialog_vpn_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions ui/dialog_vpn_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ This needs to be run NekoBox with administrator privileges.</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextEdit" name="vpn_rule_cidr"/>
<widget class="QPlainTextEdit" name="vpn_rule_cidr"/>
</item>
</layout>
</widget>
Expand All @@ -156,7 +156,7 @@ This needs to be run NekoBox with administrator privileges.</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTextEdit" name="vpn_rule_process"/>
<widget class="QPlainTextEdit" name="vpn_rule_process"/>
</item>
</layout>
</widget>
Expand Down
1 change: 1 addition & 0 deletions ui/edit/dialog_edit_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DialogEditGroup::DialogEditGroup(const std::shared_ptr<NekoGui::Group> &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;
Expand Down
8 changes: 4 additions & 4 deletions ui/edit/edit_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -62,7 +62,7 @@ void EditCustom::onStart(std::shared_ptr<NekoGui::ProxyEntity> _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)
Expand All @@ -75,7 +75,7 @@ void EditCustom::onStart(std::shared_ptr<NekoGui::ProxyEntity> _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
Expand Down Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion ui/edit/edit_custom.ui
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
</widget>
</item>
<item>
<widget class="QTextEdit" name="config_simple">
<widget class="QPlainTextEdit" name="config_simple">
<property name="minimumSize">
<size>
<width>0</width>
Expand Down

0 comments on commit f164f73

Please sign in to comment.