From 8b63f1f5643f3648c354a931dc8c6cf58dc80838 Mon Sep 17 00:00:00 2001 From: wyc <1104749580@qq.com> Date: Sun, 2 Aug 2026 00:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=8E=E9=9D=A2=E4=B8=8A=E6=B2=A1bug?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/radio/BackEnd/BackEnd.h | 10 ++++++++ module/radio/BackEnd/BackEnd_Mock.cpp | 35 +++++++++++++------------- module/radio/BackEnd/RadioWidget.cpp | 18 ++++++++++++- module/radio/BaseWidget.h | 4 --- module/radio/Global.h | 2 +- module/radio/component/ExpandInput.cpp | 2 +- module/radio/main.cpp | 1 - module/radio/menu/BaseWidgetMenu.h | 7 +++--- toolchain/vs2019.cmake | 1 + 9 files changed, 50 insertions(+), 30 deletions(-) diff --git a/module/radio/BackEnd/BackEnd.h b/module/radio/BackEnd/BackEnd.h index e5b5cf9..1574cd8 100644 --- a/module/radio/BackEnd/BackEnd.h +++ b/module/radio/BackEnd/BackEnd.h @@ -5,6 +5,7 @@ #include #include #include +#include #include class Back_End : public QObject { @@ -25,6 +26,13 @@ public: QString get_screenshot_save_file_name(); QString get_audio_file_location(); void stop_mock_thread() { + ++mock_generation; + if (mock_timer) { + mock_timer->stop(); + mock_timer->disconnect(this); + mock_timer->deleteLater(); + mock_timer = nullptr; + } if (mock_thread) { mock_thread->quit(); mock_thread->wait(); @@ -39,6 +47,8 @@ protected: ~Back_End() override { stop_mock_thread(); } + QTimer* mock_timer{}; + std::uint64_t mock_generation{}; QThread* mock_thread{}; }; diff --git a/module/radio/BackEnd/BackEnd_Mock.cpp b/module/radio/BackEnd/BackEnd_Mock.cpp index 961a5c3..c93666a 100644 --- a/module/radio/BackEnd/BackEnd_Mock.cpp +++ b/module/radio/BackEnd/BackEnd_Mock.cpp @@ -8,9 +8,10 @@ #include "SweepFrequencyWidget.h" #include #include +#include #include #include -#include "Renderive/export.h" +#include "export.h" namespace { struct Mock_Config { bool performance{}; @@ -156,25 +157,23 @@ Back_End::Back_End() { function_map["特别增加"] = Qt::Key_PageUp; function_map["特别减小"] = Qt::Key_PageDown; Mock_Config config = read_mock_config(); - QTimer::singleShot(0, this, [this, config]() { - Radio_Widget* rw = Main_Widget::instance()->radio_widget; - if (config.performance) { - auto timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - QObject::connect(timer, &QTimer::timeout, this, [config, rw]() { - for (int i = 0; i < config.batch_count; ++i) - push_radio_data_perf(rw); - }); - timer->start(config.interval_ms); + std::uint64_t start_generation = mock_generation; + QTimer::singleShot(0, this, [this, config, start_generation]() { + if (start_generation != mock_generation) return; - } - auto timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - QObject::connect(timer, &QTimer::timeout, this, [config, rw]() { - for (int i = 0; i < config.batch_count; ++i) - push_radio_data(rw); + QPointer rw = Main_Widget::instance()->radio_widget; + if (!rw) + return; + mock_timer = new QTimer(this); + mock_timer->setTimerType(Qt::PreciseTimer); + QObject::connect(mock_timer, &QTimer::timeout, this, [config, rw]() { + for (int i = 0; i < config.batch_count; ++i) { + if (!rw) + return; + config.performance ? push_radio_data_perf(rw.data()) : push_radio_data(rw.data()); + } }); - timer->start(config.interval_ms); + mock_timer->start(config.interval_ms); }); } #endif diff --git a/module/radio/BackEnd/RadioWidget.cpp b/module/radio/BackEnd/RadioWidget.cpp index 79b29c3..23a7a32 100644 --- a/module/radio/BackEnd/RadioWidget.cpp +++ b/module/radio/BackEnd/RadioWidget.cpp @@ -1,4 +1,5 @@ #include "RadioWidget.h" +#include #include #include #include @@ -9,7 +10,7 @@ #include "BackEnd.h" #include "../BackEnd/MainWidget.h" #include "Demo_Gallery/base/export.h" -static bool use_Performance_shower = false; +#include "Core/plottable/export.h" static double max = 160; static renderive::Range frequent_range = {-12000, 12000}; static bool radio_mock_perf_mode() { @@ -27,6 +28,17 @@ static void configure_radio_plot_perf(renderive::Latency_Eager_Plot* plot) { return; plot->set_max_render_fps(1000); } +static void apply_radio_performance_overlay(renderive::Latency_Eager_Plot* plot) { + static bool logged = false; + const bool enabled = radio_show_performance_overlay(); + if (!logged) { + logged = true; + qInfo() << "Performance overlay enabled:" << enabled; + } + if (!plot || !plot->core()) + return; + renderive::set_performance_shower_enabled(*plot->core(), enabled); +} QWidget* Radio_Widget::create_spectrogram_power_plot() { class Spectrum_Plot : public renderive::Latency_Eager_Plot { public: @@ -84,6 +96,7 @@ QWidget* Radio_Widget::create_spectrogram_power_plot() { }; auto w = new Spectrum_Plot; w->init(); + apply_radio_performance_overlay(w); spectrogram_line = w->sp; if (!radio_mock_perf_mode()) { progress_bar1->set_value = [this]() { @@ -153,6 +166,7 @@ QWidget* Radio_Widget::create_water_fall_plot() { }; auto w = new Water_Fall_Plot; w->init(); + apply_radio_performance_overlay(w); water_fall = w->wf; return w; } @@ -211,6 +225,7 @@ QWidget* Radio_Widget::create_audio_spectrogram_plot() { }; auto w = new Spectrum_Plot; w->init(); + apply_radio_performance_overlay(w); audio_spectrogram_plot = w->sp; return w; } @@ -268,6 +283,7 @@ QWidget* Radio_Widget::create_time_power_plot() { }; auto w = new Audio_Plot; w->init(); + apply_radio_performance_overlay(w); time_power = w->audio; return w; } diff --git a/module/radio/BaseWidget.h b/module/radio/BaseWidget.h index 961d64e..d0be2c8 100644 --- a/module/radio/BaseWidget.h +++ b/module/radio/BaseWidget.h @@ -1,7 +1,6 @@ #ifndef Base_Widget_H #define Base_Widget_H #include "Global.h" -#include "Renderive/export.h" class Base_Widget_Menu; class QHBoxLayout; class Main_Widget; @@ -17,6 +16,3 @@ protected: void keyPressEvent(QKeyEvent* event) override; }; #endif - - - diff --git a/module/radio/Global.h b/module/radio/Global.h index a67cd0d..1438dfd 100644 --- a/module/radio/Global.h +++ b/module/radio/Global.h @@ -1,6 +1,5 @@ #ifndef Global_H #define Global_H -#include "Renderive/export.h" #include "BackEnd/BackEnd.h" #include #include @@ -14,6 +13,7 @@ #include #include #include +#include "export.h" #include "private_psc_global_include/Singleton.hpp" class Global : public Psc::Singleton { public: diff --git a/module/radio/component/ExpandInput.cpp b/module/radio/component/ExpandInput.cpp index 5f2549c..60ccf1b 100644 --- a/module/radio/component/ExpandInput.cpp +++ b/module/radio/component/ExpandInput.cpp @@ -1,6 +1,6 @@ #include "ExpandInput.h" #include "../BackEnd/MainWidget.h" -#include "Renderive/export.h" +#include "export.h" #include #include Expand_Input::Expand_Input(QWidget *parent) : QLineEdit(parent) { diff --git a/module/radio/main.cpp b/module/radio/main.cpp index 456c5f9..44bafb2 100644 --- a/module/radio/main.cpp +++ b/module/radio/main.cpp @@ -1,4 +1,3 @@ -#include "Renderive/export.h" #include #ifdef _WIN32 #include diff --git a/module/radio/menu/BaseWidgetMenu.h b/module/radio/menu/BaseWidgetMenu.h index 195ed4e..f20feb1 100644 --- a/module/radio/menu/BaseWidgetMenu.h +++ b/module/radio/menu/BaseWidgetMenu.h @@ -1,9 +1,9 @@ #ifndef Base_Widget_Menu_H #define Base_Widget_Menu_H -#include "Renderive/export.h" #include #include #include +#include "export.h" #include "Widget/base/Node.hpp" #include "Widget/base/Roll_Object.h" class QHBoxLayout; @@ -26,8 +26,7 @@ public: void add_menu_button_on_layout2(const std::vector& buttons, int stretch); void add_menu_button_on_layout1(const std::vector& buttons); void add_menu_button_on_layout2(const std::vector& buttons); - signals : - +signals : void show_that(); void hide_that(); protected: @@ -104,7 +103,7 @@ public: setText(text.arg(this->value)); } Value_Menu_Button(const QString& text, int font_size, - const std::function& valueChanged, double first_value) { + const std::function& valueChanged, double first_value) { this->text = text; init(font_size); value_changed = valueChanged; diff --git a/toolchain/vs2019.cmake b/toolchain/vs2019.cmake index 067d166..3aa7fd1 100644 --- a/toolchain/vs2019.cmake +++ b/toolchain/vs2019.cmake @@ -24,6 +24,7 @@ _append_msvc_init_options( /D_USE_MATH_DEFINES /EHsc /bigobj + /DWIN32_LEAN_AND_MEAN ) _append_msvc_init_options( CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT