mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
fix connection_statistics & settings ui
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -331,45 +331,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||
<item>
|
||||
<widget class="QPushButton" name="set_custom_icon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set custom icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide dashboard at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
@@ -426,6 +387,48 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||
<item>
|
||||
<widget class="QPushButton" name="set_custom_icon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set custom icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide dashboard at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user