Fixed some settings bugs related to filtering

This commit is contained in:
Jordan Sherer 2019-12-16 13:59:10 -05:00
parent bf5570cacd
commit c1a3975231
5 changed files with 46 additions and 18 deletions

View File

@ -4416,11 +4416,13 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){
dec_data.params.nfSplit=m_wideGraph->Fmin();
dec_data.params.nfb=m_wideGraph->Fmax();
int filter = max(0, m_wideGraph->filter());
if(filter){
int f = currentFreqOffset() + computeBandwidthForSubmode(submode)/2;
dec_data.params.nfa=max(0, f - filter/2);
dec_data.params.nfb=min(f + filter/2, 5000);
if(m_wideGraph->filterEnabled()){
int filter = max(0, m_wideGraph->filter());
if(filter){
int f = currentFreqOffset() + computeBandwidthForSubmode(submode)/2;
dec_data.params.nfa=max(0, f - filter/2);
dec_data.params.nfb=min(f + filter/2, 5000);
}
}
//if(m_mode=="FT8" and m_config.bHound() and !ui->cbRxAll->isChecked()) dec_data.params.nfb=1000;
@ -7550,7 +7552,7 @@ void MainWindow::on_actionJS8_triggered()
updateModeButtonText();
m_wideGraph->setSubMode(m_nSubMode);
m_wideGraph->setFilterMinimum(computeBandwidthForSubmode(m_nSubMode));
m_wideGraph->setFilterMinimum(computeBandwidthForSubmode(m_nSubMode) + 2*rxThreshold(m_nSubMode));
bool bVHF=m_config.enable_VHF_features();
enable_DXCC_entity (m_config.DXCC ());

View File

@ -28,6 +28,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
m_plot2dGain {0},
m_plot2dZero {0},
m_nSubMode {0},
m_filterEnabled{false},
m_filterWidth {0},
m_turbo {false},
m_Running {false},
@ -123,7 +124,7 @@ void CPlotter::paintEvent(QPaintEvent *) // paint
painter.drawPixmap(m_lastMouseX, 0, m_HoverOverlayPixmap);
}
if(m_filterWidth > 0){
if(m_filterEnabled && m_filterWidth > 0){
painter.drawPixmap(0, 0, m_FilterOverlayPixmap);
}
@ -531,7 +532,7 @@ void CPlotter::DrawOverlay() //DrawOverlay()
hoverPainter.drawText(fwidth + 5, m_h, QString("%1").arg(f));
#endif
if(m_filterWidth > 0){
if(m_filterEnabled && m_filterWidth > 0){
int filterStart=XfromFreq(m_rxFreq+bw/2-m_filterWidth/2);
int filterEnd=XfromFreq(m_rxFreq+bw/2+m_filterWidth/2);
@ -551,7 +552,6 @@ void CPlotter::DrawOverlay() //DrawOverlay()
filterPainter.fillRect(0, 30, filterStart, m_h, blackMask);
filterPainter.fillRect(filterEnd+1, 30, m_Size.width(), m_h, blackMask);
}
}
}
@ -822,6 +822,12 @@ void CPlotter::setFilter(int width)
update();
}
void CPlotter::setFilterEnabled(bool enabled){
m_filterEnabled=enabled;
DrawOverlay();
update();
}
void CPlotter::setFlatten(bool b1, bool b2)
{
m_Flatten=0;

View File

@ -83,6 +83,7 @@ public:
void setRxBand(QString band);
void setTurbo(bool turbo);
void setFilter(int width);
void setFilterEnabled(bool enabled);
#if JS8_USE_REFSPEC
void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;}
@ -152,6 +153,7 @@ private:
QString m_rxBand;
QString m_redFile;
bool m_filterEnabled;
int m_filterWidth;
bool m_turbo;
bool m_Running;

View File

@ -27,6 +27,9 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
m_palettes_path {":/Palettes"},
m_ntr0 {0},
m_n {0},
m_filterWidth {0},
m_filterWidthPrev {0},
m_filterEnabled {false},
m_bHaveTransmitted {false}
{
ui->setupUi(this);
@ -111,7 +114,7 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool());
ui->cbControls->setChecked(!m_settings->value("HideControls", false).toBool());
setFilter(m_settings->value("FilterWidth", 0).toInt());
setFilter(m_settings->value("FilterWidth", 500).toInt());
setFilterEnabled(m_settings->value("FilterEnabled", false).toBool());
}
@ -327,20 +330,25 @@ int WideGraph::Fmax() //Fmax
int WideGraph::filter()
{
return m_filterEnabled ? m_filterWidth : 0;
return std::max(0, std::min(m_filterWidth, 5000));
}
bool WideGraph::filterEnabled()
{
return m_filterEnabled;
}
void WideGraph::setFilter(int width){
if(width == m_filterWidth){
return;
}
// update the filter history
m_filterWidthPrev = m_filterWidth;
m_filterWidth = width;
// update the spinner UI
ui->filterSpinBox->setValue(width);
bool blocked = ui->filterSpinBox->blockSignals(true);
{
ui->filterSpinBox->setValue(width);
}
ui->filterSpinBox->blockSignals(blocked);
// update the wide plot UI
ui->widePlot->setFilter(width);
@ -353,9 +361,18 @@ void WideGraph::setFilterMinimum(int width){
void WideGraph::setFilterEnabled(bool enabled){
m_filterEnabled = enabled;
// update the wide plot with the
ui->widePlot->setFilter(enabled ? m_filterWidth : 0);
// update the filter spinner
ui->filterSpinBox->setEnabled(enabled);
// update the checkbox ui
bool blocked = ui->filterCheckBox->blockSignals(true);
{
ui->filterCheckBox->setChecked(enabled);
}
ui->filterCheckBox->blockSignals(blocked);
// update the wideplot
ui->widePlot->setFilterEnabled(enabled);
}
int WideGraph::fSpan()

View File

@ -34,6 +34,7 @@ public:
int Fmin();
int Fmax();
int filter();
bool filterEnabled();
void setFilter(int width);
void setFilterMinimum(int width);
void setFilterEnabled(bool enabled);