From 330eb3a57e078d370227aaaccd92158c1bca97f0 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Wed, 8 Aug 2018 23:19:27 -0400 Subject: [PATCH] Initial stab at band switching...broken --- Bands.cpp | 12 + Bands.hpp | 2 + Configuration.cpp | 60 +++-- Configuration.hpp | 1 + Configuration.ui | 555 +++++++++++++++++++++++----------------------- StationList.cpp | 113 ++++++---- StationList.hpp | 14 +- mainwindow.cpp | 27 +++ 8 files changed, 441 insertions(+), 343 deletions(-) diff --git a/Bands.cpp b/Bands.cpp index a70358f..59d7ed3 100644 --- a/Bands.cpp +++ b/Bands.cpp @@ -87,6 +87,18 @@ int Bands::find (QString const& band) const return result; } +bool Bands::findFreq(QString const& band, Radio::Frequency *pFreq) const { + int row = find(band); + if(row == -1){ + return false; + } + + if(pFreq) *pFreq = ADIF_bands[row].lower_bound_; + + return true; +} + + QString const& Bands::oob () { return oob_name; diff --git a/Bands.hpp b/Bands.hpp index ed625f2..b66422d 100644 --- a/Bands.hpp +++ b/Bands.hpp @@ -56,6 +56,8 @@ public: // QString find (Frequency) const; // find band Frequency is in int find (QString const&) const; // find row of band (-1 if not valid) + bool findFreq(QString const& band, Radio::Frequency *pFreq) const; + static QString const& oob (); // Iterators diff --git a/Configuration.cpp b/Configuration.cpp index 9b71f5d..bb55b8e 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -161,6 +161,7 @@ #include #include #include +#include #include "pimpl_impl.hpp" #include "qt_helpers.hpp" @@ -260,14 +261,18 @@ public: : QDialog {parent} , filtered_bands_ {new CandidateKeyFilter {bands, stations, 0, 0}} { - setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Station")); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Schedule")); band_.setModel (filtered_bands_.data ()); + + switch_at_.setTimeSpec(Qt::UTC); + switch_at_.setDisplayFormat("hh:mm"); auto form_layout = new QFormLayout (); form_layout->addRow (tr ("&Band:"), &band_); - form_layout->addRow (tr ("&Offset (MHz):"), &delta_); - form_layout->addRow (tr ("&Antenna:"), &description_); + form_layout->addRow (tr ("&Frequency (MHz):"), &freq_); + form_layout->addRow (tr ("&Switch at (UTC)):"), &switch_at_); + //form_layout->addRow (tr ("&Antenna:"), &description_); auto main_layout = new QVBoxLayout (this); main_layout->addLayout (form_layout); @@ -277,16 +282,11 @@ public: connect (button_box, &QDialogButtonBox::accepted, this, &StationDialog::accept); connect (button_box, &QDialogButtonBox::rejected, this, &StationDialog::reject); - - if (delta_.text ().isEmpty ()) - { - delta_.setText ("0"); - } } StationList::Station station () const { - return {band_.currentText (), delta_.frequency_delta (), description_.text ()}; + return {band_.currentText (), freq_.frequency(), QDateTime(QDate(2000, 1, 1), switch_at_.time(), Qt::UTC), description_.text ()}; } int exec () override @@ -299,7 +299,8 @@ private: QScopedPointer filtered_bands_; QComboBox band_; - FrequencyDeltaLineEdit delta_; + FrequencyLineEdit freq_; + QTimeEdit switch_at_; QLineEdit description_; }; @@ -501,8 +502,7 @@ private: FrequencyList_v2 next_frequencies_; StationList stations_; StationList next_stations_; - FrequencyDelta current_offset_; - FrequencyDelta current_tx_offset_; + bool auto_switch_bands_; QAction * frequency_delete_action_; QAction * frequency_insert_action_; @@ -706,6 +706,7 @@ Bands * Configuration::bands () {return &m_->bands_;} Bands const * Configuration::bands () const {return &m_->bands_;} StationList * Configuration::stations () {return &m_->stations_;} StationList const * Configuration::stations () const {return &m_->stations_;} +bool Configuration::auto_switch_bands() const { return &m_->auto_switch_bands_; } IARURegions::Region Configuration::region () const {return m_->region_;} FrequencyList_v2 * Configuration::frequencies () {return &m_->frequencies_;} FrequencyList_v2 const * Configuration::frequencies () const {return &m_->frequencies_;} @@ -724,7 +725,7 @@ void Configuration::set_calibration (CalibrationParams params) void Configuration::enable_calibration (bool on) { - auto target_frequency = m_->remove_calibration (m_->cached_rig_state_.frequency ()) - m_->current_offset_; + auto target_frequency = m_->remove_calibration (m_->cached_rig_state_.frequency ()); m_->frequency_calibration_disabled_ = !on; transceiver_frequency (target_frequency); } @@ -910,8 +911,6 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, , next_frequencies_ {&bands_} , stations_ {&bands_} , next_stations_ {&bands_} - , current_offset_ {0} - , current_tx_offset_ {0} , frequency_dialog_ {new FrequencyDialog {®ions_, &modes_, this}} , station_dialog_ {new StationDialog {&next_stations_, &bands_, this}} , last_port_type_ {TransceiverFactory::Capabilities::none} @@ -1112,6 +1111,7 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, ui_->stations_table_view->setModel (&next_stations_); ui_->stations_table_view->sortByColumn (StationList::band_column, Qt::AscendingOrder); + connect(ui_->auto_switch_bands_check_box, &QCheckBox::clicked, ui_->stations_table_view, &QTableView::setEnabled); // delegates auto stations_item_delegate = new QStyledItemDelegate {this}; @@ -1230,6 +1230,8 @@ void Configuration::impl::initialize_models () ui_->monitor_off_check_box->setChecked (monitor_off_at_startup_); ui_->monitor_last_used_check_box->setChecked (monitor_last_used_); ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_); + ui_->auto_switch_bands_check_box->setChecked(auto_switch_bands_); + ui_->stations_table_view->setEnabled(ui_->auto_switch_bands_check_box->isChecked()); ui_->report_in_comments_check_box->setChecked (report_in_comments_); ui_->prompt_to_log_check_box->setChecked (prompt_to_log_); ui_->insert_blank_check_box->setChecked (insert_blank_); @@ -1308,6 +1310,7 @@ void Configuration::impl::initialize_models () next_frequencies_.frequency_list (frequencies_.frequency_list ()); next_stations_.station_list (stations_.station_list ()); + set_rig_invariants (); } @@ -1457,6 +1460,7 @@ void Configuration::impl::read_settings () } stations_.station_list (settings_->value ("stations").value ()); + auto_switch_bands_ = settings_->value("AutoSwitchBands", false).toBool(); log_as_RTTY_ = settings_->value ("toRTTY", false).toBool (); report_in_comments_ = settings_->value("dBtoComments", false).toBool (); @@ -1571,6 +1575,7 @@ void Configuration::impl::write_settings () settings_->setValue ("Macros", macros_.stringList ()); settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ())); settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ())); + settings_->setValue ("AutoSwitchBands", auto_switch_bands_); settings_->setValue ("toRTTY", log_as_RTTY_); settings_->setValue ("dBtoComments", report_in_comments_); settings_->setValue ("Rig", rig_params_.rig_name); @@ -1993,6 +1998,7 @@ void Configuration::impl::accept () autoreply_off_at_startup_ = ui_->autoreply_off_check_box->isChecked (); monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked (); monitor_last_used_ = ui_->monitor_last_used_check_box->isChecked (); + auto_switch_bands_ = ui_->auto_switch_bands_check_box->isChecked(); type_2_msg_gen_ = static_cast (ui_->type_2_msg_gen_combo_box->currentIndex ()); log_as_RTTY_ = ui_->log_as_RTTY_check_box->isChecked (); report_in_comments_ = ui_->report_in_comments_check_box->isChecked (); @@ -2467,16 +2473,24 @@ void Configuration::impl::delete_stations () selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); next_stations_.removeDisjointRows (selection_model->selectedRows ()); ui_->stations_table_view->resizeColumnToContents (StationList::band_column); - ui_->stations_table_view->resizeColumnToContents (StationList::offset_column); + ui_->stations_table_view->resizeColumnToContents (StationList::frequency_column); } void Configuration::impl::insert_station () { if (QDialog::Accepted == station_dialog_->exec ()) { - ui_->stations_table_view->setCurrentIndex (next_stations_.add (station_dialog_->station ())); + auto station = station_dialog_->station (); + if(station.frequency_ == 0){ + Frequency f; + if(bands_.findFreq(station.band_name_, &f)){ + station.frequency_ = f; + } + } + + ui_->stations_table_view->setCurrentIndex (next_stations_.add (station)); ui_->stations_table_view->resizeColumnToContents (StationList::band_column); - ui_->stations_table_view->resizeColumnToContents (StationList::offset_column); + ui_->stations_table_view->resizeColumnToContents (StationList::frequency_column); } } @@ -2640,8 +2654,7 @@ void Configuration::impl::transceiver_frequency (Frequency f) // cannot absolutely determine if the offset should apply but by // simply picking an offset when the Rx frequency is set and // sticking to it we get sane behaviour - current_offset_ = stations_.offset (f); - cached_rig_state_.frequency (apply_calibration (f + current_offset_)); + cached_rig_state_.frequency (apply_calibration (f)); Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_); } @@ -2664,8 +2677,7 @@ void Configuration::impl::transceiver_tx_frequency (Frequency f) // rig, we cannot absolutely determine if the offset should // apply but by simply picking an offset when the Rx // frequency is set and sticking to it we get sane behaviour - current_tx_offset_ = stations_.offset (f); - cached_rig_state_.tx_frequency (apply_calibration (f + current_tx_offset_)); + cached_rig_state_.tx_frequency (apply_calibration (f)); } Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_); @@ -2732,12 +2744,12 @@ void Configuration::impl::handle_transceiver_update (TransceiverState const& sta { TransceiverState reported_state {state}; // take off calibration & offset - reported_state.frequency (remove_calibration (reported_state.frequency ()) - current_offset_); + reported_state.frequency (remove_calibration (reported_state.frequency ())); if (reported_state.tx_frequency ()) { // take off calibration & offset - reported_state.tx_frequency (remove_calibration (reported_state.tx_frequency ()) - current_tx_offset_); + reported_state.tx_frequency (remove_calibration (reported_state.tx_frequency ())); } Q_EMIT self_->transceiver_update (reported_state); diff --git a/Configuration.hpp b/Configuration.hpp index 0821c45..c8547d5 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -162,6 +162,7 @@ public: FrequencyList_v2 const * frequencies () const; StationList * stations (); StationList const * stations () const; + bool auto_switch_bands() const; QStringListModel * macros (); QStringListModel const * macros () const; QDir save_directory () const; diff --git a/Configuration.ui b/Configuration.ui index e98e7c6..10000ac 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -556,15 +556,15 @@ true - - false - 0 0 + + false + Periodic CW ID Inter&val: @@ -578,15 +578,15 @@ true - - false - 0 0 + + false + Send a CW ID periodically every few minutes. This might be required under your countries licence regulations. @@ -2339,11 +2339,21 @@ for assessing propagation and system performance. - Station Information + Frequency Schedule - + + + + + Automatically switch bands / frequencies at specific times of day + + + + + false + Qt::ActionsContextMenu @@ -2693,268 +2703,267 @@ Right click for insert and delete options. - - -false - - - - - - false - - - Miscellaneous - - - - - - Degrade S/N of .wav file: - - - sbDegrade - - - - - - - For offline sensitivity tests - - - dB - - - 1 - - - 1.000000000000000 - - - - - - - Receiver bandwidth: - - - sbBandwidth - - - - - - - For offline sensitivity tests - - - Hz - - - 6000 - - - 100 - - - 2500 - - - - - - - Tx delay: - - - sbTxDelay - - - - - - - Minimum delay between assertion of PTT and start of Tx audio. - - - s - - - 1 - - - 0.000000000000000 - - - 0.500000000000000 - - - 0.100000000000000 - - - - - - - <html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html> - - - x 2 Tone Spacing - - - - - - - false - - - <html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html> - - - x 4 Tone Spacing - - - - - - - - - - false - - - <html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html> - - - JT65 VHF/UHF/Microwave decoding parameters - - - - - - Random erasure patterns: - - - sbNtrials - - - - - - - <html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html> - - - 0 - - - 12 - - - 6 - - - - - - - Aggressive decoding level: - - - sbAggressive - - - - - - - <html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html> - - - 10 - - - - - - - Two-pass decoding - - - true - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - false - - - - 0 - 50 - - - - FT8 DXpedition mode - - - - - 9 - 10 - 231 - 31 - - - - - - - Fox is the DXpedition station - - - Fox - - - - - - - Everybody else is a Hound - - - Hound - - - - - - - - - + + + false + + + + + + false + + + Miscellaneous + + + + + + Degrade S/N of .wav file: + + + sbDegrade + + + + + + + For offline sensitivity tests + + + dB + + + 1 + + + 1.000000000000000 + + + + + + + Receiver bandwidth: + + + sbBandwidth + + + + + + + For offline sensitivity tests + + + Hz + + + 6000 + + + 100 + + + 2500 + + + + + + + Tx delay: + + + sbTxDelay + + + + + + + Minimum delay between assertion of PTT and start of Tx audio. + + + s + + + 1 + + + 0.000000000000000 + + + 0.500000000000000 + + + 0.100000000000000 + + + + + + + <html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html> + + + x 2 Tone Spacing + + + + + + + false + + + <html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html> + + + x 4 Tone Spacing + + + + + + + + + false + + + <html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html> + + + JT65 VHF/UHF/Microwave decoding parameters + + + + + + Random erasure patterns: + + + sbNtrials + + + + + + + <html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html> + + + 0 + + + 12 + + + 6 + + + + + + + Aggressive decoding level: + + + sbAggressive + + + + + + + <html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html> + + + 10 + + + + + + + Two-pass decoding + + + true + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + false + + + + 0 + 50 + + + + FT8 DXpedition mode + + + + + 9 + 10 + 231 + 31 + + + + + + + Fox is the DXpedition station + + + Fox + + + + + + + Everybody else is a Hound + + + Hound + + + + + + + + + @@ -3135,11 +3144,11 @@ soundcard changes - - - - + + + + diff --git a/StationList.cpp b/StationList.cpp index cfd629e..bcd7cc9 100644 --- a/StationList.cpp +++ b/StationList.cpp @@ -28,7 +28,8 @@ QDebug operator << (QDebug debug, StationList::Station const& station) QDebugStateSaver saver {debug}; debug.nospace () << "Station(" << station.band_name_ << ", " - << station.offset_ << ", " + << station.frequency_ << ", " + << station.switch_at_ << ", " << station.antenna_description_ << ')'; return debug; } @@ -37,14 +38,16 @@ QDebug operator << (QDebug debug, StationList::Station const& station) QDataStream& operator << (QDataStream& os, StationList::Station const& station) { return os << station.band_name_ - << station.offset_ + << station.frequency_ + << station.switch_at_ << station.antenna_description_; } QDataStream& operator >> (QDataStream& is, StationList::Station& station) { return is >> station.band_name_ - >> station.offset_ + >> station.frequency_ + >> station.switch_at_ >> station.antenna_description_; } @@ -172,12 +175,6 @@ bool StationList::removeDisjointRows (QModelIndexList rows) return result; } -auto StationList::offset (Frequency f) const -> FrequencyDelta -{ - return m_->offset (f); -} - - auto StationList::impl::station_list (Stations stations) -> Stations { beginResetModel (); @@ -203,6 +200,7 @@ QModelIndex StationList::impl::add (Station s) return QModelIndex {}; } +#if 0 auto StationList::impl::offset (Frequency f) const -> FrequencyDelta { // Lookup band for frequency @@ -214,12 +212,13 @@ auto StationList::impl::offset (Frequency f) const -> FrequencyDelta { if (stations_[i].band_name_ == band) { - return stations_[i].offset_; + return stations_[i].frequency_; } } } return 0; // no offset } +#endif int StationList::impl::rowCount (QModelIndex const& parent) const { @@ -300,9 +299,9 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const } break; - case offset_column: + case frequency_column: { - auto frequency_offset = stations_.at (row).offset_; + auto frequency_offset = stations_.at (row).frequency_; switch (role) { case SortRole: @@ -317,7 +316,7 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const case Qt::ToolTipRole: case Qt::AccessibleDescriptionRole: - item = tr ("Frequency offset"); + item = tr ("Frequency"); break; case Qt::TextAlignmentRole: @@ -327,27 +326,48 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const } break; - case description_column: - switch (role) - { - case SortRole: - case Qt::EditRole: - case Qt::DisplayRole: - case Qt::AccessibleTextRole: - item = stations_.at (row).antenna_description_; - break; + case switch_column: + switch (role) + { + case SortRole: + case Qt::EditRole: + case Qt::DisplayRole: + case Qt::AccessibleTextRole: + item = stations_.at (row).switch_at_.toUTC().time().toString("hh:mm"); + break; - case Qt::ToolTipRole: - case Qt::AccessibleDescriptionRole: - item = tr ("Antenna description"); - break; + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("Switch at this time"); + break; - case Qt::TextAlignmentRole: - item = Qt::AlignLeft + Qt::AlignVCenter; - break; - } - break; - } + case Qt::TextAlignmentRole: + item = Qt::AlignCenter + Qt::AlignVCenter; + break; + } + break; + + case description_column: + switch (role) + { + case SortRole: + case Qt::EditRole: + case Qt::DisplayRole: + case Qt::AccessibleTextRole: + item = stations_.at (row).antenna_description_; + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("Antenna description"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignLeft + Qt::AlignVCenter; + break; + } + break; + } } return item; @@ -362,7 +382,8 @@ QVariant StationList::impl::headerData (int section, Qt::Orientation orientation switch (section) { case band_column: header = tr ("Band"); break; - case offset_column: header = tr ("Offset"); break; + case frequency_column: header = tr ("Freq. (MHz)"); break; + case switch_column: header = tr ("Switch at (UTC)"); break; case description_column: header = tr ("Antenna Description"); break; } } @@ -402,21 +423,33 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const& } break; - case offset_column: + case frequency_column: { - if (value.canConvert ()) + if (value.canConvert ()) { - FrequencyDelta offset {qvariant_cast (value)}; - if (offset != stations_[row].offset_) + Frequency offset {qvariant_cast (value)}; + + if(offset == 0){ + Frequency f; + if(bands_->findFreq(stations_[row].band_name_, &f)){ + offset = f; + } + } + + if (offset != stations_[row].frequency_) { - stations_[row].offset_ = offset; + stations_[row].frequency_ = offset; Q_EMIT dataChanged (model_index, model_index, roles); changed = true; } } } break; - + case switch_column: + stations_[row].switch_at_ = value.toDateTime(); + Q_EMIT dataChanged (model_index, model_index, roles); + changed = true; + break; case description_column: stations_[row].antenna_description_ = value.toString (); Q_EMIT dataChanged (model_index, model_index, roles); @@ -527,7 +560,7 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act , [&band] (Station const& s) {return s.band_name_ == band;})) { // not found so add it - add (Station {band, 0, QString {}}); + add (Station {band, 0, QDateTime::currentDateTimeUtc(), QString {}}); } } return true; diff --git a/StationList.hpp b/StationList.hpp index 25bf428..343f32f 100644 --- a/StationList.hpp +++ b/StationList.hpp @@ -2,6 +2,7 @@ #define STATION_LIST_HPP__ #include +#include #include #include @@ -52,13 +53,14 @@ public: struct Station { QString band_name_; - FrequencyDelta offset_; + Frequency frequency_; + QDateTime switch_at_; QString antenna_description_; }; using Stations = QList; - enum Column {band_column, offset_column, description_column}; + enum Column {band_column, frequency_column, switch_column, description_column}; explicit StationList (Bands const * bands, QObject * parent = nullptr); explicit StationList (Bands const * bands, Stations, QObject * parent = nullptr); @@ -74,7 +76,6 @@ public: QModelIndex add (Station); // Add a new Station bool remove (Station); // Remove a Station bool removeDisjointRows (QModelIndexList); // Remove one or more stations - FrequencyDelta offset (Frequency) const; // Return the offset to be used for a Frequency // Custom sort role. static int constexpr SortRole = Qt::UserRole; @@ -88,9 +89,10 @@ private: inline bool operator == (StationList::Station const& lhs, StationList::Station const& rhs) { - return lhs.band_name_ == rhs.band_name_ - && lhs.offset_ == rhs.offset_ - && lhs.antenna_description_ == rhs.antenna_description_; + return lhs.band_name_ == rhs.band_name_ && + //lhs.antenna_description_ == rhs.antenna_description_ && + lhs.frequency_ == rhs.frequency_ && + lhs.switch_at_ == rhs.switch_at_; } QDataStream& operator << (QDataStream&, StationList::Station const&); diff --git a/mainwindow.cpp b/mainwindow.cpp index 4392cd5..f036ef9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1348,6 +1348,33 @@ void MainWindow::on_the_minute () { tx_watchdog (false); } + + // see if we need to hop bands... + auto now = QDateTime::currentDateTimeUtc().time(); + Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ? + m_rigState.tx_frequency () : m_rigState.frequency ()}; + auto const& band_name = m_config.bands ()->find (dial_frequency); + auto stations = m_config.stations()->station_list(); + qSort(stations.begin(), stations.end(), [](StationList::Station const &a, StationList::Station const &b){ + return a.switch_at_ < b.switch_at_; + }); + + StationList::Station prev; + foreach(auto station, stations){ + if(station == stations.first()){ + prev = station; + continue; + } + + if(prev.switch_at_.time() <= now && now < station.switch_at_.time()){ + qDebug() << "switch to" << station.band_name_ << station.frequency_; + } + + prev = station; + } + if(prev.switch_at_.time() <= now && now < QTime(11, 59)){ + qDebug() << "switch to" << prev.band_name_ << prev.frequency_; + } } //--------------------------------------------------- MainWindow destructor