Add user option to set percentage of WideGraph height used for spectrum plot.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6156 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2015-11-22 23:38:42 +00:00
parent ad11444c63
commit 55f23a396f
5 changed files with 69 additions and 27 deletions

View File

@ -33,6 +33,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
m_nsps=6912;
m_dBStepSize=10;
m_Percent2DScreen = 30; //percent of screen used for 2D display
m_Percent2DScreen0 = 0;
m_txFreq=0;
m_fftBinWidth=1500.0/2048.0;
m_bScaleOK=false;
@ -53,24 +54,26 @@ QSize CPlotter::sizeHint() const
void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
{
if(!size().isValid()) return;
if( m_Size != size() or (m_bReference != m_bReference0)) {
if( m_Size != size() or (m_bReference != m_bReference0) or
m_Percent2DScreen != m_Percent2DScreen0) {
m_Size = size();
m_w = m_Size.width();
m_h = m_Size.height();
m_h2 = (m_Percent2DScreen)*(m_h)/100;
if(m_h2>100) m_h2=100;
m_h2 = m_Percent2DScreen*m_h/100.0;
if(m_h2>m_h-30) m_h2=m_h-30;
if(m_bReference) m_h2=m_h-30;
if(m_h2<1) m_h2=1;
m_h1=m_h-m_h2;
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
m_2DPixmap.fill(Qt::black);
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
m_OverlayPixmap.fill(Qt::black);
m_WaterfallPixmap.fill(Qt::black);
m_2DPixmap.fill(Qt::black);
m_ScalePixmap = QPixmap(m_w,30);
m_ScalePixmap = QPixmap(m_w,m_h2);
m_ScalePixmap.fill(Qt::white);
m_Percent2DScreen0 = m_Percent2DScreen;
}
DrawOverlay();
}
@ -603,3 +606,11 @@ void CPlotter::setColours(QVector<QColor> const& cl)
{
g_ColorTbl = cl;
}
void CPlotter::SetPercent2DScreen(int percent)
{
m_Percent2DScreen=percent;
resizeEvent(NULL);
// DrawOverlay();
update();
}

View File

@ -62,7 +62,7 @@ public:
void setMode(QString mode);
void setSubMode(int n);
void setModeTx(QString modeTx);
void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;}
void SetPercent2DScreen(int percent);
int Fmax();
void setDialFreq(double d);
void setCurrent(bool b) {m_bCurrent = b;}
@ -147,6 +147,7 @@ private:
qint32 m_freqPerDiv;
qint32 m_nsps;
qint32 m_Percent2DScreen;
qint32 m_Percent2DScreen0;
qint32 m_h;
qint32 m_h1;
qint32 m_h2;

View File

@ -55,6 +55,8 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->bppSpinBox->setValue(n);
m_nsmo=m_settings->value("SmoothYellow",1).toInt();
ui->smoSpinBox->setValue(m_nsmo);
m_Percent2DScreen=m_settings->value("Percent2D",30).toInt();
ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
m_waterfallAvg = m_settings->value("WaterfallAvg",5).toInt();
ui->waterfallAvgSpinBox->setValue(m_waterfallAvg);
ui->widePlot->setWaterfallAvg(m_waterfallAvg);
@ -116,6 +118,7 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("PlotWidth", ui->widePlot->plotWidth ());
m_settings->setValue ("BinsPerPixel", ui->bppSpinBox->value ());
m_settings->setValue ("SmoothYellow", ui->smoSpinBox->value ());
m_settings->setValue ("Percent2D",m_Percent2DScreen);
m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ());
m_settings->setValue ("Current", ui->widePlot->current());
m_settings->setValue ("Cumulative", ui->widePlot->cumulative());
@ -294,13 +297,11 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1)
ui->widePlot->setLinearAvg(false);
ui->widePlot->setReference(false);
ui->smoSpinBox->setEnabled(false);
ui->labSmooth->setEnabled(false);
if(arg1=="Current") ui->widePlot->setCurrent(true);
if(arg1=="Cumulative") ui->widePlot->setCumulative(true);
if(arg1=="Linear Avg") {
ui->widePlot->setLinearAvg(true);
ui->smoSpinBox->setEnabled(true);
ui->labSmooth->setEnabled(true);
}
if(arg1=="Reference") {
ui->widePlot->setReference(true);
@ -441,3 +442,9 @@ void WideGraph::setWSPRtransmitted()
{
m_bHaveTransmitted=true;
}
void WideGraph::on_sbPercent2dPlot_valueChanged(int n)
{
m_Percent2DScreen=n;
ui->widePlot->SetPercent2DScreen(n);
}

View File

@ -72,7 +72,8 @@ private slots:
void on_zeroSlider_valueChanged(int value);
void on_gain2dSlider_valueChanged(int value);
void on_zero2dSlider_valueChanged(int value);
void on_smoSpinBox_valueChanged(int n);
void on_smoSpinBox_valueChanged(int n);
void on_sbPercent2dPlot_valueChanged(int n);
private:
void readPalette();
@ -93,6 +94,7 @@ private:
qint32 m_fMax;
qint32 m_nSubMode;
qint32 m_nsmo;
qint32 m_Percent2DScreen;
bool m_lockTxFreq;
bool m_bFlatten;

View File

@ -252,22 +252,6 @@
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLabel" name="labSmooth">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Smoothing</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QSlider" name="gainSlider">
<property name="minimumSize">
@ -501,13 +485,13 @@
</property>
<property name="minimumSize">
<size>
<width>65</width>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<width>75</width>
<height>16777215</height>
</size>
</property>
@ -517,6 +501,12 @@
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>Smooth </string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -540,6 +530,37 @@
</property>
</spacer>
</item>
<item row="0" column="9">
<widget class="QSpinBox" name="sbPercent2dPlot">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="prefix">
<string>Spec </string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>