结构更新
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
#include "../BaseWidget.h"
|
#include "../BaseWidget.h"
|
||||||
#include "../menu/BaseWidgetMenu.h"
|
#include "../menu/BaseWidgetMenu.h"
|
||||||
#include "../BackEnd/MainWidget.h"
|
#include "../BackEnd/MainWidget.h"
|
||||||
#include "YSGraphic_Core/DemoGallery/Tool.h"
|
#include "YSGraphic_Core/Demo_Gallery/export.h"
|
||||||
static YSG::Range frequent_range = {-12000, 12000};
|
static YSG::Range frequent_range = {-12000, 12000};
|
||||||
static double max = 160;
|
static double max = 160;
|
||||||
QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
||||||
@@ -31,21 +31,16 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
.set_coord_range(frequent_range)
|
.set_coord_range(frequent_range)
|
||||||
.set_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.set_sub_tick_length(-5)
|
.set_sub_tick_length(-5)
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({160, 0})
|
.set_coord_range({160, 0})
|
||||||
.set_unit_text("功率")
|
.set_unit_text("功率")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||||
.set_frequent_range(frequent_range)
|
.set_frequent_range(frequent_range)
|
||||||
.set_use_sweep_frequent_rect(true)
|
.set_use_sweep_frequent_rect(true)
|
||||||
.set_frequent_point_size(1024)
|
.set_frequent_point_size(1024)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -79,7 +74,6 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
};
|
};
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() {
|
QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() {
|
||||||
class AfterglowPlot : public YSG::Plot {
|
class AfterglowPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
@@ -97,22 +91,15 @@ QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot(){
|
|||||||
.set_sub_tick_length(-5)
|
.set_sub_tick_length(-5)
|
||||||
.set_use_drag(true)
|
.set_use_drag(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({160, 0})
|
.set_coord_range({160, 0})
|
||||||
.set_use_drag(true)
|
.set_use_drag(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
ag = YSG::Afterglow::Builder(xAxis, yAxis)
|
ag = YSG::Afterglow::Builder(xAxis, yAxis)
|
||||||
.set_frequent_range(frequent_range)
|
.set_frequent_range(frequent_range)
|
||||||
.set_power_range({0, 160})
|
.set_power_range({0, 160})
|
||||||
.set_frequent_point_size(1024)
|
.set_frequent_point_size(1024)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -142,8 +129,6 @@ QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot(){
|
|||||||
mAfterglow = w->ag;
|
mAfterglow = w->ag;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
||||||
IntermediateFrequencyWidget::IntermediateFrequencyWidget(QWidget* parent) : BaseWidget(parent) {
|
IntermediateFrequencyWidget::IntermediateFrequencyWidget(QWidget* parent) : BaseWidget(parent) {
|
||||||
setObjectName("发射界面");
|
setObjectName("发射界面");
|
||||||
@@ -173,8 +158,6 @@ IntermediateFrequencyWidget::IntermediateFrequencyWidget(QWidget *parent) : Base
|
|||||||
{"3", Qt::red},
|
{"3", Qt::red},
|
||||||
{">5", Qt::red},
|
{">5", Qt::red},
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
||||||
auto main = createVBoxLayout({}, this);
|
auto main = createVBoxLayout({}, this);
|
||||||
main->addStretch(1);
|
main->addStretch(1);
|
||||||
{
|
{
|
||||||
@@ -215,18 +198,13 @@ IntermediateFrequencyWidget::IntermediateFrequencyWidget(QWidget *parent) : Base
|
|||||||
aH->addWidget(createSpectrogramPowerPlot(), 12);
|
aH->addWidget(createSpectrogramPowerPlot(), 12);
|
||||||
aH->addSpacing(8);
|
aH->addSpacing(8);
|
||||||
main->addWidget(create_Afterglow_Plot(), 12);
|
main->addWidget(create_Afterglow_Plot(), 12);
|
||||||
|
|
||||||
initMenu();
|
initMenu();
|
||||||
}
|
}
|
||||||
|
IntermediateFrequencyWidget::~IntermediateFrequencyWidget() {}
|
||||||
IntermediateFrequencyWidget::~IntermediateFrequencyWidget() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntermediateFrequencyWidget::focusInEvent(QFocusEvent* event) {
|
void IntermediateFrequencyWidget::focusInEvent(QFocusEvent* event) {
|
||||||
QWidget::focusInEvent(event);
|
QWidget::focusInEvent(event);
|
||||||
mFrequentShower->setFocus();
|
mFrequentShower->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntermediateFrequencyWidget::initMenu() {
|
void IntermediateFrequencyWidget::initMenu() {
|
||||||
int fontSize = 30;
|
int fontSize = 30;
|
||||||
auto btn1 = new DoubleTextMenuButton("设置最大值标记", "取消最大值标记", fontSize, [&](bool isFirst) {
|
auto btn1 = new DoubleTextMenuButton("设置最大值标记", "取消最大值标记", fontSize, [&](bool isFirst) {
|
||||||
@@ -234,18 +212,15 @@ void IntermediateFrequencyWidget::initMenu() {
|
|||||||
mBaseWidgetMenu->hide();
|
mBaseWidgetMenu->hide();
|
||||||
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto btn2 = new DoubleTextMenuButton("设置最小值标记", "取消最小值标记", fontSize, [&](bool isFirst) {
|
auto btn2 = new DoubleTextMenuButton("设置最小值标记", "取消最小值标记", fontSize, [&](bool isFirst) {
|
||||||
mSpectrogramLine->set_use_min_marker(isFirst);
|
mSpectrogramLine->set_use_min_marker(isFirst);
|
||||||
mBaseWidgetMenu->hide();
|
mBaseWidgetMenu->hide();
|
||||||
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto btn3 = new MenuButton("设置自定义标记", fontSize, [&]() {
|
auto btn3 = new MenuButton("设置自定义标记", fontSize, [&]() {
|
||||||
mBaseWidgetMenu->hide();
|
mBaseWidgetMenu->hide();
|
||||||
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto frequentStep2 = new ValueMenuButton("频率步进:%1", fontSize, [this](ValueMenuButton* that, bool add) {
|
auto frequentStep2 = new ValueMenuButton("频率步进:%1", fontSize, [this](ValueMenuButton* that, bool add) {
|
||||||
int newFrequent = (int)that->mValue + (add ? 1 : -1);
|
int newFrequent = (int)that->mValue + (add ? 1 : -1);
|
||||||
that->setValue(newFrequent);
|
that->setValue(newFrequent);
|
||||||
@@ -257,47 +232,37 @@ void IntermediateFrequencyWidget::initMenu() {
|
|||||||
double middle_sweep_frequent = mSpectrogramLine->middle_sweep_frequent();
|
double middle_sweep_frequent = mSpectrogramLine->middle_sweep_frequent();
|
||||||
mSpectrogramLine->set_sweep_frequent_range({middle_sweep_frequent - that->mValue, middle_sweep_frequent + that->mValue});
|
mSpectrogramLine->set_sweep_frequent_range({middle_sweep_frequent - that->mValue, middle_sweep_frequent + that->mValue});
|
||||||
}, qAbs(mSpectrogramLine->sweep_frequent_range().length() / 2));
|
}, qAbs(mSpectrogramLine->sweep_frequent_range().length() / 2));
|
||||||
|
|
||||||
btn_middleFrequent->mValueChanged = [this, btn_frequentWidth, frequentStep2](ValueMenuButton* that, bool add) {
|
btn_middleFrequent->mValueChanged = [this, btn_frequentWidth, frequentStep2](ValueMenuButton* that, bool add) {
|
||||||
that->setValue(that->mValue + (double)(add ? frequentStep2->mValue : -frequentStep2->mValue));
|
that->setValue(that->mValue + (double)(add ? frequentStep2->mValue : -frequentStep2->mValue));
|
||||||
mSpectrogramLine->set_middle_sweep_frequent(that->mValue);
|
mSpectrogramLine->set_middle_sweep_frequent(that->mValue);
|
||||||
mSpectrogramLine->set_sweep_frequent_range({that->mValue - btn_frequentWidth->mValue, that->mValue + btn_frequentWidth->mValue});
|
mSpectrogramLine->set_sweep_frequent_range({that->mValue - btn_frequentWidth->mValue, that->mValue + btn_frequentWidth->mValue});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto btn2_2 = new ValueMenuButton("参考增益:%1", fontSize, [&](ValueMenuButton* that, bool add) {
|
auto btn2_2 = new ValueMenuButton("参考增益:%1", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
mBaseWidgetMenu->addMenuButtonOnLayout1({btn1, btn2, btn3, btn2_2,});
|
mBaseWidgetMenu->addMenuButtonOnLayout1({btn1, btn2, btn3, btn2_2,});
|
||||||
mBaseWidgetMenu->addMenuButtonOnLayout2({frequentStep2, btn_middleFrequent, btn_frequentWidth,});
|
mBaseWidgetMenu->addMenuButtonOnLayout2({frequentStep2, btn_middleFrequent, btn_frequentWidth,});
|
||||||
|
|
||||||
BaseWidgetMenu* sub1 = mBaseWidgetMenu->createSubWidgetMenu(btn3);
|
BaseWidgetMenu* sub1 = mBaseWidgetMenu->createSubWidgetMenu(btn3);
|
||||||
|
|
||||||
|
|
||||||
auto frequentStep = new ValueMenuButton("频率步进:%1", fontSize, [this](ValueMenuButton* that, bool add) {
|
auto frequentStep = new ValueMenuButton("频率步进:%1", fontSize, [this](ValueMenuButton* that, bool add) {
|
||||||
int newFrequent = (int)that->mValue + (add ? 1 : -1);
|
int newFrequent = (int)that->mValue + (add ? 1 : -1);
|
||||||
that->setValue(newFrequent);
|
that->setValue(newFrequent);
|
||||||
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
||||||
}, qMax(0.0, mSpectrogramLine->frequent_range().length() / 50.0));
|
}, qMax(0.0, mSpectrogramLine->frequent_range().length() / 50.0));
|
||||||
|
|
||||||
auto markFrequent = new ValueMenuButton("更改标记频率:%1", fontSize, [frequentStep, this](ValueMenuButton* that, bool add) {
|
auto markFrequent = new ValueMenuButton("更改标记频率:%1", fontSize, [frequentStep, this](ValueMenuButton* that, bool add) {
|
||||||
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
||||||
that->setValue(newFrequent);
|
that->setValue(newFrequent);
|
||||||
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
||||||
}, -1);
|
}, -1);
|
||||||
|
|
||||||
auto addInitFrequent = new ValueMenuButton("添加初始频率:%1", fontSize, [frequentStep,this](ValueMenuButton* that, bool add) {
|
auto addInitFrequent = new ValueMenuButton("添加初始频率:%1", fontSize, [frequentStep,this](ValueMenuButton* that, bool add) {
|
||||||
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
||||||
that->setValue(newFrequent);
|
that->setValue(newFrequent);
|
||||||
}, mSpectrogramLine->frequent_range().lower);
|
}, mSpectrogramLine->frequent_range().lower);
|
||||||
|
|
||||||
auto btn1_1 = new ValueMenuButton("当前标记:%1", fontSize, [&, markFrequent](ValueMenuButton* that, bool add) {
|
auto btn1_1 = new ValueMenuButton("当前标记:%1", fontSize, [&, markFrequent](ValueMenuButton* that, bool add) {
|
||||||
int index = ((int)that->mValue + (add ? 1 : -1)) % mSpectrogramLine->select_line_marker_size();
|
int index = ((int)that->mValue + (add ? 1 : -1)) % mSpectrogramLine->select_line_marker_size();
|
||||||
that->setValue(index);
|
that->setValue(index);
|
||||||
mSpectrogramLine->set_selected_line_marker(index);
|
mSpectrogramLine->set_selected_line_marker(index);
|
||||||
markFrequent->setValue(mSpectrogramLine->get_mark_frequent(index));
|
markFrequent->setValue(mSpectrogramLine->get_mark_frequent(index));
|
||||||
}, -1);
|
}, -1);
|
||||||
|
|
||||||
auto btn1_2 = new MenuButton("添加标记", fontSize, [&, addInitFrequent]() {
|
auto btn1_2 = new MenuButton("添加标记", fontSize, [&, addInitFrequent]() {
|
||||||
mSpectrogramLine->add_custom_line_marker(addInitFrequent->mValue);
|
mSpectrogramLine->add_custom_line_marker(addInitFrequent->mValue);
|
||||||
});
|
});
|
||||||
@@ -306,7 +271,8 @@ void IntermediateFrequencyWidget::initMenu() {
|
|||||||
int size = mSpectrogramLine->select_line_marker_size();
|
int size = mSpectrogramLine->select_line_marker_size();
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
mSpectrogramLine->set_selected_line_marker(-1);
|
mSpectrogramLine->set_selected_line_marker(-1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mSpectrogramLine->set_selected_line_marker(0);
|
mSpectrogramLine->set_selected_line_marker(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -320,7 +286,3 @@ void IntermediateFrequencyWidget::initMenu() {
|
|||||||
sub1->addMenuButtonOnLayout1({btn1_1, btn1_2, btn1_3}, 2);
|
sub1->addMenuButtonOnLayout1({btn1_1, btn1_2, btn1_3}, 2);
|
||||||
sub1->addMenuButtonOnLayout2({frequentStep, markFrequent, addInitFrequent}, 2);
|
sub1->addMenuButtonOnLayout2({frequentStep, markFrequent, addInitFrequent}, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
#include "../menu/BaseWidgetMenu.h"
|
#include "../menu/BaseWidgetMenu.h"
|
||||||
#include "BackEnd.h"
|
#include "BackEnd.h"
|
||||||
#include "../BackEnd/MainWidget.h"
|
#include "../BackEnd/MainWidget.h"
|
||||||
#include "YSGraphic_Core/DemoGallery/Tool.h"
|
#include "YSGraphic_Core/Demo_Gallery/export.h"
|
||||||
|
|
||||||
static bool use_Performance_shower = false;
|
static bool use_Performance_shower = false;
|
||||||
static double max = 160;
|
static double max = 160;
|
||||||
static YSG::Range frequent_range = {-12000, 12000};
|
static YSG::Range frequent_range = {-12000, 12000};
|
||||||
@@ -24,19 +23,14 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
|||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "SpectrumPlot";
|
object_name = "SpectrumPlot";
|
||||||
|
|
||||||
|
|
||||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||||
.set_coord_range(frequent_range)
|
.set_coord_range(frequent_range)
|
||||||
.set_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({max, 0})
|
.set_coord_range({max, 0})
|
||||||
.set_unit_text("功率")
|
.set_unit_text("功率")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||||
.set_frequent_range(frequent_range)
|
.set_frequent_range(frequent_range)
|
||||||
.set_frequent_point_size(1024)
|
.set_frequent_point_size(1024)
|
||||||
@@ -75,8 +69,6 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
|||||||
};
|
};
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget* RadioWidget::createWaterFallPlot() {
|
QWidget* RadioWidget::createWaterFallPlot() {
|
||||||
class WaterFallPlot : public YSG::Plot {
|
class WaterFallPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
@@ -131,8 +123,6 @@ QWidget* RadioWidget::createWaterFallPlot() {
|
|||||||
mWaterFall = w->wf;
|
mWaterFall = w->wf;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
||||||
class SpectrumPlot : public YSG::Plot {
|
class SpectrumPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
@@ -144,27 +134,19 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
|||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "SpectrumPlot";
|
object_name = "SpectrumPlot";
|
||||||
|
|
||||||
|
|
||||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||||
.set_coord_range({-12000, 12000})
|
.set_coord_range({-12000, 12000})
|
||||||
.set_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.set_sub_tick_length(-5)
|
.set_sub_tick_length(-5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({12000, -12000})
|
.set_coord_range({12000, -12000})
|
||||||
.set_unit_text("功率").build();
|
.set_unit_text("功率").build();
|
||||||
|
|
||||||
|
|
||||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||||
.set_frequent_range({-12000, 12000})
|
.set_frequent_range({-12000, 12000})
|
||||||
.set_frequent_point_size(512)
|
.set_frequent_point_size(512)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||||
|
|
||||||
if (use_Performance_shower) set_use_performance_shower(true);
|
if (use_Performance_shower) set_use_performance_shower(true);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -176,8 +158,6 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
|||||||
yAxis->set_y(0);
|
yAxis->set_y(0);
|
||||||
yAxis->set_pixel_size(height());
|
yAxis->set_pixel_size(height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||||
if (!mMenu) {
|
if (!mMenu) {
|
||||||
auto ws =
|
auto ws =
|
||||||
@@ -195,7 +175,6 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
|||||||
mAudioSpectrogramPlot = w->sp;
|
mAudioSpectrogramPlot = w->sp;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* RadioWidget::createTimePowerPlot() {
|
QWidget* RadioWidget::createTimePowerPlot() {
|
||||||
class AudioPlot : public YSG::Plot {
|
class AudioPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
@@ -207,22 +186,16 @@ QWidget* RadioWidget::createTimePowerPlot() {
|
|||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "AudioPlot";
|
object_name = "AudioPlot";
|
||||||
|
|
||||||
xAxis = YSG::Time_Axis::Builder(this, Qt::Horizontal)
|
xAxis = YSG::Time_Axis::Builder(this, Qt::Horizontal)
|
||||||
.set_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.set_sub_tick_length(-5)
|
.set_sub_tick_length(-5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({12000, -12000})
|
.set_coord_range({12000, -12000})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
audio = YSG::Audio_Frequent::Builder(xAxis, yAxis)
|
audio = YSG::Audio_Frequent::Builder(xAxis, yAxis)
|
||||||
.build();
|
.build();
|
||||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||||
|
|
||||||
|
|
||||||
if (use_Performance_shower) set_use_performance_shower(true);
|
if (use_Performance_shower) set_use_performance_shower(true);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -252,8 +225,6 @@ QWidget* RadioWidget::createTimePowerPlot() {
|
|||||||
mTimePower = w->audio;
|
mTimePower = w->audio;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
||||||
RadioWidget::RadioWidget(QWidget* parent) : BaseWidget(parent) {
|
RadioWidget::RadioWidget(QWidget* parent) : BaseWidget(parent) {
|
||||||
setObjectName("电台界面");
|
setObjectName("电台界面");
|
||||||
@@ -285,7 +256,6 @@ RadioWidget::RadioWidget(QWidget *parent) : BaseWidget(parent) {
|
|||||||
{"100", orange},
|
{"100", orange},
|
||||||
{"+160", Qt::red},
|
{"+160", Qt::red},
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
mProgressBar2 = new ProgressBar({
|
mProgressBar2 = new ProgressBar({
|
||||||
{"1", Qt::black},
|
{"1", Qt::black},
|
||||||
{"2", Qt::yellow},
|
{"2", Qt::yellow},
|
||||||
@@ -294,9 +264,9 @@ RadioWidget::RadioWidget(QWidget *parent) : BaseWidget(parent) {
|
|||||||
}, this);
|
}, this);
|
||||||
mProgressBar1->mTickSpaceW = 2.0f;
|
mProgressBar1->mTickSpaceW = 2.0f;
|
||||||
auto main = createVBoxLayout({}, this);
|
auto main = createVBoxLayout({}, this);
|
||||||
|
|
||||||
main->addStretch(1);
|
main->addStretch(1);
|
||||||
{ // 中心Layout
|
{
|
||||||
|
// 中心Layout
|
||||||
auto center = createHBoxLayout();
|
auto center = createHBoxLayout();
|
||||||
main->addLayout(center, 7);
|
main->addLayout(center, 7);
|
||||||
auto front = createVBoxLayout();
|
auto front = createVBoxLayout();
|
||||||
@@ -328,8 +298,6 @@ RadioWidget::RadioWidget(QWidget *parent) : BaseWidget(parent) {
|
|||||||
back2->addWidget(m6, 3);
|
back2->addWidget(m6, 3);
|
||||||
}
|
}
|
||||||
main->addStretch(1);
|
main->addStretch(1);
|
||||||
|
|
||||||
|
|
||||||
auto aH1 = createHBoxLayout();
|
auto aH1 = createHBoxLayout();
|
||||||
aH1->setSpacing(8);
|
aH1->setSpacing(8);
|
||||||
main->addLayout(aH1, 12);
|
main->addLayout(aH1, 12);
|
||||||
@@ -343,48 +311,29 @@ RadioWidget::RadioWidget(QWidget *parent) : BaseWidget(parent) {
|
|||||||
aH2->addWidget(createAudioSpectrogramPlot(), 4);
|
aH2->addWidget(createAudioSpectrogramPlot(), 4);
|
||||||
initMenu();
|
initMenu();
|
||||||
}
|
}
|
||||||
|
RadioWidget::~RadioWidget() {}
|
||||||
RadioWidget::~RadioWidget() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadioWidget::initMenu() {
|
void RadioWidget::initMenu() {
|
||||||
int fontSize = 30;
|
int fontSize = 30;
|
||||||
auto btn1_1 = new MenuButton("模式设置", fontSize, []() {});
|
auto btn1_1 = new MenuButton("模式设置", fontSize, []() {});
|
||||||
auto btn1_2 = new ValueMenuButton("发射功率:%1 W", fontSize, [&](ValueMenuButton* that, bool add) {
|
auto btn1_2 = new ValueMenuButton("发射功率:%1 W", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
}, -1);
|
}, -1);
|
||||||
|
|
||||||
|
|
||||||
auto btn2_1 = new ValueMenuButton("参考增益:%1", fontSize, [&](ValueMenuButton* that, bool add) {
|
auto btn2_1 = new ValueMenuButton("参考增益:%1", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
}, -1);
|
}, -1);
|
||||||
|
|
||||||
mBaseWidgetMenu->addMenuButtonOnLayout1({btn1_1, btn1_2, {btn2_1},});
|
mBaseWidgetMenu->addMenuButtonOnLayout1({btn1_1, btn1_2, {btn2_1},});
|
||||||
//mBaseWidgetMenu->addMenuButtonOnLayout2( );
|
//mBaseWidgetMenu->addMenuButtonOnLayout2( );
|
||||||
BaseWidgetMenu* sub1 = mBaseWidgetMenu->createSubWidgetMenu(btn1_1);
|
BaseWidgetMenu* sub1 = mBaseWidgetMenu->createSubWidgetMenu(btn1_1);
|
||||||
auto s1_1 = new MenuButton("AM", fontSize, [](){
|
auto s1_1 = new MenuButton("AM", fontSize, []() {});
|
||||||
|
auto s1_2 = new MenuButton("FM", fontSize, []() {});
|
||||||
});
|
auto s1_3 = new MenuButton("SSB", fontSize, []() {});
|
||||||
auto s1_2 = new MenuButton("FM", fontSize, [](){
|
auto s1_4 = new MenuButton("CW", fontSize, []() {});
|
||||||
|
|
||||||
});
|
|
||||||
auto s1_3 = new MenuButton("SSB", fontSize, [](){
|
|
||||||
|
|
||||||
});
|
|
||||||
auto s1_4 = new MenuButton("CW", fontSize, [](){
|
|
||||||
|
|
||||||
});
|
|
||||||
sub1->addMenuButtonOnLayout1({s1_1, s1_2, s1_3, s1_4}, 1);
|
sub1->addMenuButtonOnLayout1({s1_1, s1_2, s1_3, s1_4}, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioWidget::focusInEvent(QFocusEvent* event) {
|
void RadioWidget::focusInEvent(QFocusEvent* event) {
|
||||||
QWidget::focusInEvent(event);
|
QWidget::focusInEvent(event);
|
||||||
mSelectValueWidget->setFocus();
|
mSelectValueWidget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioWidget::keyPressEvent(QKeyEvent* event) {
|
void RadioWidget::keyPressEvent(QKeyEvent* event) {
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::KeyPress) {
|
||||||
BackEnd* g = BackEnd::instance();
|
BackEnd* g = BackEnd::instance();
|
||||||
@@ -392,7 +341,8 @@ void RadioWidget::keyPressEvent(QKeyEvent *event) {
|
|||||||
if (g->match(keyEvent, "切换音量/RF Gain")) {
|
if (g->match(keyEvent, "切换音量/RF Gain")) {
|
||||||
if (m1->text().startsWith("RF Gain")) {
|
if (m1->text().startsWith("RF Gain")) {
|
||||||
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +351,8 @@ void RadioWidget::keyPressEvent(QKeyEvent *event) {
|
|||||||
mRFGainValue++;
|
mRFGainValue++;
|
||||||
BackEnd::instance()->YsSetRfGain(mRFGainValue);
|
BackEnd::instance()->YsSetRfGain(mRFGainValue);
|
||||||
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mVoiceValue++;
|
mVoiceValue++;
|
||||||
BackEnd::instance()->YsSetAfGain(mVoiceValue);
|
BackEnd::instance()->YsSetAfGain(mVoiceValue);
|
||||||
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
||||||
@@ -412,7 +363,8 @@ void RadioWidget::keyPressEvent(QKeyEvent *event) {
|
|||||||
mRFGainValue--;
|
mRFGainValue--;
|
||||||
BackEnd::instance()->YsSetRfGain(mRFGainValue);
|
BackEnd::instance()->YsSetRfGain(mRFGainValue);
|
||||||
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
m1->setText("RF Gain\n" + QString::number(mRFGainValue));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mVoiceValue--;
|
mVoiceValue--;
|
||||||
BackEnd::instance()->YsSetAfGain(mVoiceValue);
|
BackEnd::instance()->YsSetAfGain(mVoiceValue);
|
||||||
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
m1->setText("Voice\n" + QString::number(mVoiceValue));
|
||||||
@@ -421,4 +373,3 @@ void RadioWidget::keyPressEvent(QKeyEvent *event) {
|
|||||||
}
|
}
|
||||||
BaseWidget::keyPressEvent(event);
|
BaseWidget::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "../component/ShowTime.h"
|
#include "../component/ShowTime.h"
|
||||||
#include "../Global.h"
|
#include "../Global.h"
|
||||||
#include "../menu/BaseWidgetMenu.h"
|
#include "../menu/BaseWidgetMenu.h"
|
||||||
#include "YSGraphic_Core/DemoGallery/Tool.h"
|
#include "YSGraphic_Core/Demo_Gallery/export.h"
|
||||||
QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
||||||
class SweepFrequentPlot : public YSG::Plot {
|
class SweepFrequentPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
@@ -22,24 +22,17 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "AxisTestPlot";
|
object_name = "AxisTestPlot";
|
||||||
|
|
||||||
|
|
||||||
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
||||||
.set_coord_range({0, 100})
|
.set_coord_range({0, 100})
|
||||||
.set_tick_length(-10).build();
|
.set_tick_length(-10).build();
|
||||||
|
|
||||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||||
.set_coord_range({100, 0})
|
.set_coord_range({100, 0})
|
||||||
.set_tick_length(-10).build();
|
.set_tick_length(-10).build();
|
||||||
|
|
||||||
|
|
||||||
sf = YSG::Sweep_Frequent::Builder(xAxis, yAxis)
|
sf = YSG::Sweep_Frequent::Builder(xAxis, yAxis)
|
||||||
.set_block_num(200)
|
.set_block_num(200)
|
||||||
.set_block_frequent_point_size(20)
|
.set_block_frequent_point_size(20)
|
||||||
.set_frequent_range({0, 100})
|
.set_frequent_range({0, 100})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -68,7 +61,6 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
mSweepFrequencyLine = w->sf;
|
mSweepFrequencyLine = w->sf;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
//mAM, mATU, mVSQL, mNB, mNR, mDNF, mPRE, mATT, mSPL, mFIL1, mAGC_A
|
||||||
SweepFrequencyWidget::SweepFrequencyWidget(QWidget* parent) : BaseWidget(parent) {
|
SweepFrequencyWidget::SweepFrequencyWidget(QWidget* parent) : BaseWidget(parent) {
|
||||||
setObjectName("扫频界面");
|
setObjectName("扫频界面");
|
||||||
@@ -94,10 +86,10 @@ SweepFrequencyWidget::SweepFrequencyWidget(QWidget *parent) : BaseWidget(parent)
|
|||||||
{"3", Qt::red},
|
{"3", Qt::red},
|
||||||
{">5", Qt::red},
|
{">5", Qt::red},
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
auto main = createVBoxLayout({}, this);
|
auto main = createVBoxLayout({}, this);
|
||||||
main->addStretch(1);
|
main->addStretch(1);
|
||||||
{ // 中心Layout
|
{
|
||||||
|
// 中心Layout
|
||||||
auto center = createHBoxLayout();
|
auto center = createHBoxLayout();
|
||||||
main->addLayout(center, 7);
|
main->addLayout(center, 7);
|
||||||
auto front = createVBoxLayout();
|
auto front = createVBoxLayout();
|
||||||
@@ -129,15 +121,11 @@ SweepFrequencyWidget::SweepFrequencyWidget(QWidget *parent) : BaseWidget(parent)
|
|||||||
main->addWidget(createSpectrogramPowerPlot(), 24);
|
main->addWidget(createSpectrogramPowerPlot(), 24);
|
||||||
initMenu();
|
initMenu();
|
||||||
}
|
}
|
||||||
|
SweepFrequencyWidget::~SweepFrequencyWidget() {}
|
||||||
SweepFrequencyWidget::~SweepFrequencyWidget() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SweepFrequencyWidget::focusInEvent(QFocusEvent* event) {
|
void SweepFrequencyWidget::focusInEvent(QFocusEvent* event) {
|
||||||
QWidget::focusInEvent(event);
|
QWidget::focusInEvent(event);
|
||||||
mSelectValueWidget->setFocus();
|
mSelectValueWidget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SweepFrequencyWidget::initMenu() {
|
void SweepFrequencyWidget::initMenu() {
|
||||||
int fontSize = 30;
|
int fontSize = 30;
|
||||||
auto startFreq = new ValueMenuButton("起始频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
|
auto startFreq = new ValueMenuButton("起始频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||||
@@ -153,9 +141,3 @@ void SweepFrequencyWidget::initMenu() {
|
|||||||
});
|
});
|
||||||
mBaseWidgetMenu->addMenuButtonOnLayout1({startFreq, endFreq, btn3}, 2);
|
mBaseWidgetMenu->addMenuButtonOnLayout1({startFreq, endFreq, btn3}, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-12
@@ -1,7 +1,7 @@
|
|||||||
#ifndef Global_H
|
#ifndef Global_H
|
||||||
#define Global_H
|
#define Global_H
|
||||||
#include "BackEnd/BackEnd.h"
|
#include "BackEnd/BackEnd.h"
|
||||||
#include "YSGraphic_Core/GlobalTypes.h"
|
#include "YSGraphic_Core/architecture/export.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -21,29 +21,18 @@ public:
|
|||||||
int adaptHeight(int fullScreenHeight);
|
int adaptHeight(int fullScreenHeight);
|
||||||
int adaptWidth(int fullScreenWidth);
|
int adaptWidth(int fullScreenWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QVBoxLayout* createVBoxLayout(const QVector<QWidget*>& children = {}, QWidget* parent = nullptr);
|
QVBoxLayout* createVBoxLayout(const QVector<QWidget*>& children = {}, QWidget* parent = nullptr);
|
||||||
QHBoxLayout* createHBoxLayout(const QVector<QWidget*>& children = {}, QWidget* parent = nullptr);
|
QHBoxLayout* createHBoxLayout(const QVector<QWidget*>& children = {}, QWidget* parent = nullptr);
|
||||||
QRect getMaxRect(const QRect& rect, double WHRate);
|
QRect getMaxRect(const QRect& rect, double WHRate);
|
||||||
int calculateOptimalFontSize(const QString& text, const QSize& spaceSize, const QFont& font);
|
int calculateOptimalFontSize(const QString& text, const QSize& spaceSize, const QFont& font);
|
||||||
int calculateOptimalFontSize(const QVector<QString>& textList, const QSize& spaceSize, const QFont& font);
|
int calculateOptimalFontSize(const QVector<QString>& textList, const QSize& spaceSize, const QFont& font);
|
||||||
QPushButton* createButton(const QString& text, int fontSize, const std::function<void(void)>& mFunc = nullptr);
|
QPushButton* createButton(const QString& text, int fontSize, const std::function<void(void)>& mFunc = nullptr);
|
||||||
|
|
||||||
namespace YSG {
|
namespace YSG {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Roll_Object;
|
class Roll_Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BaseWidgetMenu;
|
class BaseWidgetMenu;
|
||||||
|
|
||||||
void initClickButton(QPushButton* button, const QString& text, int fontSize, const std::function<void(void)>& mFunc, YSG::Roll_Object<QPushButton>*);
|
void initClickButton(QPushButton* button, const QString& text, int fontSize, const std::function<void(void)>& mFunc, YSG::Roll_Object<QPushButton>*);
|
||||||
QPushButton* createClickButton(const QString& text, int fontSize, const std::function<void(void)>& mFunc, YSG::Roll_Object<QPushButton>*);
|
QPushButton* createClickButton(const QString& text, int fontSize, const std::function<void(void)>& mFunc, YSG::Roll_Object<QPushButton>*);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QPushButton* createNormal(const QString& text, int fontSize, const std::function<void(void)>& mFunc = nullptr);
|
QPushButton* createNormal(const QString& text, int fontSize, const std::function<void(void)>& mFunc = nullptr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "./BackEnd/MainWidget.h"
|
#include "./BackEnd/MainWidget.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "YSGraphic_Core/base/Plot.h"
|
#include "YSGraphic_Core/architecture/export.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
Application app(argc, argv);
|
Application app(argc, argv);
|
||||||
Application::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
Application::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#ifndef BaseWidgetMenu_H
|
#ifndef BaseWidgetMenu_H
|
||||||
#define BaseWidgetMenu_H
|
#define BaseWidgetMenu_H
|
||||||
#include "YSGraphic_Core/base/Node.hpp"
|
|
||||||
#include "YSGraphic_Core/base/Roll_Object.h"
|
|
||||||
#include "YSGraphic_Core/export.h"
|
#include "YSGraphic_Core/export.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|||||||
Reference in New Issue
Block a user