diff --git a/logbook/adif.cpp b/logbook/adif.cpp index 2f13ecaa4..fc1fdbebe 100644 --- a/logbook/adif.cpp +++ b/logbook/adif.cpp @@ -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; -} diff --git a/logbook/adif.h b/logbook/adif.h index da48ecf00..e47720551 100644 --- a/logbook/adif.h +++ b/logbook/adif.h @@ -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 { diff --git a/logqso.cpp b/logqso.cpp index c6ad3dd1f..f8657e152 100644 --- a/logqso.cpp +++ b/logqso.cpp @@ -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 (); } diff --git a/logqso.h b/logqso.h index 8ef0e413c..6c3eb4213 100644 --- a/logqso.h +++ b/logqso.h @@ -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; QSettings * m_settings; + Configuration const * m_config; QString m_txPower; QString m_comments; Radio::Frequency m_dialFreq; diff --git a/mainwindow.cpp b/mainwindow.cpp index c9910f18e..01c11da29 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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}},