From 99c8d50943a7234acce1e9db89fee29d217019d5 Mon Sep 17 00:00:00 2001
From: armv9 <48624112+arm64v8a@users.noreply.github.com>
Date: Wed, 9 Oct 2024 13:27:22 +0900
Subject: [PATCH] add url test button on main window
---
translations/fa_IR.ts | 8 ++++++++
translations/ru_RU.ts | 8 ++++++++
translations/zh_CN.ts | 10 +++++++++-
ui/mainwindow.cpp | 9 +++++----
ui/mainwindow.h | 2 +-
ui/mainwindow.ui | 32 ++++++++++++++++++++++++--------
ui/mainwindow_grpc.cpp | 13 +++++++------
7 files changed, 62 insertions(+), 20 deletions(-)
diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts
index d6562f575..9fc28a357 100644
--- a/translations/fa_IR.ts
+++ b/translations/fa_IR.ts
@@ -1492,6 +1492,10 @@ End: %2
+
+
+
+
ProxyItem
@@ -1632,6 +1636,10 @@ Direct: %2
پیش فرض
+
+
+
+
Qv2ray::ui::widgets::AutoCompleteTextEdit
diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts
index 880f57a5d..7abdd8638 100644
--- a/translations/ru_RU.ts
+++ b/translations/ru_RU.ts
@@ -1498,6 +1498,10 @@ End: %2
+
+
+
+
ProxyItem
@@ -1645,6 +1649,10 @@ Release note:
По умолчанию
+
+
+
+
Qv2ray::ui::widgets::AutoCompleteTextEdit
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index 213c6df69..8a9f13ab7 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -1488,7 +1488,7 @@ Split by line.
- 入口出口IP
+ 入口出口 IP
@@ -1498,6 +1498,10 @@ Split by line.
停止测试
+
+
+ URL 测试
+
ProxyItem
@@ -1645,6 +1649,10 @@ Release note:
默认
+
+
+ 上次速度测试未完全退出,请等待。如果问题仍然存在,请重新启动程序。
+
Qv2ray::ui::widgets::AutoCompleteTextEdit
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index d7ed7c475..920fe143d 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -103,6 +103,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(ui->toolButton_document, &QToolButton::clicked, this, [=] { QDesktopServices::openUrl(QUrl("https://matsuridayo.github.io/")); });
connect(ui->toolButton_ads, &QToolButton::clicked, this, [=] { QDesktopServices::openUrl(QUrl("https://matsuricom.pages.dev/")); });
connect(ui->toolButton_update, &QToolButton::clicked, this, [=] { runOnNewThread([=] { CheckUpdate(); }); });
+ connect(ui->toolButton_url_test, &QToolButton::clicked, this, [=] { speedtest_current_group(1, true); });
// Setup log UI
ui->splitter->restoreState(DecodeB64IfValid(NekoGui::dataStore->splitter_state));
@@ -333,10 +334,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
neko_set_spmode_vpn(false);
});
connect(ui->menu_qr, &QAction::triggered, this, [=]() { display_qr_link(false); });
- connect(ui->menu_tcp_ping, &QAction::triggered, this, [=]() { speedtest_current_group(0); });
- connect(ui->menu_url_test, &QAction::triggered, this, [=]() { speedtest_current_group(1); });
- connect(ui->menu_full_test, &QAction::triggered, this, [=]() { speedtest_current_group(2); });
- connect(ui->menu_stop_testing, &QAction::triggered, this, [=]() { speedtest_current_group(114514); });
+ connect(ui->menu_tcp_ping, &QAction::triggered, this, [=]() { speedtest_current_group(0, false); });
+ connect(ui->menu_url_test, &QAction::triggered, this, [=]() { speedtest_current_group(1, false); });
+ connect(ui->menu_full_test, &QAction::triggered, this, [=]() { speedtest_current_group(2, false); });
+ connect(ui->menu_stop_testing, &QAction::triggered, this, [=]() { speedtest_current_group(114514, false); });
//
auto set_selected_or_group = [=](int mode) {
// 0=group 1=select 2=unknown(menu is hide)
diff --git a/ui/mainwindow.h b/ui/mainwindow.h
index 9f95c4df0..5ca492d51 100644
--- a/ui/mainwindow.h
+++ b/ui/mainwindow.h
@@ -185,7 +185,7 @@ private slots:
static void setup_grpc();
- void speedtest_current_group(int mode);
+ void speedtest_current_group(int mode, bool test_group);
void speedtest_current();
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 86189658e..585577a13 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -205,6 +205,19 @@
+ -
+
+
+ URL Test
+
+
+ QToolButton::InstantPopup
+
+
+ Qt::ToolButtonTextUnderIcon
+
+
+
-
@@ -665,7 +678,7 @@
Tcp Ping
- Ctrl+Shift+T
+ Ctrl+Alt+T
@@ -673,7 +686,7 @@
Url Test
- Ctrl+Shift+U
+ Ctrl+Alt+U
@@ -681,7 +694,7 @@
Clear Test Result
- Ctrl+Shift+C
+ Ctrl+Alt+C
@@ -726,7 +739,7 @@
Remove Duplicates
- Ctrl+Shift+D
+ Ctrl+Alt+D
@@ -774,7 +787,7 @@
Remove Unavailable
- Ctrl+Shift+R
+ Ctrl+Alt+R
@@ -782,7 +795,7 @@
Full Test
- Ctrl+Shift+F
+ Ctrl+Alt+F
@@ -803,7 +816,7 @@
Copy links of selected (Neko Links)
- Ctrl+Alt+C
+ Ctrl+N
@@ -859,7 +872,7 @@
Resolve domain
- Ctrl+Shift+I
+ Ctrl+Alt+I
@@ -902,6 +915,9 @@
Stop Testing
+
+ Ctrl+Alt+S
+
diff --git a/ui/mainwindow_grpc.cpp b/ui/mainwindow_grpc.cpp
index 923cc5a9a..3e9f46999 100644
--- a/ui/mainwindow_grpc.cpp
+++ b/ui/mainwindow_grpc.cpp
@@ -58,8 +58,14 @@ void MainWindow::setup_grpc() {
inline bool speedtesting = false;
inline QList speedtesting_threads = {};
-void MainWindow::speedtest_current_group(int mode) {
+void MainWindow::speedtest_current_group(int mode, bool test_group) {
+ if (speedtesting) {
+ MessageBoxWarning(software_name, QObject::tr("The last speed test did not exit completely, please wait. If it persists, please restart the program."));
+ return;
+ }
+
auto profiles = get_selected_or_group();
+ if (test_group) profiles = NekoGui::profileManager->CurrentGroup()->ProfilesWithOrder();
if (profiles.isEmpty()) return;
auto group = NekoGui::profileManager->CurrentGroup();
if (group->archive) return;
@@ -75,11 +81,6 @@ void MainWindow::speedtest_current_group(int mode) {
}
#ifndef NKR_NO_GRPC
- if (speedtesting) {
- MessageBoxWarning(software_name, "The last speed test did not exit completely, please wait. If it persists, please restart the program.");
- return;
- }
-
QStringList full_test_flags;
if (mode == libcore::FullTest) {
auto w = new QDialog(this);