update traffic_loop_interval

This commit is contained in:
arm64v8a
2023-05-20 14:31:43 +09:00
parent e3f325ef38
commit f91cf4c8f7
6 changed files with 32 additions and 21 deletions

View File

@@ -80,7 +80,7 @@ namespace NekoRay::traffic {
elapsedTimer.start();
while (true) {
auto sleep_ms = dataStore->traffic_loop_interval;
if (sleep_ms < 500 || sleep_ms > 2000) sleep_ms = 1000;
if (sleep_ms < 500 || sleep_ms > 5000) sleep_ms = 1000;
QThread::msleep(sleep_ms);
if (dataStore->traffic_loop_interval == 0) continue; // user disabled

View File

@@ -94,7 +94,7 @@ namespace NekoRay {
QString log_level = "warning";
QString test_url = "http://cp.cloudflare.com/";
int test_concurrent = 5;
int traffic_loop_interval = 500;
int traffic_loop_interval = 1000;
bool connection_statistics = false;
int current_group = 0; // group id
QString mux_protocol = "";

View File

@@ -100,14 +100,6 @@
<source>Statistics refresh rate</source>
<translation>نرخ تازه سازی آمار ترافیک</translation>
</message>
<message>
<source>Fast</source>
<translation>سریع</translation>
</message>
<message>
<source>Slow</source>
<translation>کند</translation>
</message>
<message>
<source>Off</source>
<translation>خاموش</translation>

View File

@@ -99,14 +99,6 @@
<source>Statistics refresh rate</source>
<translation></translation>
</message>
<message>
<source>Fast</source>
<translation></translation>
</message>
<message>
<source>Slow</source>
<translation></translation>
</message>
<message>
<source>Off</source>
<translation></translation>

View File

@@ -110,8 +110,14 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
ui->rfsh_r->setCurrentIndex(0);
} else if (NekoRay::dataStore->traffic_loop_interval == 1000) {
ui->rfsh_r->setCurrentIndex(1);
} else {
} else if (NekoRay::dataStore->traffic_loop_interval == 2000) {
ui->rfsh_r->setCurrentIndex(2);
} else if (NekoRay::dataStore->traffic_loop_interval == 3000) {
ui->rfsh_r->setCurrentIndex(3);
} else if (NekoRay::dataStore->traffic_loop_interval == 5000) {
ui->rfsh_r->setCurrentIndex(4);
} else {
ui->rfsh_r->setCurrentIndex(5);
}
//
ui->language->setCurrentIndex(NekoRay::dataStore->language);
@@ -274,6 +280,12 @@ void DialogBasicSettings::accept() {
NekoRay::dataStore->traffic_loop_interval = 500;
} else if (ui->rfsh_r->currentIndex() == 1) {
NekoRay::dataStore->traffic_loop_interval = 1000;
} else if (ui->rfsh_r->currentIndex() == 2) {
NekoRay::dataStore->traffic_loop_interval = 2000;
} else if (ui->rfsh_r->currentIndex() == 3) {
NekoRay::dataStore->traffic_loop_interval = 3000;
} else if (ui->rfsh_r->currentIndex() == 4) {
NekoRay::dataStore->traffic_loop_interval = 5000;
} else {
NekoRay::dataStore->traffic_loop_interval = 0;
}

View File

@@ -367,12 +367,27 @@
<widget class="QComboBox" name="rfsh_r">
<item>
<property name="text">
<string>Fast</string>
<string notr="true">500ms</string>
</property>
</item>
<item>
<property name="text">
<string>Slow</string>
<string notr="true">1s</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">2s</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">3s</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">5s</string>
</property>
</item>
<item>