mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Hide system DNS by default
This commit is contained in:
parent
039f16e4d4
commit
b5b0423283
@ -103,6 +103,7 @@ namespace Configs {
|
||||
int speed_test_timeout_ms = 5000;
|
||||
QString simple_dl_url = "http://cachefly.cachefly.net/1mb.test";
|
||||
bool allow_beta_update = false;
|
||||
bool show_system_dns = false;
|
||||
|
||||
// Network
|
||||
bool net_use_proxy = false;
|
||||
|
||||
@ -28,6 +28,7 @@ private:
|
||||
QString custom_inbound;
|
||||
bool needRestart = false;
|
||||
bool updateDisableTray = false;
|
||||
bool updateSystemDns = false;
|
||||
} CACHE;
|
||||
|
||||
private slots:
|
||||
|
||||
@ -360,7 +360,7 @@
|
||||
<layout class="QHBoxLayout" name="style_h_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox_5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
<property name="sizePolicy">
|
||||
@ -374,6 +374,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="show_sys_dns">
|
||||
<property name="text">
|
||||
<string>Show System DNS option</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@ -320,6 +320,7 @@ namespace Configs {
|
||||
_add(new configItem("adblock_enable", &adblock_enable, itemType::boolean));
|
||||
_add(new configItem("speed_test_timeout_ms", &speed_test_timeout_ms, itemType::integer));
|
||||
_add(new configItem("url_test_timeout_ms", &url_test_timeout_ms, itemType::integer));
|
||||
_add(new configItem("show_system_dns", &show_system_dns, itemType::boolean));
|
||||
}
|
||||
|
||||
void DataStore::UpdateStartedId(int id) {
|
||||
|
||||
@ -419,10 +419,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
refresh_status();
|
||||
}
|
||||
});
|
||||
// only windows is supported for now
|
||||
#ifndef Q_OS_WIN
|
||||
ui->system_dns->hide();
|
||||
#endif
|
||||
if (Configs::dataStore->show_system_dns) ui->system_dns->show();
|
||||
else ui->system_dns->hide();
|
||||
|
||||
connect(ui->menu_server, &QMenu::aboutToShow, this, [=,this](){
|
||||
if (running)
|
||||
@ -770,6 +768,11 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info)
|
||||
if (info.contains("UpdateDisableTray")) {
|
||||
tray->setVisible(!Configs::dataStore->disable_tray);
|
||||
}
|
||||
if (info.contains("UpdateSystemDns"))
|
||||
{
|
||||
if (Configs::dataStore->show_system_dns) ui->system_dns->show();
|
||||
else ui->system_dns->hide();
|
||||
}
|
||||
if (info.contains("NeedChoosePort"))
|
||||
{
|
||||
Configs::dataStore->inbound_socks_port = MkPort();
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
#include <QTimer>
|
||||
#include <qfontdatabase.h>
|
||||
|
||||
#include "include/ui/mainwindow.h"
|
||||
|
||||
DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::DialogBasicSettings) {
|
||||
ui->setupUi(this);
|
||||
@ -67,6 +69,14 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
// Style
|
||||
ui->connection_statistics->setChecked(Configs::dataStore->enable_stats);
|
||||
ui->show_sys_dns->setChecked(Configs::dataStore->show_system_dns);
|
||||
connect(ui->show_sys_dns, &QCheckBox::stateChanged, this, [=]
|
||||
{
|
||||
CACHE.updateSystemDns = true;
|
||||
});
|
||||
#ifndef Q_OS_WIN
|
||||
ui->show_sys_dns->hide();
|
||||
#endif
|
||||
//
|
||||
D_LOAD_BOOL(start_minimal)
|
||||
D_LOAD_INT(max_log_line)
|
||||
@ -197,6 +207,7 @@ void DialogBasicSettings::accept() {
|
||||
Configs::dataStore->language = ui->language->currentIndex();
|
||||
D_SAVE_BOOL(start_minimal)
|
||||
D_SAVE_INT(max_log_line)
|
||||
Configs::dataStore->show_system_dns = ui->show_sys_dns->isChecked();
|
||||
|
||||
if (Configs::dataStore->max_log_line <= 0) {
|
||||
Configs::dataStore->max_log_line = 200;
|
||||
@ -243,6 +254,7 @@ void DialogBasicSettings::accept() {
|
||||
QStringList str{"UpdateDataStore"};
|
||||
if (CACHE.needRestart) str << "NeedRestart";
|
||||
if (CACHE.updateDisableTray) str << "UpdateDisableTray";
|
||||
if (CACHE.updateSystemDns) str << "UpdateSystemDns";
|
||||
if (needChoosePort) str << "NeedChoosePort";
|
||||
MW_dialog_message(Dialog_DialogBasicSettings, str.join(","));
|
||||
QDialog::accept();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user