mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-16 20:17:07 +03:00
add url test button on main window
This commit is contained in:
@@ -1492,6 +1492,10 @@ End: %2</source>
|
||||
<source>Stop Testing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL Test</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyItem</name>
|
||||
@@ -1632,6 +1636,10 @@ Direct: %2</source>
|
||||
<source>Default</source>
|
||||
<translation type="unfinished">پیش فرض</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The last speed test did not exit completely, please wait. If it persists, please restart the program.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -1498,6 +1498,10 @@ End: %2</source>
|
||||
<source>Stop Testing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL Test</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyItem</name>
|
||||
@@ -1645,6 +1649,10 @@ Release note:
|
||||
<source>Default</source>
|
||||
<translation>По умолчанию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The last speed test did not exit completely, please wait. If it persists, please restart the program.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -1488,7 +1488,7 @@ Split by line.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>In and Out IP</source>
|
||||
<translation>入口出口IP</translation>
|
||||
<translation>入口出口 IP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Test Options</source>
|
||||
@@ -1498,6 +1498,10 @@ Split by line.</source>
|
||||
<source>Stop Testing</source>
|
||||
<translation>停止测试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL Test</source>
|
||||
<translation>URL 测试</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyItem</name>
|
||||
@@ -1645,6 +1649,10 @@ Release note:
|
||||
<source>Default</source>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The last speed test did not exit completely, please wait. If it persists, please restart the program.</source>
|
||||
<translation>上次速度测试未完全退出,请等待。如果问题仍然存在,请重新启动程序。</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
|
||||
static void setup_grpc();
|
||||
|
||||
void speedtest_current_group(int mode);
|
||||
void speedtest_current_group(int mode, bool test_group);
|
||||
|
||||
void speedtest_current();
|
||||
|
||||
|
||||
@@ -205,6 +205,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_url_test">
|
||||
<property name="text">
|
||||
<string>URL Test</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -665,7 +678,7 @@
|
||||
<string notr="true">Tcp Ping</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+T</string>
|
||||
<string notr="true">Ctrl+Alt+T</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_url_test">
|
||||
@@ -673,7 +686,7 @@
|
||||
<string notr="true">Url Test</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+U</string>
|
||||
<string notr="true">Ctrl+Alt+U</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_clear_test_result">
|
||||
@@ -681,7 +694,7 @@
|
||||
<string>Clear Test Result</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+C</string>
|
||||
<string notr="true">Ctrl+Alt+C</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_export_config">
|
||||
@@ -726,7 +739,7 @@
|
||||
<string>Remove Duplicates</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+D</string>
|
||||
<string notr="true">Ctrl+Alt+D</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionfake">
|
||||
@@ -774,7 +787,7 @@
|
||||
<string>Remove Unavailable</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+R</string>
|
||||
<string notr="true">Ctrl+Alt+R</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_full_test">
|
||||
@@ -782,7 +795,7 @@
|
||||
<string>Full Test</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+F</string>
|
||||
<string notr="true">Ctrl+Alt+F</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_hotkey_settings">
|
||||
@@ -803,7 +816,7 @@
|
||||
<string>Copy links of selected (Neko Links)</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Alt+C</string>
|
||||
<string notr="true">Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionfake_2">
|
||||
@@ -859,7 +872,7 @@
|
||||
<string>Resolve domain</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Shift+I</string>
|
||||
<string notr="true">Ctrl+Alt+I</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_vpn_settings">
|
||||
@@ -902,6 +915,9 @@
|
||||
<property name="text">
|
||||
<string>Stop Testing</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+Alt+S</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -58,8 +58,14 @@ void MainWindow::setup_grpc() {
|
||||
inline bool speedtesting = false;
|
||||
inline QList<QThread *> 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);
|
||||
|
||||
Reference in New Issue
Block a user