feat: Minor improvements

This commit is contained in:
unknown 2024-06-15 01:33:42 +03:30
parent 3defe937a5
commit 3da55198e4
No known key found for this signature in database
GPG Key ID: C2CA486E4F771093
13 changed files with 29 additions and 285 deletions

View File

@ -63,7 +63,7 @@ jobs:
qt_version: "6.5"
- platform: ubuntu-22.04
arch: x64
qt_version: "5.12"
qt_version: "6.5"
- platform: macos-14
arch: x64
qt_version: "6.5"

View File

@ -240,9 +240,9 @@ set(PROJECT_SOURCES
ui/dialog_hotkey.h
ui/dialog_hotkey.ui
ui/dialog_first_setup.cpp
ui/dialog_first_setup.h
ui/dialog_first_setup.ui
ui/widget/ProxyItem.cpp
ui/widget/ProxyItem.h

View File

@ -281,9 +281,6 @@ namespace NekoGui {
_add(new configItem("vpn_ipv6", &vpn_ipv6, itemType::boolean));
_add(new configItem("vpn_hide_console", &vpn_hide_console, itemType::boolean));
_add(new configItem("vpn_strict_route", &vpn_strict_route, itemType::boolean));
_add(new configItem("vpn_bypass_process", &vpn_rule_process, itemType::string));
_add(new configItem("vpn_bypass_cidr", &vpn_rule_cidr, itemType::string));
_add(new configItem("vpn_rule_white", &vpn_rule_white, itemType::boolean));
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
_add(new configItem("sp_format", &system_proxy_format, itemType::string));
_add(new configItem("sub_clear", &sub_clear, itemType::boolean));
@ -351,7 +348,6 @@ namespace NekoGui {
_add(new configItem("direct_dns_strategy", &this->direct_dns_strategy, itemType::string));
_add(new configItem("domain_strategy", &this->domain_strategy, itemType::string));
_add(new configItem("outbound_domain_strategy", &this->outbound_domain_strategy, itemType::string));
_add(new configItem("dns_routing", &this->dns_routing, itemType::boolean));
_add(new configItem("sniffing_mode", &this->sniffing_mode, itemType::integer));
_add(new configItem("use_dns_object", &this->use_dns_object, itemType::boolean));
_add(new configItem("dns_object", &this->dns_object, itemType::string));

View File

@ -12,7 +12,6 @@ namespace NekoGui {
QString remote_dns_strategy = "";
QString direct_dns = "localhost";
QString direct_dns_strategy = "";
bool dns_routing = true;
bool use_dns_object = false;
QString dns_object = "";
QString dns_final_out = "proxy";
@ -143,9 +142,6 @@ namespace NekoGui {
bool vpn_ipv6 = false;
bool vpn_hide_console = true;
bool vpn_strict_route = false;
bool vpn_rule_white = false;
QString vpn_rule_process = "";
QString vpn_rule_cidr = "";
// NTP
bool enable_ntp = false;

View File

@ -13,7 +13,6 @@
#include "main/NekoGui.hpp"
#include "ui/mainwindow_interface.h"
#include "ui/dialog_first_setup.h"
#ifdef Q_OS_WIN
#include "sys/windows/MiniDump.h"

View File

@ -1,18 +0,0 @@
#include "dialog_first_setup.h"
#include "ui_dialog_first_setup.h"
#include "main/NekoGui.hpp"
DialogFirstSetup::DialogFirstSetup(QWidget *parent) : QDialog(parent), ui(new Ui::DialogFirstSetup) {
ui->setupUi(this);
}
DialogFirstSetup::~DialogFirstSetup() {
delete ui;
}
void DialogFirstSetup::onButtonClicked() {
auto s = sender();
NekoGui::coreType = NekoGui::CoreType::SING_BOX;
done(0);
}

View File

@ -1,23 +0,0 @@
#pragma once
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class DialogFirstSetup;
}
QT_END_NAMESPACE
class DialogFirstSetup : public QDialog {
Q_OBJECT
public:
explicit DialogFirstSetup(QWidget *parent = nullptr);
~DialogFirstSetup() override;
private:
Ui::DialogFirstSetup *ui;
private slots:
void onButtonClicked();
};

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogFirstSetup</class>
<widget class="QDialog" name="DialogFirstSetup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>First time setup</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>It looks like you are using this software for the first time, please select a core.
These settings can be changed later.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://matsuridayo.github.io/n-configuration/#nekobox&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;Help&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="v2ray">
<property name="text">
<string notr="true">Xray</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="singbox">
<property name="text">
<string notr="true">sing-box</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="quit">
<property name="text">
<string>Quit</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>v2ray</sender>
<signal>clicked()</signal>
<receiver>DialogFirstSetup</receiver>
<slot>onButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>196</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>singbox</sender>
<signal>clicked()</signal>
<receiver>DialogFirstSetup</receiver>
<slot>onButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>236</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>quit</sender>
<signal>clicked()</signal>
<receiver>DialogFirstSetup</receiver>
<slot>onButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>onButtonClicked()</slot>
</slots>
</ui>

View File

@ -82,7 +82,6 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne
ui->domainStrategyCombo->setCurrentText(NekoGui::dataStore->routing->domain_strategy);
ui->use_dns_object->setChecked(NekoGui::dataStore->routing->use_dns_object);
ui->dns_object->setPlainText(NekoGui::dataStore->routing->dns_object);
ui->dns_routing->setChecked(NekoGui::dataStore->routing->dns_routing);
ui->remote_dns->setCurrentText(NekoGui::dataStore->routing->remote_dns);
ui->remote_dns_strategy->setCurrentText(NekoGui::dataStore->routing->remote_dns_strategy);
ui->direct_dns->setCurrentText(NekoGui::dataStore->routing->direct_dns);
@ -112,7 +111,6 @@ void DialogManageRoutes::accept() {
NekoGui::dataStore->routing->outbound_domain_strategy = ui->outbound_domain_strategy->currentText();
NekoGui::dataStore->routing->use_dns_object = ui->use_dns_object->isChecked();
NekoGui::dataStore->routing->dns_object = ui->dns_object->toPlainText();
NekoGui::dataStore->routing->dns_routing = ui->dns_routing->isChecked();
NekoGui::dataStore->routing->remote_dns = ui->remote_dns->currentText();
NekoGui::dataStore->routing->remote_dns_strategy = ui->remote_dns_strategy->currentText();
NekoGui::dataStore->routing->direct_dns = ui->direct_dns->currentText();

View File

@ -48,6 +48,9 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>Sniffs the connections intial packet(s?) to identify the protocol and the SNI. Sniff result for destination also rewrites the destionation of the connection to the sniffed SNI. For more data on the sniffed protocol refer to the sing-box's documentation.</string>
</property>
<property name="text">
<string>Sniffing Mode</string>
</property>
@ -111,6 +114,9 @@ For sing-box, it sets inbound.domain_strategy</string>
</item>
<item row="5" column="0">
<widget class="QLabel" name="default_out_l">
<property name="toolTip">
<string>The outbound tag to use when the request is not handled by any rule</string>
</property>
<property name="text">
<string>Default Outbound</string>
</property>
@ -223,30 +229,10 @@ For more information, see the document &quot;Configuration/DNS&quot;.</string>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="dns_routing">
<property name="text">
<string>Enable DNS Routing</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="dns_final_out_l">
<property name="text">
<string>Final DNS Out</string>
<string>Default DNS server</string>
</property>
</widget>
</item>
@ -254,7 +240,7 @@ For more information, see the document &quot;Configuration/DNS&quot;.</string>
<widget class="QComboBox" name="dns_final_out">
<item>
<property name="text">
<string notr="true">proxy</string>
<string notr="true">remote</string>
</property>
</item>
<item>
@ -468,7 +454,6 @@ For more information, see the document &quot;Configuration/DNS&quot;.</string>
<tabstop>remote_dns_strategy</tabstop>
<tabstop>direct_dns</tabstop>
<tabstop>direct_dns_strategy</tabstop>
<tabstop>dns_routing</tabstop>
<tabstop>dns_final_out</tabstop>
<tabstop>use_dns_object</tabstop>
<tabstop>format_dns_object</tabstop>

View File

@ -25,20 +25,6 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) : QDialog(parent), ui(new
ADJUST_SIZE
#endif
ui->strict_route->setChecked(NekoGui::dataStore->vpn_strict_route);
//
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) {
ui->gb_cidr->setTitle(tr("Proxy CIDR"));
ui->gb_process_name->setTitle(tr("Proxy Process Name"));
} else {
ui->gb_cidr->setTitle(tr("Bypass CIDR"));
ui->gb_process_name->setTitle(tr("Bypass Process Name"));
}
});
ui->whitelist_mode->setChecked(NekoGui::dataStore->vpn_rule_white);
}
DialogVPNSettings::~DialogVPNSettings() {
@ -55,12 +41,8 @@ void DialogVPNSettings::accept() {
NekoGui::dataStore->vpn_ipv6 = ui->vpn_ipv6->isChecked();
NekoGui::dataStore->vpn_hide_console = ui->hide_console->isChecked();
NekoGui::dataStore->vpn_strict_route = ui->strict_route->isChecked();
NekoGui::dataStore->vpn_rule_white = ui->whitelist_mode->isChecked();
NekoGui::dataStore->enable_gso = ui->gso_enable->isChecked();
//
D_SAVE_STRING_PLAIN(vpn_rule_cidr)
D_SAVE_STRING_PLAIN(vpn_rule_process)
//
QStringList msg{"UpdateDataStore"};
msg << "VPNChanged";
MW_dialog_message("", msg.join(","));

View File

@ -139,59 +139,8 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="gb_cidr">
<property name="title">
<string>Bypass CIDR</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPlainTextEdit" name="vpn_rule_cidr"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_process_name">
<property name="title">
<string>Bypass Process Name</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPlainTextEdit" name="vpn_rule_process"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="whitelist_mode">
<property name="toolTip">
<string>Whether blacklisted or whitelisted, your traffic will be handled by nekobox_core (sing-tun). This is NOT equal to &quot;process mode&quot; of some software.</string>
</property>
<property name="text">
<string>Whitelist mode</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="troubleshooting">
<property name="text">
@ -217,29 +166,10 @@
<tabstop>strict_route</tabstop>
<tabstop>fake_dns</tabstop>
<tabstop>hide_console</tabstop>
<tabstop>vpn_rule_cidr</tabstop>
<tabstop>vpn_rule_process</tabstop>
<tabstop>whitelist_mode</tabstop>
<tabstop>troubleshooting</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogVPNSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>575</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
@ -256,5 +186,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogVPNSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>575</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -160,8 +160,7 @@ RouteItem::RouteItem(QWidget *parent, const std::shared_ptr<NekoGui::RoutingChai
updateRulePreview();
});
connect(ui->route_items, &QListWidget::itemClicked, this, [=](const QListWidgetItem *item) {
auto idx = getIndexOf(item->text());
connect(ui->route_items, &QListWidget::currentRowChanged, this, [=](const int idx) {
if (idx == -1) return;
currentIndex = idx;
updateRuleSection();