明面上没bug了
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <QTimer>
|
||||
#include <QKeyEvent>
|
||||
#include <QThread>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
|
||||
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{};
|
||||
};
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
#include "SweepFrequencyWidget.h"
|
||||
#include <algorithm>
|
||||
#include <memory_resource>
|
||||
#include <QPointer>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#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<Radio_Widget> 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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "RadioWidget.h"
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <vector>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef Global_H
|
||||
#define Global_H
|
||||
#include "Renderive/export.h"
|
||||
#include "BackEnd/BackEnd.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
@@ -14,6 +13,7 @@
|
||||
#include <QtWidgetsDepends>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include "export.h"
|
||||
#include "private_psc_global_include/Singleton.hpp"
|
||||
class Global : public Psc::Singleton<Global> {
|
||||
public:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ExpandInput.h"
|
||||
#include "../BackEnd/MainWidget.h"
|
||||
#include "Renderive/export.h"
|
||||
#include "export.h"
|
||||
#include <QAction>
|
||||
#include <QPainter>
|
||||
Expand_Input::Expand_Input(QWidget *parent) : QLineEdit(parent) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "Renderive/export.h"
|
||||
#include <QApplication>
|
||||
#ifdef _WIN32
|
||||
#include <QTextCodec>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef Base_Widget_Menu_H
|
||||
#define Base_Widget_Menu_H
|
||||
#include "Renderive/export.h"
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
#include <vector>
|
||||
#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<Abstract_Menu_Button*>& buttons, int stretch);
|
||||
void add_menu_button_on_layout1(const std::vector<Abstract_Menu_Button*>& buttons);
|
||||
void add_menu_button_on_layout2(const std::vector<Abstract_Menu_Button*>& 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<void(Value_Menu_Button*, bool)>& valueChanged, double first_value) {
|
||||
const std::function<void(Value_Menu_Button*, bool)>& valueChanged, double first_value) {
|
||||
this->text = text;
|
||||
init(font_size);
|
||||
value_changed = valueChanged;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user