mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Improve encapsulation and reliability of the wide graph 60m behaviour
The wide graph class handles 60m band behaviour of the minimum decoded JT9 DF internally without leaking implementation details. On 60m the lowest JT9 DF is always zero and the spin box to set it is disabled. This reflects that 60m only has narrow channels and JT9 signals should share the same dial frequency as JT65 signals. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7668 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
bd925c9228
commit
f7ff64bd6e
@ -1757,25 +1757,6 @@ void MainWindow::displayDialFrequency ()
|
||||
ui->bandComboBox->setCurrentText (band_name);
|
||||
m_wideGraph->setRxBand (band_name);
|
||||
m_lastBand = band_name;
|
||||
// For 60M we'll move the JT9 offset to zero and remember so we can restore
|
||||
static int saveRxRange = -1;
|
||||
if (saveRxRange < 0) {
|
||||
m_settings->beginGroup ("WideGraph");
|
||||
saveRxRange = m_settings->value ("FminSave", m_wideGraph->Fmin()).toInt ();
|
||||
m_settings->endGroup();
|
||||
}
|
||||
if (band_name == "60m") {
|
||||
saveRxRange = m_wideGraph->Fmin();
|
||||
// We need to remember our save value in case we restart on 60M
|
||||
m_settings->beginGroup ("WideGraph");
|
||||
m_settings->setValue ("FminSave", saveRxRange);
|
||||
m_settings->endGroup();
|
||||
m_wideGraph->setRxRangeAndSplitSpinBox(0);
|
||||
|
||||
}
|
||||
else {
|
||||
m_wideGraph->setRxRangeAndSplitSpinBox(saveRxRange);
|
||||
}
|
||||
}
|
||||
|
||||
// search working frequencies for one we are within 10kHz of (1 Mhz
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "widegraph.h"
|
||||
#include <algorithm>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include "ui_widegraph.h"
|
||||
@ -21,6 +22,7 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
|
||||
m_palettes_path {":/Palettes"},
|
||||
m_ntr0 {0},
|
||||
m_lockTxFreq {false},
|
||||
m_bHaveTransmitted {false},
|
||||
m_n {0}
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -40,8 +42,9 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
|
||||
connect(ui->widePlot, SIGNAL(setFreq1(int,int)),this,
|
||||
SLOT(setFreq2(int,int)));
|
||||
|
||||
{
|
||||
//Restore user's settings
|
||||
m_settings->beginGroup("WideGraph");
|
||||
SettingsGroup g {m_settings, "WideGraph"};
|
||||
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
||||
ui->widePlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
||||
ui->widePlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
||||
@ -82,17 +85,18 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
|
||||
m_userPalette = WFPalette {m_settings->value("UserPalette").value<WFPalette::Colours> ()};
|
||||
int m_fMin = m_settings->value ("Fmin", 2500).toInt ();
|
||||
ui->fSplitSpinBox->setValue (m_fMin);
|
||||
setRxRange (m_fMin);
|
||||
setRxRange ();
|
||||
ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool ());
|
||||
m_settings->endGroup();
|
||||
}
|
||||
|
||||
saveSettings (); // update config with defaults
|
||||
|
||||
QStringList allFiles = m_palettes_path.entryList(QDir::NoDotAndDotDot |
|
||||
QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files,
|
||||
QDir::DirsFirst);
|
||||
int index=0;
|
||||
foreach(QString file, allFiles) {
|
||||
for (QString const& file:
|
||||
m_palettes_path.entryList(QDir::NoDotAndDotDot |
|
||||
QDir::System | QDir::Hidden |
|
||||
QDir::AllDirs | QDir::Files,
|
||||
QDir::DirsFirst)) {
|
||||
QString t=file.mid(0,file.length()-4);
|
||||
ui->paletteComboBox->addItem(t);
|
||||
if(t==m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
|
||||
@ -101,7 +105,6 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
|
||||
ui->paletteComboBox->addItem (user_defined);
|
||||
if (user_defined == m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
|
||||
readPalette ();
|
||||
m_bHaveTransmitted=false;
|
||||
}
|
||||
|
||||
WideGraph::~WideGraph ()
|
||||
@ -116,7 +119,7 @@ void WideGraph::closeEvent (QCloseEvent * e)
|
||||
|
||||
void WideGraph::saveSettings() //saveSettings
|
||||
{
|
||||
m_settings->beginGroup ("WideGraph");
|
||||
SettingsGroup g {m_settings, "WideGraph"};
|
||||
m_settings->setValue ("geometry", saveGeometry ());
|
||||
m_settings->setValue ("PlotZero", ui->widePlot->plotZero());
|
||||
m_settings->setValue ("PlotGain", ui->widePlot->plotGain());
|
||||
@ -135,11 +138,9 @@ 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 ("Fmin", m_fMin);
|
||||
m_settings->setValue("Flatten",m_bFlatten);
|
||||
m_settings->setValue("UseRef",m_bRef);
|
||||
m_settings->setValue("HideControls",!ui->controls_widget->isVisible());
|
||||
m_settings->endGroup ();
|
||||
}
|
||||
|
||||
void WideGraph::drawRed(int ia, int ib)
|
||||
@ -252,31 +253,21 @@ void WideGraph::wideFreezeDecode(int n) //wideFreez
|
||||
emit freezeDecode2(n);
|
||||
}
|
||||
|
||||
void WideGraph::setRxRange(int fMin) //setRxRange
|
||||
void WideGraph::setRxRange ()
|
||||
{
|
||||
ui->widePlot->setRxRange(fMin);
|
||||
ui->widePlot->setRxRange (Fmin ());
|
||||
ui->widePlot->DrawOverlay();
|
||||
ui->widePlot->update();
|
||||
}
|
||||
|
||||
void WideGraph::setRxRangeAndSplitSpinBox(int fMin)
|
||||
{
|
||||
// Need to ensure split box is set too
|
||||
// e.g. For 60M we force the offset to 0 so this routine makes the split box match
|
||||
// Otherwise we can't decode JT9
|
||||
ui->fSplitSpinBox->setValue(fMin);
|
||||
}
|
||||
|
||||
int WideGraph::Fmin() //Fmin
|
||||
{
|
||||
return m_fMin;
|
||||
return "60m" == m_rxBand ? 0 : m_fMin;
|
||||
}
|
||||
|
||||
int WideGraph::Fmax() //Fmax
|
||||
{
|
||||
int n=ui->widePlot->Fmax();
|
||||
if(n>5000) n=5000;
|
||||
return n;
|
||||
return std::max (5000, ui->widePlot->Fmax());
|
||||
}
|
||||
|
||||
int WideGraph::fSpan()
|
||||
@ -343,8 +334,8 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1)
|
||||
|
||||
void WideGraph::on_fSplitSpinBox_valueChanged(int n) //fSplit
|
||||
{
|
||||
m_fMin=n;
|
||||
setRxRange(m_fMin);
|
||||
if (m_rxBand != "60m") m_fMin=n;
|
||||
setRxRange ();
|
||||
}
|
||||
|
||||
void WideGraph::setLockTxFreq(bool b) //LockTxFreq
|
||||
@ -363,9 +354,21 @@ void WideGraph::setDialFreq(double d) //setDialFreq
|
||||
ui->widePlot->setDialFreq(d);
|
||||
}
|
||||
|
||||
void WideGraph::setRxBand(QString band)
|
||||
void WideGraph::setRxBand (QString const& band)
|
||||
{
|
||||
m_rxBand = band;
|
||||
if ("60m" == m_rxBand)
|
||||
{
|
||||
ui->fSplitSpinBox->setEnabled (false);
|
||||
ui->fSplitSpinBox->setValue (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->fSplitSpinBox->setValue (m_fMin);
|
||||
ui->fSplitSpinBox->setEnabled (true);
|
||||
}
|
||||
ui->widePlot->setRxBand(band);
|
||||
setRxRange ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,8 +32,6 @@ public:
|
||||
int Fmax();
|
||||
int fSpan();
|
||||
void saveSettings();
|
||||
void setRxRange(int fMin);
|
||||
void setRxRangeAndSplitSpinBox(int fMin);
|
||||
void setFsample(int n);
|
||||
void setPeriod(int ntrperiod, int nsps);
|
||||
void setTxFreq(int n);
|
||||
@ -45,7 +43,7 @@ public:
|
||||
bool useRef();
|
||||
void setTol(int n);
|
||||
int smoothYellow();
|
||||
void setRxBand(QString band);
|
||||
void setRxBand (QString const& band);
|
||||
void setWSPRtransmitted();
|
||||
void drawRed(int ia, int ib);
|
||||
void setVHF(bool bVHF);
|
||||
@ -85,6 +83,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void readPalette ();
|
||||
void setRxRange ();
|
||||
|
||||
QScopedPointer<Ui::WideGraph> ui;
|
||||
|
||||
@ -98,6 +97,7 @@ private:
|
||||
qint32 m_ntr0;
|
||||
qint32 m_fMin;
|
||||
qint32 m_fMax;
|
||||
QString m_rxBand;
|
||||
qint32 m_nSubMode;
|
||||
qint32 m_nsmo;
|
||||
qint32 m_Percent2DScreen;
|
||||
|
Loading…
Reference in New Issue
Block a user