Added the ability to adjust the filter mask opacity
This commit is contained in:
parent
f6ebfccc96
commit
c6b327dba7
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
36
widegraph.ui
36
widegraph.ui
@ -373,9 +373,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<y>-517</y>
|
||||
<width>267</width>
|
||||
<height>615</height>
|
||||
<height>691</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
@ -807,6 +807,38 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Opacity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="filterOpacitySpinBox">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user