mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
add: update RuleWidget
This commit is contained in:
parent
b9e2b38965
commit
e88b5e6ad5
@ -1 +1 @@
|
||||
5794
|
||||
5795
|
||||
|
@ -16,8 +16,8 @@
|
||||
<widget class="QWidget" name="balancersWidget" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>100</y>
|
||||
<x>40</x>
|
||||
<y>30</y>
|
||||
<width>197</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define LOADINGCHECK \
|
||||
if (isLoading) \
|
||||
return;
|
||||
#define rule (*ruleptr)
|
||||
#define rule (*(this->ruleptr))
|
||||
|
||||
QvNodeRuleWidget::QvNodeRuleWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
@ -35,7 +35,6 @@ void QvNodeRuleWidget::ShowCurrentRuleDetail(std::shared_ptr<RuleObject> _rulept
|
||||
ruleEnableCB->setEnabled(true);
|
||||
ruleEnableCB->setChecked(rule.QV2RAY_RULE_ENABLED);
|
||||
ruleTagLineEdit->setEnabled(true);
|
||||
ruleRenameBtn->setEnabled(true);
|
||||
LOAD_FLAG_BEGIN
|
||||
ruleTagLineEdit->setText(rule.QV2RAY_RULE_TAG);
|
||||
// balancerSelectionCombo->clear();
|
||||
@ -62,7 +61,6 @@ void QvNodeRuleWidget::ShowCurrentRuleDetail(std::shared_ptr<RuleObject> _rulept
|
||||
bool isBoth = (network.contains("tcp") && network.contains("udp")) || network.isEmpty();
|
||||
netUDPRB->setChecked(network.contains("udp"));
|
||||
netTCPRB->setChecked(network.contains("tcp"));
|
||||
netBothRB->setChecked(isBoth);
|
||||
//
|
||||
// Set protocol checkboxes.
|
||||
auto protocol = rule.protocol;
|
||||
@ -75,7 +73,6 @@ void QvNodeRuleWidget::ShowCurrentRuleDetail(std::shared_ptr<RuleObject> _rulept
|
||||
//
|
||||
// Users
|
||||
QString users = rule.user.join(NEWLINE);
|
||||
routeUserTxt->setPlainText(users);
|
||||
//
|
||||
// Incoming Sources
|
||||
QString sources = rule.source.join(NEWLINE);
|
||||
@ -91,53 +88,20 @@ void QvNodeRuleWidget::ShowCurrentRuleDetail(std::shared_ptr<RuleObject> _rulept
|
||||
LOAD_FLAG_END
|
||||
}
|
||||
|
||||
void QvNodeRuleWidget::on_routeProtocolHTTPCB_stateChanged(int arg1)
|
||||
void QvNodeRuleWidget::on_routeProtocolHTTPCB_stateChanged(int)
|
||||
{
|
||||
LOADINGCHECK
|
||||
QStringList protocols;
|
||||
|
||||
if (arg1 == Qt::Checked)
|
||||
protocols.push_back("http");
|
||||
|
||||
if (routeProtocolTLSCB->isChecked())
|
||||
protocols.push_back("tls");
|
||||
|
||||
if (routeProtocolBTCB->isChecked())
|
||||
protocols.push_back("bittorrent");
|
||||
|
||||
rule.protocol = protocols;
|
||||
SetProtocolProperty();
|
||||
}
|
||||
void QvNodeRuleWidget::on_routeProtocolTLSCB_stateChanged(int arg1)
|
||||
void QvNodeRuleWidget::on_routeProtocolTLSCB_stateChanged(int)
|
||||
{
|
||||
LOADINGCHECK
|
||||
QStringList protocols;
|
||||
|
||||
if (arg1 == Qt::Checked)
|
||||
protocols.push_back("tls");
|
||||
|
||||
if (routeProtocolHTTPCB->isChecked())
|
||||
protocols.push_back("http");
|
||||
|
||||
if (routeProtocolBTCB->isChecked())
|
||||
protocols.push_back("bittorrent");
|
||||
|
||||
rule.protocol = protocols;
|
||||
SetProtocolProperty();
|
||||
}
|
||||
void QvNodeRuleWidget::on_routeProtocolBTCB_stateChanged(int arg1)
|
||||
void QvNodeRuleWidget::on_routeProtocolBTCB_stateChanged(int)
|
||||
{
|
||||
LOADINGCHECK
|
||||
QStringList protocols;
|
||||
|
||||
if (arg1 == Qt::Checked)
|
||||
protocols.push_back("bittorrent");
|
||||
|
||||
if (routeProtocolHTTPCB->isChecked())
|
||||
protocols.push_back("http");
|
||||
|
||||
if (routeProtocolTLSCB->isChecked())
|
||||
protocols.push_back("tls");
|
||||
|
||||
rule.protocol = protocols;
|
||||
SetProtocolProperty();
|
||||
}
|
||||
void QvNodeRuleWidget::on_hostList_textChanged()
|
||||
{
|
||||
@ -159,25 +123,15 @@ void QvNodeRuleWidget::on_routeUserTxt_textEdited(const QString &arg1)
|
||||
LOADINGCHECK
|
||||
rule.user = SplitLines(arg1);
|
||||
}
|
||||
void QvNodeRuleWidget::on_netBothRB_clicked()
|
||||
{
|
||||
LOADINGCHECK
|
||||
rule.network = "tcp,udp";
|
||||
}
|
||||
void QvNodeRuleWidget::on_netUDPRB_clicked()
|
||||
{
|
||||
LOADINGCHECK
|
||||
rule.network = "udp";
|
||||
SetNetworkProperty();
|
||||
}
|
||||
void QvNodeRuleWidget::on_netTCPRB_clicked()
|
||||
{
|
||||
LOADINGCHECK
|
||||
rule.network = "tcp";
|
||||
}
|
||||
void QvNodeRuleWidget::on_routeUserTxt_textChanged()
|
||||
{
|
||||
LOADINGCHECK
|
||||
rule.user = SplitLines(routeUserTxt->toPlainText());
|
||||
SetNetworkProperty();
|
||||
}
|
||||
void QvNodeRuleWidget::on_sourceIPList_textChanged()
|
||||
{
|
||||
|
@ -25,10 +25,8 @@ class QvNodeRuleWidget
|
||||
void on_ipList_textChanged();
|
||||
void on_routePortTxt_textEdited(const QString &arg1);
|
||||
void on_routeUserTxt_textEdited(const QString &arg1);
|
||||
void on_netBothRB_clicked();
|
||||
void on_netUDPRB_clicked();
|
||||
void on_netTCPRB_clicked();
|
||||
void on_routeUserTxt_textChanged();
|
||||
void on_sourceIPList_textChanged();
|
||||
void on_enableBalancerCB_stateChanged(int arg1);
|
||||
void on_ruleRenameBtn_clicked();
|
||||
@ -38,4 +36,26 @@ class QvNodeRuleWidget
|
||||
void changeEvent(QEvent *e);
|
||||
std::shared_ptr<RuleObject> ruleptr;
|
||||
bool isLoading;
|
||||
|
||||
inline void SetNetworkProperty()
|
||||
{
|
||||
QStringList list;
|
||||
if (netUDPRB->isChecked())
|
||||
list << "udp";
|
||||
if (netTCPRB->isChecked())
|
||||
list << "tcp";
|
||||
ruleptr->network = list.join(",");
|
||||
}
|
||||
|
||||
inline void SetProtocolProperty()
|
||||
{
|
||||
QStringList protocols;
|
||||
if (routeProtocolTLSCB->isChecked())
|
||||
protocols.push_back("tls");
|
||||
if (routeProtocolHTTPCB->isChecked())
|
||||
protocols.push_back("http");
|
||||
if (routeProtocolBTCB->isChecked())
|
||||
protocols.push_back("bittorrent");
|
||||
ruleptr->protocol = protocols;
|
||||
}
|
||||
};
|
||||
|
@ -6,14 +6,20 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>298</width>
|
||||
<height>500</height>
|
||||
<width>330</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>330</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -29,29 +35,19 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ruleTagLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="ruleRenameBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="ruleEnableCB">
|
||||
<property name="text">
|
||||
<string>Rename</string>
|
||||
<string>Enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ruleTagLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ruleEnableCB">
|
||||
<property name="text">
|
||||
<string>Rule Enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Show / Hide</string>
|
||||
</property>
|
||||
@ -65,95 +61,38 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Network</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="netTCPRB">
|
||||
<property name="text">
|
||||
<string>TCP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="netUDPRB">
|
||||
<property name="text">
|
||||
<string>UDP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="netBothRB">
|
||||
<property name="text">
|
||||
<string>Both</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Protocol</string>
|
||||
<string>Target IP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="routeProtocolHTTPCB">
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="routeProtocolTLSCB">
|
||||
<property name="text">
|
||||
<string>TLS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="routeProtocolBTCB">
|
||||
<property name="text">
|
||||
<string>BitTorrent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QPlainTextEdit" name="sourceIPList"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPlainTextEdit" name="hostList"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="routePortTxt">
|
||||
<property name="placeholderText">
|
||||
<string>e.g. 80, 443, 8000-8080</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Users List</string>
|
||||
<string>Target Domain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -164,32 +103,87 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPlainTextEdit" name="routeUserTxt"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="sourceIPList"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Target Domain List</string>
|
||||
<string>General</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Target IP List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPlainTextEdit" name="hostList"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPlainTextEdit" name="ipList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="netTCPRB">
|
||||
<property name="text">
|
||||
<string>TCP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="netUDPRB">
|
||||
<property name="text">
|
||||
<string>UDP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="routeProtocolHTTPCB">
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="routeProtocolTLSCB">
|
||||
<property name="text">
|
||||
<string>TLS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="routeProtocolBTCB">
|
||||
<property name="text">
|
||||
<string>BitTorrent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="routePortTxt">
|
||||
<property name="placeholderText">
|
||||
<string>80, 443, 8000-8080</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user