Use a single definition of band limits (Bands class)

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8089 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-09-16 20:27:20 +00:00
parent c6acee8bfd
commit 1e4845cdfd
5 changed files with 10 additions and 39 deletions

View File

@ -214,35 +214,3 @@ bool ADIF::addQSOToFile(QString const& hisCall, QString const& hisGrid, QString
}
return true;
}
QString ADIF::bandFromFrequency(double dialFreq)
{
QString band="";
if(dialFreq>0.135 and dialFreq<0.139) band="2200m";
else if(dialFreq>0.45 and dialFreq<0.55) band="630m";
else if(dialFreq>1.8 and dialFreq<2.0) band="160m";
else if(dialFreq>3.5 and dialFreq<4.0) band="80m";
else if(dialFreq>5.1 and dialFreq<5.45) band="60m";
else if(dialFreq>7.0 and dialFreq<7.3) band="40m";
else if(dialFreq>10.0 and dialFreq<10.15) band="30m";
else if(dialFreq>14.0 and dialFreq<14.35) band="20m";
else if(dialFreq>18.068 and dialFreq<18.168) band="17m";
else if(dialFreq>21.0 and dialFreq<21.45) band="15m";
else if(dialFreq>24.890 and dialFreq<24.990) band="12m";
else if(dialFreq>28.0 and dialFreq<29.7) band="10m";
else if(dialFreq>50.0 and dialFreq<54.0) band="6m";
else if(dialFreq>70.0 and dialFreq<71.0) band="4m";
else if(dialFreq>144.0 and dialFreq<148.0) band="2m";
else if(dialFreq>222.0 and dialFreq<225.0) band="1.25m";
else if(dialFreq>420.0 and dialFreq<450.0) band="70cm";
else if(dialFreq>902.0 and dialFreq<928.0) band="33cm";
else if(dialFreq>1240.0 and dialFreq<1300.0) band="23cm";
else if(dialFreq>2300.0 and dialFreq<2450.0) band="13cm";
else if(dialFreq>3300.0 and dialFreq<3500.0) band="9cm";
else if(dialFreq>5650.0 and dialFreq<5925.0) band="6cm";
else if(dialFreq>10000.0 and dialFreq<10500.0) band="3cm";
else if(dialFreq>24000.0 and dialFreq<24250.0) band="1.25cm";
else if(dialFreq>47000.0 and dialFreq<47200.0) band="6mm";
else if(dialFreq>75500.0 and dialFreq<81000.0) band="4mm";
return band;
}

View File

@ -32,8 +32,6 @@ class ADIF
bool addQSOToFile(QString const& hisCall, QString const& hisGrid, QString const& mode, QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn, QDateTime const& dateTimeOff, QString const& band,
QString const& comments, QString const& name, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid, QString const& m_txPower);
static QString bandFromFrequency(double dialFreq);
private:
struct QSO
{

View File

@ -8,14 +8,18 @@
#include "logbook/adif.h"
#include "MessageBox.hpp"
#include "Configuration.hpp"
#include "Bands.hpp"
#include "ui_logqso.h"
#include "moc_logqso.cpp"
LogQSO::LogQSO(QString const& programTitle, QSettings * settings, QWidget *parent)
LogQSO::LogQSO(QString const& programTitle, QSettings * settings
, Configuration const * config, QWidget *parent)
: QDialog(parent)
, ui(new Ui::LogQSO)
, m_settings (settings)
, m_config {config}
{
ui->setupUi(this);
setWindowTitle(programTitle + " - Log QSO");
@ -78,8 +82,7 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
m_dialFreq=dialFreq;
m_myCall=myCall;
m_myGrid=myGrid;
QString band= ADIF::bandFromFrequency(dialFreq / 1.e6);
ui->band->setText(band);
ui->band->setText (m_config->bands ()->find (dialFreq));
show ();
}

View File

@ -17,13 +17,14 @@ namespace Ui {
}
class QSettings;
class Configuration;
class LogQSO : public QDialog
{
Q_OBJECT
public:
explicit LogQSO(QString const& programTitle, QSettings *, QWidget *parent = 0);
explicit LogQSO(QString const& programTitle, QSettings *, Configuration const *, QWidget *parent = 0);
~LogQSO();
void initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode,
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
@ -50,6 +51,7 @@ private:
QScopedPointer<Ui::LogQSO> ui;
QSettings * m_settings;
Configuration const * m_config;
QString m_txPower;
QString m_comments;
Radio::Frequency m_dialFreq;

View File

@ -197,7 +197,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_wideGraph (new WideGraph(m_settings)),
m_echoGraph (new EchoGraph(m_settings)),
m_fastGraph (new FastGraph(m_settings)),
m_logDlg (new LogQSO (program_title (), m_settings, this)),
m_logDlg (new LogQSO (program_title (), m_settings, &m_config, this)),
m_lastDialFreq {0},
m_dialFreqRxWSPR {0},
m_detector {new Detector {RX_SAMPLE_RATE, NTMAX, downSampleFactor}},