diff --git a/plotter.cpp b/plotter.cpp
index abfb59f..f5c4629 100644
--- a/plotter.cpp
+++ b/plotter.cpp
@@ -550,7 +550,7 @@ void CPlotter::DrawOverlay() //DrawOverlay()
filterPainter.drawLine(filterStart, 30, filterStart, m_h);
filterPainter.drawLine(filterEnd, 30, filterEnd, m_h);
- QColor blackMask(0, 0, 0, 128);
+ QColor blackMask(0, 0, 0, std::max(0, std::min(m_filterOpacity, 255)));
filterPainter.fillRect(0, 30, filterStart, m_h, blackMask);
filterPainter.fillRect(filterEnd+1, 30, m_Size.width(), m_h, blackMask);
}
@@ -836,6 +836,12 @@ void CPlotter::setFilterEnabled(bool enabled){
update();
}
+void CPlotter::setFilterOpacity(int alpha){
+ m_filterOpacity=alpha;
+ DrawOverlay();
+ update();
+}
+
void CPlotter::setFlatten(bool b1, bool b2)
{
m_Flatten=0;
diff --git a/plotter.h b/plotter.h
index 1988e0f..54e6d74 100644
--- a/plotter.h
+++ b/plotter.h
@@ -85,6 +85,7 @@ public:
void setFilterCenter(int center);
void setFilterWidth(int width);
void setFilterEnabled(bool enabled);
+ void setFilterOpacity(int alpha);
#if JS8_USE_REFSPEC
void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;}
@@ -173,6 +174,7 @@ private:
float m_sum[2048];
+ qint32 m_filterOpacity;
qint32 m_dBStepSize;
qint32 m_FreqUnits;
qint32 m_hdivs;
diff --git a/widegraph.cpp b/widegraph.cpp
index 18e850e..1468896 100644
--- a/widegraph.cpp
+++ b/widegraph.cpp
@@ -161,6 +161,7 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
}
setFilter(m_settings->value("FilterMinimum", 500).toInt(), m_settings->value("FilterMaximum", 2500).toInt());
+ setFilterOpacityPercent(m_settings->value("FilterOpacityPercent", 50).toInt());
setFilterEnabled(m_settings->value("FilterEnabled", false).toBool());
}
@@ -213,14 +214,15 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ()));
- m_settings->setValue("Flatten",m_bFlatten);
- m_settings->setValue("UseRef",m_bRef);
+ m_settings->setValue ("Flatten",m_bFlatten);
+ m_settings->setValue ("UseRef",m_bRef);
m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
m_settings->setValue ("FminPerBand", m_fMinPerBand);
m_settings->setValue ("CenterOffset", ui->centerSpinBox->value());
m_settings->setValue ("FilterMinimum", m_filterMinimum);
m_settings->setValue ("FilterMaximum", m_filterMaximum);
m_settings->setValue ("FilterEnabled", m_filterEnabled);
+ m_settings->setValue ("FilterOpacityPercent", ui->filterOpacitySpinBox->value());
m_settings->setValue ("SplitState", ui->splitter->saveState());
}
@@ -447,6 +449,18 @@ void WideGraph::setFilterEnabled(bool enabled){
ui->widePlot->setFilterEnabled(enabled);
}
+void WideGraph::setFilterOpacityPercent(int n){
+ // update the spinbox
+ bool blocked = ui->filterOpacitySpinBox->blockSignals(true);
+ {
+ ui->filterOpacitySpinBox->setValue(n);
+ }
+ ui->filterOpacitySpinBox->blockSignals(blocked);
+
+ // update the wide plot
+ ui->widePlot->setFilterOpacity(int((float(n)/100.0)*255));
+}
+
int WideGraph::fSpan()
{
return ui->widePlot->fSpan ();
@@ -712,6 +726,10 @@ void WideGraph::on_filterCheckBox_toggled(bool b){
setFilterEnabled(b);
}
+void WideGraph::on_filterOpacitySpinBox_valueChanged(int n){
+ setFilterOpacityPercent(n);
+}
+
void WideGraph::setRedFile(QString fRed)
{
ui->widePlot->setRedFile(fRed);
diff --git a/widegraph.h b/widegraph.h
index bdb7461..a300d93 100644
--- a/widegraph.h
+++ b/widegraph.h
@@ -39,6 +39,7 @@ public:
void setFilter(int a, int b);
void setFilterMinimumBandwidth(int width);
void setFilterEnabled(bool enabled);
+ void setFilterOpacityPercent(int n);
int fSpan();
void saveSettings();
void setFsample(int n);
@@ -99,6 +100,7 @@ private slots:
void on_filterMinSpinBox_valueChanged(int n);
void on_filterMaxSpinBox_valueChanged(int n);
void on_filterCheckBox_toggled(bool b);
+ void on_filterOpacitySpinBox_valueChanged(int n);
void on_driftSpinBox_valueChanged(int n);
void on_driftSyncButton_clicked();
diff --git a/widegraph.ui b/widegraph.ui
index 0c958bf..3c05d09 100644
--- a/widegraph.ui
+++ b/widegraph.ui
@@ -373,9 +373,9 @@
0
- 0
+ -517
267
- 615
+ 691
@@ -807,6 +807,38 @@
+ -
+
+
+ Filter
+
+
+
-
+
+
+ Opacity:
+
+
+
+ -
+
+
+ Qt::AlignCenter
+
+
+ %
+
+
+ 100
+
+
+ 50
+
+
+
+
+
+
-