From fa73b3f50ec6ead52c3371a96f62bc6e666a9ee5 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sun, 4 Dec 2022 22:15:32 +0100 Subject: New upstream version 2.6.0~rc5+repack --- .gitattributes | 6 - .gitignore | 25 - Audio/soundin.cpp | 16 +- CMakeLists.txt | 5 +- Configuration.cpp | 296 +- Configuration.hpp | 6 +- MetaDataRegistry.cpp | 8 +- NEWS | 97 +- Network/MessageClient.cpp | 1 + Network/wsprnet.cpp | 5 +- Release_Notes.txt | 97 +- Transceiver/DXLabSuiteCommanderTransceiver.cpp | 11 +- Transceiver/PollingTransceiver.cpp | 4 + WSPR/WSPRBandHopping.hpp | 2 +- doc/CMakeLists.txt | 2 +- doc/user_guide/en/images/Echo_1296.png | Bin 0 -> 181262 bytes doc/user_guide/en/images/echo_144.png | Bin 15958 -> 0 bytes doc/user_guide/en/introduction.adoc | 3 +- doc/user_guide/en/new_features.adoc | 9 +- doc/user_guide/en/vhf-features.adoc | 68 +- item_delegates/MessageItemDelegate.cpp | 26 + item_delegates/MessageItemDelegate.hpp | 20 + lib/avecho.f90 | 47 +- lib/echosim.f90 | 54 +- lib/fst4_decode.f90 | 25 +- lib/ft8/ft8b.f90 | 8 +- lib/ft8/sync8.f90 | 54 +- lib/ft8_decode.f90 | 22 +- lib/symspec.f90 | 6 +- lib/testfast9.f90 | 6 +- map65/astro.cpp | 75 +- map65/astro.h | 6 +- map65/astro.ui | 236 +- map65/libm65/decode0.f90 | 5 +- map65/libm65/map65a.f90 | 12 +- map65/libm65/q65b.f90 | 2 + map65/main.cpp | 2 +- map65/mainwindow.cpp | 47 +- map65/mainwindow.h | 3 +- models/Bands.hpp | 2 +- models/FrequencyList.cpp | 891 +++-- models/FrequencyList.hpp | 90 +- models/StationList.cpp | 2 +- translations/wsjtx_ca.ts | 2 +- translations/wsjtx_es.ts | 2 +- translations/wsjtx_zh_HK.ts | 2 +- translations/wsjtx_zh_TW.ts | 2 +- validators/LiveFrequencyValidator.cpp | 2 +- validators/LiveFrequencyValidator.hpp | 6 +- widgets/BandComboBox.cpp | 2 +- widgets/displaytext.cpp | 19 +- widgets/displaytext.h | 7 +- widgets/mainwindow.cpp | 444 ++- widgets/mainwindow.h | 9 +- widgets/mainwindow.ui | 4207 ++++++++++++------------ widgets/plotter.cpp | 98 +- widgets/plotter.h | 8 + widgets/widegraph.cpp | 19 +- widgets/widegraph.h | 3 +- widgets/widegraph.ui | 5 + 60 files changed, 4417 insertions(+), 2722 deletions(-) delete mode 100755 .gitattributes delete mode 100755 .gitignore create mode 100755 doc/user_guide/en/images/Echo_1296.png delete mode 100755 doc/user_guide/en/images/echo_144.png create mode 100755 item_delegates/MessageItemDelegate.cpp create mode 100755 item_delegates/MessageItemDelegate.hpp diff --git a/.gitattributes b/.gitattributes deleted file mode 100755 index 07481d3d..00000000 --- a/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -.gitattributes export-ignore -/samples export-ignore -/lib/fsk4hf export-ignore -/lib/fsk4hf export-ignore -/robots export-ignore -/plots export-ignore diff --git a/.gitignore b/.gitignore deleted file mode 100755 index 3e9fde32..00000000 --- a/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -~* -TAGS -tags -GPATH -GRTAGS -GTAGS -*~ -junk* -jnq* -*.exe -*.o -*.mod -*.pro.user -*.txt -*.bak -!**/CMakeLists.txt -!**/*.txt -__pycache__ -cmake-build-debug -cmake-build-release -CMakeFiles -fnd -lib/77bit/tmp -lib/tmp -lib/ftrsd diff --git a/Audio/soundin.cpp b/Audio/soundin.cpp index 0503c665..affb8104 100755 --- a/Audio/soundin.cpp +++ b/Audio/soundin.cpp @@ -180,13 +180,15 @@ void SoundInput::reset (bool report_dropped_frames) if (cummulative_lost_usec_ != std::numeric_limits::min () && report_dropped_frames) { auto lost_usec = elapsed_usecs - m_stream->processedUSecs () - cummulative_lost_usec_; - if (std::abs (lost_usec) > 48000 / 5) - { - LOG_WARN ("Detected dropped audio source samples: " - << m_stream->format ().framesForDuration (lost_usec) - << " (" << std::setprecision (4) << lost_usec / 1.e6 << " S)"); - } - else if (std::abs (lost_usec) > 5 * 48000) + // disable log warnings on dropped audio for now, as detection is not reliable +// if (std::abs (lost_usec) > 48000 / 5) +// { +// LOG_WARN ("Detected dropped audio source samples: " +// << m_stream->format ().framesForDuration (lost_usec) +// << " (" << std::setprecision (4) << lost_usec / 1.e6 << " S)"); +// } +// else if (std::abs (lost_usec) > 5 * 48000) + if (std::abs (lost_usec) > 5 * 48000) { LOG_ERROR ("Detected excessive dropped audio source samples: " << m_stream->format ().framesForDuration (lost_usec) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b9ef3d3..58d2849e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ message (STATUS "******************************************************") include (set_build_type) # RC 0 or omitted is a development build, GA is a General Availability release build -set_build_type (RC 4) +set_build_type (RC 5) set (wsjtx_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${BUILD_TYPE_REVISION}") # @@ -80,7 +80,7 @@ set (wsjtx_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_ set (PROJECT_BUNDLE_NAME "WSJT-X") set (PROJECT_VENDOR "Joe Taylor, K1JT") set (PROJECT_CONTACT "Joe Taylor ") -set (PROJECT_COPYRIGHT "Copyright (C) 2001-2021 by Joe Taylor, K1JT") +set (PROJECT_COPYRIGHT "Copyright (C) 2001-2022 by Joe Taylor, K1JT") set (PROJECT_HOMEPAGE https://www.physics.princeton.edu/pulsar/K1JT/wsjtx.html) set (PROJECT_MANUAL wsjtx-main) set (PROJECT_MANUAL_DIRECTORY_URL https://www.physics.princeton.edu/pulsar/K1JT/wsjtx-doc/) @@ -190,6 +190,7 @@ set (wsjt_qt_CXXSRCS widgets/FrequencyDeltaLineEdit.cpp item_delegates/CandidateKeyFilter.cpp item_delegates/ForeignKeyDelegate.cpp + item_delegates/MessageItemDelegate.cpp validators/LiveFrequencyValidator.cpp GetUserId.cpp Audio/AudioDevice.cpp diff --git a/Configuration.cpp b/Configuration.cpp index 8e4320ef..74cf5344 100755 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -168,6 +168,11 @@ #include #include #include +#include +#include +#include +#include + #include "pimpl_impl.hpp" #include "Logger.hpp" @@ -180,6 +185,7 @@ #include "item_delegates/ForeignKeyDelegate.hpp" #include "item_delegates/FrequencyDelegate.hpp" #include "item_delegates/FrequencyDeltaDelegate.hpp" +#include "item_delegates/MessageItemDelegate.hpp" #include "Transceiver/TransceiverFactory.hpp" #include "Transceiver/Transceiver.hpp" #include "models/Bands.hpp" @@ -250,7 +256,8 @@ namespace // Magic numbers for file validation constexpr quint32 qrg_magic {0xadbccbdb}; - constexpr quint32 qrg_version {100}; // M.mm + constexpr quint32 qrg_version {101}; // M.mm + constexpr quint32 qrg_version_100 {100}; } @@ -263,13 +270,27 @@ class FrequencyDialog final Q_OBJECT public: - using Item = FrequencyList_v2::Item; + using Item = FrequencyList_v2_101::Item; explicit FrequencyDialog (IARURegions * regions_model, Modes * modes_model, QWidget * parent = nullptr) : QDialog {parent} { + start_date_time_edit_ = new QDateTimeEdit(QDateTime(QDate::currentDate(), QTime(0,0,0,0), Qt::UTC), parent); + end_date_time_edit_ = new QDateTimeEdit(QDateTime(QDate::currentDate().addDays(2), QTime(0,0,0,0), Qt::UTC), parent); + + enable_dates_checkbox_ = new QCheckBox {tr ("")}; + start_date_time_edit_->setDisplayFormat("yyyy.MM.dd hh:mm:ss 'UTC'"); + start_date_time_edit_->setTimeSpec(Qt::UTC); + start_date_time_edit_->setMinimumDate(QDate::currentDate().addDays(-365)); + + end_date_time_edit_->setDisplayFormat("yyyy.MM.dd hh:mm:ss 'UTC'"); + end_date_time_edit_->setTimeSpec(Qt::UTC); + end_date_time_edit_->setMinimumDate(QDate::currentDate().addDays(-365)); + preferred_frequency_checkbox_ = new QCheckBox {tr ("")}; + setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Frequency")); + region_combo_box_.setModel (regions_model); mode_combo_box_.setModel (modes_model); @@ -277,28 +298,74 @@ public: form_layout->addRow (tr ("IARU &Region:"), ®ion_combo_box_); form_layout->addRow (tr ("&Mode:"), &mode_combo_box_); form_layout->addRow (tr ("&Frequency (MHz):"), &frequency_line_edit_); + form_layout->addRow (tr ("&Preferred for Band/Mode:"), preferred_frequency_checkbox_); + form_layout->addRow (tr ("&Description:"), &description_line_edit_); + form_layout->addRow (tr ("&Enable Date Range:"), enable_dates_checkbox_); + form_layout->addRow (tr ("S&tart:"), start_date_time_edit_); + form_layout->addRow (tr ("&End:"), end_date_time_edit_); + form_layout->addRow (tr ("&Source:"), &source_line_edit_); auto main_layout = new QVBoxLayout (this); main_layout->addLayout (form_layout); - auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel}; + button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel}; main_layout->addWidget (button_box); connect (button_box, &QDialogButtonBox::accepted, this, &FrequencyDialog::accept); connect (button_box, &QDialogButtonBox::rejected, this, &FrequencyDialog::reject); + connect(start_date_time_edit_, &QDateTimeEdit::dateTimeChanged, this, &FrequencyDialog::checkSaneDates); + connect(end_date_time_edit_, &QDateTimeEdit::dateTimeChanged, this, &FrequencyDialog::checkSaneDates); + connect(enable_dates_checkbox_, &QCheckBox::stateChanged, this, &FrequencyDialog::toggleValidity); + toggleValidity(); } + void toggleValidity() + { + start_date_time_edit_->setEnabled(enable_dates_checkbox_->isChecked()); + end_date_time_edit_->setEnabled(enable_dates_checkbox_->isChecked()); + checkSaneDates(); + } + + void checkSaneDates() + { + if (enable_dates_checkbox_->isChecked() && start_date_time_edit_->dateTime().isValid() && end_date_time_edit_->dateTime().isValid()) + { + if (start_date_time_edit_->dateTime() > end_date_time_edit_->dateTime()) + { + QMessageBox::warning(this, tr("Invalid Date Range"), tr("Start date must be before end date")); + button_box->button(QDialogButtonBox::Ok)->setEnabled(false); + return; + } + } + button_box->button(QDialogButtonBox::Ok)->setEnabled(true); + } + Item item () const { - return {frequency_line_edit_.frequency () - , Modes::value (mode_combo_box_.currentText ()) - , IARURegions::value (region_combo_box_.currentText ())}; + QDateTime start_time = enable_dates_checkbox_->isChecked() ? start_date_time_edit_->dateTime() : QDateTime(); + QDateTime end_time = enable_dates_checkbox_->isChecked() ? end_date_time_edit_->dateTime() : QDateTime(); + return { + frequency_line_edit_.frequency(), + Modes::value(mode_combo_box_.currentText()), + IARURegions::value(region_combo_box_.currentText()), + description_line_edit_.text(), source_line_edit_.text(), + start_time, + end_time, + preferred_frequency_checkbox_->isChecked() + }; } private: QComboBox region_combo_box_; QComboBox mode_combo_box_; FrequencyLineEdit frequency_line_edit_; + QLineEdit description_line_edit_; + QLineEdit source_line_edit_; + QDialogButtonBox * button_box; + QCheckBox *enable_dates_checkbox_; + QCheckBox *preferred_frequency_checkbox_; + QDateTimeEdit *end_date_time_edit_; + QDateTimeEdit *start_date_time_edit_; }; @@ -375,31 +442,7 @@ public: }; -// -// Class MessageItemDelegate -// -// Item delegate for message entry such as free text message macros. -// -class MessageItemDelegate final - : public QStyledItemDelegate -{ -public: - explicit MessageItemDelegate (QObject * parent = nullptr) - : QStyledItemDelegate {parent} - { - } - QWidget * createEditor (QWidget * parent - , QStyleOptionViewItem const& /* option*/ - , QModelIndex const& /* index */ - ) const override - { - auto editor = new QLineEdit {parent}; - editor->setFrame (false); - editor->setValidator (new QRegularExpressionValidator {message_alphabet, editor}); - return editor; - } -}; // Internal implementation of the Configuration class. class Configuration::impl final @@ -477,7 +520,9 @@ private: void save_frequencies (); void reset_frequencies (); void insert_frequency (); - FrequencyList_v2::FrequencyItems read_frequencies_file (QString const&); + void size_frequency_table_columns(); + + FrequencyList_v2_101::FrequencyItems read_frequencies_file (QString const&); void delete_stations (); void insert_station (); @@ -569,8 +614,8 @@ private: IARURegions regions_; IARURegions::Region region_; Modes modes_; - FrequencyList_v2 frequencies_; - FrequencyList_v2 next_frequencies_; + FrequencyList_v2_101 frequencies_; + FrequencyList_v2_101 next_frequencies_; StationList stations_; StationList next_stations_; FrequencyDelta current_offset_; @@ -776,8 +821,8 @@ Bands const * Configuration::bands () const {return &m_->bands_;} StationList * Configuration::stations () {return &m_->stations_;} StationList const * Configuration::stations () const {return &m_->stations_;} IARURegions::Region Configuration::region () const {return m_->region_;} -FrequencyList_v2 * Configuration::frequencies () {return &m_->frequencies_;} -FrequencyList_v2 const * Configuration::frequencies () const {return &m_->frequencies_;} +FrequencyList_v2_101 * Configuration::frequencies () {return &m_->frequencies_;} +FrequencyList_v2_101 const * Configuration::frequencies () const {return &m_->frequencies_;} QStringListModel * Configuration::macros () {return &m_->macros_;} QStringListModel const * Configuration::macros () const {return &m_->macros_;} QDir Configuration::save_directory () const {return m_->save_directory_;} @@ -1045,7 +1090,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network throw std::runtime_error {"Failed to create save directory"}; } - // we now have a deafult save path that exists + // we now have a default save path that exists // make sure samples directory exists QString samples_dir {"samples"}; @@ -1194,20 +1239,23 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network // // setup working frequencies table model & view // - frequencies_.sort (FrequencyList_v2::frequency_column); + frequencies_.sort (FrequencyList_v2_101::frequency_column); ui_->frequencies_table_view->setModel (&next_frequencies_); ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); + ui_->frequencies_table_view->horizontalHeader ()->setResizeContentsPrecision (0); + ui_->frequencies_table_view->horizontalHeader ()->moveSection(8, 3); // swap preferred to be in front of description ui_->frequencies_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); ui_->frequencies_table_view->verticalHeader ()->setResizeContentsPrecision (0); - ui_->frequencies_table_view->sortByColumn (FrequencyList_v2::frequency_column, Qt::AscendingOrder); - ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2::frequency_mhz_column, true); + ui_->frequencies_table_view->sortByColumn (FrequencyList_v2_101::frequency_column, Qt::AscendingOrder); + ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2_101::frequency_mhz_column, true); + ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2_101::source_column, true); // delegates - ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::frequency_column, new FrequencyDelegate {this}); - ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::region_column, new ForeignKeyDelegate {®ions_, 0, this}); - ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::mode_column, new ForeignKeyDelegate {&modes_, 0, this}); + ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::frequency_column, new FrequencyDelegate {this}); + ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::region_column, new ForeignKeyDelegate {®ions_, 0, this}); + ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::mode_column, new ForeignKeyDelegate {&modes_, 0, this}); // actions frequency_delete_action_ = new QAction {tr ("&Delete"), ui_->frequencies_table_view}; @@ -1388,7 +1436,9 @@ void Configuration::impl::initialize_models () ui_->TX_audio_source_button_group->button (rig_params_.audio_source)->setChecked (true); ui_->CAT_poll_interval_spin_box->setValue (rig_params_.poll_interval); ui_->opCallEntry->setText (opCall_); + ui_->udp_server_line_edit->setEnabled(false); ui_->udp_server_line_edit->setText (udp_server_name_); + ui_->udp_server_line_edit->setEnabled(true); on_udp_server_line_edit_editingFinished (); ui_->udp_server_port_spin_box->setValue (udp_server_port_); load_network_interfaces (ui_->udp_interfaces_combo_box, udp_interface_names_); @@ -1450,6 +1500,13 @@ void Configuration::impl::done (int r) void Configuration::impl::read_settings () { SettingsGroup g {settings_, "Configuration"}; + LOG_INFO(QString{"Configuration Settings (%1)"}.arg(settings_->fileName())); + QStringList keys = settings_->allKeys(); + //Q_FOREACH (auto const& item, keys) + //{ + // LOG_INFO(QString{" %1 = %2"}.arg(item).arg(settings_->value(item).toString())); + //} + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); my_callsign_ = settings_->value ("MyCall", QString {}).toString (); @@ -1503,12 +1560,20 @@ void Configuration::impl::read_settings () region_ = settings_->value ("Region", QVariant::fromValue (IARURegions::ALL)).value (); - if (settings_->contains ("FrequenciesForRegionModes")) + LOG_INFO(QString{"Reading frequencies"}); + + if (settings_->contains ("FrequenciesForRegionModes_v2")) { - auto const& v = settings_->value ("FrequenciesForRegionModes"); + LOG_INFO(QString{"read_settings found FrequenciesForRegionModes_v2"}); + if (settings_->contains ("FrequenciesForRegionModes")) + { + LOG_INFO(QString{"read_settings ALSO found FrequenciesForRegionModes"}); + } + + auto const& v = settings_->value ("FrequenciesForRegionModes_v2"); if (v.isValid ()) { - frequencies_.frequency_list (v.value ()); + frequencies_.frequency_list (v.value ()); } else { @@ -1517,7 +1582,34 @@ void Configuration::impl::read_settings () } else { - frequencies_.reset_to_defaults (); + LOG_INFO(QString{"read_settings looking for FrequenciesForRegionModes"}); + if (settings_->contains ("FrequenciesForRegionModes")) // has the old ones. + { + LOG_INFO(QString{"found FrequenciesForRegionModes"}); + auto const& v = settings_->value("FrequenciesForRegionModes"); + LOG_INFO(QString{"v is %1"}.arg(v.typeName())); + if (v.isValid()) + { + LOG_INFO(QString{"read_settings found VALID FrequenciesForRegionModes"}); + FrequencyList_v2_101::FrequencyItems list; + FrequencyList_v2::FrequencyItems v100 = v.value(); + LOG_INFO(QString{"read_settings read %1 old_format items from FrequenciesForRegionModes"}.arg(v100.size())); + + Q_FOREACH (auto const& item, v100) + { + list << FrequencyList_v2_101::Item{item.frequency_, item.mode_, item.region_, QString(), QString(), QDateTime(), + QDateTime(), false}; + } + LOG_INFO(QString{"converted %1 items to FrequenciesForRegionModes_v2"}.arg(list.size())); + + frequencies_.frequency_list(list); + } + else + { + LOG_INFO(QString{"read_settings INVALID FrequenciesForRegionModes"}); + frequencies_.reset_to_defaults(); + } + } } stations_.station_list (settings_->value ("stations").value ()); @@ -1659,8 +1751,8 @@ void Configuration::impl::write_settings () settings_->setValue ("After73", id_after_73_); settings_->setValue ("TxQSYAllowed", tx_QSY_allowed_); settings_->setValue ("Macros", macros_.stringList ()); - settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ())); settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ())); + settings_->setValue ("FrequenciesForRegionModes_v2", QVariant::fromValue (frequencies_.frequency_list ())); settings_->setValue ("DecodeHighlighting", QVariant::fromValue (decode_highlighing_model_.items ())); settings_->setValue ("HighlightByMode", highlight_by_mode_); settings_->setValue ("OnlyFieldsSought", highlight_only_fields_); @@ -1987,7 +2079,6 @@ TransceiverFactory::ParameterPack Configuration::impl::gather_rig_data () void Configuration::impl::accept () { // Called when OK button is clicked. - if (!validate ()) { return; // not accepting @@ -2188,7 +2279,7 @@ void Configuration::impl::accept () if (frequencies_.frequency_list () != next_frequencies_.frequency_list ()) { frequencies_.frequency_list (next_frequencies_.frequency_list ()); - frequencies_.sort (FrequencyList_v2::frequency_column); + frequencies_.sort (FrequencyList_v2_101::frequency_column); } if (stations_.station_list () != next_stations_.station_list ()) @@ -2449,6 +2540,28 @@ void Configuration::impl::on_udp_server_line_edit_textChanged (QString const&) void Configuration::impl::on_udp_server_line_edit_editingFinished () { + if (this->isVisible()) + { + int q1,q2,q3,q4; + char tmpbuf[2]; + int n = sscanf(ui_->udp_server_line_edit->text ().trimmed ().toLatin1(), "%d.%d.%d.%d.%1s", &q1, &q2, &q3, &q4, tmpbuf); + const char *iperr; + switch(n) + { + case 0: iperr = "Error before first number";break; + case 1: iperr = "Error between first and second number";break; + case 2: iperr = "Error between second and third number";break; + case 3: iperr = "Error between third and fourth number";break; + case 4: iperr = ""; break; + case 5: iperr = "Invalid characters after IP address"; break; + default: iperr = "Unknown error parsing network address"; + } + if (n != 4) + { + MessageBox::warning_message (this, tr ("Error in network address"), tr (iperr)); + return; + } + if (udp_server_name_edited_) { auto const& server = ui_->udp_server_line_edit->text ().trimmed (); @@ -2468,6 +2581,7 @@ void Configuration::impl::on_udp_server_line_edit_editingFinished () check_multicast (ha); } } + } } void Configuration::impl::host_info_results (QHostInfo host_info) @@ -2508,17 +2622,25 @@ void Configuration::impl::check_multicast (QHostAddress const& ha) udp_server_name_edited_ = false; } +void Configuration::impl::size_frequency_table_columns() +{ + ui_->frequencies_table_view->setVisible(false); + ui_->frequencies_table_view->resizeColumnsToContents(); + ui_->frequencies_table_view->setVisible(true); +} + void Configuration::impl::delete_frequencies () { auto selection_model = ui_->frequencies_table_view->selectionModel (); selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); next_frequencies_.removeDisjointRows (selection_model->selectedRows ()); - ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2::mode_column); + ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2_101::mode_column); + size_frequency_table_columns (); } void Configuration::impl::load_frequencies () { - auto file_name = QFileDialog::getOpenFileName (this, tr ("Load Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg);;All files (*.*)")); + auto file_name = QFileDialog::getOpenFileName (this, tr ("Load Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg *.qrg.json);;All files (*.*)")); if (!file_name.isNull ()) { auto const list = read_frequencies_file (file_name); @@ -2532,24 +2654,42 @@ void Configuration::impl::load_frequencies () { next_frequencies_.frequency_list (list); // update the model } + size_frequency_table_columns(); } } void Configuration::impl::merge_frequencies () { - auto file_name = QFileDialog::getOpenFileName (this, tr ("Merge Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg);;All files (*.*)")); + auto file_name = QFileDialog::getOpenFileName (this, tr ("Merge Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg *.qrg.json);;All files (*.*)")); if (!file_name.isNull ()) { next_frequencies_.frequency_list_merge (read_frequencies_file (file_name)); // update the model + size_frequency_table_columns(); } } -FrequencyList_v2::FrequencyItems Configuration::impl::read_frequencies_file (QString const& file_name) +FrequencyList_v2_101::FrequencyItems Configuration::impl::read_frequencies_file (QString const& file_name) { QFile frequencies_file {file_name}; frequencies_file.open (QFile::ReadOnly); QDataStream ids {&frequencies_file}; - FrequencyList_v2::FrequencyItems list; + FrequencyList_v2_101::FrequencyItems list; + FrequencyList_v2::FrequencyItems list_v100; + + // read file as json if ends with qrg.json. + if (file_name.endsWith(".qrg.json", Qt::CaseInsensitive)) + { + try + { + list = FrequencyList_v2_101::from_json_file(&frequencies_file); + } + catch (ReadFileException const &e) + { + MessageBox::critical_message(this, tr("Error reading frequency file"), e.message_); + } + return list; + } + quint32 magic; ids >> magic; if (qrg_magic != magic) @@ -2568,8 +2708,20 @@ FrequencyList_v2::FrequencyItems Configuration::impl::read_frequencies_file (QSt } // de-serialize the data using version if necessary to - // handle old schemata - ids >> list; + // handle old schema + if (version == qrg_version_100) + { + ids >> list_v100; + Q_FOREACH (auto const& item, list_v100) + { + list << FrequencyList_v2_101::Item{item.frequency_, item.mode_, item.region_, QString(), QString(), QDateTime(), + QDateTime(), false}; + } + } + else + { + ids >> list; + } if (ids.status () != QDataStream::Ok || !ids.atEnd ()) { @@ -2577,18 +2729,21 @@ FrequencyList_v2::FrequencyItems Configuration::impl::read_frequencies_file (QSt list.clear (); return list; } - return list; } void Configuration::impl::save_frequencies () { - auto file_name = QFileDialog::getSaveFileName (this, tr ("Save Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg);;All files (*.*)")); + auto file_name = QFileDialog::getSaveFileName (this, tr ("Save Working Frequencies"), writeable_data_dir_.absolutePath (), tr ("Frequency files (*.qrg *.qrg.json);;All files (*.*)")); if (!file_name.isNull ()) { + bool b_write_json = file_name.endsWith(".qrg.json", Qt::CaseInsensitive); + QFile frequencies_file {file_name}; frequencies_file.open (QFile::WriteOnly); + QDataStream ods {&frequencies_file}; + auto selection_model = ui_->frequencies_table_view->selectionModel (); if (selection_model->hasSelection () && MessageBox::Yes == MessageBox::query_message (this @@ -2598,11 +2753,28 @@ void Configuration::impl::save_frequencies () "Click No to save all."))) { selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - ods << qrg_magic << qrg_version << next_frequencies_.frequency_list (selection_model->selectedRows ()); + if (b_write_json) + { + next_frequencies_.to_json_file(&frequencies_file, "0x" + QString::number(qrg_magic, 16).toUpper(), + "0x" + QString::number(qrg_version, 16).toUpper(), + next_frequencies_.frequency_list(selection_model->selectedRows())); + } else + { + ods << qrg_magic << qrg_version << next_frequencies_.frequency_list(selection_model->selectedRows()); + } } else { - ods << qrg_magic << qrg_version << next_frequencies_.frequency_list (); + if (b_write_json) + { + next_frequencies_.to_json_file(&frequencies_file, + "0x" + QString::number(qrg_magic, 16).toUpper(), + "0x" + QString::number(qrg_version, 16).toUpper(), + next_frequencies_.frequency_list()); + } else + { + ods << qrg_magic << qrg_version << next_frequencies_.frequency_list(); + } } } } @@ -2616,6 +2788,7 @@ void Configuration::impl::reset_frequencies () { next_frequencies_.reset_to_defaults (); } + size_frequency_table_columns (); } void Configuration::impl::insert_frequency () @@ -2623,7 +2796,8 @@ void Configuration::impl::insert_frequency () if (QDialog::Accepted == frequency_dialog_->exec ()) { ui_->frequencies_table_view->setCurrentIndex (next_frequencies_.add (frequency_dialog_->item ())); - ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2::mode_column); + ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2_101::mode_column); + size_frequency_table_columns(); } } diff --git a/Configuration.hpp b/Configuration.hpp index a4a41010..bf9ca3a4 100755 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -18,7 +18,7 @@ class QAudioDeviceInfo; class QDir; class QNetworkAccessManager; class Bands; -class FrequencyList_v2; +class FrequencyList_v2_101; class StationList; class QStringListModel; class LotWUsers; @@ -164,8 +164,8 @@ public: Bands * bands (); Bands const * bands () const; IARURegions::Region region () const; - FrequencyList_v2 * frequencies (); - FrequencyList_v2 const * frequencies () const; + FrequencyList_v2_101 * frequencies (); + FrequencyList_v2_101 const * frequencies () const; StationList * stations (); StationList const * stations () const; QStringListModel * macros (); diff --git a/MetaDataRegistry.cpp b/MetaDataRegistry.cpp index 64e35c76..7acfc6f4 100755 --- a/MetaDataRegistry.cpp +++ b/MetaDataRegistry.cpp @@ -52,9 +52,13 @@ void register_types () item_editor_factory->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); - // Frequency list model + // V101 Frequency list model + qRegisterMetaTypeStreamOperators ("Item_v2_101"); + QMetaType::registerConverter (&FrequencyList_v2_101::Item::toString); + qRegisterMetaTypeStreamOperators ("FrequencyItems_v2_101"); + + // V100 Frequency list model qRegisterMetaTypeStreamOperators ("Item_v2"); - QMetaType::registerConverter (&FrequencyList_v2::Item::toString); qRegisterMetaTypeStreamOperators ("FrequencyItems_v2"); // defunct old versions diff --git a/NEWS b/NEWS index 41a177c7..e34a4705 100755 --- a/NEWS +++ b/NEWS @@ -11,11 +11,106 @@ Copyright 2001 - 2022 by Joe Taylor, K1JT, and the WSJT Development Team + Release: WSJT-X 2.6.0-rc5 + November 29, 2022 + ------------------------- + +WSJT-X 2.6.0 Release Candidate 5 brings a number of improvements as +well as some bug fixes. + +In program WSJT-X: + + - Better calibration for FST4/W SNR estimates. + + - Upload FST4W-900 spots to wsprnet with TR code 15 instead of 16. + + - Improved FT8 decoding on crowded bands. + + - The Working frequency table now offers the following options: + - Better handling of more than one frequency per band. + - Set your preferred frequencies, WSJT-X always comes back to these + QRGs when changing band or mode. + - You can label your frequencies with descriptions (e.g. DXp AB0YXZ). + - Option to set Start and End Date/Time, so that the frequencies + automatically appear and disappear. Useful for contest or + DXpedition QRGs. + - Load a frequency table from a file to easily get all such data + implemented. + + - In Fox mode, there are now a few additional functions that allow + operators to react even better to different QSO situations: + - A new two-column table in Tab 2 provides a better overview of + the queue and of the callsigns with QSOs in progress. + - Fox operator can now change the ordering of callsigns in the + queue so that he can react if there is only a narrow time slot + for a particular QSO due to propagation. + - Fox now responds for another two cycles to stations whose + report was not received, increasing the success rate for a + difficult QSO. + + - Correct a flaw in Hound mode that sometimes prevented completion of + QSOs with non-standard calls. + + - Improvements to EME Echo mode: + - New control "Avg" sets the number of Echo cycles to be averaged. + - New capability to display measurements of wideband noise power as + a function of time. This can be useful for measuring Sun noise, + antenna tracking errors, and the like. + - Several minor bug fixes + + - Correct a flaw that prevented WSJT-X from always initializing + correctly when special operating activities were enabled. + + - Correct a flaw that caused wrong Tx frequencies to be written to + ALL.TXT. + + - The GUI has been improved regarding some details. The controls now + scale better at different font sizes and on different operating + systems. + + - When in Hound mode and click the "H" button again, the frequency + is now kept. This gives the user the following two options to return + to normal FT8 mode: + - Click the "H" button again. Then you will stay on the QRG. + - Click the "FT8" button (or use the Settings menu). It brings + you back to the default FT8 QRG. + + - Decodes flagged as 'a7' are now disabled when "Enable AP" is not + checked, and during the first period after a band change. + + - The network address of the UDP server is now checked for errors + before being accepted. + + - Some improvements to the DX Lab Suite Commander interface. + + - Correct some possible flaws that could cause segfault errors in + certain unusual situations. + + - Warnings on dropped audio have been disabled for now, as detection + has turned out to be not reliable enough. + + - Correct a long-standing flaw which caused the "Transmit digital gain" + overlay to appear somewhere on the screen. + + - "Highlight DX Call" now also works when the other station is <...>. + + - CQ messages without a grid are now sent to PSK reporter. + + - Several other minor corrections (tool tips, etc.). + +Program MAP65 (Windows only) includes several minor bug fixes and two +tentative new features: + - an aid for measuring antenna pointing errors + - an ability to read the file wsjtx.log (kept by WSJT-X) to recognize + EME contest dupes. + + Release: WSJT-X 2.6.0-rc4 September 8, 2022 ------------------------- -WSJT-X 2.6.0 Release Candidate 4 provides further improvements to Echo mode, a new File menu item, and several bug fixes. +WSJT-X 2.6.0 Release Candidate 4 provides further improvements to Echo +mode, a new File menu item, and several bug fixes. - New features and fixes for Echo mode - Created a new simulator echosim[.exe] diff --git a/Network/MessageClient.cpp b/Network/MessageClient.cpp index 57df6665..aa26fa1f 100755 --- a/Network/MessageClient.cpp +++ b/Network/MessageClient.cpp @@ -137,6 +137,7 @@ void MessageClient::impl::host_info_results (QHostInfo host_info) if (QHostInfo::NoError != host_info.error ()) { Q_EMIT self_->error ("UDP server DNS lookup failed: " + host_info.errorString ()); + return; } else { diff --git a/Network/wsprnet.cpp b/Network/wsprnet.cpp index 4f3bc9a0..ec4ed9e4 100755 --- a/Network/wsprnet.cpp +++ b/Network/wsprnet.cpp @@ -278,9 +278,10 @@ QString WSPRNet::encode_mode () const if (m_mode == "FST4W") { auto tr = static_cast ((TR_period_ / 60.)+.5); - if (2 == tr || 15 == tr) +// if (2 == tr || 15 == tr) + if (2 == tr) { - tr += 1; // distinguish from WSPR-2 and WSPR-15 + tr += 1; // distinguish from WSPR-2 } return QString::number (tr); } diff --git a/Release_Notes.txt b/Release_Notes.txt index effe6249..34291697 100755 --- a/Release_Notes.txt +++ b/Release_Notes.txt @@ -11,11 +11,106 @@ Copyright 2001 - 2022 by Joe Taylor, K1JT, and the WSJT Development Team + Release: WSJT-X 2.6.0-rc5 + November 29, 2022 + ------------------------- + +WSJT-X 2.6.0 Release Candidate 5 brings a number of improvements as +well as some bug fixes. + +In program WSJT-X: + + - Better calibration for FST4/W SNR estimates. + + - Upload FST4W-900 spots to wsprnet with TR code 15 instead of 16. + + - Improved FT8 decoding on crowded bands. + + - The Working frequency table now offers the following options: + - Better handling of more than one frequency per band. + - Set your preferred frequencies, WSJT-X always comes back to these + QRGs when changing band or mode. + - You can label your frequencies with descriptions (e.g. DXp AB0YXZ). + - Option to set Start and End Date/Time, so that the frequencies + automatically appear and disappear. Useful for contest or + DXpedition QRGs. + - Load a frequency table from a file to easily get all such data + implemented. + + - In Fox mode, there are now a few additional functions that allow + operators to react even better to different QSO situations: + - A new two-column table in Tab 2 provides a better overview of + the queue and of the callsigns with QSOs in progress. + - Fox operator can now change the ordering of callsigns in the + queue so that he can react if there is only a narrow time slot + for a particular QSO due to propagation. + - Fox now responds for another two cycles to stations whose + report was not received, increasing the success rate for a + difficult QSO. + + - Correct a flaw in Hound mode that sometimes prevented completion of + QSOs with non-standard calls. + + - Improvements to EME Echo mode: + - New control "Avg" sets the number of Echo cycles to be averaged. + - New capability to display measurements of wideband noise power as + a function of time. This can be useful for measuring Sun noise, + antenna tracking errors, and the like. + - Several minor bug fixes + + - Correct a flaw that prevented WSJT-X from always initializing + correctly when special operating activities were enabled. + + - Correct a flaw that caused wrong Tx frequencies to be written to + ALL.TXT. + + - The GUI has been improved regarding some details. The controls now + scale better at different font sizes and on different operating + systems. + + - When in Hound mode and click the "H" button again, the frequency + is now kept. This gives the user the following two options to return + to normal FT8 mode: + - Click the "H" button again. Then you will stay on the QRG. + - Click the "FT8" button (or use the Settings menu). It brings + you back to the default FT8 QRG. + + - Decodes flagged as 'a7' are now disabled when "Enable AP" is not + checked, and during the first period after a band change. + + - The network address of the UDP server is now checked for errors + before being accepted. + + - Some improvements to the DX Lab Suite Commander interface. + + - Correct some possible flaws that could cause segfault errors in + certain unusual situations. + + - Warnings on dropped audio have been disabled for now, as detection + has turned out to be not reliable enough. + + - Correct a long-standing flaw which caused the "Transmit digital gain" + overlay to appear somewhere on the screen. + + - "Highlight DX Call" now also works when the other station is <...>. + + - CQ messages without a grid are now sent to PSK reporter. + + - Several other minor corrections (tool tips, etc.). + +Program MAP65 (Windows only) includes several minor bug fixes and two +tentative new features: + - an aid for measuring antenna pointing errors + - an ability to read the file wsjtx.log (kept by WSJT-X) to recognize + EME contest dupes. + + Release: WSJT-X 2.6.0-rc4 September 8, 2022 ------------------------- -WSJT-X 2.6.0 Release Candidate 4 provides further improvements to Echo mode, a new File menu item, and several bug fixes. +WSJT-X 2.6.0 Release Candidate 4 provides further improvements to Echo +mode, a new File menu item, and several bug fixes. - New features and fixes for Echo mode - Created a new simulator echosim[.exe] diff --git a/Transceiver/DXLabSuiteCommanderTransceiver.cpp b/Transceiver/DXLabSuiteCommanderTransceiver.cpp index 9925506a..22fe7bc0 100755 --- a/Transceiver/DXLabSuiteCommanderTransceiver.cpp +++ b/Transceiver/DXLabSuiteCommanderTransceiver.cpp @@ -437,15 +437,14 @@ QString DXLabSuiteCommanderTransceiver::command_with_reply (QString const& cmd) }; } - auto result = commander_->readAll (); - // qDebug () << "result: " << result; - // for (int i = 0; i < result.size (); ++i) - // { - // qDebug () << i << ":" << hex << int (result[i]); - // } + QString result = commander_->readAll (); + if (result != NULL) + { CAT_TRACE (cmd << " -> " << QString {result}); return result; // converting raw UTF-8 bytes to QString + } + return ""; } bool DXLabSuiteCommanderTransceiver::write_to_port (QString const& s) diff --git a/Transceiver/PollingTransceiver.cpp b/Transceiver/PollingTransceiver.cpp index cb4c309d..6a0b8ffc 100755 --- a/Transceiver/PollingTransceiver.cpp +++ b/Transceiver/PollingTransceiver.cpp @@ -117,6 +117,10 @@ void PollingTransceiver::do_post_ptt (bool p) retries_ = polls_to_stabilize; //retries_ = 0; // fast feedback on PTT } + else + { + next_state_.ptt(p); // ensure this is initialized + } } bool PollingTransceiver::do_pre_update () diff --git a/WSPR/WSPRBandHopping.hpp b/WSPR/WSPRBandHopping.hpp index 7c438bdf..045bc0d7 100755 --- a/WSPR/WSPRBandHopping.hpp +++ b/WSPR/WSPRBandHopping.hpp @@ -41,7 +41,7 @@ class QWidget; // storage using the provided QSettings object instance. // // A passed in Configuration object instance is used to query the -// FrequencyList_v2 model to determine working frequencies for each +// FrequencyList_v2_101 model to determine working frequencies for each // band. The row index of this model is returned by this classes // hopping scheduling method so it may be conveniently used to select // a new working frequency by a client. diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index fe067dc5..b9b22781 100755 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -72,7 +72,7 @@ set (UG_IMGS images/config-menu.png images/decode-menu.png images/download_samples.png - images/echo_144.png + images/Echo_1296.png images/EME_Deep_0.png images/EME_Deep_1.png images/EME_Deep_2.png diff --git a/doc/user_guide/en/images/Echo_1296.png b/doc/user_guide/en/images/Echo_1296.png new file mode 100755 index 00000000..e33af55a Binary files /dev/null and b/doc/user_guide/en/images/Echo_1296.png differ diff --git a/doc/user_guide/en/images/echo_144.png b/doc/user_guide/en/images/echo_144.png deleted file mode 100755 index 77f80e97..00000000 Binary files a/doc/user_guide/en/images/echo_144.png and /dev/null differ diff --git a/doc/user_guide/en/introduction.adoc b/doc/user_guide/en/introduction.adoc index 0d2561d7..6a5c84e4 100755 --- a/doc/user_guide/en/introduction.adoc +++ b/doc/user_guide/en/introduction.adoc @@ -70,7 +70,8 @@ provides a mapping facility, archival storage, and many other features. *Echo* mode allows you to detect and measure your own station's echoes -from the moon, even if they are far below the audible threshold. +from the moon and to make other measurements useful for optimizing +your EME station's performance. _WSJT-X_ provides spectral displays for receiver passbands as wide as 5 kHz, flexible rig control for nearly all modern radios used by diff --git a/doc/user_guide/en/new_features.adoc b/doc/user_guide/en/new_features.adoc index 77a0373a..e6f1ff40 100755 --- a/doc/user_guide/en/new_features.adoc +++ b/doc/user_guide/en/new_features.adoc @@ -15,10 +15,11 @@ that station. of situations with available _a priori_ (AP) information. - *Echo* mode now offers a *Clear Avg* button and produces reliable -measurements of SNR even when Doppler spread is large. The *Measure* -function can be used to measure SNR for a received unmodulated carrier --- for example, a key-down test signal emitted by another station and -reflected from the Moon. +measurements of SNR even when Doppler spread is large. Its *Monitor* +function can be used to measure SNR for a received unmodulated +carrier such as a key-down test signal emitted by another station and +reflected from the Moon, and to measure Sun, Moon, and ground noise as +aids for optimizing an EME station's performance. - New buttons on the main window allow quick changes between modes FT4, FT8, MSK144, Q65, and JT65. Another new button allows toggling diff --git a/doc/user_guide/en/vhf-features.adoc b/doc/user_guide/en/vhf-features.adoc index 44d7cdb3..4e1f75c4 100755 --- a/doc/user_guide/en/vhf-features.adoc +++ b/doc/user_guide/en/vhf-features.adoc @@ -280,37 +280,43 @@ being readable by anyone listening in. === Echo Mode -*Echo* mode allows you to make sensitive measurements of your own -lunar echoes even when they are too weak to be heard. Select *Echo* -from the *Mode* menu, aim your antenna at the moon, pick a clear -frequency, and toggle click *Tx Enable*. _WSJT-X_ will then cycle -through the following loop every 6 seconds: - -1. Transmit a 1500 Hz fixed tone for 2.3 s -2. Wait about 0.2 s for start of the return echo -3. Record the received signal for 2.3 s -4. Analyze, average, and display the results -5. Repeat from step 1 - -To make a sequence of echo tests: - -- Select *Echo* from the *Mode* menu. - -- Check *Doppler tracking* and *Constant frequency on the Moon* on the -Astronomical Data window. - -- Be sure that your rig control has been set up for _Split Operation_, -using either *Rig* or *Fake It* on the *Settings | Radio* tab. - -- Click *Enable Tx* on the main window to start a sequence of 6-second -cycles. - -- _WSJT-X_ calculates and compensates for Doppler shift automatically. -As shown in the screen shot below, when proper Doppler corrections -have been applied your return echo should always appear at the center -of the plot area on the Echo Graph window. - -image::echo_144.png[align="center",alt="Echo 144 MHz"] +*Echo* mode provides tools for two types of measurements: echoes of +your transmitted signal from the Moon, and broadband noise power +received from the Sun, Moon, and possibly other sources including +nearby ground. In each case the system noise temperature (noise power +referred to the antenna terminals, expressed in Kelvin degrees) serves +as the reference noise level. Such measurements are widely used for +optimizing a station's capabilities for Earth-Moon-Earth (EME) +communication. + +For lunar echoes, _WSJT_ generates short fixed-frequency transmissions +that alternate with reception intervals at the appropriate +Doppler-shifted frequency. With *Split Operation* set to *Rig* or +*Fake It* on the *Settings | Radio* tab, check *Doppler tracking* and +*Own Echo* on the Astronomical Data window. Point your antenna at the +Moon and click *Enable Tx* on the main window to start a sequence of +echo measurements. Each cycle takes 6 seconds. If strong enough, +echoes will be visible in the waterfall. Their average spectrum will +be displayed in the Echo Graph window, and numerical parameters of the +measurements appear in the main window: + +image::Echo_1296.png[align="center",alt="Echo 144 MHz"] + +At the end of each echo cycle a line of data in the main text window +displays the following information: + + UTC Time in hhmmss format + Hour UTC in hours and decimal fraction + Level Relative received noise power (dB) + Doppler EME Doppler shift at center of lunar disk + Width EME Doppler spread over full lunar disk + N Number of accumulated echo or monitor cycles + Q Estimated quality of averaged data on a 0 – 10 scale + DF Offset of spectral peak from 1500 Hz + SNR Average signal-to-noise ratio (dB/2500 Hz) + dBerr Estimated uncertainty of SNR + +... more to come ... === Tips for EME diff --git a/item_delegates/MessageItemDelegate.cpp b/item_delegates/MessageItemDelegate.cpp new file mode 100755 index 00000000..c1864f62 --- /dev/null +++ b/item_delegates/MessageItemDelegate.cpp @@ -0,0 +1,26 @@ +// +// Moved from Configuration.cpp +// + +#include "MessageItemDelegate.hpp" + +#include +#include + +// +// Class MessageItemDelegate +// +// Item delegate for message entry such as free text message macros. +// +MessageItemDelegate::MessageItemDelegate(QObject *parent): QStyledItemDelegate{parent} +{ +} + +QWidget *MessageItemDelegate::createEditor(QWidget *parent, QStyleOptionViewItem const &, QModelIndex const &) const +{ + QRegularExpression message_alphabet{"[- @A-Za-z0-9+./?#<>;$]*"}; + auto editor = new QLineEdit{parent}; + editor->setFrame(false); + editor->setValidator(new QRegularExpressionValidator{message_alphabet, editor}); + return editor; +} diff --git a/item_delegates/MessageItemDelegate.hpp b/item_delegates/MessageItemDelegate.hpp new file mode 100755 index 00000000..6058f80a --- /dev/null +++ b/item_delegates/MessageItemDelegate.hpp @@ -0,0 +1,20 @@ +// +// +// + +#ifndef WSJTX_MESSAGEITEMDELEGATE_H +#define WSJTX_MESSAGEITEMDELEGATE_H + +#include + +class MessageItemDelegate: public QStyledItemDelegate + { + Q_OBJECT + +public: + explicit MessageItemDelegate(QObject *parent = nullptr); + QWidget *createEditor(QWidget *parent, QStyleOptionViewItem const & /* option*/ + , QModelIndex const & /* index */ + ) const override; +}; +#endif //WSJTX_MESSAGEITEMDELEGATE_H diff --git a/lib/avecho.f90 b/lib/avecho.f90 index 4b078f71..7b499a05 100755 --- a/lib/avecho.f90 +++ b/lib/avecho.f90 @@ -1,5 +1,5 @@ -subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & - dfreq,width,bDiskData) +subroutine avecho(id2,ndop,nfrit,nauto,navg,nqual,f1,xlevel,snrdb, & + db_err,dfreq,width,bDiskData) integer TXLENGTH parameter (TXLENGTH=27648) !27*1024 @@ -8,6 +8,8 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & integer*2 id2(34560) !Buffer for Rx data real sa(NZ) !Avg spectrum relative to initial Doppler echo freq real sb(NZ) !Avg spectrum with Dither and changing Doppler removed + real, dimension (:,:), allocatable :: sax + real, dimension (:,:), allocatable :: sbx integer nsum !Number of integrations real dop0 !Doppler shift for initial integration (Hz) real dop !Doppler shift for current integration (Hz) @@ -20,8 +22,18 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & equivalence (x,c),(ipk,ipkv) common/echocom/nclearave,nsum,blue(NZ),red(NZ) common/echocom2/fspread_self,fspread_dx - save dop0,sa,sb + data navg0/-1/ + save dop0,navg0,sax,sbx + if(navg.ne.navg0) then + if(allocated(sax)) deallocate(sax) + if(allocated(sbx)) deallocate(sbx) + allocate(sax(1:navg,1:NZ)) + allocate(sbx(1:navg,1:NZ)) + nsum=0 + navg0=navg + endif + fspread=fspread_dx !### Use the predicted Doppler spread ### if(bDiskData) fspread=width if(nauto.eq.1) fspread=fspread_self @@ -44,8 +56,8 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & if(nclearave.ne.0) nsum=0 if(nsum.eq.0) then dop0=dop !Remember the initial Doppler - sa=0. !Clear the average arrays - sb=0. + sax=0. !Clear the average arrays + sbx=0. endif x(TXLENGTH+1:)=0. @@ -67,10 +79,14 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & endif nsum=nsum+1 + j=mod(nsum-1,navg)+1 do i=1,NZ - sa(i)=sa(i) + s(ia+i-2048) !Center at initial doppler freq - sb(i)=sb(i) + s(ib+i-2048) !Center at expected echo freq + sax(j,i)=s(ia+i-2048) !Center at initial doppler freq + sbx(j,i)=s(ib+i-2048) !Center at expected echo freq + sa(i)=sum(sax(1:navg,i)) + sb(i)=sum(sbx(1:navg,i)) enddo + call echo_snr(sa,sb,fspread,blue,red,snrdb,db_err,dfreq,snr_detect) nqual=snr_detect-2 if(nqual.lt.0) nqual=0 @@ -87,12 +103,17 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & call smo121(blue,NZ) enddo - ia=200.0/df - ib=400.0/df - call pctile(red(ia:ib),ib-ia+1,50,bred) - red=red-bred - call pctile(blue(ia:ib),ib-ia+1,50,bblue) - blue=blue-bblue + ia=50.0/df + ib=250.0/df + call pctile(red(ia:ib),ib-ia+1,50,bred1) + call pctile(blue(ia:ib),ib-ia+1,50,bblue1) + ia=1250.0/df + ib=1450.0/df + call pctile(red(ia:ib),ib-ia+1,50,bred2) + call pctile(blue(ia:ib),ib-ia+1,50,bblue2) + + red=red-0.5*(bred1+bred2) + blue=blue-0.5*(bblue1+bblue2) 900 call sleep_msec(10) !Avoid the "blue Decode button" syndrome return diff --git a/lib/echosim.f90 b/lib/echosim.f90 index eeac4bd8..88477a21 100755 --- a/lib/echosim.f90 +++ b/lib/echosim.f90 @@ -8,7 +8,7 @@ program echosim character arg*12,fname*17 complex c0(0:NMAX-1) complex c(0:NMAX-1) -! complex cwave(0:NWAVE-1) + real*4 level_1,level_2 real*8 f0,dt,twopi,phi,dphi real wave(NZ) integer*2 iwave(NZ) !Generated full-length waveform @@ -20,9 +20,11 @@ program echosim ! Get command-line argument(s) nargs=iargc() - if(nargs.ne.5) then - print*,'Usage: echosim f0 fdop fspread nfiles snr' - print*,'Examples: echosim 1500 0.0 4.0 10 -22' + if(nargs.ne.3 .and. nargs.ne.5) then + print*,'Usage 1: echosim f0 fdop fspread nfiles snr' + print*,'Example: echosim 1500 0.0 4.0 10 -22' + print*,'Usage 2: echosim level_1 level_2 nfiles' + print*,'Example: echosim 30.0 40.0 100' go to 999 endif @@ -32,12 +34,21 @@ program echosim read(arg,*) fdop !Doppler shift (Hz) call getarg(3,arg) read(arg,*) fspread !Frequency spread (Hz) (JHT Lorentzian model) + + if(nargs.eq.3) then + level_1=f0 + level_2=fdop + nfiles=fspread + snrdb=0. + go to 10 + endif + call getarg(4,arg) read(arg,*) nfiles !Number of files call getarg(5,arg) read(arg,*) snrdb !SNR_2500 - twopi=8.d0*atan(1.d0) +10 twopi=8.d0*atan(1.d0) fs=12000.0 !Sample rate (Hz) dt=1.d0/fs !Sample interval (s) bandwidth_ratio=2500.0/(fs/2.0) @@ -49,18 +60,23 @@ program echosim 1000 format(' N f0 fDop fSpread SNR File name'/51('-')) do ifile=1,nfiles - phi=0.d0 - do i=0,NWAVE-1 - phi=phi + dphi - if(phi.gt.twopi) phi=phi-twopi - xphi=phi - c0(i)=cmplx(cos(xphi),sin(xphi)) - enddo - c0(NWAVE:)=0. - if(fspread.gt.0.0) call fspread_lorentz(c0,fspread) - c=sig*c0 - wave(1:NWAVE)=imag(c(1:NWAVE)) - peak=maxval(abs(wave)) + wave=0. + + if(nargs.eq.5) then + phi=0.d0 + do i=0,NWAVE-1 + phi=phi + dphi + if(phi.gt.twopi) phi=phi-twopi + xphi=phi + c0(i)=cmplx(cos(xphi),sin(xphi)) + enddo + c0(NWAVE:)=0. + if(fspread.gt.0.0) call fspread_lorentz(c0,fspread) + c=sig*c0 + wave(1:NWAVE)=imag(c(1:NWAVE)) + peak=maxval(abs(wave)) + endif + if(snrdb.lt.90) then do i=1,NWAVE !Add gaussian noise at specified SNR xnoise=gran() @@ -73,6 +89,10 @@ program echosim endif gain=100.0 + if(nargs.eq.3) then + gain=10.0**(0.05*level_1) + if(mod((ifile-1)/10,2).eq.1) gain=10.0**(0.05*level_2) + endif if(snrdb.lt.90.0) then wave=gain*wave else diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index 4245ad91..d3b8af73 100755 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -586,13 +586,26 @@ contains xsig=xsig+s4(itone(i),i) enddo base=candidates(icand,5) - arg=600.0*(xsig/base)-1.0 + select case(ntrperiod) + case(15) + snr_calfac=800.0 + case(30) + snr_calfac=600.0 + case(60) + snr_calfac=430.0 + case(120) + snr_calfac=390.0 + case(300) + snr_calfac=340.0 + case(900) + snr_calfac=320.0 + case(1800) + snr_calfac=320.0 + case default + end select + arg=snr_calfac*xsig/base - 1.0 if(arg.gt.0.0) then - xsnr=10*log10(arg)-35.5-12.5*log10(nsps/8200.0) - if(ntrperiod.eq. 15) xsnr=xsnr+2 - if(ntrperiod.eq. 30) xsnr=xsnr+1 - if(ntrperiod.eq. 900) xsnr=xsnr+1 - if(ntrperiod.eq.1800) xsnr=xsnr+2 + xsnr=10*log10(arg)+10*log10(1.46/2500)+10*log10(8200.0/nsps) else xsnr=-99.9 endif diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 36ae1283..75b17adf 100755 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -287,6 +287,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & ! 5 : WW_DIGI ! 6 : FOX ! 7 : HOUND +! 8 : ARRL_DIGI ! ! Conditions that cause us to bail out of AP decoding if(ncontest.le.5 .and. iaptype.ge.3 .and. (abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid) ) cycle @@ -306,6 +307,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(ncontest.eq.4) llrz(1:29)=apmag*mcqru(1:29) if(ncontest.eq.5) llrz(1:29)=apmag*mcqww(1:29) if(ncontest.eq.7) llrz(1:29)=apmag*mcq(1:29) + if(ncontest.eq.8) llrz(1:29)=apmag*mcqtest(1:29) apmask(75:77)=1 llrz(75:76)=apmag*(-1) llrz(77)=apmag*(+1) @@ -313,7 +315,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.2) then ! MyCall,???,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.5) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.5.or.ncontest.eq.8) then apmask(1:29)=1 llrz(1:29)=apmag*apsym(1:29) apmask(75:77)=1 @@ -353,7 +355,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.3) then ! MyCall,DxCall,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.5.or.ncontest.eq.7) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.5.or.ncontest.eq.7.or.ncontest.eq.8) then apmask(1:58)=1 llrz(1:58)=apmag*apsym apmask(75:77)=1 @@ -379,7 +381,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.5.and.ncontest.eq.7) cycle !Hound if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then apmask=0 - if(ncontest.le.5 .or. (ncontest.eq.7.and.iaptype.eq.6)) then + if(ncontest.le.5 .or. (ncontest.eq.7.and.iaptype.eq.6) .or. ncontest.eq.8) then apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73 llrz(1:58)=apmag*apsym if(iaptype.eq.4) llrz(59:77)=apmag*mrrr diff --git a/lib/ft8/sync8.f90 b/lib/ft8/sync8.f90 index 5ea2254a..f93afe75 100755 --- a/lib/ft8/sync8.f90 +++ b/lib/ft8/sync8.f90 @@ -1,9 +1,10 @@ -subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & +subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,nzhsym,candidate, & ncand,sbase) include 'ft8_params.f90' - parameter (MAXPRECAND=500) -! Search over +/- 2.5s relative to 0.5s TX start time. + parameter (MAXPRECAND=1000) +! Maximum sync correlation lag +/- 2.5s relative to 0.5s TX start time. +! 2.5s / 0.16s/symbol * 4 samples/symbol = 62.5 lag steps in 2.5s parameter (JZ=62) complex cx(0:NH1) real s(NH1,NHSYM) @@ -12,11 +13,14 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & real x(NFFT1) real sync2d(NH1,-JZ:JZ) real red(NH1) + real red2(NH1) real candidate0(3,MAXPRECAND) real candidate(3,maxcand) real dd(NMAX) integer jpeak(NH1) + integer jpeak2(NH1) integer indx(NH1) + integer indx2(NH1) integer ii(1) integer icos7(0:6) data icos7/3,1,4,0,6,5,2/ !Costas 7x7 tone pattern @@ -82,11 +86,16 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & enddo red=0. + red2=0. + mlag=10 + mlag2=JZ do i=ia,ib - ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ - j0=ii(1) - jpeak(i)=j0 - red(i)=sync2d(i,j0) + ii=maxloc(sync2d(i,-mlag:mlag)) - 1 - mlag + jpeak(i)=ii(1) + red(i)=sync2d(i,jpeak(i)) + ii=maxloc(sync2d(i,-mlag2:mlag2)) - 1 - mlag2 + jpeak2(i)=ii(1) + red2(i)=sync2d(i,jpeak2(i)) enddo iz=ib-ia+1 call indexx(red(ia:ib),iz,indx) @@ -100,14 +109,29 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & if(ibase.gt.nh1) ibase=nh1 base=red(ibase) red=red/base - + call indexx(red2(ia:ib),iz,indx2) + ibase2=indx2(npctile) - 1 + ia + if(ibase2.lt.1) ibase2=1 + if(ibase2.gt.nh1) ibase2=nh1 + base2=red2(ibase2) + red2=red2/base2 do i=1,min(MAXPRECAND,iz) n=ia + indx(iz+1-i) - 1 - if(red(n).lt.syncmin.or.isnan(red(n)).or.k.eq.MAXPRECAND) exit - k=k+1 - candidate0(1,k)=n*df - candidate0(2,k)=(jpeak(n)-0.5)*tstep - candidate0(3,k)=red(n) + if(k.ge.MAXPRECAND) exit + if( (red(n).ge.syncmin) .and. (.not.isnan(red(n))) ) then + k=k+1 + candidate0(1,k)=n*df + candidate0(2,k)=(jpeak(n)-0.5)*tstep + candidate0(3,k)=red(n) + endif + if(abs(jpeak2(n)-jpeak(n)).eq.0) cycle + if(k.ge.MAXPRECAND) exit + if( (red2(n).ge.syncmin) .and. (.not.isnan(red2(n))) ) then + k=k+1 + candidate0(1,k)=n*df + candidate0(2,k)=(jpeak2(n)-0.5)*tstep + candidate0(3,k)=red2(n) + endif enddo ncand=k @@ -116,7 +140,8 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & if(i.ge.2) then do j=1,i-1 fdiff=abs(candidate0(1,i))-abs(candidate0(1,j)) - if(abs(fdiff).lt.4.0) then + tdiff=abs(candidate0(2,i)-candidate0(2,j)) + if(abs(fdiff).lt.4.0.and.tdiff.lt.0.04) then if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0. if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0. endif @@ -148,6 +173,5 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & endif enddo ncand=k-1 - return end subroutine sync8 diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index 4eefa211..d36fbd5a 100755 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -44,7 +44,7 @@ contains class(ft8_decoder), intent(inout) :: this procedure(ft8_decode_callback) :: callback - parameter (MAXCAND=300,MAX_EARLY=100) + parameter (MAXCAND=600,MAX_EARLY=100) real*8 tsec,tseq real s(NH1,NHSYM) real sbase(NH1) @@ -80,7 +80,9 @@ contains dt0=0. f0=0. endif - if(nutc.ne.nutc0) then +!Added 41==nzhsym to force a reset if the same wav file is processed twice or more in a row, +!in which case nutc.eq.nutc0 and ndec(jseq,1) doesn't get reset + if(nzhsym==41 .or. (nutc.ne.nutc0)) then ! New UTC. Move previously saved 'a7' data from k=1 to k=0 iz=ndec(jseq,1) dt0(1:iz,jseq,0) = dt0(1:iz,jseq,1) @@ -107,6 +109,7 @@ contains dd=iwave dd1=dd endif + if(nzhsym.eq.41) then ndecodes=0 allmessages=' ' @@ -114,10 +117,12 @@ contains else ndecodes=ndec_early endif + if(nzhsym.eq.47 .and. ndec_early.eq.0) then dd1=dd go to 800 endif + if(nzhsym.eq.47 .and. ndec_early.ge.1) then lsubtracted=.false. lrefinedt=.true. @@ -140,6 +145,7 @@ contains dd1=dd go to 900 endif + if(nzhsym.eq.50 .and. ndec_early.ge.1 .and. .not.nagain) then n=47*3456 dd(1:n)=dd1(1:n) @@ -151,6 +157,7 @@ contains enddo call timer('sub_ft8c',1) endif + ifa=nfa ifb=nfb if(nzhsym.eq.50 .and. nagain) then @@ -164,11 +171,12 @@ contains ! ndepth=2: subtraction, 3 passes, bp+osd (no subtract refinement) ! ndepth=3: subtraction, 3 passes, bp+osd npass=3 - if(ndepth.eq.1) npass=1 + if(ndepth.eq.1) npass=2 do ipass=1,npass newdat=.true. syncmin=1.3 if(ndepth.le.2) syncmin=1.6 + if(nzhsym.eq.41) syncmin=2.0 if(ipass.eq.1) then lsubtract=.true. ndeep=ndepth @@ -185,7 +193,7 @@ contains endif call timer('sync8 ',0) maxc=MAXCAND - call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,s,candidate, & + call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,nzhsym,candidate, & ncand,sbase) call timer('sync8 ',1) do icand=1,ncand @@ -221,10 +229,6 @@ contains if(emedelay.ne.0) xdt=xdt+2.0 call this%callback(sync,nsnr,xdt,f1,msg37,iaptype,qual) call ft8_a7_save(nutc,xdt,f1,msg37) !Enter decode in table -! ii=ndec(jseq,1) -! write(41,3041) jseq,ii,nint(f0(ii,jseq,0)),msg0(ii,jseq,0)(1:22),& -! nint(f0(ii,jseq,1)),msg0(ii,jseq,1)(1:22) -!3041 format(3i5,2x,a22,i5,2x,a22) endif endif call timestamp(tsec,tseq,ctime) @@ -237,7 +241,7 @@ contains if(nzhsym.lt.50) ndec_early=ndecodes 900 continue - if(nzhsym.eq.50 .and. ndec(jseq,0).ge.1) then + if(lft8apon .and. ncontest.ne.6 .and. ncontest.ne.7 .and. nzhsym.eq.50 .and. ndec(jseq,0).ge.1) then newdat=.true. do i=1,ndec(jseq,0) if(f0(i,jseq,0).eq.-99.0) exit diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 8dd788b4..4f54d022 100755 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -55,6 +55,7 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & endif if(k.lt.k0) then !Start a new data block + k0=0 ja=0 ssum=0. ihsym=0 @@ -64,11 +65,8 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & sq=0. pxmax=0.; -! dwell_time=0.0001 -! if(k.gt.k0 .and. npct.gt.0) call blanker(shared_data%id2(k0+1:k), & -! k-k0,dwell_time,npct) - do i=k0+1,k + if(k0.eq.0 .and. i.le.10) cycle x1=shared_data%id2(i) if (abs(x1).gt.pxmax) pxmax = abs(x1); sq=sq + x1*x1 diff --git a/lib/testfast9.f90 b/lib/testfast9.f90 index 22993b24..eb08fb78 100755 --- a/lib/testfast9.f90 +++ b/lib/testfast9.f90 @@ -1,6 +1,6 @@ program testfast9 - parameter (NMAX=359424) + parameter (NMAX=30*12000) integer*2 id2(NMAX) integer narg(0:11) character*80 line(100) @@ -8,8 +8,8 @@ program testfast9 nargs=iargc() if(nargs.ne.2) then - print*,'Usage: testfast9 submode infile' - print*,'Example: testfast9 E /data/VE1SKY/K1JT/JT9E/150806_123300.wav' + print*,'Usage: testfast9 submode infile' + print*,'Example: testfast9 E 150806_123300.wav' go to 999 endif call getarg(1,submode) diff --git a/map65/astro.cpp b/map65/astro.cpp index 6282c18e..b9476883 100755 --- a/map65/astro.cpp +++ b/map65/astro.cpp @@ -7,6 +7,7 @@ #include #include "SettingsGroup.hpp" #include "commons.h" +#include extern "C" { void astrosub_ (int* nyear, int* month, int* nday, double* uth, int* nfreq, @@ -44,7 +45,7 @@ Astro::~Astro() } void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, - int fQSO, int nsetftx, int ntxFreq, QString azelDir) + int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg) { static int ntxFreq0=-99; char cc[300]; @@ -86,6 +87,65 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, ntsky,xnr,dgrd); ui->astroTextBrowser->setText(" "+ date + "\nUTC: " + utc + "\n" + cc); + double azOffset=0.0; + double elOffset=0.0; + double rad=57.2957795131; + int iCycle=2; +// Are we doing pointing tests? + bool bPointing=ui->cbPointingTests->isChecked(); + ui->gbPointing->setVisible(bPointing); + if(bPointing) { + int nDwell=int(ui->sbDwell->value()); + if(ui->cbAutoCycle->isChecked()) { + iCycle=(t.currentSecsSinceEpoch()%(6*nDwell))/nDwell + 1; + if(iCycle==1) { + azOffset = -ui->sbOffset->value()/cos(elsun/rad); + ui->rb1->setChecked(true); + } + if(iCycle==2 or iCycle==5) { + ui->rb2->setChecked(true); + } + if(iCycle==3) { + azOffset = +ui->sbOffset->value()/cos(elsun/rad); + ui->rb3->setChecked(true); + } + if(iCycle==4) { + elOffset = -ui->sbOffset->value(); + ui->rb4->setChecked(true); + } + if(iCycle==6) { + elOffset = +ui->sbOffset->value(); + ui->rb6->setChecked(true); + } + } + if(ui->cbOnOff->isChecked()) { + iCycle=(t.currentSecsSinceEpoch()%(2*nDwell))/nDwell + 1; + if(iCycle==1) { + azOffset = -ui->sbOffset->value()/cos(elsun/rad); + ui->rb1->setChecked(true); + } + if(iCycle==2) { + ui->rb2->setChecked(true); + } + } + if(ui->cbAutoCycle->isChecked() or ui->cbOnOff->isChecked()) { + QFile f("pointing.out"); + if(f.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream out(&f); + out << t.toString("yyyy-MMM-dd hh:mm:ss"); + sprintf(cc,"%7.1f %7.1f %d %7.1f %7.1f %10.1f %7.2f\n", + azsun,elsun,iCycle,azOffset,elOffset,xavg,10.0*log10(xavg)); + out << cc; + f.close(); + } + } + } else { + ui->rb2->setChecked(true); + ui->cbAutoCycle->setChecked(false); + ui->cbOnOff->setChecked(false); + } + +// Write pointing data to azel.dat QString fname=azelDir+"/azel.dat"; QFile f(fname); if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -107,7 +167,7 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, "%3d,%1d,fQSO\n" "%3d,%1d,fQSO2\n", nhr,nmin,isec,azmoon,elmoon, - nhr,nmin,isec,azsun,elsun, + nhr,nmin,isec,azsun+azOffset,elsun+elOffset, nhr,nmin,isec,0.0,0.0, nfreq,ndop,ndop00, fQSO,nsetftx, @@ -120,3 +180,14 @@ void Astro::setFontSize(int n) { ui->astroTextBrowser->setFontPointSize(n); } + +void Astro::on_cbAutoCycle_clicked(bool checked) +{ + if(checked) ui->cbOnOff->setChecked(false); +} + +void Astro::on_cbOnOff_clicked(bool checked) +{ + if(checked) ui->cbAutoCycle->setChecked(false); +} + diff --git a/map65/astro.h b/map65/astro.h index 918649e1..c752a2db 100755 --- a/map65/astro.h +++ b/map65/astro.h @@ -15,10 +15,14 @@ class Astro : public QWidget public: explicit Astro (QString const& settings_filename, QWidget *parent = 0); void astroUpdate(QDateTime t, QString mygrid, QString hisgrid, - int fQSO, int nsetftx, int ntxFreq, QString azelDir); + int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg); void setFontSize(int n); ~Astro (); +private slots: + void on_cbOnOff_clicked(bool checked); + void on_cbAutoCycle_clicked(bool checked); + private: Ui::Astro *ui; QString m_settings_filename; diff --git a/map65/astro.ui b/map65/astro.ui index df1ce80c..fc31352a 100755 --- a/map65/astro.ui +++ b/map65/astro.ui @@ -6,30 +6,242 @@ 0 0 - 262 + 441 483 Form - + + + + 269 + 19 + 151 + 431 + + + + + + + + + 10 + 100 + 30 + 17 + + + + 1 + + + + + + 60 + 100 + 40 + 17 + + + + 2, 5 + + + true + + + + + + 110 + 100 + 30 + 17 + + + + 3 + + + + + + 60 + 150 + 30 + 17 + + + + 4 + + + + + + 60 + 50 + 30 + 17 + + + + 6 + + + + + + 10 + 230 + 130 + 22 + + + + Qt::AlignCenter + + + Offset + + + deg + + + 1 + + + 0.500000000000000 + + + 20.000000000000000 + + + 0.500000000000000 + + + 2.500000000000000 + + + + + + 30 + 330 + 91 + 17 + + + + Auto Cycle + + + + + + 30 + 380 + 70 + 17 + + + + On Off + + + + + + 10 + 280 + 130 + 22 + + + + Qt::AlignCenter + + + s + + + Dwell + + + 10 + + + 300 + + + 10 + + + + 0 10 - 256 - 451 + 258 + 471 - - - Courier New - 20 - 75 - true - - + + + + + + Courier New + 20 + 75 + true + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Pointing Tests + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/map65/libm65/decode0.f90 b/map65/libm65/decode0.f90 index dec94337..411e38ed 100755 --- a/map65/libm65/decode0.f90 +++ b/map65/libm65/decode0.f90 @@ -14,6 +14,7 @@ subroutine decode0(dd,ss,savg,nstandalone) mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,nmode, & nfast,nsave,max_drift,nhsym,mycall,mygrid,hiscall,hisgrid,datetime common/early/nhsym1,nhsym2,ldecoded(32768) + common/decodes/ndecodes data neme0/-99/,mcall3b/1/ save @@ -62,8 +63,8 @@ subroutine decode0(dd,ss,savg,nstandalone) call sec0(1,tdec) if(nhsym.eq.nhsym1) write(*,1010) nsum,nsave,nstandalone,nhsym,tdec 1010 format('',3i4,i6,f6.2) - if(nhsym.eq.nhsym2) write(*,1012) nsum,nsave,nstandalone,nhsym,tdec -1012 format('',3i4,i6,f6.2) + if(nhsym.eq.nhsym2) write(*,1012) nsum,nsave,nstandalone,nhsym,tdec,ndecodes +1012 format('',3i4,i6,f6.2,i5) flush(6) return diff --git a/map65/libm65/map65a.f90 b/map65/libm65/map65a.f90 index 552a6a0c..e1f31993 100755 --- a/map65/libm65/map65a.f90 +++ b/map65/libm65/map65a.f90 @@ -34,12 +34,15 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & common/c3com/ mcall3a common/testcom/ifreq common/early/nhsym1,nhsym2,ldecoded(32768) + common/decodes/ndecodes data blank/' '/,cm/'#'/ data shmsg0/'ATT','RO ','RRR','73 '/ data nfile/0/,nutc0/-999/,nid/0/,ip000/1/,ip001/1/,mousefqso0/-999/ save + ndecodes=0 + ! Clean start for Q65 at early decode if(nhsym.eq.nhsym1 .or. nagain.ne.0) ldecoded=.false. if(ndiskdat.eq.1) ldecoded=.false. @@ -50,7 +53,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & mode65=mod(nmode,10) if(mode65.eq.3) mode65=4 mode_q65=nmode/10 - nts_jt65=2**(mode65-1) !JT65 tone separation factor + nts_jt65=mode65 !JT65 tone separation factor nts_q65=2**(mode_q65-1) !Q65 tone separation factor xpol=(nxpol.ne.0) @@ -158,7 +161,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & ssmax=1.e30 call ccf65(ss(1,1,i),nhsym,ssmax,sync1,ipol,jpz,dt, & flipk,syncshort,snr2,ipol2,dt2) - if(dt.lt.-2.6 .or. dt.gt.2.5) sync1=-99.0 !### +!### if(dt.lt.-2.6 .or. dt.gt.2.5) sync1=-99.0 !### call timer('ccf65 ',1) if(mode65.eq.0) syncshort=-99.0 !If "No JT65", don't waste time @@ -410,8 +413,8 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & if(cand(icand)%iflip.ne.0) cycle !Do only Q65 candidates here if(candec(icand)) cycle !Skip if already decoded freq=cand(icand)%f+nkhz_center-48.0-1.27046 -! If here at nqd=1, do only candidates at mousefqso +/- ntol - if(nqd.eq.1 .and. abs(freq-mousefqso).gt.0.001*ntol) cycle +!###! If here at nqd=1, do only candidates at mousefqso +/- ntol +!### if(nqd.eq.1 .and. abs(freq-mousefqso).gt.0.001*ntol) cycle ikhz=nint(freq) f0=cand(icand)%f call timer('q65b ',0) @@ -499,6 +502,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & write(26,1014) f0,ndf,ndf0,ndf1,ndf2,dt,npol,nsync1, & nsync2,nutc,decoded,cp,cmode 1014 format(f8.3,i5,3i3,f5.1,i4,i3,i4,i5.4,4x,a22,2x,a1,3x,a2) + ndecodes=ndecodes+1 write(21,1100) f0,ndf,dt,npol,nsync2,nutc,decoded,cp, & cmode(1:1),cmode(2:2) 1100 format(f8.3,i5,f5.1,2i4,i5.4,2x,a22,2x,a1,3x,a1,1x,a1) diff --git a/map65/libm65/q65b.f90 b/map65/libm65/q65b.f90 index 009a9e73..6e555284 100755 --- a/map65/libm65/q65b.f90 +++ b/map65/libm65/q65b.f90 @@ -35,6 +35,7 @@ subroutine q65b(nutc,nqd,nxant,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & character*1 cp,cmode*2 common/cacb/ca,cb common/early/nhsym1,nhsym2,ldecoded(32768) + common/decodes/ndecodes data nutc00/-1/,msg00/' '/ save @@ -179,6 +180,7 @@ subroutine q65b(nutc,nqd,nxant,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & ! to map65_rx.log if(nutc.ne.nutc00 .or. msg0(1:28).ne.msg00 .or. freq1.ne.freq1_00) then ! Write to file map65_rx.log: + ndecodes=ndecodes+1 write(21,1110) freq1,ndf,xdt0,npol,nsnr0,nutc,msg0(1:28),cq0 1110 format(f8.3,i5,f5.1,2i4,i5.4,2x,a28,': A',2x,a3) nutc00=nutc diff --git a/map65/main.cpp b/map65/main.cpp index 225713d3..2cc4069c 100755 --- a/map65/main.cpp +++ b/map65/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) QApplication a {argc, argv}; // Override programs executable basename as application name. a.setApplicationName ("MAP65"); - a.setApplicationVersion ("3.0.0"); + a.setApplicationVersion ("3.0.1"); // switch off as we share an Info.plist file with WSJT-X a.setAttribute (Qt::AA_DontUseNativeMenuBar); MainWindow w; diff --git a/map65/mainwindow.cpp b/map65/mainwindow.cpp index 4cd5eebc..f31eec21 100755 --- a/map65/mainwindow.cpp +++ b/map65/mainwindow.cpp @@ -520,6 +520,8 @@ void MainWindow::dataSink(int k) static int nkhz; static int nfsample=96000; static int nxpol=0; + static int nsec0=0; + static int nsum=0; static float fgreen; static int ndiskdat; static int nb; @@ -529,6 +531,7 @@ void MainWindow::dataSink(int k) static float rejectx; static float rejecty; static float slimit; + static double xsum=0.0; if(m_diskData) { ndiskdat=1; @@ -551,8 +554,22 @@ void MainWindow::dataSink(int k) &nfsample, &fgreen, &m_adjustIQ, &m_applyIQcal, &m_gainx, &m_gainy, &m_phasex, &m_phasey, &rejectx, &rejecty, &px, &py, s, &nkhz, &ihsym, &nzap, &slimit, lstrong); + + int nsec=QDateTime::currentSecsSinceEpoch(); + if(nsec==nsec0) { + xsum+=pow(10.0,0.1*px); + nsum+=1; + } else { + m_xavg=0.0; + if(nsum>0) m_xavg=xsum/nsum; + xsum=pow(10.0,0.1*px); + nsum=1; + } + nsec0=nsec; + QString t; m_pctZap=nzap/178.3; + ui->yMeterFrame->setVisible(m_xpol); if(m_xpol) { lab4->setText ( QString {" Rx noise: %1 %2 %3 %% "} @@ -1119,6 +1136,9 @@ void MainWindow::diskDat() //diskDat() //These may be redundant?? m_diskData=true; datcom_.newdat=1; + if(m_wide_graph_window->m_bForceCenterFreq) { + datcom_.fcenter=m_wide_graph_window->m_dForceCenterFreq; + } if(m_fs96000) hsym=2048.0*96000.0/11025.0; //Samples per JT65 half-symbol if(!m_fs96000) hsym=2048.0*95238.1/11025.0; @@ -1396,6 +1416,8 @@ void MainWindow::readFromStdout() //readFromStdout QFile lockFile(m_appDir + "/.lock"); lockFile.open(QIODevice::ReadWrite); if(t.indexOf("") >= 0) { + int ndecodes=t.mid(40,5).toInt(); + lab5->setText(QString::number(ndecodes)); m_map65RxLog=0; m_startAnother=m_loopall; } @@ -1404,6 +1426,8 @@ void MainWindow::readFromStdout() //readFromStdout return; } + read_log(); + if(t.indexOf("!") >= 0) { int n=t.length(); int m=2; @@ -1688,7 +1712,7 @@ void MainWindow::guiUpdate() QDateTime t = QDateTime::currentDateTimeUtc(); int fQSO=m_wide_graph_window->QSOfreq(); m_astro_window->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, m_setftx, - m_txFreq, m_azelDir); + m_txFreq, m_azelDir, m_xavg); m_setftx=0; QString utc = t.date().toString(" yyyy MMM dd \n") + t.time().toString(); ui->labUTC->setText(utc); @@ -2344,3 +2368,24 @@ bool MainWindow::isGrid4(QString g) if(g.mid(3,1)<'0' or g.mid(3,1)>'9') return false; return true; } + +void MainWindow::read_log() +{ + // Update "m_worked" by reading wsjtx.log + m_worked.clear(); //Start from scratch + QFile f("wsjtx.log"); + f.open(QIODevice::ReadOnly); + if(f.isOpen()) { + QTextStream in(&f); + QString line,callsign; + for(int i=0; i<99999; i++) { + line=in.readLine(); + if(line.length()<=0) break; + callsign=line.mid(40,6); + int n=callsign.indexOf(","); + if(n>0) callsign=callsign.left(n); + m_worked[callsign]=true; + } + f.close(); + } +} diff --git a/map65/mainwindow.h b/map65/mainwindow.h index 2f6e6b47..cdd1a6e4 100755 --- a/map65/mainwindow.h +++ b/map65/mainwindow.h @@ -194,12 +194,12 @@ private: qint32 m_RxState; qint32 m_dB; - double m_fAdd; // double m_IQamp; // double m_IQphase; double m_cal570; double m_TxOffset; + double m_xavg; bool m_monitoring; bool m_transmitting; @@ -294,6 +294,7 @@ private: void stub(); bool isGrid4(QString g); bool subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus); + void read_log(); }; extern void getfile(QString fname, bool xpol, int idInt); diff --git a/models/Bands.hpp b/models/Bands.hpp index 78039313..629e63b4 100755 --- a/models/Bands.hpp +++ b/models/Bands.hpp @@ -24,7 +24,7 @@ // // Implements the QAbstractTableModel interface as an immutable table // where rows are bands and columns are band name, lower frequency -// limit and, upper ferquency limit respectively. +// limit and, upper frequency limit respectively. // class Bands final : public QAbstractTableModel diff --git a/models/FrequencyList.cpp b/models/FrequencyList.cpp index 26668446..03176584 100755 --- a/models/FrequencyList.cpp +++ b/models/FrequencyList.cpp @@ -5,6 +5,7 @@ #include #include + #include #include #include @@ -17,51 +18,59 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "Radio.hpp" #include "Bands.hpp" #include "pimpl_impl.hpp" +#include "revision_utils.hpp" +#include "Logger.hpp" #include "moc_FrequencyList.cpp" namespace { - FrequencyList_v2::FrequencyItems const default_frequency_list = + FrequencyList_v2_101::FrequencyItems const default_frequency_list = { - {198000, Modes::FreqCal, IARURegions::R1}, // BBC Radio 4 Droitwich - {4996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal - {9996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal - {14996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal + {198000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // BBC Radio 4 Droitwich + {4996000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // RWM time signal + {9996000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // RWM time signal + {14996000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // RWM time signal - {660000, Modes::FreqCal, IARURegions::R2}, - {880000, Modes::FreqCal, IARURegions::R2}, - {1210000, Modes::FreqCal, IARURegions::R2}, + {660000, Modes::FreqCal, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {880000, Modes::FreqCal, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {1210000, Modes::FreqCal, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, - {2500000, Modes::FreqCal, IARURegions::ALL}, - {3330000, Modes::FreqCal, IARURegions::ALL}, - {5000000, Modes::FreqCal, IARURegions::ALL}, - {7850000, Modes::FreqCal, IARURegions::ALL}, - {10000000, Modes::FreqCal, IARURegions::ALL}, - {14670000, Modes::FreqCal, IARURegions::ALL}, - {15000000, Modes::FreqCal, IARURegions::ALL}, - {20000000, Modes::FreqCal, IARURegions::ALL}, + {2500000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {3330000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {5000000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {7850000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {10000000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {14670000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {15000000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {20000000, Modes::FreqCal, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, - {136000, Modes::WSPR, IARURegions::ALL}, - {136000, Modes::FST4, IARURegions::ALL}, - {136000, Modes::FST4W, IARURegions::ALL}, - {136000, Modes::JT9, IARURegions::ALL}, - - {474200, Modes::JT9, IARURegions::ALL}, - {474200, Modes::FST4, IARURegions::ALL}, - {474200, Modes::WSPR, IARURegions::ALL}, - {474200, Modes::FST4W, IARURegions::ALL}, - - {1836600, Modes::WSPR, IARURegions::ALL}, - {1836800, Modes::FST4W, IARURegions::ALL}, - {1838000, Modes::JT65, IARURegions::ALL}, // squeezed allocations - {1839000, Modes::JT9, IARURegions::ALL}, - {1839000, Modes::FST4, IARURegions::ALL}, - {1840000, Modes::FT8, IARURegions::ALL}, + {136000, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {136000, Modes::FST4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {136000, Modes::FST4W, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {136000, Modes::JT9, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + + {474200, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {474200, Modes::FST4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {474200, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {474200, Modes::FST4W, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {1836600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {1836800, Modes::FST4W, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {1838000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // squeezed allocations + {1839000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {1839000, Modes::FST4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {1840000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // Band plans (all USB dial unless stated otherwise) // @@ -90,12 +99,12 @@ namespace // 3580 PSK31 // 3600 LSB EMCOMM // - {3570000, Modes::JT65, IARURegions::ALL}, // JA compatible - {3572000, Modes::JT9, IARURegions::ALL}, - {3573000, Modes::FT8, IARURegions::ALL}, // above as below JT65 is out of DM allocation - {3568600, Modes::WSPR, IARURegions::ALL}, // needs guard marker and lock out - {3575000, Modes::FT4, IARURegions::ALL}, // provisional - {3568000, Modes::FT4, IARURegions::R3}, // provisional + {3570000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // JA compatible + {3572000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {3573000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // above as below JT65 is out of DM allocation + {3568600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // needs guard marker and lock out + {3575000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional + {3568000, Modes::FT4, IARURegions::R3, "","", QDateTime(), QDateTime(), false}, // provisional // Band plans (all USB dial unless stated otherwise) // @@ -128,11 +137,11 @@ namespace // 7090 LSB QRP CoA // 7110 LSB EMCOMM // - {7038600, Modes::WSPR, IARURegions::ALL}, - {7074000, Modes::FT8, IARURegions::ALL}, - {7076000, Modes::JT65, IARURegions::ALL}, - {7078000, Modes::JT9, IARURegions::ALL}, - {7047500, Modes::FT4, IARURegions::ALL}, // provisional - moved + {7038600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {7074000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {7076000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {7078000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {7047500, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional - moved // up 500Hz to clear // W1AW code practice QRG @@ -162,11 +171,11 @@ namespace // 10142.25 OLIVIA, Contestia, etc. // 10143.25 OLIVIA, Contestia, etc. (main QRG) // - {10136000, Modes::FT8, IARURegions::ALL}, - {10138000, Modes::JT65, IARURegions::ALL}, - {10138700, Modes::WSPR, IARURegions::ALL}, - {10140000, Modes::JT9, IARURegions::ALL}, - {10140000, Modes::FT4, IARURegions::ALL}, // provisional + {10136000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {10138000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {10138700, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {10140000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {10140000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional // Band plans (all USB dial unless stated otherwise) // @@ -205,11 +214,11 @@ namespace // 14105.5 OLIVIA 1000 // 14106.5 OLIVIA 1000 (main QRG) // - {14095600, Modes::WSPR, IARURegions::ALL}, - {14074000, Modes::FT8, IARURegions::ALL}, - {14076000, Modes::JT65, IARURegions::ALL}, - {14078000, Modes::JT9, IARURegions::ALL}, - {14080000, Modes::FT4, IARURegions::ALL}, // provisional + {14095600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {14074000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {14076000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {14078000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {14080000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional // Band plans (all USB dial unless stated otherwise) // @@ -238,148 +247,179 @@ namespace // 18104.4 OLIVIA, Contestia, etc. // 18110 NCDXF beacons // - {18100000, Modes::FT8, IARURegions::ALL}, - {18102000, Modes::JT65, IARURegions::ALL}, - {18104000, Modes::JT9, IARURegions::ALL}, - {18104000, Modes::FT4, IARURegions::ALL}, // provisional - {18104600, Modes::WSPR, IARURegions::ALL}, - - {21074000, Modes::FT8, IARURegions::ALL}, - {21076000, Modes::JT65, IARURegions::ALL}, - {21078000, Modes::JT9, IARURegions::ALL}, - {21094600, Modes::WSPR, IARURegions::ALL}, - {21140000, Modes::FT4, IARURegions::ALL}, - - {24915000, Modes::FT8, IARURegions::ALL}, - {24917000, Modes::JT65, IARURegions::ALL}, - {24919000, Modes::JT9, IARURegions::ALL}, - {24919000, Modes::FT4, IARURegions::ALL}, // provisional - {24924600, Modes::WSPR, IARURegions::ALL}, - - {28074000, Modes::FT8, IARURegions::ALL}, - {28076000, Modes::JT65, IARURegions::ALL}, - {28078000, Modes::JT9, IARURegions::ALL}, - {28124600, Modes::WSPR, IARURegions::ALL}, - {28180000, Modes::FT4, IARURegions::ALL}, - - {50200000, Modes::Echo, IARURegions::ALL}, - {50211000, Modes::Q65, IARURegions::ALL}, - {50275000, Modes::Q65, IARURegions::ALL}, - {50276000, Modes::JT65, IARURegions::R2}, - {50276000, Modes::JT65, IARURegions::R3}, - {50380000, Modes::MSK144, IARURegions::R1}, - {50260000, Modes::MSK144, IARURegions::R2}, - {50260000, Modes::MSK144, IARURegions::R3}, - {50293000, Modes::WSPR, IARURegions::R2}, - {50293000, Modes::WSPR, IARURegions::R3}, - {50310000, Modes::JT65, IARURegions::ALL}, - {50312000, Modes::JT9, IARURegions::ALL}, - {50313000, Modes::FT8, IARURegions::ALL}, - {50318000, Modes::FT4, IARURegions::ALL}, // provisional - {50323000, Modes::FT8, IARURegions::ALL}, + {18100000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {18102000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {18104000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {18104000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional + {18104600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {21074000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {21076000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {21078000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {21094600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {21140000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {24915000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {24917000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {24919000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {24919000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional + {24924600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {28074000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {28076000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {28078000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {28124600, Modes::WSPR, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {28180000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {50200000, Modes::Echo, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50211000, Modes::Q65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50275000, Modes::Q65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50276000, Modes::JT65, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {50276000, Modes::JT65, IARURegions::R3, "","", QDateTime(), QDateTime(), false}, + {50380000, Modes::MSK144, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {50260000, Modes::MSK144, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {50260000, Modes::MSK144, IARURegions::R3, "","", QDateTime(), QDateTime(), false}, + {50293000, Modes::WSPR, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {50293000, Modes::WSPR, IARURegions::R3, "","", QDateTime(), QDateTime(), false}, + {50310000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50312000, Modes::JT9, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50313000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {50318000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, // provisional + {50323000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, - {70102000, Modes::JT65, IARURegions::R1}, - {70104000, Modes::JT9, IARURegions::R1}, - {70091000, Modes::WSPR, IARURegions::R1}, - {70154000, Modes::FT8, IARURegions::R1}, - {70230000, Modes::MSK144, IARURegions::R1}, + {70102000, Modes::JT65, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {70104000, Modes::JT9, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {70091000, Modes::WSPR, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {70154000, Modes::FT8, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {70230000, Modes::MSK144, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, - {144116000, Modes::Q65, IARURegions::ALL}, - {144120000, Modes::JT65, IARURegions::ALL}, - {144120000, Modes::Echo, IARURegions::ALL}, - {144170000, Modes::FT4, IARURegions::ALL}, - {144174000, Modes::FT8, IARURegions::ALL}, - {144360000, Modes::MSK144, IARURegions::R1}, - {144150000, Modes::MSK144, IARURegions::R2}, - {144489000, Modes::WSPR, IARURegions::ALL}, + {144116000, Modes::Q65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {144120000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {144120000, Modes::Echo, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {144170000, Modes::FT4, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {144174000, Modes::FT8, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {144360000, Modes::MSK144, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, + {144150000, Modes::MSK144, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {144489000, Modes::WSPR, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {222065000, Modes::Echo, IARURegions::R2}, - {222065000, Modes::JT65, IARURegions::R2}, - {222065000, Modes::Q65, IARURegions::R2}, + {222065000, Modes::Echo, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {222065000, Modes::JT65, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {222065000, Modes::Q65, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, - {432065000, Modes::Echo, IARURegions::ALL}, - {432065000, Modes::JT65, IARURegions::ALL}, - {432300000, Modes::WSPR, IARURegions::ALL}, - {432360000, Modes::MSK144, IARURegions::ALL}, - {432065000, Modes::Q65, IARURegions::ALL}, + {432065000, Modes::Echo, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {432065000, Modes::JT65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {432300000, Modes::WSPR, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {432360000, Modes::MSK144, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {432065000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {902065000, Modes::JT65, IARURegions::R2}, - {902065000, Modes::Q65, IARURegions::R2}, + {902065000, Modes::JT65, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, + {902065000, Modes::Q65, IARURegions::R2, "","", QDateTime(), QDateTime(), false}, - {1296065000, Modes::Echo, IARURegions::ALL}, - {1296065000, Modes::JT65, IARURegions::ALL}, - {1296500000, Modes::WSPR, IARURegions::ALL}, - {1296065000, Modes::Q65, IARURegions::ALL}, + {1296065000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {1296065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {1296500000, Modes::WSPR, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {1296065000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {2301000000, Modes::Echo, IARURegions::ALL}, - {2301065000, Modes::JT4, IARURegions::ALL}, - {2301065000, Modes::JT65, IARURegions::ALL}, - {2301065000, Modes::Q65, IARURegions::ALL}, - - {2304065000, Modes::Echo, IARURegions::ALL}, - {2304065000, Modes::JT4, IARURegions::ALL}, - {2304065000, Modes::JT65, IARURegions::ALL}, - {2304065000, Modes::Q65, IARURegions::ALL}, + {2301000000, Modes::Echo, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {2301065000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2301065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2301065000, Modes::Q65, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + + {2304065000, Modes::Echo, IARURegions::ALL, "","", QDateTime(), QDateTime(), false}, + {2304065000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2304065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2304065000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {2320065000, Modes::Echo, IARURegions::ALL}, - {2320065000, Modes::JT4, IARURegions::ALL}, - {2320065000, Modes::JT65, IARURegions::ALL}, - {2320065000, Modes::Q65, IARURegions::ALL}, + {2320065000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2320065000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2320065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {2320065000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {3400065000, Modes::Echo, IARURegions::ALL}, - {3400065000, Modes::JT4, IARURegions::ALL}, - {3400065000, Modes::JT65, IARURegions::ALL}, - {3400065000, Modes::Q65, IARURegions::ALL}, + {3400065000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {3400065000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {3400065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {3400065000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {5760065000, Modes::Echo, IARURegions::ALL}, - {5760065000, Modes::JT4, IARURegions::ALL}, - {5760065000, Modes::JT65, IARURegions::ALL}, - {5760200000, Modes::Q65, IARURegions::ALL}, + {5760065000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {5760065000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {5760065000, Modes::JT65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {5760200000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {10368100000, Modes::Echo, IARURegions::ALL}, - {10368200000, Modes::JT4, IARURegions::ALL}, - {10368200000, Modes::Q65, IARURegions::ALL}, + {10368100000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {10368200000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {10368200000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, - {24048100000, Modes::Echo, IARURegions::ALL}, - {24048200000, Modes::JT4, IARURegions::ALL}, - {24048200000, Modes::Q65, IARURegions::ALL}, + {24048100000, Modes::Echo, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {24048200000, Modes::JT4, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, + {24048200000, Modes::Q65, IARURegions::ALL,"","", QDateTime(), QDateTime(), false}, }; } #if !defined (QT_NO_DEBUG_STREAM) -QDebug operator << (QDebug debug, FrequencyList_v2::Item const& item) +QDebug operator << (QDebug debug, FrequencyList_v2_101::Item const& item) { QDebugStateSaver saver {debug}; return debug.nospace () << item.toString (); } #endif +bool FrequencyList_v2_101::Item::isSane() const +{ + return frequency_ > 0.0 && (!start_time_.isValid() || !end_time_.isValid() || start_time_ < end_time_) + && (region_ == IARURegions::ALL || region_ == IARURegions::R1 || region_ == IARURegions::R2 || region_ == IARURegions::R3); +} -QString FrequencyList_v2::Item::toString () const +QString FrequencyList_v2_101::Item::toString () const { QString string; QTextStream qts {&string}; qts << "FrequencyItem(" << Radio::frequency_MHz_string (frequency_) << ", " << IARURegions::name (region_) << ", " - << Modes::name (mode_) << ')'; + << Modes::name (mode_) << ", " + << start_time_.toString(Qt::ISODate) << ", " + << end_time_.toString(Qt::ISODate) << ", " + << description_ << ", " + << source_ << "," + << preferred_ << ')'; return string; } -QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item) +QJsonObject FrequencyList_v2_101::Item::toJson() const { + return {{"frequency", Radio::frequency_MHz_string (frequency_) }, + {"mode", Modes::name (mode_) }, + {"region", IARURegions::name (region_)}, + {"description", description_}, + {"source", source_}, + {"start_time", start_time_.toString(Qt::ISODate) }, + {"end_time", end_time_.toString(Qt::ISODate) }, + {"preferred", preferred_}}; +} + +QDataStream& operator << (QDataStream& os, FrequencyList_v2_101::Item const& item) { return os << item.frequency_ << item.mode_ - << item.region_; + << item.region_ + << item.start_time_ + << item.end_time_ + << item.description_ + << item.source_ + << item.preferred_; } -QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item) +QDataStream& operator >> (QDataStream& is, FrequencyList_v2_101::Item& item) { return is >> item.frequency_ >> item.mode_ - >> item.region_; + >> item.region_ + >> item.start_time_ + >> item.end_time_ + >> item.description_ + >> item.source_ + >> item.preferred_; } -class FrequencyList_v2::impl final +class FrequencyList_v2_101::impl final : public QAbstractTableModel { public: @@ -388,6 +428,7 @@ public: , bands_ {bands} , region_filter_ {IARURegions::ALL} , mode_filter_ {Modes::ALL} + , filter_on_time_ {false} { } @@ -407,6 +448,8 @@ public: QStringList mimeTypes () const override; QMimeData * mimeData (QModelIndexList const&) const override; + void unprefer_all_but(Item & item, int const row, QVector ); + static int constexpr num_cols {SENTINAL}; static auto constexpr mime_type = "application/wsjt.Frequencies"; @@ -414,9 +457,11 @@ public: FrequencyItems frequency_list_; Region region_filter_; Mode mode_filter_; + bool filter_on_time_; + }; -FrequencyList_v2::FrequencyList_v2 (Bands const * bands, QObject * parent) +FrequencyList_v2_101::FrequencyList_v2_101 (Bands const * bands, QObject * parent) : QSortFilterProxyModel {parent} , m_ {bands, parent} { @@ -424,21 +469,21 @@ FrequencyList_v2::FrequencyList_v2 (Bands const * bands, QObject * parent) setSortRole (SortRole); } -FrequencyList_v2::~FrequencyList_v2 () +FrequencyList_v2_101::~FrequencyList_v2_101 () { } -auto FrequencyList_v2::frequency_list (FrequencyItems frequency_list) -> FrequencyItems +auto FrequencyList_v2_101::frequency_list (FrequencyItems frequency_list) -> FrequencyItems { return m_->frequency_list (frequency_list); } -auto FrequencyList_v2::frequency_list () const -> FrequencyItems const& +auto FrequencyList_v2_101::frequency_list () const -> FrequencyItems const& { return m_->frequency_list_; } -auto FrequencyList_v2::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems +auto FrequencyList_v2_101::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems { FrequencyItems list; Q_FOREACH (auto const& index, model_index_list) @@ -448,12 +493,13 @@ auto FrequencyList_v2::frequency_list (QModelIndexList const& model_index_list) return list; } -void FrequencyList_v2::frequency_list_merge (FrequencyItems const& items) +void FrequencyList_v2_101::frequency_list_merge (FrequencyItems const& items) { m_->add (items); } -int FrequencyList_v2::best_working_frequency (Frequency f) const + +int FrequencyList_v2_101::best_working_frequency (Frequency f) const { int result {-1}; auto const& target_band = m_->bands_->find (f); @@ -468,6 +514,11 @@ int FrequencyList_v2::best_working_frequency (Frequency f) const auto const& band = m_->bands_->find (candidate_frequency); if (band == target_band) { + // take the preferred one + if (m_->frequency_list_[source_row].preferred_) + { + return row; + } // take closest band match Radio::FrequencyDelta new_delta = f - candidate_frequency; if (std::abs (new_delta) < std::abs (delta)) @@ -481,7 +532,7 @@ int FrequencyList_v2::best_working_frequency (Frequency f) const return result; } -int FrequencyList_v2::best_working_frequency (QString const& target_band) const +int FrequencyList_v2_101::best_working_frequency (QString const& target_band) const { int result {-1}; if (!target_band.isEmpty ()) @@ -493,24 +544,26 @@ int FrequencyList_v2::best_working_frequency (QString const& target_band) const auto const& band = m_->bands_->find (m_->frequency_list_[source_row].frequency_); if (band == target_band) { - return row; + if (m_->frequency_list_[source_row].preferred_) + return row; // return the preferred one immediately + result = row; } } } return result; } -void FrequencyList_v2::reset_to_defaults () +void FrequencyList_v2_101::reset_to_defaults () { m_->frequency_list (default_frequency_list); } -QModelIndex FrequencyList_v2::add (Item f) +QModelIndex FrequencyList_v2_101::add (Item f) { return mapFromSource (m_->add (f)); } -bool FrequencyList_v2::remove (Item f) +bool FrequencyList_v2_101::remove (Item f) { auto row = m_->frequency_list_.indexOf (f); @@ -522,13 +575,13 @@ bool FrequencyList_v2::remove (Item f) return m_->removeRow (row); } -bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows) +bool FrequencyList_v2_101::removeDisjointRows (QModelIndexList rows) { bool result {true}; // We must work with source model indexes because we don't want row // removes to invalidate model indexes we haven't yet processed. We - // achieve that by processing them in decending row order. + // achieve that by processing them in descending row order. for (int r = 0; r < rows.size (); ++r) { rows[r] = mapToSource (rows[r]); @@ -549,14 +602,20 @@ bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows) return result; } -void FrequencyList_v2::filter (Region region, Mode mode) +void FrequencyList_v2_101::filter (Region region, Mode mode, bool filter_on_time) { m_->region_filter_ = region; m_->mode_filter_ = mode; + m_->filter_on_time_ = filter_on_time; invalidateFilter (); } -bool FrequencyList_v2::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const +void FrequencyList_v2_101::filter_refresh () +{ + invalidateFilter (); +} + +bool FrequencyList_v2_101::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const { bool result {true}; auto const& item = m_->frequency_list_[source_row]; @@ -570,11 +629,16 @@ bool FrequencyList_v2::filterAcceptsRow (int source_row, QModelIndex const& /* p result = (Modes::ALL == item.mode_ && m_->mode_filter_ != Modes::FreqCal) || m_->mode_filter_ == item.mode_; } + if (result && m_->filter_on_time_) + { + result = (!item.start_time_.isValid() || item.start_time_ <= QDateTime::currentDateTimeUtc ()) && + (!item.end_time_.isValid() || item.end_time_ >= QDateTime::currentDateTimeUtc ()); + } return result; } -auto FrequencyList_v2::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems +auto FrequencyList_v2_101::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems { beginResetModel (); std::swap (frequency_list_, frequency_list); @@ -583,7 +647,7 @@ auto FrequencyList_v2::impl::frequency_list (FrequencyItems frequency_list) -> F } // add a frequency returning the new model index -QModelIndex FrequencyList_v2::impl::add (Item f) +QModelIndex FrequencyList_v2_101::impl::add (Item f) { // Any Frequency that isn't in the list may be added if (!frequency_list_.contains (f)) @@ -594,12 +658,15 @@ QModelIndex FrequencyList_v2::impl::add (Item f) frequency_list_.append (f); endInsertRows (); + // if we added one that had a preferred frequency, unprefer everything else + unprefer_all_but(f, row, {Qt::DisplayRole, Qt::CheckStateRole}); + return index (row, 0); } return QModelIndex {}; } -void FrequencyList_v2::impl::add (FrequencyItems items) +void FrequencyList_v2_101::impl::add (FrequencyItems items) { // Any Frequency that isn't in the list may be added for (auto p = items.begin (); p != items.end ();) @@ -624,17 +691,17 @@ void FrequencyList_v2::impl::add (FrequencyItems items) } } -int FrequencyList_v2::impl::rowCount (QModelIndex const& parent) const +int FrequencyList_v2_101::impl::rowCount (QModelIndex const& parent) const { return parent.isValid () ? 0 : frequency_list_.size (); } -int FrequencyList_v2::impl::columnCount (QModelIndex const& parent) const +int FrequencyList_v2_101::impl::columnCount (QModelIndex const& parent) const { return parent.isValid () ? 0 : num_cols; } -Qt::ItemFlags FrequencyList_v2::impl::flags (QModelIndex const& index) const +Qt::ItemFlags FrequencyList_v2_101::impl::flags (QModelIndex const& index) const { auto result = QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled; auto row = index.row (); @@ -647,11 +714,16 @@ Qt::ItemFlags FrequencyList_v2::impl::flags (QModelIndex const& index) const { result |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled; } + + if (preferred_column == column) + { + result |= Qt::ItemIsUserCheckable; + } } return result; } -QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const +QVariant FrequencyList_v2_101::impl::data (QModelIndex const& index, int role) const { QVariant item; @@ -746,8 +818,14 @@ QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const case Qt::DisplayRole: { auto const& band = bands_->find (frequency_item.frequency_); - item = Radio::pretty_frequency_MHz_string (frequency_item.frequency_) - + " MHz (" + (band.isEmpty () ? "OOB" : band) + ')'; + QString desc_text; + desc_text = frequency_item.description_.isEmpty() ? "" : " \u2502 " + frequency_item.description_; + item = (frequency_item.preferred_ ? "\u2055 " : "") + + Radio::pretty_frequency_MHz_string(frequency_item.frequency_) + + " MHz (" + (band.isEmpty() ? "OOB" : band) + ")" + + (((frequency_item.start_time_.isValid() && !frequency_item.start_time_.isNull()) || + (frequency_item.end_time_.isValid() && !frequency_item.end_time_.isNull())) ? " \u2016 " : "") + + desc_text; } break; @@ -760,71 +838,328 @@ QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const item = Qt::AlignRight + Qt::AlignVCenter; break; } + break; + + case description_column: + switch (role) + { + case SortRole: + case Qt::DisplayRole: + case Qt::EditRole: + case Qt::AccessibleTextRole: + item = frequency_item.description_; + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr("Description"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignLeft + Qt::AlignVCenter; + break; + } + break; + + case source_column: + switch (role) + { + case SortRole: + case Qt::DisplayRole: + case Qt::EditRole: + case Qt::AccessibleTextRole: + item = frequency_item.source_; + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("Source"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignLeft + Qt::AlignVCenter; + break; + } + break; + + case start_time_column: + switch (role) + { + case SortRole: + item = frequency_item.start_time_; + break; + + case Qt::EditRole: + if (frequency_item.start_time_.isNull () || !frequency_item.start_time_.isValid ()) + { + item = QDateTime::currentDateTimeUtc ().toString (Qt::ISODate); + } + else + { + item = frequency_item.start_time_.toString(Qt::ISODate); + } + break; + + case Qt::DisplayRole: + case Qt::AccessibleTextRole: + item = frequency_item.start_time_.toString(Qt::ISODate); + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("Start Time"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignLeft + Qt::AlignVCenter; + break; + } + break; + + case end_time_column: + switch (role) + { + case SortRole: + item = frequency_item.end_time_; + break; + + case Qt::EditRole: + if (frequency_item.end_time_.isNull () || !frequency_item.end_time_.isValid ()) + { + item = QDateTime::currentDateTimeUtc ().toString (Qt::ISODate); + } + else + { + item = frequency_item.end_time_.toString(Qt::ISODate); + } + break; + + case Qt::DisplayRole: + case Qt::AccessibleTextRole: + item = frequency_item.end_time_.toString(Qt::ISODate); + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("End Time"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignLeft + Qt::AlignVCenter; + break; + } + break; + + case preferred_column: + switch (role) + { + case SortRole: + item = frequency_item.preferred_; + break; + case Qt::DisplayRole: + case Qt::EditRole: + case Qt::AccessibleTextRole: + //item = frequency_item.preferred_ ? QString("True") : QString("False"); + break; + + case Qt::ToolTipRole: + case Qt::AccessibleDescriptionRole: + item = tr ("Pref"); + break; + + case Qt::TextAlignmentRole: + item = Qt::AlignHCenter + Qt::AlignVCenter; + break; + + case Qt::CheckStateRole: + item = frequency_item.preferred_ ? Qt::Checked : Qt::Unchecked; + break; + } break; } } return item; } -bool FrequencyList_v2::impl::setData (QModelIndex const& model_index, QVariant const& value, int role) +void FrequencyList_v2_101::impl::unprefer_all_but(Item &item, int const item_row, QVector roles) { - bool changed {false}; + // un-prefer all of the other frequencies in this band + auto const band = bands_->find (item.frequency_); + if (band.isEmpty ()) return; // out of any band + roles << Qt::CheckStateRole; + roles << Qt::DisplayRole; + + for (int row = 0; row < rowCount (); ++row) + { + if (row == item_row) continue; + + Item &i = frequency_list_[row]; + auto const &iter_band = bands_->find(i.frequency_); + + if (!iter_band.isEmpty() && band == iter_band && (i.region_ == item.region_) && (i.mode_ == item.mode_)) + { + i.preferred_ = false; + Q_EMIT dataChanged(index(row,preferred_column), index(row,preferred_column), roles); + } + } +} + +bool FrequencyList_v2_101::impl::setData (QModelIndex const& model_index, QVariant const& value, int role) +{ + bool changed {false}; auto const& row = model_index.row (); + auto& item = frequency_list_[row]; + + QVector roles; + roles << role; + + if (model_index.isValid () + && Qt::CheckStateRole == role + && row < frequency_list_.size () + && model_index.column () == preferred_column) + { + bool b_val = ((Qt::CheckState)value.toInt() == Qt::Checked); + if (b_val != item.preferred_) + { + item.preferred_ = b_val; + if (item.preferred_) + { + unprefer_all_but (item, row, roles); // un-prefer all of the other frequencies in this band + } + Q_EMIT dataChanged(index(row,description_column), index(row,preferred_column), roles); + changed = true; + } + } + if (model_index.isValid () && Qt::EditRole == role && row < frequency_list_.size ()) { - QVector roles; - roles << role; - - auto& item = frequency_list_[row]; - switch (model_index.column ()) + switch (model_index.column()) { - case region_column: - { - auto region = IARURegions::value (value.toString ()); - if (region != item.region_) - { - item.region_ = region; - Q_EMIT dataChanged (model_index, model_index, roles); - changed = true; - } + case region_column: + { + auto region = IARURegions::value(value.toString()); + if (region != item.region_) + { + item.region_ = region; + Q_EMIT dataChanged(model_index, model_index, roles); + changed = true; + } } break; - case mode_column: - { - auto mode = Modes::value (value.toString ()); - if (mode != item.mode_) - { - item.mode_ = mode; - Q_EMIT dataChanged (model_index, model_index, roles); - changed = true; - } - } + case mode_column: + { + auto mode = Modes::value(value.toString()); + if (mode != item.mode_) + { + item.mode_ = mode; + Q_EMIT dataChanged(model_index, model_index, roles); + changed = true; + } + } break; - case frequency_column: - if (value.canConvert ()) + case frequency_column: + { + if (value.canConvert()) + { + Radio::Frequency frequency{qvariant_cast(value)}; + if (frequency != item.frequency_) + { + item.frequency_ = frequency; + // mark derived column (1) changed as well + Q_EMIT dataChanged(index(model_index.row(), 1), model_index, roles); + changed = true; + } + } + } + break; + + case description_column: + { + if (value.toString() != item.description_) + { + item.description_ = value.toString(); + Q_EMIT dataChanged(model_index, model_index, roles); + changed = true; + } + } + break; + + case source_column: + { + if (value.toString() != item.source_) + { + item.source_ = value.toString(); + Q_EMIT dataChanged(model_index, model_index, roles); + changed = true; + } + } + break; + + case start_time_column: + { + QDateTime start_time = QDateTime::fromString(value.toString(), Qt::ISODate); + LOG_INFO(QString{"start_time = %1 - isEmpty %2"}.arg(value.toString()).arg(value.toString().isEmpty())); + if (value.toString().isEmpty()) + { // empty string is valid + start_time = QDateTime(); + } + if (start_time.isValid() || start_time.isNull()) + { + item.start_time_ = start_time; + if (item.end_time_.isValid() && !item.start_time_.isNull() && item.end_time_ < item.start_time_) + { + item.end_time_ = item.start_time_; + } + Q_EMIT dataChanged(model_index, index(model_index.row(), end_time_column), roles); + changed = true; + } + } + break; + + case end_time_column: + { + QDateTime end_time = QDateTime::fromString(value.toString(), Qt::ISODate); + if (value.toString().isEmpty()) + { // empty string is valid + end_time = QDateTime(); + } + if (end_time.isValid() || end_time.isNull()) + { + item.end_time_ = end_time; + if (item.start_time_.isValid() && !item.end_time_.isNull() && end_time <= item.start_time_) + { + item.start_time_ = end_time; + } + Q_EMIT dataChanged(index(model_index.row(), start_time_column), model_index, roles); + changed = true; + } + } + break; + + case preferred_column: { - Radio::Frequency frequency {qvariant_cast (value)}; - if (frequency != item.frequency_) + bool b_value = value.toBool(); + if (b_value != item.preferred_) { - item.frequency_ = frequency; - // mark derived column (1) changed as well - Q_EMIT dataChanged (index (model_index.row (), 1), model_index, roles); + item.preferred_ = b_value; + Q_EMIT dataChanged(index(model_index.row(), start_time_column), model_index, roles); changed = true; } } break; + } } return changed; } -QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orientation, int role) const +QVariant FrequencyList_v2_101::impl::headerData (int section, Qt::Orientation orientation, int role) const { QVariant header; if (Qt::DisplayRole == role @@ -833,10 +1168,15 @@ QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orient { switch (section) { - case region_column: header = tr ("IARU Region"); break; - case mode_column: header = tr ("Mode"); break; - case frequency_column: header = tr ("Frequency"); break; - case frequency_mhz_column: header = tr ("Frequency (MHz)"); break; + case region_column: header = tr ("IARU Region"); break; + case mode_column: header = tr ("Mode"); break; + case frequency_column: header = tr ("Frequency"); break; + case frequency_mhz_column: header = tr ("Frequency (MHz)"); break; + case source_column: header = tr ("Source"); break; + case start_time_column: header = tr ("Start Date/Time"); break; + case end_time_column: header = tr ("End Date/Time"); break; + case preferred_column: header = tr ("Pref"); break; + case description_column: header = tr ("Description"); break; } } else @@ -846,7 +1186,7 @@ QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orient return header; } -bool FrequencyList_v2::impl::removeRows (int row, int count, QModelIndex const& parent) +bool FrequencyList_v2_101::impl::removeRows (int row, int count, QModelIndex const& parent) { if (0 < count && (row + count) <= rowCount (parent)) { @@ -861,14 +1201,14 @@ bool FrequencyList_v2::impl::removeRows (int row, int count, QModelIndex const& return false; } -bool FrequencyList_v2::impl::insertRows (int row, int count, QModelIndex const& parent) +bool FrequencyList_v2_101::impl::insertRows (int row, int count, QModelIndex const& parent) { if (0 < count) { beginInsertRows (parent, row, row + count - 1); for (auto r = 0; r < count; ++r) { - frequency_list_.insert (row, Item {0, Mode::ALL, IARURegions::ALL}); + frequency_list_.insert (row, Item {0, Mode::ALL, IARURegions::ALL, QString(), QString(), QDateTime(), QDateTime(), false}); } endInsertRows (); return true; @@ -876,14 +1216,14 @@ bool FrequencyList_v2::impl::insertRows (int row, int count, QModelIndex const& return false; } -QStringList FrequencyList_v2::impl::mimeTypes () const +QStringList FrequencyList_v2_101::impl::mimeTypes () const { QStringList types; types << mime_type; return types; } -QMimeData * FrequencyList_v2::impl::mimeData (QModelIndexList const& items) const +QMimeData * FrequencyList_v2_101::impl::mimeData (QModelIndexList const& items) const { QMimeData * mime_data = new QMimeData {}; QByteArray encoded_data; @@ -901,43 +1241,43 @@ QMimeData * FrequencyList_v2::impl::mimeData (QModelIndexList const& items) cons return mime_data; } -auto FrequencyList_v2::const_iterator::operator * () const -> Item const& +auto FrequencyList_v2_101::const_iterator::operator * () const -> Item const& { return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ()); } -auto FrequencyList_v2::const_iterator::operator -> () const -> Item const * +auto FrequencyList_v2_101::const_iterator::operator -> () const -> Item const * { return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ()); } -bool FrequencyList_v2::const_iterator::operator != (const_iterator const& rhs) const +bool FrequencyList_v2_101::const_iterator::operator != (const_iterator const& rhs) const { return parent_ != rhs.parent_ || row_ != rhs.row_; } -bool FrequencyList_v2::const_iterator::operator == (const_iterator const& rhs) const +bool FrequencyList_v2_101::const_iterator::operator == (const_iterator const& rhs) const { return parent_ == rhs.parent_ && row_ == rhs.row_; } -auto FrequencyList_v2::const_iterator::operator ++ () -> const_iterator& +auto FrequencyList_v2_101::const_iterator::operator ++ () -> const_iterator& { ++row_; return *this; } -auto FrequencyList_v2::begin () const -> const_iterator +auto FrequencyList_v2_101::begin () const -> const_iterator { return const_iterator (this, 0); } -auto FrequencyList_v2::end () const -> const_iterator +auto FrequencyList_v2_101::end () const -> const_iterator { return const_iterator (this, rowCount ()); } -auto FrequencyList_v2::find (Frequency f) const -> const_iterator +auto FrequencyList_v2_101::find (Frequency f) const -> const_iterator { int row {0}; for (; row < rowCount (); ++row) @@ -950,7 +1290,7 @@ auto FrequencyList_v2::find (Frequency f) const -> const_iterator return const_iterator (this, row); } -auto FrequencyList_v2::filtered_bands () const -> BandSet +auto FrequencyList_v2_101::filtered_bands () const -> BandSet { BandSet result; for (auto const& item : *this) @@ -960,7 +1300,7 @@ auto FrequencyList_v2::filtered_bands () const -> BandSet return result; } -auto FrequencyList_v2::all_bands (Region region, Mode mode) const -> BandSet +auto FrequencyList_v2_101::all_bands (Region region, Mode mode) const -> BandSet { BandSet result; for (auto const& item : m_->frequency_list_) @@ -977,6 +1317,93 @@ auto FrequencyList_v2::all_bands (Region region, Mode mode) const -> BandSet return result; } +FrequencyList_v2_101::FrequencyItems FrequencyList_v2_101::from_json_file(QFile *input_file) +{ + FrequencyList_v2_101::FrequencyItems list; + QJsonDocument doc = QJsonDocument::fromJson(input_file->readAll()); + if (doc.isNull()) + { + throw ReadFileException {tr ("Failed to parse JSON file")}; + } + QJsonObject obj = doc.object(); + if (obj.isEmpty()) + { + throw ReadFileException{tr("Information Missing")}; + } + QJsonArray arr = obj["frequencies"].toArray(); + if (arr.isEmpty()) + { + throw ReadFileException{tr ("No Frequencies were found")}; + } + int valid_entry_count = 0; + int skipped_entry_count = 0; + for (auto const &item: arr) + { + QString mode_s, region_s; + QJsonObject obj = item.toObject(); + FrequencyList_v2_101::Item freq; + region_s = obj["region"].toString(); + mode_s = obj["mode"].toString(); + + freq.frequency_ = obj["frequency"].toString().toDouble() * 1e6; + freq.region_ = IARURegions::value(region_s); + freq.mode_ = Modes::value(mode_s); + freq.description_ = obj["description"].toString(); + freq.source_ = obj["source"].toString(); + freq.start_time_ = QDateTime::fromString(obj["start_time"].toString(), Qt::ISODate); + freq.end_time_ = QDateTime::fromString(obj["end_time"].toString(), Qt::ISODate); + freq.preferred_ = obj["preferred"].toBool(); + + if ((freq.mode_ != Modes::ALL || QString::compare("ALL", mode_s)) && + (freq.region_ != IARURegions::ALL || QString::compare("ALL", region_s, Qt::CaseInsensitive)) && + freq.isSane()) + { + list.push_back(freq); + valid_entry_count++; + } else + skipped_entry_count++; + } + //MessageBox::information_message(this, tr("Loaded Frequencies from %1").arg(file_name), + // tr("Entries Valid/Skipped %1").arg(QString::number(valid_entry_count) + "/" + + // QString::number(skipped_entry_count))); + return list; +} +// write JSON format to a file +void FrequencyList_v2_101::to_json_file(QFile *output_file, QString magic_s, QString version_s, + FrequencyItems const &frequency_items) +{ + QJsonObject jobject{ + {"wsjtx_file", "qrg"}, + {"wsjtx_version", QCoreApplication::applicationVersion()+" "+revision()}, + {"generated_at", QDateTime::currentDateTimeUtc ().toString (Qt::ISODate)}, + {"wsjtx_filetype", magic_s}, + {"qrg_version", version_s}, + {"frequency_count", frequency_items.count()}}; + + QJsonArray array; + for (auto &item: frequency_items) + array.append(item.toJson()); + jobject["frequencies"] = array; + + QJsonDocument d = QJsonDocument(jobject); + output_file->write(d.toJson()); +} + +// previous version 100 of the FrequencyList_v2 class +QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item) +{ + return is >> item.frequency_ + >> item.mode_ + >> item.region_; +} + +QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item) +{ + return os << item.frequency_ + << item.mode_ + << item.region_; +} + // // Obsolete version of FrequencyList no longer used but needed to // allow loading and saving of old settings contents without damage diff --git a/models/FrequencyList.hpp b/models/FrequencyList.hpp index 7c5611b0..82f4946a 100755 --- a/models/FrequencyList.hpp +++ b/models/FrequencyList.hpp @@ -5,6 +5,11 @@ #include #include +#include +#include +#include +#include +#include #include "Radio.hpp" #include "IARURegions.hpp" @@ -37,7 +42,7 @@ class Bands; // Implements the QSortFilterProxyModel interface for a list of spot // frequencies. // -class FrequencyList_v2 final +class FrequencyList_v2_101 final : public QSortFilterProxyModel { Q_OBJECT; @@ -52,18 +57,26 @@ public: Frequency frequency_; Mode mode_; Region region_; + QString description_; + QString source_; + QDateTime start_time_; + QDateTime end_time_; + bool preferred_; // preferred frequency for this band and mode QString toString () const; + bool isSane() const; + QJsonObject toJson () const; + }; using FrequencyItems = QList; using BandSet = QSet; - enum Column {region_column, mode_column, frequency_column, frequency_mhz_column, SENTINAL}; + enum Column {region_column, mode_column, frequency_column, frequency_mhz_column, description_column, start_time_column, end_time_column, source_column, preferred_column, SENTINAL}; // an iterator that meets the requirements of the C++ for range statement class const_iterator { public: - const_iterator (FrequencyList_v2 const * parent, int row) + const_iterator (FrequencyList_v2_101 const * parent, int row) : parent_ {parent} , row_ {row} { @@ -76,18 +89,21 @@ public: const_iterator& operator ++ (); private: - FrequencyList_v2 const * parent_; + FrequencyList_v2_101 const * parent_; int row_; }; - explicit FrequencyList_v2 (Bands const *, QObject * parent = nullptr); - ~FrequencyList_v2 (); + explicit FrequencyList_v2_101 (Bands const *, QObject * parent = nullptr); + + ~FrequencyList_v2_101 (); // Load and store underlying items FrequencyItems frequency_list (FrequencyItems); FrequencyItems const& frequency_list () const; FrequencyItems frequency_list (QModelIndexList const&) const; void frequency_list_merge (FrequencyItems const&); + void to_json_file(QFile *, QString, QString, FrequencyItems const&); + static FrequencyItems from_json_file(QFile *); // Iterators for the sorted and filtered items // @@ -116,7 +132,7 @@ public: int best_working_frequency (QString const& band) const; // Set filter - Q_SLOT void filter (Region, Mode); + Q_SLOT void filter (Region, Mode, bool); // Reset Q_SLOT void reset_to_defaults (); @@ -129,6 +145,9 @@ public: // Proxy API bool filterAcceptsRow (int source_row, QModelIndex const& parent) const override; + // Refresh the filter based on the current filter settings (underlying data may have changed) + void filter_refresh (); + // Custom roles. static int constexpr SortRole = Qt::UserRole; @@ -138,25 +157,56 @@ private: }; inline -bool operator == (FrequencyList_v2::Item const& lhs, FrequencyList_v2::Item const& rhs) +bool operator == (FrequencyList_v2_101::Item const& lhs, FrequencyList_v2_101::Item const& rhs) { return lhs.frequency_ == rhs.frequency_ && lhs.region_ == rhs.region_ - && lhs.mode_ == rhs.mode_; + && lhs.mode_ == rhs.mode_ + && lhs.description_ == rhs.description_ + && lhs.source_ == rhs.source_ + && lhs.start_time_ == rhs.start_time_ + && lhs.end_time_ == rhs.end_time_ + && lhs.preferred_ == rhs.preferred_; } -QDataStream& operator << (QDataStream&, FrequencyList_v2::Item const&); -QDataStream& operator >> (QDataStream&, FrequencyList_v2::Item&); +QDataStream& operator << (QDataStream&, FrequencyList_v2_101::Item const&); +QDataStream& operator >> (QDataStream&, FrequencyList_v2_101::Item&); #if !defined (QT_NO_DEBUG_STREAM) -QDebug operator << (QDebug, FrequencyList_v2::Item const&); +QDebug operator << (QDebug, FrequencyList_v2_101::Item const&); #endif +Q_DECLARE_METATYPE (FrequencyList_v2_101::Item); +Q_DECLARE_METATYPE (FrequencyList_v2_101::FrequencyItems); + +class FrequencyList_v2 final +{ + +public: + using Frequency = Radio::Frequency; + using Mode = Modes::Mode; + using Region = IARURegions::Region; + + struct Item + { + Frequency frequency_; + Mode mode_; + Region region_; + QString toString () const; + }; + using FrequencyItems = QList; + +private: + FrequencyItems frequency_list_; +}; + +QDataStream& operator << (QDataStream&, FrequencyList_v2::Item const&); +QDataStream& operator >> (QDataStream&, FrequencyList_v2::Item&); + Q_DECLARE_METATYPE (FrequencyList_v2::Item); Q_DECLARE_METATYPE (FrequencyList_v2::FrequencyItems); - // // Obsolete version of FrequencyList no longer used but needed to // allow loading and saving of old settings contents without damage @@ -184,4 +234,18 @@ QDataStream& operator >> (QDataStream&, FrequencyList::Item&); Q_DECLARE_METATYPE (FrequencyList::Item); Q_DECLARE_METATYPE (FrequencyList::FrequencyItems); +class ReadFileException : public QException { +public: + ReadFileException (QString const& message) + : message_ {message} + { + } + + void raise () const override { throw *this; } + ReadFileException * clone () const override { return new ReadFileException {*this}; } + + QString filename_; + QString message_; +}; + #endif diff --git a/models/StationList.cpp b/models/StationList.cpp index 790b275d..7c6de0ce 100755 --- a/models/StationList.cpp +++ b/models/StationList.cpp @@ -527,7 +527,7 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act QDataStream stream {&encoded_data, QIODevice::ReadOnly}; while (!stream.atEnd ()) { - FrequencyList_v2::Item item; + FrequencyList_v2_101::Item item; stream >> item; auto const& band = bands_->find (item.frequency_); if (stations_.cend () == std::find_if (stations_.cbegin () diff --git a/translations/wsjtx_ca.ts b/translations/wsjtx_ca.ts index 073479a0..5a90cd5d 100755 --- a/translations/wsjtx_ca.ts +++ b/translations/wsjtx_ca.ts @@ -1477,7 +1477,7 @@ Error: %2 - %3 - FrequencyList_v2 + FrequencyList_v2_100 diff --git a/translations/wsjtx_es.ts b/translations/wsjtx_es.ts index 1a874d37..f2788d61 100755 --- a/translations/wsjtx_es.ts +++ b/translations/wsjtx_es.ts @@ -1630,7 +1630,7 @@ Error: %2 - %3 - FrequencyList_v2 + FrequencyList_v2_100 diff --git a/translations/wsjtx_zh_HK.ts b/translations/wsjtx_zh_HK.ts index 99225170..d08cf0a0 100755 --- a/translations/wsjtx_zh_HK.ts +++ b/translations/wsjtx_zh_HK.ts @@ -1475,7 +1475,7 @@ Error: %2 - %3 - FrequencyList_v2 + FrequencyList_v2_100 diff --git a/translations/wsjtx_zh_TW.ts b/translations/wsjtx_zh_TW.ts index fb9f9765..7fa5c63d 100755 --- a/translations/wsjtx_zh_TW.ts +++ b/translations/wsjtx_zh_TW.ts @@ -1475,7 +1475,7 @@ Error: %2 - %3 - FrequencyList_v2 + FrequencyList_v2_100 diff --git a/validators/LiveFrequencyValidator.cpp b/validators/LiveFrequencyValidator.cpp index b444ba99..01034c54 100755 --- a/validators/LiveFrequencyValidator.cpp +++ b/validators/LiveFrequencyValidator.cpp @@ -12,7 +12,7 @@ LiveFrequencyValidator::LiveFrequencyValidator (QComboBox * combo_box , Bands const * bands - , FrequencyList_v2 const * frequencies + , FrequencyList_v2_101 const * frequencies , Frequency const * nominal_frequency , QWidget * parent) : QRegExpValidator { diff --git a/validators/LiveFrequencyValidator.hpp b/validators/LiveFrequencyValidator.hpp index b1c4f44a..48c78dc1 100755 --- a/validators/LiveFrequencyValidator.hpp +++ b/validators/LiveFrequencyValidator.hpp @@ -7,7 +7,7 @@ #include "Radio.hpp" class Bands; -class FrequencyList_v2; +class FrequencyList_v2_101; class QComboBox; class QWidget; @@ -35,7 +35,7 @@ public: LiveFrequencyValidator (QComboBox * combo_box // associated combo box , Bands const * bands // bands model - , FrequencyList_v2 const * frequencies // working frequencies model + , FrequencyList_v2_101 const * frequencies // working frequencies model , Frequency const * nominal_frequency , QWidget * parent = nullptr); @@ -46,7 +46,7 @@ public: private: Bands const * bands_; - FrequencyList_v2 const * frequencies_; + FrequencyList_v2_101 const * frequencies_; Frequency const * nominal_frequency_; QComboBox * combo_box_; }; diff --git a/widgets/BandComboBox.cpp b/widgets/BandComboBox.cpp index d75b5b43..c34ec7e7 100755 --- a/widgets/BandComboBox.cpp +++ b/widgets/BandComboBox.cpp @@ -15,7 +15,7 @@ BandComboBox::BandComboBox (QWidget * parent) // item text. void BandComboBox::showPopup () { - auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2::frequency_mhz_column); + auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2_101::frequency_mhz_column); if (count () > maxVisibleItems ()) { // for some as yet unknown reason, in FT8 mode the scrollbar diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index 8d8ccb38..2a75c2da 100755 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -86,7 +86,7 @@ void DisplayText::mouseDoubleClickEvent(QMouseEvent *e) void DisplayText::insertLineSpacer(QString const& line) { - appendText (line, "#d3d3d3"); + insertText (line, "#d3d3d3"); } namespace @@ -123,11 +123,11 @@ namespace } } -void DisplayText::appendText(QString const& text, QColor bg, QColor fg - , QString const& call1, QString const& call2) +void DisplayText::insertText(QString const& text, QColor bg, QColor fg + , QString const& call1, QString const& call2, QTextCursor::MoveOperation location) { auto cursor = textCursor (); - cursor.movePosition (QTextCursor::End); + cursor.movePosition (location); auto block_format = cursor.blockFormat (); auto format = cursor.blockCharFormat (); format.setFont (char_font_); @@ -484,7 +484,7 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con } } - appendText (message.trimmed (), bg, fg, decodedText.call (), dxCall); + insertText (message.trimmed (), bg, fg, decodedText.call (), dxCall); } @@ -516,18 +516,19 @@ void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 tx QColor fg; highlight_types types {Highlight::Tx}; set_colours (m_config, &bg, &fg, types); - appendText (t, bg, fg); + insertText (t, bg, fg); } void DisplayText::displayQSY(QString text) { QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text; - appendText (t, "hotpink"); + insertText (t, "hotpink"); } -void DisplayText::displayFoxToBeCalled(QString t, QColor bg, QColor fg) +void DisplayText::displayHoundToBeCalled(QString t, bool bAtTop, QColor bg, QColor fg) { - appendText (t, bg, fg); + if (bAtTop) t = t + "\n"; // need a newline when insertion at top + insertText(t, bg, fg, "", "", bAtTop ? QTextCursor::Start : QTextCursor::End); } namespace diff --git a/widgets/displaytext.h b/widgets/displaytext.h index 06f9bec8..1d385534 100755 --- a/widgets/displaytext.h +++ b/widgets/displaytext.h @@ -33,7 +33,7 @@ public: bool haveFSpread = false, float fSpread = 0.0, bool bDisplayPoints=false, int points=-99); void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode, double TRperiod); void displayQSY(QString text); - void displayFoxToBeCalled(QString t, QColor bg = QColor {}, QColor fg = QColor {}); + void displayHoundToBeCalled(QString t, bool bAtTop=false, QColor bg = QColor {}, QColor fg = QColor {}); void new_period (); QString CQPriority(){return m_CQPriority;}; qint32 m_points; @@ -42,8 +42,8 @@ public: Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers); Q_SIGNAL void erased (); - Q_SLOT void appendText (QString const& text, QColor bg = QColor {}, QColor fg = QColor {} - , QString const& call1 = QString {}, QString const& call2 = QString {}); + Q_SLOT void insertText (QString const& text, QColor bg = QColor {}, QColor fg = QColor {} + , QString const& call1 = QString {}, QString const& call2 = QString {}, QTextCursor::MoveOperation location=QTextCursor::End); Q_SLOT void erase (); Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only); @@ -62,6 +62,7 @@ private: , QString const& currentMode, QString extra); QFont char_font_; QAction * erase_action_; + QHash> highlighted_calls_; bool high_volume_; QMetaObject::Connection vertical_scroll_connection_; diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index de0b2cee..8e38a601 100755 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -90,6 +90,7 @@ #include "ExportCabrillo.h" #include "ui_mainwindow.h" #include "moc_mainwindow.cpp" +#include "Logger.hpp" #define FCL fortran_charlen_t @@ -155,7 +156,7 @@ extern "C" { void save_echo_params_(int* ndoptotal, int* ndop, int* nfrit, float* f1, float* fspread, short id2[], int* idir); - void avecho_( short id2[], int* dop, int* nfrit, int* nauto, int* nqual, float* f1, + void avecho_( short id2[], int* dop, int* nfrit, int* nauto, int* navg, int* nqual, float* f1, float* level, float* sigdb, float* snr, float* dfreq, float* width, bool* bDiskData); @@ -208,6 +209,8 @@ QVector g_ColorTbl; using SpecOp = Configuration::SpecialOperatingActivity; bool m_displayBand = false; +bool no_a7_decodes = false; +bool keep_frequency = false; namespace { @@ -654,7 +657,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, connect(txMsgButtonGroup,SIGNAL(buttonClicked(int)),SLOT(set_ntx(int))); connect (ui->decodedTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall2); connect (ui->decodedTextBrowser2, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall); - connect (ui->textBrowser4, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxQueue); + connect (ui->houndQueueTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxQueue); + connect (ui->foxTxListTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxInProgress); connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared); connect (ui->decodedTextBrowser2, &DisplayText::erased, this, &MainWindow::rx_frequency_activity_cleared); @@ -753,24 +757,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, } }); - // ensure a balanced layout of the mode buttons - qreal pointSize = m_config.text_font().pointSizeF(); - if (pointSize < 11) { - ui->houndButton->setMaximumWidth(40); - ui->ft8Button->setMaximumWidth(40); - ui->ft4Button->setMaximumWidth(40); - ui->msk144Button->setMaximumWidth(40); - ui->q65Button->setMaximumWidth(40); - ui->jt65Button->setMaximumWidth(40); - } else { - ui->houndButton->setMinimumWidth(50); - ui->ft8Button->setMinimumWidth(50); - ui->ft4Button->setMinimumWidth(50); - ui->msk144Button->setMinimumWidth(50); - ui->q65Button->setMinimumWidth(50); - ui->jt65Button->setMinimumWidth(50); - } - // hook up save WAV file exit handling connect (&m_saveWAVWatcher, &QFutureWatcher::finished, [this] { // extract the promise from the future @@ -783,7 +769,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, // Hook up working frequencies. ui->bandComboBox->setModel (m_config.frequencies ()); - ui->bandComboBox->setModelColumn (FrequencyList_v2::frequency_mhz_column); + ui->bandComboBox->setModelColumn (FrequencyList_v2_101::frequency_mhz_column); // Enable live band combo box entry validation and action. auto band_validator = new LiveFrequencyValidator {ui->bandComboBox @@ -1035,6 +1021,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_wideGraph->setMode(m_mode); connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::on_the_minute); + connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::invalidate_frequencies_filter); + minuteTimer.setSingleShot (true); minuteTimer.start (ms_minute_error () + 60 * 1000); @@ -1061,9 +1049,9 @@ void MainWindow::not_GA_warning_message () MessageBox::critical_message (this, "This is a pre-release version of WSJT-X 2.6.0 made\n" "available for testing purposes. By design it will\n" - "be nonfunctional after Dec 31, 2022."); + "be nonfunctional after Mar 31, 2023."); auto now = QDateTime::currentDateTimeUtc (); - if (now >= QDateTime {{2022, 12, 31}, {23, 59, 59, 999}, Qt::UTC}) { + if (now >= QDateTime {{2023, 03, 31}, {23, 59, 59, 999}, Qt::UTC}) { Q_EMIT finished (); } } @@ -1079,6 +1067,14 @@ void MainWindow::splash_done () m_splash && m_splash->close (); } +void MainWindow::invalidate_frequencies_filter () +{ + // every interval, invalidate the frequency filter, so that if any + // working frequency goes in/out of scope, we pick it up. + m_config.frequencies ()->filter_refresh (); + ui->bandComboBox->update (); +} + void MainWindow::on_the_minute () { if (minuteTimer.isSingleShot ()) @@ -1214,6 +1210,7 @@ void MainWindow::writeSettings() m_settings->setValue("Blanker",ui->sbNB->value()); m_settings->setValue("Score",m_score); m_settings->setValue("labDXpedText",ui->labDXped->text()); + m_settings->setValue("EchoAvg",ui->sbEchoAvg->value()); { QList coeffs; // suitable for QSettings @@ -1347,6 +1344,7 @@ void MainWindow::readSettings() ui->actionAuto_Clear_Avg->setChecked (m_settings->value ("AutoClearAvg", false).toBool()); ui->decodes_splitter->restoreState(m_settings->value("SplitterState").toByteArray()); ui->sbNB->setValue(m_settings->value("Blanker",0).toInt()); + ui->sbEchoAvg->setValue(m_settings->value("EchoAvg",10).toInt()); { auto const& coeffs = m_settings->value ("PhaseEqualizationCoefficients" , QList {0., 0., 0., 0., 0.}).toList (); @@ -1364,6 +1362,7 @@ void MainWindow::readSettings() m_audioThreadPriority = static_cast (m_settings->value ("Audio/ThreadPriority", QThread::TimeCriticalPriority).toInt () % 8); m_settings->endGroup (); + m_specOp=m_config.special_op_id(); checkMSK144ContestType(); if(displayMsgAvg) on_actionMessage_averaging_triggered(); if (displayFoxLog) on_fox_log_action_triggered (); @@ -1400,10 +1399,35 @@ void MainWindow::set_application_font (QFont const& font) QFile sf {sheet}; if (sf.open (QFile::ReadOnly | QFile::Text)) { - ss = sf.readAll () + ss; + QString tmp = sf.readAll(); + if (tmp != NULL) ss = sf.readAll () + tmp; + else qDebug() << "tmp==NULL at sf.readAll"; } } qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); + // ensure a balanced layout of the mode buttons + qreal pointSize = m_config.text_font().pointSizeF(); + if (pointSize < 11) { + ui->houndButton->setMaximumWidth(40); + ui->ft8Button->setMaximumWidth(40); + ui->ft4Button->setMaximumWidth(40); + ui->msk144Button->setMaximumWidth(40); + ui->q65Button->setMaximumWidth(40); + ui->jt65Button->setMaximumWidth(40); + ui->houndButton->setMinimumWidth(0); + ui->ft8Button->setMinimumWidth(0); + ui->ft4Button->setMinimumWidth(0); + ui->msk144Button->setMinimumWidth(0); + ui->q65Button->setMinimumWidth(0); + ui->jt65Button->setMinimumWidth(0); + } else { + ui->houndButton->setMinimumWidth(50); + ui->ft8Button->setMinimumWidth(50); + ui->ft4Button->setMinimumWidth(50); + ui->msk144Button->setMinimumWidth(50); + ui->q65Button->setMinimumWidth(50); + ui->jt65Button->setMinimumWidth(50); + } for (auto& widget : qApp->topLevelWidgets ()) { widget->updateGeometry (); @@ -1414,9 +1438,14 @@ void MainWindow::setDecodedTextFont (QFont const& font) { ui->decodedTextBrowser->setContentFont (font); ui->decodedTextBrowser2->setContentFont (font); - ui->textBrowser4->setContentFont(font); - ui->textBrowser4->displayFoxToBeCalled(" "); - ui->textBrowser4->setText(""); + ui->houndQueueTextBrowser->setContentFont(font); + ui->houndQueueTextBrowser->displayHoundToBeCalled(" "); + ui->houndQueueTextBrowser->setText(""); + + ui->foxTxListTextBrowser->setContentFont(font); + ui->foxTxListTextBrowser->displayHoundToBeCalled(" "); + ui->foxTxListTextBrowser->setText(""); + auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}'; ui->lh_decodes_headings_label->setStyleSheet (ui->lh_decodes_headings_label->styleSheet () + style_sheet); ui->rh_decodes_headings_label->setStyleSheet (ui->rh_decodes_headings_label->styleSheet () + style_sheet); @@ -1531,7 +1560,7 @@ void MainWindow::dataSink(qint64 frames) if(m_ihsym <=0) return; if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer if(m_monitoring || m_diskData) { - m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData); + m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData,m_px); } if(m_mode=="MSK144") return; @@ -1606,11 +1635,12 @@ void MainWindow::dataSink(qint64 frames) echocom_.nclearave=m_nclearave; int nDop=m_fAudioShift; int nDopTotal=m_fDop; + int navg=ui->sbEchoAvg->value(); if(m_diskData) { int idir=-1; save_echo_params_(&nDopTotal,&nDop,&nfrit,&f1,&width,dec_data.d2,&idir); } - avecho_(dec_data.d2,&nDop,&nfrit,&nauto,&nqual,&f1,&xlevel,&sigdb, + avecho_(dec_data.d2,&nDop,&nfrit,&nauto,&navg,&nqual,&f1,&xlevel,&sigdb, &dBerr,&dfreq,&width,&m_diskData); //Don't restart Monitor after an Echo transmission if(m_bEchoTxed and !m_auto) { @@ -1619,7 +1649,7 @@ void MainWindow::dataSink(qint64 frames) } if(m_monitoring or m_auto or m_diskData) { - QString t0; + QString t0,t1; if(m_diskData) { t0=t0.asprintf("%06d ",m_UTCdisk); } else { @@ -1630,17 +1660,20 @@ void MainWindow::dataSink(qint64 frames) if(m_auto) isec=isec - isec%6; if(!m_auto) isec=isec - isec%3; t0=t0.asprintf("%02d%02d%02d ",ihr,imin,isec); + t1=now.toString("yyMMdd_"); } int n=t0.toInt(); int nsec=((n/10000)*3600) + (((n/100)%100)*60) + (n%100); - if(!m_echoRunning) m_echoSec0=nsec; - n=(nsec-m_echoSec0 + 864000)%86400; + if(!m_echoRunning or echocom_.nsum<2) m_echoSec0=nsec; + float hour=n/10000 + ((n/100)%100)/60.0 + (n%100)/3600.0; m_echoRunning=true; QString t; - t = t.asprintf("%6d %5.2f %7d %7.1f %7d %7d %7d %7.1f %7.1f",n,xlevel, + t = t.asprintf("%9.6f %5.2f %7d %7.1f %7d %7d %7d %7.1f %7.1f",hour,xlevel, nDopTotal,width,echocom_.nsum,nqual,qRound(dfreq),sigdb,dBerr); t = t0 + t; - if (ui) ui->decodedTextBrowser->appendText(t); + if (ui) ui->decodedTextBrowser->insertText(t); + t=t1+t; + write_all("Rx",t); } if(m_echoGraph->isVisible()) m_echoGraph->plotSpec(); @@ -2078,7 +2111,6 @@ void MainWindow::auto_tx_mode (bool state) void MainWindow::keyPressEvent (QKeyEvent * e) { - if(SpecOp::FOX == m_specOp) { switch (e->key()) { case Qt::Key_Return: @@ -2090,6 +2122,13 @@ void MainWindow::keyPressEvent (QKeyEvent * e) case Qt::Key_Backspace: qDebug() << "Key Backspace"; return; +#ifdef DEBUG_FOX + case Qt::Key_X: + if(e->modifiers() & Qt::AltModifier) { + foxTest(); + return; + } +#endif } QMainWindow::keyPressEvent (e); } @@ -3166,6 +3205,7 @@ void MainWindow::on_ClrAvgButton_clicked() if(m_mode=="Echo") { echocom_.nsum=0; m_echoGraph->clearAvg(); + m_wideGraph->restartTotalPower(); } else { if(m_msgAvgWidget != NULL) { if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); @@ -3672,6 +3712,10 @@ void MainWindow::readFromStdout() //readFromStdout continue; } } + + // Don't allow a7 decodes during the first period because they can be leftovers from the previous band + if (!(no_a7_decodes && line_read.contains("a7"))) { + if (m_mode!="FT8" and m_mode!="FT4" and !m_mode.startsWith ("FST4") and m_mode!="Q65") { //Pad 22-char msg to at least 37 chars line_read = line_read.left(44) + " " + line_read.mid(44); @@ -3738,6 +3782,7 @@ void MainWindow::readFromStdout() //readFromStdout } m_tBlankLine = line_read.left(ntime); } + } if ("FST4W" == m_mode) { uploadWSPRSpots (true, line_read); @@ -3787,7 +3832,8 @@ void MainWindow::readFromStdout() //readFromStdout if (m_config.highlight_DXcall () && (m_hisCall!="") && ((decodedtext.string().contains(QRegularExpression {"(\\w+) " + m_hisCall})) || (decodedtext.string().contains(QRegularExpression {"(\\w+) <" + m_hisCall +">"})) - || (decodedtext.string().contains(QRegularExpression {"<(\\w+)> " + m_hisCall})))) { + || (decodedtext.string().contains(QRegularExpression {"<(\\w+)> " + m_hisCall})) + || (decodedtext.string().contains(QRegularExpression {"<...> " + m_hisCall})))) { ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true); // highlight dxCallEntry QTimer::singleShot (500, [=] { // repeated highlighting to override JTAlert ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true); @@ -3849,8 +3895,13 @@ void MainWindow::readFromStdout() //readFromStdout bool bProcessMsgNormally=ui->respondComboBox->currentText()=="CQ: First" or (ui->respondComboBox->currentText()=="CQ: Max Dist" and m_ActiveStationsWidget==NULL) or (m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible()); - QString t=decodedtext.messageWords()[4]; - if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; + if (decodedtext.messageWords().length() >= 2) { + QString t=decodedtext.messageWords()[2]; + if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; + } + else { + bProcessMsgNormally=true; + } if(bProcessMsgNormally) { m_bDoubleClicked=true; m_bAutoReply = true; @@ -3861,6 +3912,9 @@ void MainWindow::readFromStdout() //readFromStdout QString deCall; QString deGrid; decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + // if they dont' send their grid we'll use ours and assume dx=0 + if (deGrid.length() == 0) deGrid = m_config.my_grid(); + if(deGrid.contains(grid_regexp) or (deGrid.contains("+") or deGrid.contains("-"))) { int points=0; @@ -3903,7 +3957,7 @@ void MainWindow::readFromStdout() //readFromStdout } if(SpecOp::FOX==m_specOp and decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign - if(SpecOp::FOX==m_specOp and for_us and (audioFreq<1000)) bDisplayRight=true; + if(SpecOp::FOX==m_specOp and for_us and decodedtext.string().contains(QRegularExpression{" R\\W\\d"})) bDisplayRight=true; if(SpecOp::FOX!=m_specOp and (for_us or (abs(audioFreq - m_wideGraph->rxFreq()) <= 10))) bDisplayRight=true; } } else { @@ -4009,7 +4063,8 @@ void MainWindow::readFromStdout() //readFromStdout if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream s(&f); QString t=s.readAll(); - m_msgAvgWidget->displayAvg(t); + if (t != NULL) m_msgAvgWidget->displayAvg(t); + else qDebug() << "tmp==NULL at s.readAll"; } } } @@ -4109,7 +4164,7 @@ void MainWindow::pskPost (DecodedText const& decodedtext) } int snr = decodedtext.snr(); Frequency frequency = m_freqNominalPeriod + audioFrequency; // prevent spotting wrong band - if(grid.contains (grid_regexp)) { + if(grid.contains (grid_regexp) || decodedtext.string().contains(" CQ ")) { // qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr; if (!m_psk_Reporter.addRemoteStation (deCall, grid, frequency, msgmode, snr)) { @@ -4860,7 +4915,7 @@ void MainWindow::startTx2() t = " Transmitting " + m_mode + " ----------------------- " + m_config.bands ()->find (m_freqNominal); t=beacon_start_time (m_TRperiod / 2) + ' ' + t.rightJustified (66, '-'); - ui->decodedTextBrowser->appendText(t); + ui->decodedTextBrowser->insertText(t); } write_all("Tx",m_currentMessage); } @@ -5139,7 +5194,7 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) if(SpecOp::FOX==m_specOp and m_decodedText2) { if(m_houndQueue.count()<10 and m_nSortedHounds>0) { QString t=cursor.block().text(); - selectHound(t); + selectHound(t, modifiers==(Qt::AltModifier)); // alt double-click gets put at top of queue } return; } @@ -6138,7 +6193,9 @@ void MainWindow::on_addButton_clicked() //Add button // preserve symlinks f1.open (QFile::WriteOnly | QFile::Text); // truncates f2.seek (0); - f1.write (f2.readAll ()); // copy contents + QByteArray tmp = f2.readAll(); + if (tmp != (const char*)NULL) f1.write (tmp); // copy contents + else qDebug() << "tmp==NULL at f1.write"; f2.remove (); } } @@ -6516,6 +6573,7 @@ void MainWindow::displayWidgets(qint64 n) (m_config.RTTY_Exchange()=="DX" or m_config.RTTY_Exchange()=="#") ); } if(m_mode=="MSK144") b=SpecOp::EU_VHF==m_specOp; + ui->sbEchoAvg->setVisible(m_mode=="Echo"); ui->sbSerialNumber->setVisible(b); m_lastCallsign.clear (); // ensures Tx5 is updated for new modes b=m_mode.startsWith("FST4"); @@ -6624,6 +6682,7 @@ void MainWindow::on_actionFT4_triggered() m_wideGraph->setMode(m_mode); m_send_RR73=true; VHF_features_enabled(bVHF); + ui->cbAutoSeq->setChecked(true); m_fastGraph->hide(); m_wideGraph->show(); ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message")); @@ -6730,7 +6789,7 @@ void MainWindow::on_actionFT8_triggered() ui->txb5->setEnabled(false); ui->txb6->setEnabled(false); } else { - switch_mode (Modes::FT8); + if (!(keep_frequency)) switch_mode (Modes::FT8); } if(m_specOp != SpecOp::HOUND) { @@ -6941,6 +7000,7 @@ void MainWindow::on_actionQ65_triggered() m_mode="Q65"; ui->actionQ65->setChecked(true); switch_mode(Modes::Q65); + ui->cbAutoSeq->setChecked(true); fast_config(false); WSPR_config(false); setup_status_bar(true); @@ -7022,6 +7082,7 @@ void MainWindow::on_actionMSK144_triggered() m_toneSpacing=0.0; WSPR_config(false); VHF_features_enabled(true); + ui->cbAutoSeq->setChecked(true); m_bFastMode=true; m_bFast9=false; ui->sbTR->values ({5, 10, 15, 30}); @@ -7098,7 +7159,13 @@ void MainWindow::on_actionWSPR_triggered() void MainWindow::on_actionEcho_triggered() { + int nd=int(m_ndepth&3); on_actionJT4_triggered(); +// Don't allow decoding depth to be changed just because Echo mode was entered: + if(nd==1) ui->actionQuickDecode->setChecked (true); + if(nd==2) ui->actionMediumDecode->setChecked (true); + if(nd==3) ui->actionDeepestDecode->setChecked (true); + m_mode="Echo"; ui->actionEcho->setChecked(true); m_TRperiod=3.0; @@ -7121,11 +7188,11 @@ void MainWindow::on_actionEcho_triggered() m_bFastMode=false; m_bFast9=false; WSPR_config(true); - ui->lh_decodes_headings_label->setText(" UTC Tsec Level Doppler Width N Q DF SNR dBerr"); + ui->lh_decodes_headings_label->setText(" UTC Hour Level Doppler Width N Q DF SNR dBerr"); // 01234567890123456789012345678901234567 displayWidgets(nWidgets("00000000000000000010001000000000000000")); fast_config(false); - if(m_astroWidget) m_astroWidget->selectOwnEcho(); + ui->sbEchoAvg->values ({1, 2, 5, 10, 20, 50, 100}); statusChanged(); monitor(false); } @@ -7159,7 +7226,7 @@ void MainWindow::on_actionFreqCal_triggered() void MainWindow::switch_mode (Mode mode) { m_fastGraph->setMode(m_mode); - m_config.frequencies ()->filter (m_config.region (), mode); + m_config.frequencies ()->filter (m_config.region (), mode, true); // filter on current time auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal); ui->bandComboBox->setCurrentIndex (row); if (row >= 0) { @@ -7404,7 +7471,7 @@ void MainWindow::on_actionOpen_log_directory_triggered () void MainWindow::on_bandComboBox_currentIndexChanged (int index) { auto const& frequencies = m_config.frequencies (); - auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2::frequency_column)); + auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column)); Frequency frequency {m_freqNominal}; if (source_index.isValid ()) { @@ -7432,7 +7499,7 @@ void MainWindow::on_bandComboBox_editTextChanged (QString const& text) void MainWindow::on_bandComboBox_activated (int index) { auto const& frequencies = m_config.frequencies (); - auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2::frequency_column)); + auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column)); Frequency frequency {m_freqNominal}; if (source_index.isValid ()) { @@ -7445,6 +7512,10 @@ void MainWindow::on_bandComboBox_activated (int index) void MainWindow::band_changed (Frequency f) { + // Don't allow a7 decodes during the first period because they can be leftovers from the previous band + no_a7_decodes = true; + QTimer::singleShot ((int(1500.0*m_TRperiod)), [=] {no_a7_decodes = false;}); + // Set the attenuation value if options are checked if (m_config.pwrBandTxMemory() && !m_tune) { auto const&curBand = ui->bandComboBox->currentText(); @@ -7981,7 +8052,7 @@ void MainWindow::on_outAttenuation_valueChanged (int a) tt_str = tr ("Transmit digital gain "); } tt_str += (a ? QString::number (-dBAttn, 'f', 1) : "0") + "dB"; - if (!m_block_pwr_tooltip) { + if (ui->outAttenuation->hasFocus() && !m_block_pwr_tooltip) { QToolTip::showText (QCursor::pos (), tt_str, ui->outAttenuation); } QString curBand = ui->bandComboBox->currentText(); @@ -8465,7 +8536,7 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout t = " " + tr ("Receiving") + " " + m_mode + " ----------------------- " + m_config.bands ()->find (m_dialFreqRxWSPR); t=beacon_start_time (-m_TRperiod / 2) + ' ' + t.rightJustified (66, '-'); - ui->decodedTextBrowser->appendText(t); + ui->decodedTextBrowser->insertText(t); } killFileTimer.start (45*1000); //Kill in 45s (for slow modes) } @@ -8539,12 +8610,12 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout QString band; Frequency f=1000000.0*rxFields.at(3).toDouble()+0.5; band = ' ' + m_config.bands ()->find (f); - ui->decodedTextBrowser->appendText(band.rightJustified (71, '-')); + ui->decodedTextBrowser->insertText(band.rightJustified (71, '-')); } m_tBlankLine = rxLine.left(4); } m_nWSPRdecodes += 1; - ui->decodedTextBrowser->appendText(rxLine); + ui->decodedTextBrowser->insertText(rxLine); } } } @@ -9127,7 +9198,9 @@ void MainWindow::on_pbFoxReset_clicked() QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt")); f.remove(); ui->decodedTextBrowser->setText(""); - ui->textBrowser4->setText(""); + ui->houndQueueTextBrowser->setText(""); + ui->foxTxListTextBrowser->setText(""); + m_houndQueue.clear(); m_foxQSO.clear(); m_foxQSOinProgress.clear(); @@ -9247,19 +9320,18 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB) } //------------------------------------------------------------------------------ -void MainWindow::selectHound(QString line) +void MainWindow::selectHound(QString line, bool bTopQueue) { /* Called from doubleClickOnCall() in DXpedition Fox mode. * QString "line" is a user-selected line from left text window. * The line may be selected by double-clicking; alternatively, hitting * is equivalent to double-clicking on the top-most line. */ - if(line.length()==0) return; QString houndCall=line.split(" ",SkipEmptyParts).at(0); // Don't add a call already enqueued or in QSO - if(ui->textBrowser4->toPlainText().indexOf(houndCall) >= 0) return; + if(ui->houndQueueTextBrowser->toPlainText().indexOf(houndCall) >= 0) return; QString houndGrid=line.split(" ",SkipEmptyParts).at(1); // Hound caller's grid QString rpt=line.split(" ",SkipEmptyParts).at(2); // Hound SNR @@ -9269,16 +9341,25 @@ void MainWindow::selectHound(QString line) ui->decodedTextBrowser->setText(m_houndCallers); // Populate left window with Hound callers QString t1=houndCall + " "; QString t2=rpt; + QString t1_with_grid; if(rpt.mid(0,1) != "-" and rpt.mid(0,1) != "+") t2="+" + rpt; if(t2.length()==2) t2=t2.mid(0,1) + "0" + t2.mid(1,1); t1=t1.mid(0,12) + t2; - ui->textBrowser4->displayFoxToBeCalled(t1); // Add hound call and rpt to tb4 - t1=t1 + " " + houndGrid; // Append the grid - m_houndQueue.enqueue(t1); // Put this hound into the queue - writeFoxQSO(" Sel: " + t1); - QTextCursor cursor = ui->textBrowser4->textCursor(); + ui->houndQueueTextBrowser->displayHoundToBeCalled(t1, bTopQueue); // Add hound call and rpt to tb4 + t1_with_grid=t1 + " " + houndGrid; // Append the grid + + if (bTopQueue) + { + m_houndQueue.prepend(t1_with_grid); // Put this hound into the queue at the top + } + else + { + m_houndQueue.enqueue(t1_with_grid); // Put this hound into the queue + } + writeFoxQSO(" Sel: " + t1_with_grid); + QTextCursor cursor = ui->houndQueueTextBrowser->textCursor(); cursor.setPosition(0); // Scroll to top of list - ui->textBrowser4->setTextCursor(cursor); + ui->houndQueueTextBrowser->setTextCursor(cursor); } //------------------------------------------------------------------------------ @@ -9307,7 +9388,7 @@ void MainWindow::houndCallers() houndCall=line.mid(0,i0); paddedHoundCall=houndCall + " "; //Don't list a hound already in the queue - if(!ui->textBrowser4->toPlainText().contains(paddedHoundCall)) { + if(!ui->houndQueueTextBrowser->toPlainText().contains(paddedHoundCall)) { if(m_loggedByFox[houndCall].contains(m_lastBand)) continue; //already logged on this band if(m_foxQSO.contains(houndCall)) continue; //still in the QSO map auto const& entity = m_logBook.countries ()->lookup (houndCall); @@ -9364,6 +9445,19 @@ void MainWindow::foxRxSequencer(QString msg, QString houndCall, QString rptRcvd) } } } +void MainWindow::updateFoxQSOsInProgressDisplay() +{ + + ui->foxTxListTextBrowser->clear(); + for (int i = 0; i < m_foxQSOinProgress.count(); i++) + { + //First do those for QSOs in progress + QString hc = m_foxQSOinProgress.at(i); + QString status = m_foxQSO[hc].ncall > m_maxStrikes ? QString(" (rx) ") : QString(" "); + QString str = (hc + " ").left(13) + QString::number(m_foxQSO[hc].ncall) + status; + ui->foxTxListTextBrowser->displayHoundToBeCalled(str); + } +} void MainWindow::foxTxSequencer() { @@ -9499,6 +9593,10 @@ list2Done: on_logQSOButton_clicked (); m_foxRateQueue.enqueue (now); //Add present time in seconds //to Rate queue. + QTimer::singleShot (13000, [=] { + m_foxQSOinProgress.removeOne(hc1); //Remove from In Progress window + updateFoxQSOsInProgressDisplay(); //Update InProgress display after Tx is complete + }); } m_loggedByFox[hc1] += (m_lastBand + " "); } @@ -9560,13 +9658,14 @@ Transmit: m_foxLogWindow->rate (m_foxRateQueue.size ()); m_foxLogWindow->queued (m_foxQSOinProgress.count ()); } + updateFoxQSOsInProgressDisplay(); } void MainWindow::rm_tb4(QString houndCall) { if(houndCall=="") return; QString t=""; - QString tb4=ui->textBrowser4->toPlainText(); + QString tb4=ui->houndQueueTextBrowser->toPlainText(); QStringList list=tb4.split("\n"); int n=list.size(); int j=0; @@ -9579,24 +9678,78 @@ void MainWindow::rm_tb4(QString houndCall) } } t.replace("\n\n","\n"); - ui->textBrowser4->setText(t); + ui->houndQueueTextBrowser->setText(t); } void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers) { if(modifiers==9999) return; //Silence compiler warning - QTextCursor cursor=ui->textBrowser4->textCursor(); + QTextCursor cursor=ui->houndQueueTextBrowser->textCursor(); cursor.setPosition(cursor.selectionStart()); - QString houndCall=cursor.block().text().mid(0,12).trimmed(); - rm_tb4(houndCall); - writeFoxQSO(" Del: " + houndCall); - QQueue tmpQueue; - while(!m_houndQueue.isEmpty()) { - QString t=m_houndQueue.dequeue(); - QString hc=t.mid(0,12).trimmed(); - if(hc != houndCall) tmpQueue.enqueue(t); - } - m_houndQueue.swap(tmpQueue); + QString houndLine=cursor.block().text(); + QString houndCall=houndLine.mid(0,12).trimmed(); + + if (modifiers == (Qt::AltModifier)) + { + //Alt-click on a Fox queue entry - put on top of queue + // remove + for(auto i=0; ihoundQueueTextBrowser->clear(); + for (QString line: m_houndQueue) + { + ui->houndQueueTextBrowser->displayHoundToBeCalled(line.mid(0,16), false); + } + } else + { + rm_tb4(houndCall); + writeFoxQSO(" Del: " + houndCall); + QQueue tmpQueue; + while (!m_houndQueue.isEmpty()) + { + QString t = m_houndQueue.dequeue(); + QString hc = t.mid(0, 12).trimmed(); + if (hc != houndCall) tmpQueue.enqueue(t); + } + m_houndQueue.swap(tmpQueue); + } +} + +void MainWindow::doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers) +{ + if (modifiers == 9999) return; //Silence compiler warning + QTextCursor cursor = ui->foxTxListTextBrowser->textCursor(); + cursor.setPosition(cursor.selectionStart()); + QString houndLine = cursor.block().text(); + QString houndCall = houndLine.mid(0, 12).trimmed(); + + if (modifiers == 0) + { + m_foxQSO[houndCall].ncall = m_maxStrikes + 1; // time them out + updateFoxQSOsInProgressDisplay(); + } +} + +void MainWindow::foxQueueTopCallCommand() +{ + m_decodedText2 = true; + if(SpecOp::FOX==m_specOp && m_decodedText2 && m_houndQueue.count() < 10) + { + + QTextCursor cursor = ui->decodedTextBrowser->textCursor(); + cursor.setPosition(cursor.selectionStart()); + QString houndCallLine = cursor.block().text(); + + writeFoxQSO(" QTop: " + houndCallLine); + selectHound(houndCallLine, true); // alt double-click gets put at top of queue + } } void MainWindow::foxGenWaveform(int i,QString fm) @@ -9650,14 +9803,29 @@ void MainWindow::writeFoxQSO(QString const& msg) /*################################################################################### */ void MainWindow::foxTest() { - QFile f("steps.txt"); - if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) return; + QString curdir = QDir::currentPath(); + bool b_hounds_written = false; - QFile fdiag("diag.txt"); + QFile fdiag(m_config.writeable_data_dir ().absoluteFilePath("diag.txt")); if(!fdiag.open(QIODevice::WriteOnly | QIODevice::Text)) return; + QFile f(m_config.writeable_data_dir ().absoluteFilePath("steps.txt")); + if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) { + fdiag.write("Cannot open steps.txt"); + return; + } + QTextStream s(&f); QTextStream sdiag(&fdiag); + + QFile fhounds(m_config.temp_dir().absoluteFilePath("houndcallers.txt")); + if(!fhounds.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) + { + sdiag << "can't write to houndcallers.txt"; + return; + } + QTextStream houndstream(&fhounds); + QString line; QString t; QString msg; @@ -9675,7 +9843,19 @@ void MainWindow::foxTest() } if(line.contains("Sel:")) { t=line.mid(43,6) + " " + line.mid(54,4) + " " + line.mid(50,3); - selectHound(t); + selectHound(t, false); + } + auto line_trimmed = line.trimmed(); + if(line_trimmed.startsWith("Hound:")) { + t=line_trimmed.mid(6,-1).trimmed(); + b_hounds_written = true; + houndstream << t +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; } if(line.contains("Del:")) { @@ -9715,6 +9895,11 @@ void MainWindow::foxTest() sdiag << t << line.mid(37).trimmed() << "\n"; } } + if (b_hounds_written) + { + fhounds.close(); + houndCallers(); + } } void MainWindow::write_all(QString txRx, QString message) @@ -9724,45 +9909,55 @@ void MainWindow::write_all(QString txRx, QString message) QString t; QString msg; QString mode_string; + QString file_name="ALL.TXT"; - if (message.size () > 5 && message[4]==' ') { - msg=message.mid(4,-1); - } else { - msg=message.mid(6,-1); - } + if(m_mode!="Echo") { + if (message.size () > 5 && message[4]==' ') { + msg=message.mid(4,-1); + } else { + msg=message.mid(6,-1); + } - if (message.size () > 19 && message[19]=='#') { - mode_string="JT65 "; - } else if (message.size () > 19 && message[19]=='@') { - mode_string="JT9 "; - } else if(m_mode=="Q65") { - mode_string=mode_label.text(); - } else { - mode_string=m_mode.leftJustified(6,' '); - } + if (message.size () > 19 && message[19]=='#') { + mode_string="JT65 "; + } else if (message.size () > 19 && message[19]=='@') { + mode_string="JT9 "; + } else if(m_mode=="Q65") { + mode_string=mode_label.text(); + } else { + mode_string=m_mode.leftJustified(6,' '); + } - msg=msg.mid(0,15) + msg.mid(18,-1); + msg=msg.mid(0,15) + msg.mid(18,-1); - t = t.asprintf("%5d",ui->TxFreqSpinBox->value()); - if (txRx=="Tx") msg=" 0 0.0" + t + " " + message; - auto time = QDateTime::currentDateTimeUtc (); - if( txRx=="Rx" && !m_bFastMode ) time=m_dateTimeSeqStart; + t = t.asprintf("%5d",ui->TxFreqSpinBox->value()); + if (txRx=="Tx") msg=" 0 0.0" + t + " " + message; + auto time = QDateTime::currentDateTimeUtc (); + if( txRx=="Rx" && !m_bFastMode ) time=m_dateTimeSeqStart; - t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies - if (m_diskData) { - if (m_fileDateTime.size()==11) { - line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg; + if (txRx=="Rx") { + t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies } else { - line=m_fileDateTime + t + txRx + " " + mode_string + msg; - } + t = t.asprintf("%10.3f ",m_freqNominal/1.e6); + } + if (m_diskData) { + if (m_fileDateTime.size()==11) { + line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg; + } else { + line=m_fileDateTime + t + txRx + " " + mode_string + msg; + } + } else { + line=time.toString("yyMMdd_hhmmss") + t + txRx + " " + mode_string + msg; + } + + if (ui->actionSplit_ALL_TXT_yearly->isChecked()) file_name=(time.toString("yyyy") + "-" + "ALL.TXT"); + if (ui->actionSplit_ALL_TXT_monthly->isChecked()) file_name=(time.toString("yyyy-MM") + "-" + "ALL.TXT"); + if (m_mode=="WSPR") file_name="ALL_WSPR.TXT"; } else { - line=time.toString("yyMMdd_hhmmss") + t + txRx + " " + mode_string + msg; + file_name="all_echo.txt"; + line=message; } - QString file_name="ALL.TXT"; - if (ui->actionSplit_ALL_TXT_yearly->isChecked()) file_name=(time.toString("yyyy") + "-" + "ALL.TXT"); - if (ui->actionSplit_ALL_TXT_monthly->isChecked()) file_name=(time.toString("yyyy-MM") + "-" + "ALL.TXT"); - if (m_mode=="WSPR") file_name="ALL_WSPR.TXT"; QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)}; if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { QTextStream out(&f); @@ -9956,6 +10151,8 @@ void MainWindow::on_houndButton_clicked (bool checked) } else { ui->houndButton->setStyleSheet(""); m_config.setSpecial_None(); + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); } m_specOp=m_config.special_op_id(); on_actionFT8_triggered(); @@ -10015,26 +10212,3 @@ void MainWindow::on_jt65Button_clicked() } on_actionJT65_triggered(); } - -void MainWindow::on_actionCopy_to_WSJTX_txt_triggered() -{ - static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("WSJT-X.txt")}; - if(!f.open(QIODevice::Text | QIODevice::WriteOnly)) { - MessageBox::warning_message (this, tr ("WSJT-X.txt file error"), - tr ("Cannot open \"%1\" for writing").arg (f.fileName ()), - tr ("Error: %1").arg (f.errorString ())); - } else { - QString t=ui->decodedTextBrowser->toPlainText(); - - QTextStream out(&f); - out << t << -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - endl -#else - Qt::endl -#endif - ; - f.close(); - } -} - diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 62c4008e..b8b9b020 100755 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -127,6 +127,7 @@ public slots: void doubleClickOnCall (Qt::KeyboardModifiers); void doubleClickOnCall2(Qt::KeyboardModifiers); void doubleClickOnFoxQueue(Qt::KeyboardModifiers); + void doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers); void readFromStdout(); void p1ReadFromStdout(); void setXIT(int n, Frequency base = 0u); @@ -173,7 +174,6 @@ private slots: void on_actionOpen_next_in_directory_triggered(); void on_actionDecode_remaining_files_in_directory_triggered(); void on_actionDelete_all_wav_files_in_SaveDir_triggered(); - void on_actionCopy_to_WSJTX_txt_triggered(); void on_actionOpen_log_directory_triggered (); void on_actionNone_triggered(); void on_actionSave_all_triggered(); @@ -477,7 +477,7 @@ private: qint32 m_k0; qint32 m_kdone; qint32 m_nPick; - FrequencyList_v2::const_iterator m_frequency_list_fcal_iter; + FrequencyList_v2_101::const_iterator m_frequency_list_fcal_iter; qint32 m_nTx73; qint32 m_UTCdisk; qint32 m_wait; @@ -824,6 +824,7 @@ private: void subProcessError (QProcess *, QProcess::ProcessError); void statusUpdate () const; void update_watchdog_label (); + void invalidate_frequencies_filter (); void on_the_minute (); void add_child_to_event_filter (QObject *); void remove_child_from_event_filter (QObject *); @@ -833,8 +834,10 @@ private: void displayWidgets(qint64 n); QChar current_submode () const; // returns QChar {0} if submode is not appropriate void write_transmit_entry (QString const& file_name); - void selectHound(QString t); + void selectHound(QString t, bool bTopQueue); void houndCallers(); + void updateFoxQSOsInProgressDisplay(); + void foxQueueTopCallCommand(); void foxRxSequencer(QString msg, QString houndCall, QString rptRcvd); void foxTxSequencer(); void foxGenWaveform(int i,QString fm); diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index b7760141..9c00e53f 100755 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 893 - 665 + 991 + 690 @@ -36,7 +36,6 @@ 10 - 50 false @@ -180,7 +179,6 @@ 10 - 50 false @@ -326,7 +324,7 @@ 0 - + @@ -435,6 +433,22 @@ + + + + Avg + + + 1 + + + 100 + + + 10 + + + @@ -560,1931 +574,9 @@ - - - - - Pwr - - - - - - - - 0 - 0 - - - - QLabel { - font-family: MS Shell Dlg 2; - font-size: 16pt; - background-color : black; - color : yellow; -} - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 2 - - - 0 - - - <html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html> - - - Qt::AlignCenter - - - 5 - - - - - - - - 0 - 0 - - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - false - - - <html><head/><body><p>Frequency to call CQ on in kHz above the current MHz</p></body></html> - - - Frequency to call CQ on in kHz above the current MHz - - - Tx CQ - - - 1 - - - 999 - - - 260 - - - - - - - false - - - <html><head/><body><p>Check this to call CQ on the &quot;Tx CQ&quot; frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.</p><p>Not available to nonstandard callsign holders.</p></body></html> - - - Check this to call CQ on the "Tx CQ" frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on. -Not available to nonstandard callsign holders. - - - - - - - - - - Decode other Hounds calling above 1000 Hz audio offset - - - Rx All Freqs - - - - - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - Fox - - - Qt::AlignCenter - - - - - - - <html><head/><body><p>Check to monitor Sh messages.</p></body></html> - - - Check to monitor Sh messages. - - - SWL - - - - - - - Enable auto response to the first decode from a new DXCC or new call on the current band. - - - QPushButton:checked { - color: rgb(0, 0, 0); - background-color: red; - border-style: outset; - border-width: 1px; - border-radius: 5px; - border-color: black; - min-width: 5em; - padding: 3px; -} - - - Best S+P - - - true - - - - - - - <html><head/><body><p>Check this to start recording calibration data.<br/>While measuring calibration correction is disabled.<br/>When not checked you can view the calibration results.</p></body></html> - - - Check this to start recording calibration data. -While measuring calibration correction is disabled. -When not checked you can view the calibration results. - - - Measure - - - - - - - - - - - <html><head/><body><p>Check to use short-format messages.</p></body></html> - - - Check to use short-format messages. - - - Sh - - - - - - - <html><head/><body><p>Check to enable JT9 fast modes</p></body></html> - - - Check to enable JT9 fast modes - - - Fast - - - - - - - <html><head/><body><p>Check to enable automatic sequencing of Tx messages based on received messages.</p></body></html> - - - Check to enable automatic sequencing of Tx messages based on received messages. - - - Auto Seq - - - - - - - <html><head/><body><p>Select <span style=" font-weight:600;">CQ: First</span> to respond automatically to the first decoded reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Max Pts</span> to respond automatically to the reply yielding most points in the ARRL International Digital Contest.</p><p>Select <span style=" font-weight:600;">CQ: None</span> to choose callers manually.</p></body></html> - - - - - - -1 - - - 3 - - - - - - - false - - - Check to generate "@1250 (SEND MSGS)" in Tx6. - - - Tx6 - - - - - - - - - - - <html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences.</p></body></html> - - - Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. - - - Tx even/1st - - - - - - - Audio Tx frequency - - - Qt::AlignCenter - - - Hz - - - Tx - - - 200 - - - 5000 - - - 1500 - - - - - - - - - - 0 - 0 - - - - - 35 - 0 - - - - Set Tx frequency to Rx Frequency - - - Set Tx frequency to Rx Frequency - - - ▲ - - - - - - - Frequency tolerance (Hz) - - - Qt::AlignCenter - - - F Tol - - - 1 - - - 1000 - - - 10 - - - - - - - - 0 - 0 - - - - - 35 - 0 - - - - Set Rx frequency to Tx Frequency - - - Set Rx frequency to Tx Frequency - - - ▼ - - - - - - - - - Audio Rx frequency - - - Qt::AlignCenter - - - Hz - - - Rx - - - 200 - - - 5000 - - - 1500 - - - - - - - <html><head/><body><p>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</p></body></html> - - - Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB). - - - Qt::AlignCenter - - - Report - - - -50 - - - 49 - - - -15 - - - - - - - <html><head/><body><p>Tx/Rx or Frequency calibration sequence length</p></body></html> - - - Tx/Rx or Frequency calibration sequence length - - - Qt::AlignCenter - - - s - - - T/R - - - 5 - - - 1800 - - - 30 - - - - - - - - - - - <html><head/><body><p>Check to keep Tx frequency fixed when double-clicking on decoded text.</p></body></html> - - - Check to keep Tx frequency fixed when double-clicking on decoded text. - - - Hold Tx Freq - - - - - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Tx# - - - 1 - - - 4095 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::AlignCenter - - - F Low - - - 100 - - - 5000 - - - 50 - - - 600 - - - - - - - Qt::AlignCenter - - - - - - F High - - - 100 - - - 5000 - - - 50 - - - 1400 - - - - - - - - - - - <html><head/><body><p>Submode determines tone spacing; A is narrowest.</p></body></html> - - - Submode determines tone spacing; A is narrowest. - - - Qt::AlignCenter - - - Submode - - - 0 - - - 7 - - - - - - - <html><head/><body><p>Synchronizing threshold. Lower numbers accept weaker sync signals.</p></body></html> - - - Synchronizing threshold. Lower numbers accept weaker sync signals. - - - Qt::AlignCenter - - - Sync - - - -1 - - - 10 - - - 1 - - - - - - - Maximum drift rate in units of symbol rate per transmission. - - - Max Drift - - - 50 - - - 5 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 0 - 0 - - - - QTabWidget::West - - - QTabWidget::Triangular - - - 0 - - - - 1 - - - - - - - - Send this message in next Tx interval - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+6 - - - true - - - - - - - Queue up the next Tx message - - - Next - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - - - - <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> - - - Send this message in next Tx interval -Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders) -RR73 messages should only be used when you are reasonably confident that no message repetitions will be required - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+4 - - - - - - - <html><head/><body><p>Send this message in next Tx interval</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> - - - Send this message in next Tx interval -Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+1 - - - - - - - - 0 - 0 - - - - - - - - <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p></body></html> - - - Switch to this Tx message NOW -Double-click to reset to the standard 73 message - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &5 - - - Alt+5 - - - - - - - Switch to this Tx message NOW - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &2 - - - Alt+2 - - - - - - - - 0 - 0 - - - - - - - - Switch to this Tx message NOW - - - Now - - - Qt::AlignCenter - - - - - - - Send this message in next Tx interval - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+2 - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - Generate standard messages for minimal QSO - - - Generate Std Msgs - - - - - - - Switch to this Tx message NOW - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &3 - - - Alt+3 - - - - - - - <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> - - - Switch to this Tx message NOW -Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders) -RR73 messages should only be used when you are reasonably confident that no message repetitions will be required - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &4 - - - Alt+4 - - - - - - - <html><head/><body><p>Switch to this Tx message NOW</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> - - - Switch to this Tx message NOW -Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) - - - Qt::LeftToRight - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &1 - - - Alt+1 - - - - - - - Switch to this Tx message NOW - - - padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% - - - Tx &6 - - - Alt+6 - - - - - - - Send this message in next Tx interval - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+3 - - - - - - - Enter a free text message (maximum 13 characters) -or select a predefined macro from the dropdown list. -Press ENTER to add the current text to the predefined -list. The list can be maintained in Settings (F2). - - - true - - - QComboBox::InsertAtBottom - - - QComboBox::AdjustToMinimumContentsLength - - - - - - - <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to reset to the standard 73 message</p></body></html> - - - Send this message in next Tx interval -Double-click to reset to the standard 73 message - - - margin-left: 10%; margin-right: 0% - - - - - - Ctrl+5 - - - - - - - - - - 2 - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Max dB - - - -15 - - - 70 - - - 30 - - - - - - - CQ - - - - CQ - - - - - CQ AF - - - - - CQ AN - - - - - CQ AS - - - - - CQ EU - - - - - CQ NA - - - - - CQ OC - - - - - CQ SA - - - - - CQ 0 - - - - - CQ 1 - - - - - CQ 2 - - - - - CQ 3 - - - - - CQ 4 - - - - - CQ 5 - - - - - CQ 6 - - - - - CQ 7 - - - - - CQ 8 - - - - - CQ 9 - - - - - - - - Reset - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - N List - - - 5 - - - 100 - - - 12 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - N Slots - - - 1 - - - 5 - - - 1 - - - 10 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Random - - - 5 - - - - Random - - - - - Call - - - - - Grid - - - - - S/N (dB) - - - - - Distance - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - More CQs - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QAbstractScrollArea::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::AlignCenter - - - Hz - - - Tx - - - 1400 - - - 1600 - - - 1500 - - - - - - - Qt::AlignCenter - - - Hz - - - Rx - - - 100 - - - 4900 - - - 100 - - - 1500 - - - - - - - Qt::AlignCenter - - - Hz - - - F Tol - - - 100 - - - 500 - - - 100 - - - - - - - true - - - 0 - - - - Random - - - - - 1/2 - - - - - 2/2 - - - - - 1/3 - - - - - 2/3 - - - - - 3/3 - - - - - 1/4 - - - - - 2/4 - - - - - 3/4 - - - - - 4/4 - - - - - 1/5 - - - - - 2/5 - - - - - 3/5 - - - - - 4/5 - - - - - 5/5 - - - - - 1/6 - - - - - 2/6 - - - - - 3/6 - - - - - 4/6 - - - - - 5/6 - - - - - 6/6 - - - - - - - - Percentage of minute sequences devoted to transmitting. - - - QSpinBox:enabled[notx="true"] { - color: rgb(0, 0, 0); - background-color: rgb(255, 255, 0); -} - - - Qt::AlignCenter - - - % - - - Tx Pct - - - 100 - - - - - - - Qt::AlignCenter - - - s - - - T/R - - - 15 - - - 1800 - - - - - - - Band Hopping - - - true - - - - - - Choose bands and times of day for band-hopping. - - - Schedule ... - - - - - - - - - - - - - - - - - - Upload decoded messages to WSPRnet.org. - - - QCheckBox:unchecked { - color: rgb(0, 0, 0); - background-color: rgb(255, 255, 0); -} - - - Upload spots - - - - - - - - - <html><head/><body><p>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</p></body></html> - - - 6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol. - - - Prefer Type 1 messages - - - true - - - - - - - No own call decodes - - - - - - - - - <html><head/><body><p>Transmit during the next sequence.</p></body></html> - - - QPushButton:checked { - color: rgb(0, 0, 0); - background-color: red; - border-style: outset; - border-width: 1px; - border-radius: 5px; - border-color: black; - min-width: 5em; - padding: 3px; -} - - - Tx Next - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Set Tx power in dBm (dB above 1 mW) as part of your WSPR message. - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - - - 100 - 16777215 - - - - <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> - - - Frequency entry - - - Select operating band or enter frequency in MHz or enter kHz increment followed by k. - - - true - - - QComboBox::NoInsert - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - - - - - - - - 100 - 16777215 - - - - Qt::AlignCenter - - - % - - - NB - - - -2 - - - 25 - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> - - - Rx Signal - - - 30dB recommended when only noise present -Green when good -Red when clipping may occur -Yellow when too low - - - QFrame::Panel - - - QFrame::Sunken - - - - - - - + + + 0 @@ -2724,113 +816,2026 @@ Yellow when too low Search for callsign in database - - &Lookup + + &Lookup + + + + + + + Add callsign and locator to database + + + Add + + + + + + + true + + + Az: 251 16553 km + + + Qt::AlignCenter + + + 4 + + + + + + + + + + + + Adjust Tx audio level + + + 450 + + + 0 + + + Qt::Vertical + + + true + + + true + + + QSlider::TicksBelow + + + 50 + + + + + + + Pwr + + + + + + + 6 + + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + Qt::AlignCenter + + + % + + + NB + + + -2 + + + 25 + + + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> + + + Rx Signal + + + 30dB recommended when only noise present +Green when good +Red when clipping may occur +Yellow when too low + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + + + + + + 0 + 0 + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + + + 0 - - - - - - Add callsign and locator to database + + 0 - - Add + + 0 - - - - - - true + + + + + + + + false + + + <html><head/><body><p>Frequency to call CQ on in kHz above the current MHz</p></body></html> + + + Frequency to call CQ on in kHz above the current MHz + + + Tx CQ + + + 1 + + + 999 + + + 260 + + + + + + + false + + + <html><head/><body><p>Check this to call CQ on the &quot;Tx CQ&quot; frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.</p><p>Not available to nonstandard callsign holders.</p></body></html> + + + Check this to call CQ on the "Tx CQ" frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on. +Not available to nonstandard callsign holders. + + + + + + + + + + Decode other Hounds calling above 1000 Hz audio offset + + + Rx All Freqs + + + + + + + + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + Fox + + + Qt::AlignCenter + + + + + + + <html><head/><body><p>Check to monitor Sh messages.</p></body></html> + + + Check to monitor Sh messages. + + + SWL + + + + + + + Enable auto response to the first decode from a new DXCC or new call on the current band. + + + QPushButton:checked { + color: rgb(0, 0, 0); + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +} + + + Best S+P + + + true + + + + + + + <html><head/><body><p>Check this to start recording calibration data.<br/>While measuring calibration correction is disabled.<br/>When not checked you can view the calibration results.</p></body></html> + + + Check this to start recording calibration data. +While measuring calibration correction is disabled. +When not checked you can view the calibration results. + + + Measure + + + + + + + + + + + <html><head/><body><p>Check to use short-format messages.</p></body></html> + + + Check to use short-format messages. + + + Sh + + + + + + + <html><head/><body><p>Check to enable JT9 fast modes</p></body></html> + + + Check to enable JT9 fast modes + + + Fast + + + + + + + <html><head/><body><p>Check to enable automatic sequencing of Tx messages based on received messages.</p></body></html> + + + Check to enable automatic sequencing of Tx messages based on received messages. + + + Auto Seq + + + + + + + <html><head/><body><p>Select <span style=" font-weight:600;">CQ: First</span> to respond automatically to the first decoded reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Max Dist</span> to respond automatically to the reply yielding most points in the ARRL International Digital Contest.</p><p>Select <span style=" font-weight:600;">CQ: None</span> to choose callers manually.</p></body></html> + + + + + + -1 + + + 3 + + + + + + + false + + + Check to generate "@1250 (SEND MSGS)" in Tx6. + + + Tx6 + + + + + + + + + + + <html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences.</p></body></html> + + + Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. + + + Tx even/1st + + + + + + + Audio Tx frequency + + + Qt::AlignCenter + + + Hz + + + Tx + + + 200 + + + 5000 + + + 1500 + + + + + + + + + + 0 + 0 + + + + + 35 + 0 + + + + Set Tx frequency to Rx Frequency + + + Set Tx frequency to Rx Frequency + + + ▲ + + + + + + + Frequency tolerance (Hz) + + + Qt::AlignCenter + + + F Tol + + + 1 + + + 1000 + + + 10 + + + + + + + + 0 + 0 + + + + + 35 + 0 + + + + Set Rx frequency to Tx Frequency + + + Set Rx frequency to Tx Frequency + + + ▼ + + + + + + + + + Audio Rx frequency + + + Qt::AlignCenter + + + Hz + + + Rx + + + 200 + + + 5000 + + + 1500 + + + + + + + <html><head/><body><p>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</p></body></html> + + + Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB). + + + Qt::AlignCenter + + + Report + + + -50 + + + 49 + + + -15 + + + + + + + <html><head/><body><p>Tx/Rx or Frequency calibration sequence length</p></body></html> + + + Tx/Rx or Frequency calibration sequence length + + + Qt::AlignCenter + + + s + + + T/R + + + 5 + + + 1800 + + + 30 + + + + + + + + + + + <html><head/><body><p>Check to keep Tx frequency fixed when double-clicking on decoded text.</p></body></html> + + + Check to keep Tx frequency fixed when double-clicking on decoded text. + + + Hold Tx Freq + + + + + + + 1 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Tx# + + + 1 + + + 4095 + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::AlignCenter + + + F Low + + + 100 + + + 5000 + + + 50 + + + 600 + + + + + + + Qt::AlignCenter + + + + + + F High + + + 100 + + + 5000 + + + 50 + + + 1400 + + + + + + + + + + + <html><head/><body><p>Submode determines tone spacing; A is narrowest.</p></body></html> + + + Submode determines tone spacing; A is narrowest. + + + Qt::AlignCenter + + + Submode + + + 0 + + + 7 + + + + + + + <html><head/><body><p>Synchronizing threshold. Lower numbers accept weaker sync signals.</p></body></html> + + + Synchronizing threshold. Lower numbers accept weaker sync signals. + + + Qt::AlignCenter + + + Sync + + + -1 + + + 10 + + + 1 + + + + + + + Maximum drift rate in units of symbol rate per transmission. + + + Max Drift + + + 50 + + + 5 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + QTabWidget::West + + + QTabWidget::Triangular + + + 0 + + + + 1 + + + + + + + + Send this message in next Tx interval + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+6 + + + true + + + + + + + Queue up the next Tx message + + + Next + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + + + + <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> + + + Send this message in next Tx interval +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+4 + + + + + + + <html><head/><body><p>Send this message in next Tx interval</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> + + + Send this message in next Tx interval +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+1 + + + + + + + + 0 + 0 + + + + + + + + <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p></body></html> + + + Switch to this Tx message NOW +Double-click to reset to the standard 73 message + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &5 + + + Alt+5 + + + + + + + Switch to this Tx message NOW + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &2 + + + Alt+2 + + + + + + + + 0 + 0 + + + + + + + + Switch to this Tx message NOW + + + Now + + + Qt::AlignCenter + + + + + + + Send this message in next Tx interval + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+2 + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + Generate standard messages for minimal QSO + + + Generate Std Msgs + + + + + + + Switch to this Tx message NOW + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &3 + + + Alt+3 + + + + + + + <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> + + + Switch to this Tx message NOW +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &4 + + + Alt+4 + + + + + + + <html><head/><body><p>Switch to this Tx message NOW</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> + + + Switch to this Tx message NOW +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) + + + Qt::LeftToRight + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &1 + + + Alt+1 + + + + + + + Switch to this Tx message NOW + + + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% + + + Tx &6 + + + Alt+6 + + + + + + + Send this message in next Tx interval + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+3 + + + + + + + Enter a free text message (maximum 13 characters) +or select a predefined macro from the dropdown list. +Press ENTER to add the current text to the predefined +list. The list can be maintained in Settings (F2). + + + true + + + QComboBox::InsertAtBottom + + + + + + + <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to reset to the standard 73 message</p></body></html> + + + Send this message in next Tx interval +Double-click to reset to the standard 73 message + + + margin-left: 10%; margin-right: 0% + + + + + + Ctrl+5 + + + + + + + + + + 2 + + + + 4 + + + 4 + + + 4 + + + 4 + + + 4 + + + + + 0 + + + 6 + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Random + + + 5 + + + + Random + + + + + Call + + + + + Grid + + + + + S/N (dB) + + + + + Distance + + + + + + + + + 9 + + + + Queue + + + Qt::AlignCenter + + + + + + + More CQs + + + + + + + CQ + + + + CQ + + + + + CQ AF + + + + + CQ AN + + + + + CQ AS + + + + + CQ EU + + + + + CQ NA + + + + + CQ OC + + + + + CQ SA + + + + + CQ 0 + + + + + CQ 1 + + + + + CQ 2 + + + + + CQ 3 + + + + + CQ 4 + + + + + CQ 5 + + + + + CQ 6 + + + + + CQ 7 + + + + + CQ 8 + + + + + CQ 9 + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + N List + + + 5 + + + 100 + + + 12 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Max dB + + + -15 + + + 70 + + + 30 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + N Slots + + + 1 + + + 5 + + + 1 + + + 10 + + + + + + + Reset + + + + + + + In Progress + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QAbstractScrollArea::AdjustToContentsOnFirstShow + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QAbstractScrollArea::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 - - Az: 251 16553 km + + 0 - - Qt::AlignCenter + + 0 - - 4 + + 0 - - - - - - - - - - - Adjust Tx audio level - - - 450 - - - 0 - - - Qt::Vertical - - - true - - - true - - - QSlider::TicksBelow - - - 50 - - - - - - - false - - - <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> - - - If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. - - - QPushButton { - font-family: helvetica; - font-size: 9pt; - font-weight: bold; - background-color: white; - color: black; - border-style: solid; - border-width:1px; - border-radius:10px; - border-color: gray; - max-width:20px; - max-height:20px; - min-width:20px; - min-height:20px; -} -QPushButton[state="error"] { - background-color: red; -} -QPushButton[state="warning"] { - background-color: orange; -} -QPushButton[state="ok"] { - background-color: #00ff00; + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::AlignCenter + + + Hz + + + Tx + + + 1400 + + + 1600 + + + 1500 + + + + + + + Qt::AlignCenter + + + Hz + + + Rx + + + 100 + + + 4900 + + + 100 + + + 1500 + + + + + + + Qt::AlignCenter + + + Hz + + + F Tol + + + 100 + + + 500 + + + 100 + + + + + + + true + + + 0 + + + + Random + + + + + 1/2 + + + + + 2/2 + + + + + 1/3 + + + + + 2/3 + + + + + 3/3 + + + + + 1/4 + + + + + 2/4 + + + + + 3/4 + + + + + 4/4 + + + + + 1/5 + + + + + 2/5 + + + + + 3/5 + + + + + 4/5 + + + + + 5/5 + + + + + 1/6 + + + + + 2/6 + + + + + 3/6 + + + + + 4/6 + + + + + 5/6 + + + + + 6/6 + + + + + + + + Percentage of minute sequences devoted to transmitting. + + + QSpinBox:enabled[notx="true"] { + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 0); +} + + + Qt::AlignCenter + + + % + + + Tx Pct + + + 100 + + + + + + + Qt::AlignCenter + + + s + + + T/R + + + 15 + + + 1800 + + + + + + + Band Hopping + + + true + + + + + + Choose bands and times of day for band-hopping. + + + Schedule ... + + + + + + + + + + + + + + + + + + Upload decoded messages to WSPRnet.org. + + + QCheckBox:unchecked { + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 0); } - - - ? - + + + Upload spots + + + + + + + + + <html><head/><body><p>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</p></body></html> + + + 6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol. + + + Prefer Type 1 messages + + + true + + + + + + + No own call decodes + + + + + + + + + <html><head/><body><p>Transmit during the next sequence.</p></body></html> + + + QPushButton:checked { + color: rgb(0, 0, 0); + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +} + + + Tx Next + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Set Tx power in dBm (dB above 1 mW) as part of your WSPR message. + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + - + @@ -2863,7 +2868,7 @@ QLabel[oob="true"] { - + @@ -3002,6 +3007,131 @@ QLabel[oob="true"] { + + + + + 0 + 0 + + + + QLabel { + font-family: MS Shell Dlg 2; + font-size: 16pt; + background-color : black; + color : yellow; +} + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 2 + + + 0 + + + <html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html> + + + Qt::AlignCenter + + + 5 + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> + + + Frequency entry + + + Select operating band or enter frequency in MHz or enter kHz increment followed by k. + + + true + + + QComboBox::NoInsert + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + + + + + false + + + <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> + + + If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. + + + QPushButton { + font-family: helvetica; + font-size: 9pt; + font-weight: bold; + background-color: white; + color: black; + border-style: solid; + border-width:1px; + border-radius:10px; + border-color: gray; + max-width:20px; + max-height:20px; + min-width:20px; + min-height:20px; +} +QPushButton[state="error"] { + background-color: red; +} +QPushButton[state="warning"] { + background-color: orange; +} +QPushButton[state="ok"] { + background-color: #00ff00; +} + + + ? + + + + + @@ -3014,8 +3144,8 @@ QLabel[oob="true"] { 0 0 - 893 - 21 + 991 + 22 @@ -3026,8 +3156,6 @@ QLabel[oob="true"] { - - @@ -3038,6 +3166,7 @@ QLabel[oob="true"] { + @@ -3670,11 +3799,6 @@ QLabel[oob="true"] { Active Stations - - - Copy main text window to WSJT-X.txt - - @@ -3734,7 +3858,6 @@ QLabel[oob="true"] { stopTxButton tuneButton cbMenus - bandComboBox sbNB dxCallEntry dxGridEntry @@ -3781,14 +3904,6 @@ QLabel[oob="true"] { tx6 txrb6 txb6 - textBrowser4 - comboBoxHoundSort - sbNlist - sbMax_dB - sbNslots - comboBoxCQ - cbMoreCQs - pbFoxReset WSPRfreqSpinBox sbFST4W_RxFreq sbFST4W_FTol diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index fcfd5412..e08ecaed 100755 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -100,7 +100,6 @@ void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() if(m_bReference) m_h2=m_h-30; if(m_h2<1) m_h2=1; m_h1=m_h-m_h2; -// m_line=0; m_2DPixmap = QPixmap(m_Size.width(), m_h2); m_2DPixmap.fill(Qt::black); m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1); @@ -112,6 +111,8 @@ void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() m_ScalePixmap.fill(Qt::white); m_Percent2DScreen0 = m_Percent2DScreen; m_bResized = true; + m_vpixperdiv = float(m_h2)/float(VERT_DIVS); + m_x=0; } DrawOverlay(); } @@ -167,6 +168,8 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) static QPoint LineBuf[MAX_SCREENSIZE]; static QPoint LineBuf2[MAX_SCREENSIZE]; static QPoint LineBuf3[MAX_SCREENSIZE]; + static QPoint LineBuf4[MAX_SCREENSIZE]; + j=0; j0=int(m_startFreq/m_fftBinWidth + 0.5); int iz=XfromFreq(5000.0); @@ -231,7 +234,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) } - if(i==iz-1 and !m_bQ65_Sync) { + if(i==iz-1 and !m_bQ65_Sync and !m_bTotalPower) { painter2D.drawPolyline(LineBuf,j); } LineBuf[j].setX(i); @@ -320,6 +323,22 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) painter2D.drawText(m_w-100,m_h2/2,t); } } + + if(m_bTotalPower and m_pdB>1.0) { + painter2D.setPen(Qt::green); + if(m_x==m_w-1) { + for (int i=0; i100) m_freqPerDiv=20; if(m_fSpan>250) m_freqPerDiv=50; @@ -377,25 +396,48 @@ void CPlotter::DrawOverlay() //DrawOverlay() if(m_fSpan>1000) m_freqPerDiv=200; if(m_fSpan>2500) m_freqPerDiv=500; - pixperdiv = m_freqPerDiv/df; - m_hdivs = w*df/m_freqPerDiv + 1.9999; - - float xx0=float(m_startFreq)/float(m_freqPerDiv); - xx0=xx0-int(xx0); - int x0=xx0*pixperdiv+0.5; - for( int i=1; i= 0 and x<=m_w) { - painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); - painter.drawLine(x, 0, x , m_h2); + if(!m_bTotalPower) { + pixperdiv = m_freqPerDiv/df; + m_hdivs = w*df/m_freqPerDiv + 1.9999; + float xx0=float(m_startFreq)/float(m_freqPerDiv); + xx0=xx0-int(xx0); + int x0=xx0*pixperdiv+0.5; + for( int i=1; i= 0 and x<=m_w) { + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + painter.drawLine(x, 0, x , m_h2); + } } } - pixperdiv = (float)m_h2 / (float)VERT_DIVS; painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); - for( int i=1; i100) { + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + for( int i=1; i<5*VERT_DIVS; i++) { //draw horizontal 2 dB grids + if(i%5 > 0) { + y = int(0.2*i*m_vpixperdiv); + painter.drawLine(0, y, w, y); + } + } } QRect rect0; @@ -730,7 +772,15 @@ int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq void CPlotter::mouseMoveEvent (QMouseEvent * event) { int x=event->x(); - QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + int y=event->y(); + float pdB=10.0*(m_h-y)/m_vpixperdiv + 20.0; + if(y<(m_h-m_h2)) { + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + } else { + QString t; + t=t.asprintf("%4.1f dB",pdB); + QToolTip::showText(event->globalPos(),t); + } QWidget::mouseMoveEvent(event); } @@ -874,3 +924,13 @@ void CPlotter::setDiskUTC(int nutc) { m_nUTC=nutc; } + +void CPlotter::drawTotalPower(float pdB) +{ + m_pdB=pdB; +} + +void CPlotter::restartTotalPower() +{ + m_x=0; +} diff --git a/widgets/plotter.h b/widgets/plotter.h index c727eb29..3ef25e5d 100755 --- a/widgets/plotter.h +++ b/widgets/plotter.h @@ -34,6 +34,7 @@ public: QSize sizeHint() const Q_DECL_OVERRIDE; void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall + void drawTotalPower(float pdB); void replot(); void SetRunningState(bool running); void setPlotZero(int plotZero); @@ -81,12 +82,15 @@ public: bool Reference() const {return m_bReference;} void setQ65_Sync(bool b) {m_bQ65_Sync = b;} bool Q65_Sync() const {return m_bQ65_Sync;} + void setTotalPower(bool b) {m_bTotalPower = b;} + bool TotalPower() const {return m_bTotalPower;} void drawRed(int ia, int ib, float swide[]); void setVHF(bool bVHF); void setRedFile(QString fRed); void setFST4_FreqRange(int fLow,int fHigh); void setSingleDecode(bool b); void setDiskUTC(int nutc); + void restartTotalPower(); bool scaleOK () const {return m_bScaleOK;} signals: @@ -116,12 +120,15 @@ private: bool m_bReference; bool m_bReference0; bool m_bQ65_Sync; + bool m_bTotalPower; bool m_bVHF; bool m_bSingleDecode; bool m_bFirst=true; bool m_bResized; float m_fSpan; + float m_pdB=0.0; + float m_vpixperdiv; qint32 m_plotZero; qint32 m_plotGain; @@ -137,6 +144,7 @@ private: qint32 m_nfa; qint32 m_nfb; qint32 m_nUTC; + qint32 m_x=0; QPixmap m_WaterfallPixmap; QPixmap m_2DPixmap; diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp index 16ee60ca..3b0d652e 100755 --- a/widgets/widegraph.cpp +++ b/widgets/widegraph.cpp @@ -71,11 +71,13 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool()); ui->widePlot->setReference(m_settings->value("Reference",false).toBool()); ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool()); + ui->widePlot->setTotalPower(m_settings->value("TotalPower",false).toBool()); if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0); if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1); if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2); if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3); if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4); + if(ui->widePlot->TotalPower()) ui->spec2dComboBox->setCurrentIndex(5); int nbpp=m_settings->value("BinsPerPixel",2).toInt(); ui->widePlot->setBinsPerPixel(nbpp); ui->sbPercent2dPlot->setValue(m_Percent2DScreen); @@ -133,6 +135,7 @@ void WideGraph::saveSettings() //saveS m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg()); m_settings->setValue ("Reference", ui->widePlot->Reference()); m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync()); + m_settings->setValue ("TotalPower", ui->widePlot->TotalPower()); m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ()); m_settings->setValue ("StartFreq", ui->widePlot->startFreq ()); m_settings->setValue ("WaterfallPalette", m_waterfallPalette); @@ -148,11 +151,12 @@ void WideGraph::drawRed(int ia, int ib) ui->widePlot->drawRed(ia,ib,m_swide); } -void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2 +void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB) //dataSink2 { static float splot[NSMAX]; int nbpp = ui->widePlot->binsPerPixel(); + if(ui->widePlot->TotalPower()) ui->widePlot->drawTotalPower(pdB); //Average spectra over specified number, m_waterfallAvg if (m_n==0) { for (int i=0; iwidePlot->setLinearAvg(false); ui->widePlot->setReference(false); ui->widePlot->setQ65_Sync(false); + ui->widePlot->setTotalPower(false); ui->smoSpinBox->setEnabled(false); switch (index) { @@ -332,7 +337,10 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index) case 4: ui->widePlot->setQ65_Sync(true); break; - } + case 5: + ui->widePlot->setTotalPower(true); + break; + } replot(); } @@ -473,6 +481,7 @@ void WideGraph::on_zeroSlider_valueChanged(int value) //Zero void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2 { ui->widePlot->setPlot2dGain(value); + if(ui->widePlot->TotalPower()) return; if(ui->widePlot->scaleOK ()) { ui->widePlot->draw(m_swide,false,false); if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true); @@ -482,6 +491,7 @@ void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2 void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2 { ui->widePlot->setPlot2dZero(value); + if(ui->widePlot->TotalPower()) return; if(ui->widePlot->scaleOK ()) { ui->widePlot->draw(m_swide,false,false); if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true); @@ -540,3 +550,8 @@ void WideGraph::setDiskUTC(int nutc) { ui->widePlot->setDiskUTC(nutc); } + +void WideGraph::restartTotalPower() +{ + ui->widePlot->restartTotalPower(); +} diff --git a/widgets/widegraph.h b/widgets/widegraph.h index 53003e64..7f0b024e 100755 --- a/widgets/widegraph.h +++ b/widgets/widegraph.h @@ -26,7 +26,7 @@ public: explicit WideGraph(QSettings *, QWidget *parent = 0); ~WideGraph (); - void dataSink2(float s[], float df3, int ihsym, int ndiskdata); + void dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB); void setRxFreq(int n); int rxFreq(); int nStartFreq(); @@ -51,6 +51,7 @@ public: void setFST4_FreqRange(int fLow,int fHigh); void setSingleDecode(bool b); void setDiskUTC(int nutc); + void restartTotalPower(); signals: void freezeDecode2(int n); diff --git a/widgets/widegraph.ui b/widgets/widegraph.ui index 4b3b0f04..df0afa85 100755 --- a/widgets/widegraph.ui +++ b/widgets/widegraph.ui @@ -340,6 +340,11 @@ Q65_Sync + + + Total power (dB) + + -- cgit v1.2.3