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