v2ray format migration

This commit is contained in:
armv9
2024-07-03 16:55:14 +09:00
parent df141f9079
commit cd9bb8f72d
32 changed files with 160 additions and 956 deletions

View File

@@ -62,7 +62,7 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
ui->host_l->setVisible(false);
}
// 传输设置 ED
if (txt == "ws" && IS_NEKO_BOX) {
if (txt == "ws") {
ui->ws_early_data_length->setVisible(true);
ui->ws_early_data_length_l->setVisible(true);
ui->ws_early_data_name->setVisible(true);
@@ -74,11 +74,7 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
ui->ws_early_data_name_l->setVisible(false);
}
// 传输设置 for NekoBox
if (IS_NEKO_BOX) {
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems(Preset::SingBox::UtlsFingerPrint);
} else {
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems(Preset::Xray::UtlsFingerPrint);
}
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems(Preset::SingBox::UtlsFingerPrint);
// 传输设置 是否可见
int networkBoxVisible = 0;
for (auto label: ui->network_box->findChildren<QLabel *>()) {
@@ -89,19 +85,13 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
});
ui->network->removeItem(0);
// if (IS_NEKO_BOX) {
// ui->network->addItem("httpupgrade");
// }
// security changed
connect(ui->security, &QComboBox::currentTextChanged, this, [=](const QString &txt) {
if (txt == "tls") {
ui->security_box->setVisible(true);
ui->tls_camouflage_box->setVisible(true);
if (IS_NEKO_BOX) {
ui->reality_spx->hide();
ui->reality_spx_l->hide();
}
ui->reality_spx->hide();
ui->reality_spx_l->hide();
} else {
ui->security_box->setVisible(false);
ui->tls_camouflage_box->setVisible(false);
@@ -286,47 +276,43 @@ void DialogEditProfile::typeSelected(const QString &newType) {
ADD_ASTERISK(this)
// 设置 for NekoBox
if (IS_NEKO_BOX) {
if (type == "vmess" || type == "vless") {
ui->packet_encoding->setVisible(true);
ui->packet_encoding_l->setVisible(true);
} else {
ui->packet_encoding->setVisible(false);
ui->packet_encoding_l->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan") {
ui->network_l->setVisible(true);
ui->network->setVisible(true);
ui->network_box->setVisible(true);
} else {
ui->network_l->setVisible(false);
ui->network->setVisible(false);
ui->network_box->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan" || type == "http") {
ui->security->setVisible(true);
ui->security_l->setVisible(true);
} else {
ui->security->setVisible(false);
ui->security_l->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan" || type == "shadowsocks") {
ui->multiplex->setVisible(true);
ui->multiplex_l->setVisible(true);
} else {
ui->multiplex->setVisible(false);
ui->multiplex_l->setVisible(false);
}
// 设置 是否可见
int streamBoxVisible = 0;
for (auto label: ui->stream_box->findChildren<QLabel *>()) {
if (!label->isHidden()) streamBoxVisible++;
}
ui->stream_box->setVisible(streamBoxVisible);
if (type == "vmess" || type == "vless") {
ui->packet_encoding->setVisible(true);
ui->packet_encoding_l->setVisible(true);
} else {
ui->packet_encoding->setVisible(false);
ui->packet_encoding_l->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan") {
ui->network_l->setVisible(true);
ui->network->setVisible(true);
ui->network_box->setVisible(true);
} else {
ui->network_l->setVisible(false);
ui->network->setVisible(false);
ui->network_box->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan" || type == "http") {
ui->security->setVisible(true);
ui->security_l->setVisible(true);
} else {
ui->security->setVisible(false);
ui->security_l->setVisible(false);
}
if (type == "vmess" || type == "vless" || type == "trojan" || type == "shadowsocks") {
ui->multiplex->setVisible(true);
ui->multiplex_l->setVisible(true);
} else {
ui->multiplex->setVisible(false);
ui->multiplex_l->setVisible(false);
}
// 设置 是否可见
int streamBoxVisible = 0;
for (auto label: ui->stream_box->findChildren<QLabel *>()) {
if (!label->isHidden()) streamBoxVisible++;
}
ui->stream_box->setVisible(streamBoxVisible);
// 载入 type 之后,有些类型没有右边的设置
auto rightNoBox = (ui->stream_box->isHidden() && ui->network_box->isHidden() && ui->security_box->isHidden());