结构更新
This commit is contained in:
@@ -12,40 +12,35 @@
|
|||||||
#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() {
|
||||||
class SpectrumPlot : public YSG::Plot {
|
class SpectrumPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
YSG::Frequent_Axis *xAxis{};
|
YSG::Frequent_Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Muti_Select_Rect* msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
YSG::Spectrum *sp{};
|
YSG::Spectrum* sp{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
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_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.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:
|
||||||
@@ -58,7 +53,7 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
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 =
|
||||||
bw(cw(sp, -1), "频谱图") +
|
bw(cw(sp, -1), "频谱图") +
|
||||||
bw(cw(xAxis), "频率x轴") +
|
bw(cw(xAxis), "频率x轴") +
|
||||||
@@ -79,40 +74,32 @@ 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:
|
||||||
YSG::Frequent_Axis *xAxis{};
|
YSG::Frequent_Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Afterglow *ag{};
|
YSG::Afterglow* ag{};
|
||||||
YSG::Muti_Select_Rect* msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "AfterglowPlot";
|
object_name = "AfterglowPlot";
|
||||||
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)
|
||||||
.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:
|
||||||
@@ -126,11 +113,11 @@ QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot(){
|
|||||||
ag->set_power_point_size(ag->power_axis()->get_pixel_point_size());
|
ag->set_power_point_size(ag->power_axis()->get_pixel_point_size());
|
||||||
}
|
}
|
||||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||||
if(!mMenu) {
|
if (!mMenu) {
|
||||||
auto ws =
|
auto ws =
|
||||||
bw(cw(ag, -1), "余辉图") +
|
bw(cw(ag, -1), "余辉图") +
|
||||||
bw(cw(xAxis), "频率轴") +
|
bw(cw(xAxis), "频率轴") +
|
||||||
bw(cw(yAxis),"功率概率轴") +
|
bw(cw(yAxis), "功率概率轴") +
|
||||||
bw(cw(msr), "多选框");
|
bw(cw(msr), "多选框");
|
||||||
mMenu = createMenu(this, ws);
|
mMenu = createMenu(this, ws);
|
||||||
}
|
}
|
||||||
@@ -142,10 +129,8 @@ 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("发射界面");
|
||||||
int fontSize = 20;
|
int fontSize = 20;
|
||||||
m1 = createNormal("RF Gain\n62", fontSize);
|
m1 = createNormal("RF Gain\n62", fontSize);
|
||||||
@@ -157,24 +142,22 @@ IntermediateFrequencyWidget::IntermediateFrequencyWidget(QWidget *parent) : Base
|
|||||||
mFrequentShower = new FrequentShower(this);
|
mFrequentShower = new FrequentShower(this);
|
||||||
QColor orange(255, 165, 0);
|
QColor orange(255, 165, 0);
|
||||||
mProgressBar1 = new ProgressBar({
|
mProgressBar1 = new ProgressBar({
|
||||||
Tick("S", Qt::black),
|
Tick("S", Qt::black),
|
||||||
{"3", Qt::black},
|
{"3", Qt::black},
|
||||||
{"6", Qt::black},
|
{"6", Qt::black},
|
||||||
{"9", Qt::black},
|
{"9", Qt::black},
|
||||||
{"20", Qt::black},
|
{"20", Qt::black},
|
||||||
{"+40", orange},
|
{"+40", orange},
|
||||||
{"+60", orange},
|
{"+60", orange},
|
||||||
{"+80", orange},
|
{"+80", orange},
|
||||||
{"+100", Qt::red},
|
{"+100", Qt::red},
|
||||||
}, this);
|
}, this);
|
||||||
mProgressBar2 = new ProgressBar({
|
mProgressBar2 = new ProgressBar({
|
||||||
{"1", Qt::black},
|
{"1", Qt::black},
|
||||||
{"2", Qt::yellow},
|
{"2", Qt::yellow},
|
||||||
{"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,112 +198,91 @@ 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) {
|
||||||
mSpectrogramLine->set_use_max_marker(isFirst);
|
mSpectrogramLine->set_use_max_marker(isFirst);
|
||||||
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);
|
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 btn_middleFrequent = new ValueMenuButton("中频:%1 Hz", fontSize, nullptr, mSpectrogramLine->middle_sweep_frequent());
|
auto btn_middleFrequent = new ValueMenuButton("中频:%1 Hz", fontSize, nullptr, mSpectrogramLine->middle_sweep_frequent());
|
||||||
auto btn_frequentWidth = new ValueMenuButton("频宽:%1 Hz", fontSize, [this, frequentStep2](ValueMenuButton* that, bool add){
|
auto btn_frequentWidth = new ValueMenuButton("频宽:%1 Hz", fontSize, [this, 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));
|
||||||
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) {
|
||||||
|
int newFrequent = (int)that->mValue + (add ? 1 : -1);
|
||||||
auto frequentStep = new ValueMenuButton("频率步进:%1", fontSize, [this](ValueMenuButton* that, bool add){
|
that->setValue(newFrequent);
|
||||||
int newFrequent = (int)that->mValue + (add?1:-1);
|
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
||||||
that->setValue(newFrequent);
|
}, qMax(0.0, mSpectrogramLine->frequent_range().length() / 50.0));
|
||||||
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
auto markFrequent = new ValueMenuButton("更改标记频率:%1", fontSize, [frequentStep, this](ValueMenuButton* that, bool add) {
|
||||||
}, qMax(0.0, mSpectrogramLine->frequent_range().length()/50.0));
|
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
||||||
|
that->setValue(newFrequent);
|
||||||
auto markFrequent = new ValueMenuButton("更改标记频率:%1", fontSize, [frequentStep, this](ValueMenuButton* that, bool add){
|
mSpectrogramLine->set_current_marker_frequent(newFrequent);
|
||||||
int newFrequent = (int)that->mValue + (add?frequentStep->mValue:-frequentStep->mValue);
|
|
||||||
that->setValue(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);
|
||||||
});
|
});
|
||||||
auto btn1_3 = new MenuButton("删除标记", fontSize, [&](){
|
auto btn1_3 = new MenuButton("删除标记", fontSize, [&]() {
|
||||||
mSpectrogramLine->remove_current_marker();
|
mSpectrogramLine->remove_current_marker();
|
||||||
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(sub1, &BaseWidgetMenu::showThat, [&, markFrequent](){
|
connect(sub1, &BaseWidgetMenu::showThat, [&, markFrequent]() {
|
||||||
mSpectrogramLine->set_selected_line_marker(0);
|
mSpectrogramLine->set_selected_line_marker(0);
|
||||||
markFrequent->setValue(mSpectrogramLine->get_mark_frequent(0));
|
markFrequent->setValue(mSpectrogramLine->get_mark_frequent(0));
|
||||||
});
|
});
|
||||||
connect(sub1, &BaseWidgetMenu::hideThat, [&](){
|
connect(sub1, &BaseWidgetMenu::hideThat, [&]() {
|
||||||
mSpectrogramLine->un_select_marker();
|
mSpectrogramLine->un_select_marker();
|
||||||
});
|
});
|
||||||
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,41 +8,35 @@
|
|||||||
#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};
|
||||||
QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
||||||
class SpectrumPlot : public YSG::Plot {
|
class SpectrumPlot : public YSG::Plot {
|
||||||
public:
|
public:
|
||||||
YSG::Frequent_Axis *xAxis{};
|
YSG::Frequent_Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Muti_Select_Rect* msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
YSG::Spectrum *sp{};
|
YSG::Spectrum* sp{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
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)
|
||||||
.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:
|
||||||
void resizeEvent(QResizeEvent* event) override {
|
void resizeEvent(QResizeEvent* event) override {
|
||||||
@@ -54,7 +48,7 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
|||||||
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 =
|
||||||
bw(cw(sp, -1), "频谱图") +
|
bw(cw(sp, -1), "频谱图") +
|
||||||
bw(cw(xAxis), "频率x轴") +
|
bw(cw(xAxis), "频率x轴") +
|
||||||
@@ -75,35 +69,33 @@ 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:
|
||||||
YSG::Frequent_Axis *xAxis{};
|
YSG::Frequent_Axis* xAxis{};
|
||||||
YSG::Time_Axis *yAxis{};
|
YSG::Time_Axis* yAxis{};
|
||||||
YSG::Muti_Select_Rect *msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
YSG::Waterfall *wf{};
|
YSG::Waterfall* wf{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
void init() override {
|
void init() override {
|
||||||
Plot::init();
|
Plot::init();
|
||||||
object_name = "WaterFallPlot";
|
object_name = "WaterFallPlot";
|
||||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||||
.set_tick_length(-10)
|
.set_tick_length(-10)
|
||||||
.set_sub_tick_length(-5)
|
.set_sub_tick_length(-5)
|
||||||
.set_coord_range(frequent_range)
|
.set_coord_range(frequent_range)
|
||||||
.build();
|
.build();
|
||||||
yAxis = YSG::Time_Axis::Builder(this, Qt::Vertical)
|
yAxis = YSG::Time_Axis::Builder(this, Qt::Vertical)
|
||||||
.set_time_point_size(100)
|
.set_time_point_size(100)
|
||||||
.build();
|
.build();
|
||||||
wf = YSG::Waterfall::Builder(xAxis, yAxis)
|
wf = YSG::Waterfall::Builder(xAxis, yAxis)
|
||||||
.set_frequent_range(frequent_range)
|
.set_frequent_range(frequent_range)
|
||||||
.set_frequent_point_size(1024)
|
.set_frequent_point_size(1024)
|
||||||
.set_power_range({0, max})
|
.set_power_range({0, max})
|
||||||
// .set_time_point_size(100)
|
// .set_time_point_size(100)
|
||||||
.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:
|
||||||
void resizeEvent(QResizeEvent* event) override {
|
void resizeEvent(QResizeEvent* event) override {
|
||||||
@@ -115,7 +107,7 @@ QWidget* RadioWidget::createWaterFallPlot() {
|
|||||||
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 =
|
||||||
bw(cw(wf, -1), "瀑布图") +
|
bw(cw(wf, -1), "瀑布图") +
|
||||||
bw(cw(xAxis), "频率轴") +
|
bw(cw(xAxis), "频率轴") +
|
||||||
@@ -131,41 +123,31 @@ 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:
|
||||||
YSG::Frequent_Axis *xAxis{};
|
YSG::Frequent_Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Muti_Select_Rect* msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
YSG::Spectrum *sp{};
|
YSG::Spectrum* sp{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
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:
|
||||||
void resizeEvent(QResizeEvent* event) override {
|
void resizeEvent(QResizeEvent* event) override {
|
||||||
@@ -176,10 +158,8 @@ 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 =
|
||||||
bw(cw(sp, -1), "频谱图") +
|
bw(cw(sp, -1), "频谱图") +
|
||||||
bw(cw(xAxis), "频率x轴") +
|
bw(cw(xAxis), "频率x轴") +
|
||||||
@@ -195,35 +175,28 @@ 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:
|
||||||
YSG::Time_Axis *xAxis{};
|
YSG::Time_Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Audio_Frequent *audio{};
|
YSG::Audio_Frequent* audio{};
|
||||||
YSG::Muti_Select_Rect* msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
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:
|
||||||
void resizeEvent(QResizeEvent* event) override {
|
void resizeEvent(QResizeEvent* event) override {
|
||||||
@@ -236,10 +209,10 @@ QWidget* RadioWidget::createTimePowerPlot() {
|
|||||||
audio->set_time_point_size(xAxis->get_pixel_point_size());
|
audio->set_time_point_size(xAxis->get_pixel_point_size());
|
||||||
}
|
}
|
||||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||||
if(!mMenu) {
|
if (!mMenu) {
|
||||||
auto ws =
|
auto ws =
|
||||||
bw( cw(audio, -1), "音频图") +
|
bw(cw(audio, -1), "音频图") +
|
||||||
bw(cw(yAxis),"功率y轴") +
|
bw(cw(yAxis), "功率y轴") +
|
||||||
bw(cw(xAxis), "时间轴") +
|
bw(cw(xAxis), "时间轴") +
|
||||||
bw(cw(msr), "多选框");
|
bw(cw(msr), "多选框");
|
||||||
mMenu = createMenu(this, ws);
|
mMenu = createMenu(this, ws);
|
||||||
@@ -252,10 +225,8 @@ 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("电台界面");
|
||||||
mVoiceValue = BackEnd::instance()->YsGetAfGain();
|
mVoiceValue = BackEnd::instance()->YsGetAfGain();
|
||||||
mRFGainValue = BackEnd::instance()->YsGetRfGain();
|
mRFGainValue = BackEnd::instance()->YsGetRfGain();
|
||||||
@@ -269,34 +240,33 @@ RadioWidget::RadioWidget(QWidget *parent) : BaseWidget(parent) {
|
|||||||
mSelectValueWidget = new FrequentShower(this);
|
mSelectValueWidget = new FrequentShower(this);
|
||||||
int n = 5;
|
int n = 5;
|
||||||
QVector<double> tickList(n);
|
QVector<double> tickList(n);
|
||||||
double space = 100.0/n;
|
double space = 100.0 / n;
|
||||||
for(int i = 0; i < n; ++i){
|
for (int i = 0; i < n; ++i) {
|
||||||
tickList[i] = i * space;
|
tickList[i] = i * space;
|
||||||
}
|
}
|
||||||
QColor orange(255, 165, 0);
|
QColor orange(255, 165, 0);
|
||||||
mProgressBar1 = new ProgressBar({
|
mProgressBar1 = new ProgressBar({
|
||||||
Tick("S", Qt::black),
|
Tick("S", Qt::black),
|
||||||
{"3", Qt::black},
|
{"3", Qt::black},
|
||||||
{"6", Qt::black},
|
{"6", Qt::black},
|
||||||
{"9", Qt::black},
|
{"9", Qt::black},
|
||||||
{"20", Qt::black},
|
{"20", Qt::black},
|
||||||
{"40", orange},
|
{"40", orange},
|
||||||
{"60", orange},
|
{"60", orange},
|
||||||
{"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},
|
||||||
{"3", Qt::red},
|
{"3", Qt::red},
|
||||||
{">5", Qt::red},
|
{">5", Qt::red},
|
||||||
}, 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,76 +311,60 @@ 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) {
|
||||||
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
auto btn2_1 = new ValueMenuButton("参考增益:%1", fontSize, [&](ValueMenuButton* that, bool add){
|
|
||||||
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();
|
||||||
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
auto* keyEvent = dynamic_cast<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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(g->match(keyEvent, "特别增加")){
|
if (g->match(keyEvent, "特别增加")) {
|
||||||
if(m1->text().startsWith("RF Gain")){
|
if (m1->text().startsWith("RF Gain")) {
|
||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(g->match(keyEvent, "特别减小")){
|
if (g->match(keyEvent, "特别减小")) {
|
||||||
if(m1->text().startsWith("RF Gain")){
|
if (m1->text().startsWith("RF Gain")) {
|
||||||
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,36 +10,29 @@
|
|||||||
#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:
|
||||||
YSG::Axis *xAxis{};
|
YSG::Axis* xAxis{};
|
||||||
YSG::Axis *yAxis{};
|
YSG::Axis* yAxis{};
|
||||||
YSG::Muti_Select_Rect *msr{};
|
YSG::Muti_Select_Rect* msr{};
|
||||||
YSG::Sweep_Frequent* sf{};
|
YSG::Sweep_Frequent* sf{};
|
||||||
QMenu *mMenu{};
|
QMenu* mMenu{};
|
||||||
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:
|
||||||
@@ -52,7 +45,7 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
|||||||
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 =
|
||||||
bw(cw(sf, -1), "扫频图") +
|
bw(cw(sf, -1), "扫频图") +
|
||||||
bw(cw(xAxis), "x轴") +
|
bw(cw(xAxis), "x轴") +
|
||||||
@@ -68,9 +61,8 @@ 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("扫频界面");
|
||||||
int fontSize = 20;
|
int fontSize = 20;
|
||||||
m1 = createNormal("RF Gain\n62", fontSize);
|
m1 = createNormal("RF Gain\n62", fontSize);
|
||||||
@@ -79,25 +71,25 @@ SweepFrequencyWidget::SweepFrequencyWidget(QWidget *parent) : BaseWidget(parent)
|
|||||||
m4 = createNormal("MODEM\nRTTY", fontSize);
|
m4 = createNormal("MODEM\nRTTY", fontSize);
|
||||||
mSelectValueWidget = new FrequentShower(this);
|
mSelectValueWidget = new FrequentShower(this);
|
||||||
mProgressBar1 = new ProgressBar({
|
mProgressBar1 = new ProgressBar({
|
||||||
{"S", Qt::black},
|
{"S", Qt::black},
|
||||||
{"3", Qt::black},
|
{"3", Qt::black},
|
||||||
{"5", Qt::black},
|
{"5", Qt::black},
|
||||||
{"7", Qt::black},
|
{"7", Qt::black},
|
||||||
{"9", Qt::black},
|
{"9", Qt::black},
|
||||||
{"+20", Qt::yellow},
|
{"+20", Qt::yellow},
|
||||||
{"+40", Qt::yellow},
|
{"+40", Qt::yellow},
|
||||||
{"+60", Qt::red},
|
{"+60", Qt::red},
|
||||||
}, this);
|
}, this);
|
||||||
mProgressBar2 = new ProgressBar({
|
mProgressBar2 = new ProgressBar({
|
||||||
{"1", Qt::black},
|
{"1", Qt::black},
|
||||||
{"2", Qt::yellow},
|
{"2", Qt::yellow},
|
||||||
{"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,33 +121,23 @@ 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) {
|
||||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
}, -1);
|
}, -1);
|
||||||
startFreq->setValue(mSweepFrequencyLine->frequent_range().lower);
|
startFreq->setValue(mSweepFrequencyLine->frequent_range().lower);
|
||||||
auto endFreq = new ValueMenuButton("终止频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add){
|
auto endFreq = new ValueMenuButton("终止频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||||
}, -1);
|
}, -1);
|
||||||
endFreq->setValue(mSweepFrequencyLine->frequent_range().upper);
|
endFreq->setValue(mSweepFrequencyLine->frequent_range().upper);
|
||||||
auto btn3 = new MenuButton("设置频率", fontSize, [&, startFreq, endFreq](){
|
auto btn3 = new MenuButton("设置频率", fontSize, [&, startFreq, endFreq]() {
|
||||||
mSweepFrequencyLine->set_frequent_range({startFreq->mValue, endFreq->mValue});
|
mSweepFrequencyLine->set_frequent_range({startFreq->mValue, endFreq->mValue});
|
||||||
});
|
});
|
||||||
mBaseWidgetMenu->addMenuButtonOnLayout1({startFreq, endFreq, btn3}, 2);
|
mBaseWidgetMenu->addMenuButtonOnLayout1({startFreq, endFreq, btn3}, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+8
-19
@@ -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);
|
||||||
|
QHBoxLayout* createHBoxLayout(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);
|
|
||||||
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,10 +5,8 @@
|
|||||||
#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);
|
||||||
BackEnd::instance();
|
BackEnd::instance();
|
||||||
|
|||||||
@@ -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