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