diff --git a/db/TrafficLooper.cpp b/db/TrafficLooper.cpp index 178f1f9..9f1aa90 100644 --- a/db/TrafficLooper.cpp +++ b/db/TrafficLooper.cpp @@ -80,11 +80,11 @@ namespace NekoRay::traffic { elapsedTimer.start(); while (true) { auto sleep_ms = dataStore->traffic_loop_interval; - auto user_disabled = sleep_ms == 0; if (sleep_ms < 500 || sleep_ms > 2000) sleep_ms = 1000; QThread::msleep(sleep_ms); - if (user_disabled) continue; + if (dataStore->traffic_loop_interval == 0) continue; // user disabled + // profile start and stop if (!loop_enabled) { // 停止 if (looping) { diff --git a/ui/dialog_basic_settings.cpp b/ui/dialog_basic_settings.cpp index 2994352..f258b14 100644 --- a/ui/dialog_basic_settings.cpp +++ b/ui/dialog_basic_settings.cpp @@ -283,6 +283,11 @@ void DialogBasicSettings::accept() { D_SAVE_BOOL(skip_cert) NekoRay::dataStore->enable_js_hook = ui->enable_js_hook->currentIndex(); + // 关闭连接统计,停止刷新前清空记录。 + if (NekoRay::dataStore->traffic_loop_interval == 0 || NekoRay::dataStore->connection_statistics == false) { + MW_dialog_message("", "ClearConnectionList"); + } + MW_dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore"); QDialog::accept(); } diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui index 1d8b51c..2767de1 100644 --- a/ui/dialog_basic_settings.ui +++ b/ui/dialog_basic_settings.ui @@ -331,45 +331,6 @@ - - - - - - - - 0 - 0 - - - - Set custom icon - - - - - - - Qt::Vertical - - - - - - - - 0 - 0 - - - - Hide dashboard at startup - - - - - - @@ -426,6 +387,48 @@ + + + + + + + + + + 0 + 0 + + + + Set custom icon + + + + + + + + + + + + + + 0 + 0 + + + + Hide dashboard at startup + + + + + + + + diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index b5060ac..9113bb4 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -454,11 +454,14 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info) } refresh_status(); } + // if (info == "RestartProgram") { this->exit_reason = 2; on_menu_exit_triggered(); } else if (info == "Raise") { ACTIVE_THIS_WINDOW + } else if (info == "ClearConnectionList") { + refresh_connection_list({}); } // sender if (sender == Dialog_DialogEditProfile) { @@ -1422,6 +1425,8 @@ void MainWindow::refresh_connection_list(const QJsonArray &arr) { } last_arr = arr; + if (NekoRay::dataStore->flag_debug) qDebug() << arr; + ui->tableWidget_conn->setRowCount(0); int row = -1;