mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
gui: core settings
This commit is contained in:
@@ -823,7 +823,7 @@ namespace NekoRay {
|
||||
QJSONARRAY_ADD(routingRules, status->routingRules)
|
||||
auto routeObj = QJsonObject{
|
||||
{"rules", routingRules},
|
||||
{"auto_detect_interface", true},
|
||||
{"auto_detect_interface", NekoRay::dataStore->core_box_auto_detect_interface},
|
||||
{
|
||||
"geoip",
|
||||
QJsonObject{
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace NekoRay {
|
||||
_add(new configItem("max_log_line", &max_log_line, itemType::integer));
|
||||
_add(new configItem("splitter_state", &splitter_state, 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
|
||||
_add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean));
|
||||
#endif
|
||||
|
||||
@@ -149,6 +149,9 @@ namespace NekoRay {
|
||||
QString hotkey_route = "";
|
||||
QString hotkey_system_proxy_menu = "";
|
||||
|
||||
// Core
|
||||
bool core_box_auto_detect_interface = true;
|
||||
|
||||
// Other Core
|
||||
ExtraCore *extraCore = new ExtraCore;
|
||||
|
||||
|
||||
@@ -233,6 +233,10 @@
|
||||
<source>Default uTLS Fingerprint</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished">تنظیمات</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogEditGroup</name>
|
||||
|
||||
@@ -227,6 +227,10 @@
|
||||
<source>Default uTLS Fingerprint</source>
|
||||
<translation>默认 uTLS 指纹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Settings</source>
|
||||
<translation>设置</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogEditGroup</name>
|
||||
|
||||
@@ -167,6 +167,8 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
// Core
|
||||
|
||||
if (!IS_NEKO_BOX) ui->core_settings->hide();
|
||||
|
||||
ui->groupBox_core->setTitle(software_core_name);
|
||||
ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir);
|
||||
//
|
||||
@@ -386,3 +388,37 @@ void DialogBasicSettings::on_inbound_auth_clicked() {
|
||||
w->deleteLater();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ private slots:
|
||||
void on_set_custom_icon_clicked();
|
||||
|
||||
void on_inbound_auth_clicked();
|
||||
|
||||
void on_core_settings_clicked();
|
||||
};
|
||||
|
||||
#endif // DIALOG_BASIC_SETTINGS_H
|
||||
|
||||
@@ -590,6 +590,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="core_settings">
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user