Filter general working frequencies in FreqCal mode

Allow band  drop down list to  be used to select  FreqCal frequencies,
also  resets position  in automatic  cycle. Tidy  up some  unnecessary
code.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7486 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-01-12 21:03:30 +00:00
parent 247aa1a2ee
commit 18a80232cc
4 changed files with 37 additions and 21 deletions

View File

@ -310,7 +310,9 @@ bool FrequencyList::filterAcceptsRow (int source_row, QModelIndex const& /* pare
if (m_->mode_filter_ != Modes::NULL_MODE)
{
auto const& item = m_->frequency_list_[source_row];
result = item.mode_ == Modes::NULL_MODE || m_->mode_filter_ == item.mode_;
// we pass NULL_MODE mode rows unless filtering for FreqCal mode
result = (Modes::NULL_MODE == item.mode_ && m_->mode_filter_ != Modes::FreqCal)
|| m_->mode_filter_ == item.mode_;
}
return result;
}
@ -610,16 +612,29 @@ auto FrequencyList::const_iterator::operator ++ () -> const_iterator&
return *this;
}
auto FrequencyList::begin () const -> FrequencyList::const_iterator
auto FrequencyList::begin () const -> const_iterator
{
return const_iterator (this, 0);
}
auto FrequencyList::end () const -> FrequencyList::const_iterator
auto FrequencyList::end () const -> const_iterator
{
return const_iterator (this, rowCount ());
}
auto FrequencyList::find (Frequency f) const -> const_iterator
{
int row {0};
for (; row < rowCount (); ++row)
{
if (m_->frequency_list_[mapToSource (index (row, 0)).row ()].frequency_ == f)
{
break;
}
}
return const_iterator (this, row);
}
auto FrequencyList::filtered_bands () const -> BandSet
{
BandSet result;

View File

@ -91,6 +91,9 @@ public:
const_iterator begin () const;
const_iterator end () const;
// Find a row with a given frequency
const_iterator find (Frequency) const;
// Bands of the frequencies
BandSet all_bands (Mode = Modes::NULL_MODE) const;
BandSet filtered_bands () const;

View File

@ -1164,7 +1164,7 @@ void MainWindow::dataSink(qint64 frames)
, tr ("Cannot open \"%1\" for append: %2")
.arg (f.fileName ()).arg (f.errorString ()));
}
if(m_ihsym==m_hsymStop and m_bFreqCalStep) {
if(m_ihsym==m_hsymStop && ui->actionFrequency_calibration->isChecked()) {
freqCalStep();
}
}
@ -4813,10 +4813,18 @@ void MainWindow::band_changed (Frequency f)
m_bandEdited = false;
psk_Reporter->sendReport(); // Upload any queued spots before changing band
if (!m_transmitting) monitor (true);
float r=m_freqNominal/(f+0.0001);
if(r<0.9 or r>1.1) m_bVHFwarned=false;
setRig (f);
setXIT (ui->TxFreqSpinBox->value ());
if ("FreqCal" == m_mode)
{
m_frequency_list_fcal_iter = m_config.frequencies ()->find (f);
setRig (f - ui->RxFreqSpinBox->value ());
}
else
{
float r=m_freqNominal/(f+0.0001);
if(r<0.9 or r>1.1) m_bVHFwarned=false;
setRig (f);
setXIT (ui->TxFreqSpinBox->value ());
}
if(monitor_off) monitor(false);
}
}
@ -6106,20 +6114,12 @@ void MainWindow::on_actionErase_reference_spectrum_triggered()
m_bClearRefSpec=true;
}
void MainWindow::on_actionFrequency_calibration_triggered(bool b)
{
// m_bFreqCalStep=ui->actionFrequency_calibration->isChecked();
m_bFreqCalStep=b;
}
void MainWindow::freqCalStep()
{
FrequencyList::const_iterator flist=m_frequency_list_fcal_iter;
if (++flist == m_config.frequencies ()->end ()) {
if (++m_frequency_list_fcal_iter == m_config.frequencies ()->end ()) {
m_frequency_list_fcal_iter = m_config.frequencies ()->begin ();
} else {
++m_frequency_list_fcal_iter;
}
}
// allow for empty list
if (m_frequency_list_fcal_iter != m_config.frequencies ()->end ()) {
setRig (m_frequency_list_fcal_iter->frequency_ - ui->RxFreqSpinBox->value ());

View File

@ -250,7 +250,6 @@ private slots:
void fast_decode_done();
void on_actionMeasure_reference_spectrum_triggered();
void on_actionErase_reference_spectrum_triggered();
void on_actionFrequency_calibration_triggered(bool b);
void on_sbTR_valueChanged(int index);
void on_sbFtol_valueChanged(int index);
void on_cbFast9_clicked(bool b);
@ -526,7 +525,6 @@ private:
bool m_tx_watchdog; // true when watchdog triggered
bool m_block_pwr_tooltip;
bool m_PwrBandSetOK;
bool m_bFreqCalStep;
bool m_bVHFwarned;
Frequency m_lastMonitoredFrequency;
double m_toneSpacing;