gui: core settings

This commit is contained in:
arm64v8a
2023-04-07 17:18:52 +09:00
parent 1d8fdc7a7d
commit fb3f83c19c
8 changed files with 58 additions and 1 deletions

View File

@@ -823,7 +823,7 @@ namespace NekoRay {
QJSONARRAY_ADD(routingRules, status->routingRules) QJSONARRAY_ADD(routingRules, status->routingRules)
auto routeObj = QJsonObject{ auto routeObj = QJsonObject{
{"rules", routingRules}, {"rules", routingRules},
{"auto_detect_interface", true}, {"auto_detect_interface", NekoRay::dataStore->core_box_auto_detect_interface},
{ {
"geoip", "geoip",
QJsonObject{ QJsonObject{

View File

@@ -75,6 +75,7 @@ namespace NekoRay {
_add(new configItem("max_log_line", &max_log_line, itemType::integer)); _add(new configItem("max_log_line", &max_log_line, itemType::integer));
_add(new configItem("splitter_state", &splitter_state, itemType::string)); _add(new configItem("splitter_state", &splitter_state, itemType::string));
_add(new configItem("utlsFingerprint", &utlsFingerprint, itemType::string)); _add(new configItem("utlsFingerprint", &utlsFingerprint, itemType::string));
_add(new configItem("core_box_auto_detect_interface", &core_box_auto_detect_interface, itemType::boolean));
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
_add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean)); _add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean));
#endif #endif

View File

@@ -149,6 +149,9 @@ namespace NekoRay {
QString hotkey_route = ""; QString hotkey_route = "";
QString hotkey_system_proxy_menu = ""; QString hotkey_system_proxy_menu = "";
// Core
bool core_box_auto_detect_interface = true;
// Other Core // Other Core
ExtraCore *extraCore = new ExtraCore; ExtraCore *extraCore = new ExtraCore;

View File

@@ -233,6 +233,10 @@
<source>Default uTLS Fingerprint</source> <source>Default uTLS Fingerprint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Settings</source>
<translation type="unfinished">تنظیمات</translation>
</message>
</context> </context>
<context> <context>
<name>DialogEditGroup</name> <name>DialogEditGroup</name>

View File

@@ -227,6 +227,10 @@
<source>Default uTLS Fingerprint</source> <source>Default uTLS Fingerprint</source>
<translation> uTLS </translation> <translation> uTLS </translation>
</message> </message>
<message>
<source>Settings</source>
<translation></translation>
</message>
</context> </context>
<context> <context>
<name>DialogEditGroup</name> <name>DialogEditGroup</name>

View File

@@ -167,6 +167,8 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
// Core // Core
if (!IS_NEKO_BOX) ui->core_settings->hide();
ui->groupBox_core->setTitle(software_core_name); ui->groupBox_core->setTitle(software_core_name);
ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir); ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir);
// //
@@ -386,3 +388,37 @@ void DialogBasicSettings::on_inbound_auth_clicked() {
w->deleteLater(); w->deleteLater();
refresh_auth(); refresh_auth();
} }
void DialogBasicSettings::on_core_settings_clicked() {
auto w = new QDialog(this);
w->setWindowTitle(software_core_name + " settings");
auto layout = new QGridLayout;
w->setLayout(layout);
//
auto line = -1;
QCheckBox *core_box_auto_detect_interface;
if (IS_NEKO_BOX) {
auto core_box_auto_detect_interface_l = new QLabel("auto_detect_interface");
core_box_auto_detect_interface = new QCheckBox;
core_box_auto_detect_interface->setChecked(NekoRay::dataStore->core_box_auto_detect_interface);
layout->addWidget(core_box_auto_detect_interface_l, ++line, 0);
layout->addWidget(core_box_auto_detect_interface, line, 1);
}
//
auto box = new QDialogButtonBox;
box->setOrientation(Qt::Horizontal);
box->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
connect(box, &QDialogButtonBox::accepted, w, [=] {
if (IS_NEKO_BOX) {
NekoRay::dataStore->core_box_auto_detect_interface = core_box_auto_detect_interface->isChecked();
}
NekoRay::dataStore->Save();
w->accept();
});
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
layout->addWidget(box, ++line, 1);
//
w->exec();
w->deleteLater();
refresh_auth();
}

View File

@@ -36,6 +36,8 @@ private slots:
void on_set_custom_icon_clicked(); void on_set_custom_icon_clicked();
void on_inbound_auth_clicked(); void on_inbound_auth_clicked();
void on_core_settings_clicked();
}; };
#endif // DIALOG_BASIC_SETTINGS_H #endif // DIALOG_BASIC_SETTINGS_H

View File

@@ -590,6 +590,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="core_settings">
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>