From 013920d99d0ab32d504b46e666e62528fd5766f9 Mon Sep 17 00:00:00 2001
From: arm64v8a <48624112+arm64v8a@users.noreply.github.com>
Date: Sun, 30 Oct 2022 17:55:11 +0900
Subject: [PATCH] change hysteria gui
---
CMakeLists.txt | 3 -
translations/zh_CN.ts | 35 +--------
ui/edit/edit_custom.cpp | 15 +---
ui/edit/gen_hysteria.cpp | 37 ---------
ui/edit/gen_hysteria.h | 29 -------
ui/edit/gen_hysteria.ui | 159 ---------------------------------------
6 files changed, 8 insertions(+), 270 deletions(-)
delete mode 100644 ui/edit/gen_hysteria.cpp
delete mode 100644 ui/edit/gen_hysteria.h
delete mode 100644 ui/edit/gen_hysteria.ui
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54ace94..f1b1a93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,9 +166,6 @@ set(PROJECT_SOURCES
ui/edit/edit_trojan_vless.h
ui/edit/edit_trojan_vless.cpp
ui/edit/edit_trojan_vless.ui
- ui/edit/gen_hysteria.h
- ui/edit/gen_hysteria.cpp
- ui/edit/gen_hysteria.ui
ui/edit/edit_naive.h
ui/edit/edit_naive.cpp
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index 03020be..9e5b438 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -607,6 +607,10 @@
Outbound JSON, please read the documentation.
填写出站 JSON 对象,详细请看文档。
+
+ Please read the documentation. If you don't understand, use a share link instead.
+ 格式请看文档。如果不懂,直接导入 hysteria:// 链接。
+
EditNaive
@@ -711,37 +715,6 @@
-
- GenHysteria
-
- Generate
- 生成配置
-
-
- Allow Insecure
- 不检查服务器证书(不安全)
-
-
- Certificate Path
- 证书路径
-
-
- Obfs Password
- 混淆密码
-
-
- Auth String
- 字符串验证密钥
-
-
- Protocol
- 协议
-
-
- <html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">Document</span></a></p></body></html>
- <html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">文档</span></a></p></body></html>
-
-
GroupItem
diff --git a/ui/edit/edit_custom.cpp b/ui/edit/edit_custom.cpp
index 07fa9ac..ddc1855 100644
--- a/ui/edit/edit_custom.cpp
+++ b/ui/edit/edit_custom.cpp
@@ -4,7 +4,6 @@
#include "qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp"
#include "fmt/CustomBean.hpp"
#include "fmt/Preset.hpp"
-#include "ui/edit/gen_hysteria.h"
EditCustom::EditCustom(QWidget *parent) :
QWidget(parent), ui(new Ui::EditCustom) {
@@ -36,6 +35,9 @@ void EditCustom::onStart(QSharedPointer _ent) {
preset_command = Preset::Hysteria::command;
preset_config = Preset::Hysteria::config;
ui->config_simple->setPlaceholderText("");
+ ui->core->hide();
+ ui->core_l->setText(
+ tr("Please read the documentation. If you don't understand, use a share link instead."));
} else if (preset_core == "internal") {
preset_command = preset_config = "";
ui->config_simple->setPlaceholderText("{\n"
@@ -69,16 +71,7 @@ void EditCustom::onStart(QSharedPointer _ent) {
}
// Generators
- if (bean->core == "hysteria") {
- ui->generator->setVisible(true);
- auto genHy = new GenHysteria(ent);
- ui->generator->layout()->addWidget(genHy);
- connect(genHy, &GenHysteria::config_generated, this, [=](const QString &result) {
- ui->config_simple->setText(result);
- });
- } else {
- ui->generator->setVisible(false);
- }
+ ui->generator->setVisible(false);
}
bool EditCustom::onEnd() {
diff --git a/ui/edit/gen_hysteria.cpp b/ui/edit/gen_hysteria.cpp
deleted file mode 100644
index 8c4e301..0000000
--- a/ui/edit/gen_hysteria.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "gen_hysteria.h"
-#include "ui_gen_hysteria.h"
-
-#include "fmt/CustomBean.hpp"
-#include "fmt/Preset.hpp"
-
-GenHysteria::GenHysteria(const QSharedPointer &ent, QWidget *parent) :
- QWidget(parent), ui(new Ui::GenHysteria) {
- ui->setupUi(this);
- this->ent = ent;
-}
-
-GenHysteria::~GenHysteria() {
- delete ui;
-}
-
-void GenHysteria::on_gen_clicked() {
- auto result = QString2QJsonObject(Preset::Hysteria::config);
- result["obfs"] = ui->obfs_password->text();
- result["insecure"] = ui->allow_insecure->isChecked();
- result["protocol"] = ui->protocol->currentText();
- result["up_mbps"] = ui->up_mbps->text().toInt();
- result["down_mbps"] = ui->down_mbps->text().toInt();
- if (!ui->auth_string->text().isEmpty()) {
- result["auth_str"] = ui->auth_string->text();
- }
- if (!ui->alpn->text().isEmpty()) {
- result["alpn"] = ui->alpn->text();
- }
- if (!ui->sni->text().isEmpty()) {
- result["server_name"] = ui->sni->text();
- }
- if (!ui->cert_path->text().isEmpty()) {
- result["ca"] = ui->cert_path->text();
- }
- emit config_generated(QJsonObject2QString(result, false));
-}
diff --git a/ui/edit/gen_hysteria.h b/ui/edit/gen_hysteria.h
deleted file mode 100644
index e7cb7b3..0000000
--- a/ui/edit/gen_hysteria.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-#include "db/ProxyEntity.hpp"
-
-QT_BEGIN_NAMESPACE
-namespace Ui { class GenHysteria; }
-QT_END_NAMESPACE
-
-class GenHysteria : public QWidget {
-Q_OBJECT
-
-public:
- explicit GenHysteria(const QSharedPointer &ent, QWidget *parent = nullptr);
-
- ~GenHysteria() override;
-
-private:
- Ui::GenHysteria *ui;
- QSharedPointer ent;
-
-signals:
-
- void config_generated(const QString &result);
-
-private slots:
-
- void on_gen_clicked();
-};
diff --git a/ui/edit/gen_hysteria.ui b/ui/edit/gen_hysteria.ui
deleted file mode 100644
index 0bdc63a..0000000
--- a/ui/edit/gen_hysteria.ui
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
- GenHysteria
-
-
-
- 0
- 0
- 400
- 400
-
-
-
- -
-
-
- Certificate Path
-
-
-
- -
-
-
- Obfs Password
-
-
-
- -
-
-
- 50
-
-
-
- -
-
-
- down_mpbs
-
-
-
- -
-
-
- Generate
-
-
-
- -
-
-
- -
-
-
- Protocol
-
-
-
- -
-
-
- up_mbps
-
-
-
- -
-
-
-
-
- udp
-
-
- -
-
- wechat-video
-
-
-
-
- -
-
-
- -
-
-
- 10
-
-
-
- -
-
-
- SNI
-
-
-
- -
-
-
- -
-
-
- -
-
-
- ALPN
-
-
-
- -
-
-
- -
-
-
- Auth String
-
-
-
- -
-
-
- Allow Insecure
-
-
-
- -
-
-
- <html><head/><body><p><a href="https://github.com/HyNetwork/hysteria/wiki"><span style=" text-decoration: underline; color:#2980b9;">Document</span></a></p></body></html>
-
-
- true
-
-
-
-
-
-
-
- MyLineEdit
- QLineEdit
-
-
-
-
- obfs_password
- auth_string
- protocol
- up_mbps
- down_mbps
- sni
- alpn
- cert_path
- gen
-
-
-
-