diff options
| author | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
| commit | 5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch) | |
| tree | 410fa358a5f73260a579b4d669730f319a4d2609 /Configuration.cpp | |
| parent | 6c82050de806dcdafaed0077400a6c3396a4a159 (diff) | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack'
with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'Configuration.cpp')
| -rw-r--r-- | Configuration.cpp | 536 |
1 files changed, 384 insertions, 152 deletions
diff --git a/Configuration.cpp b/Configuration.cpp index c93660a7..cb0566c1 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -150,14 +150,14 @@ #include <QStringList> #include <QStringListModel> #include <QLineEdit> -#include <QRegExpValidator> +#include <QRegularExpression> +#include <QRegularExpressionValidator> #include <QIntValidator> #include <QThread> #include <QTimer> #include <QStandardPaths> #include <QFont> #include <QFontDialog> -#include <QColorDialog> #include <QSerialPortInfo> #include <QScopedPointer> #include <QDebug> @@ -166,20 +166,23 @@ #include "qt_helpers.hpp" #include "MetaDataRegistry.hpp" #include "SettingsGroup.hpp" -#include "FrequencyLineEdit.hpp" -#include "CandidateKeyFilter.hpp" -#include "ForeignKeyDelegate.hpp" +#include "widgets/FrequencyLineEdit.hpp" +#include "item_delegates/CandidateKeyFilter.hpp" +#include "item_delegates/ForeignKeyDelegate.hpp" #include "TransceiverFactory.hpp" #include "Transceiver.hpp" -#include "Bands.hpp" -#include "IARURegions.hpp" -#include "Modes.hpp" -#include "FrequencyList.hpp" -#include "StationList.hpp" +#include "models/Bands.hpp" +#include "models/IARURegions.hpp" +#include "models/Modes.hpp" +#include "models/FrequencyList.hpp" +#include "models/StationList.hpp" #include "NetworkServerLookup.hpp" -#include "MessageBox.hpp" -#include "MaidenheadLocatorValidator.hpp" -#include "CallsignValidator.hpp" +#include "widgets/MessageBox.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" +#include "validators/CallsignValidator.hpp" +#include "LotWUsers.hpp" +#include "models/DecodeHighlightingModel.hpp" +#include "logbook/logbook.h" #include "ui_Configuration.h" #include "moc_Configuration.cpp" @@ -193,7 +196,44 @@ namespace int const combo_box_item_disabled (0); // QRegExp message_alphabet {"[- A-Za-z0-9+./?]*"}; - QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>]*"}; + QRegularExpression message_alphabet {"[- @A-Za-z0-9+./?#<>]*"}; + QRegularExpression RTTY_roundup_exchange_re { + R"( + ( + AL|AZ|AR|CA|CO|CT|DE|FL|GA # 48 contiguous states + |ID|IL|IN|IA|KS|KY|LA|ME|MD + |MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ + |NM|NY|NC|ND|OH|OK|OR|PA|RI|SC + |SD|TN|TX|UT|VT|VA|WA|WV|WI|WY + |NB|NS|QC|ON|MB|SK|AB|BC|NWT|NF # VE provinces + |LB|NU|YT|PEI + |DC # District of Columbia + |DX # anyone else + ) + )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption}; + + QRegularExpression field_day_exchange_re { + R"( + ( + [1-9] # # transmitters (1 to 32 inc.) + |[0-2]\d + |3[0-2] + ) + [A-F]\ * # class and optional space + ( + AB|AK|AL|AR|AZ|BC|CO|CT|DE|EB # ARRL/RAC section + |EMA|ENY|EPA|EWA|GA|GTA|IA|ID + |IL|IN|KS|KY|LA|LAX|MAR|MB|MDC + |ME|MI|MN|MO|MS|MT|NC|ND|NE|NFL + |NH|NL|NLI|NM|NNJ|NNY|NT|NTX|NV + |OH|OK|ONE|ONN|ONS|OR|ORG|PAC + |PR|QC|RI|SB|SC|SCV|SD|SDG|SF + |SFL|SJV|SK|SNJ|STX|SV|TN|UT|VA + |VI|VT|WCF|WI|WMA|WNY|WPA|WTX + |WV|WWA|WY + |DX # anyone else + ) + )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption}; // Magic numbers for file validation constexpr quint32 qrg_magic {0xadbccbdb}; @@ -339,7 +379,7 @@ public: { auto editor = new QLineEdit {parent}; editor->setFrame (false); - editor->setValidator (new QRegExpValidator {message_alphabet, editor}); + editor->setValidator (new QRegularExpressionValidator {message_alphabet, editor}); return editor; } }; @@ -354,8 +394,12 @@ public: using FrequencyDelta = Radio::FrequencyDelta; using port_type = Configuration::port_type; - explicit impl (Configuration * self, QDir const& temp_directory, - QSettings * settings, QWidget * parent); + explicit impl (Configuration * self + , QNetworkAccessManager * network_manager + , QDir const& temp_directory + , QSettings * settings + , LogBook * logbook + , QWidget * parent); ~impl (); bool have_rig (); @@ -439,11 +483,15 @@ private: Q_SLOT void on_calibration_slope_ppm_spin_box_valueChanged (double); Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number); Q_SLOT void handle_transceiver_failure (QString const& reason); - Q_SLOT void on_pbCQmsg_clicked(); - Q_SLOT void on_pbMyCall_clicked(); - Q_SLOT void on_pbTxMsg_clicked(); - Q_SLOT void on_pbNewDXCC_clicked(); - Q_SLOT void on_pbNewCall_clicked(); + Q_SLOT void on_reset_highlighting_to_defaults_push_button_clicked (bool); + Q_SLOT void on_rescan_log_push_button_clicked (bool); + Q_SLOT void on_LotW_CSV_fetch_push_button_clicked (bool); + Q_SLOT void on_cbx2ToneSpacing_clicked(bool); + Q_SLOT void on_cbx4ToneSpacing_clicked(bool); + Q_SLOT void on_prompt_to_log_check_box_clicked(bool); + Q_SLOT void on_cbAutoLog_clicked(bool); + Q_SLOT void on_Field_Day_Exchange_textEdited (QString const&); + Q_SLOT void on_RTTY_Exchange_textEdited (QString const&); // typenames used as arguments must match registered type names :( Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const; @@ -459,7 +507,9 @@ private: QScopedPointer<Ui::configuration_dialog> ui_; + QNetworkAccessManager * network_manager_; QSettings * settings_; + LogBook * logbook_; QDir doc_dir_; QDir data_dir_; @@ -476,6 +526,8 @@ private: QFont decoded_text_font_; QFont next_decoded_text_font_; + LotWUsers lotw_users_; + bool restart_sound_input_device_; bool restart_sound_output_device_; @@ -504,10 +556,15 @@ private: QAction * reset_frequencies_action_; FrequencyDialog * frequency_dialog_; - QAction * station_delete_action_; - QAction * station_insert_action_; + QAction station_delete_action_; + QAction station_insert_action_; StationDialog * station_dialog_; + DecodeHighlightingModel decode_highlighing_model_; + DecodeHighlightingModel next_decode_highlighing_model_; + bool highlight_by_mode_; + int LotW_days_since_upload_; + TransceiverFactory::ParameterPack rig_params_; TransceiverFactory::ParameterPack saved_rig_params_; TransceiverFactory::Capabilities::PortType last_port_type_; @@ -520,20 +577,14 @@ private: CalibrationParams calibration_; bool frequency_calibration_disabled_; // not persistent unsigned transceiver_command_number_; + QString dynamic_grid_; // configuration fields that we publish QString my_callsign_; QString my_grid_; - QColor color_CQ_; - QColor next_color_CQ_; - QColor color_MyCall_; - QColor next_color_MyCall_; - QColor color_TxMsg_; - QColor next_color_TxMsg_; - QColor color_DXCC_; - QColor next_color_DXCC_; - QColor color_NewCall_; - QColor next_color_NewCall_; + QString FD_exchange_; + QString RTTY_exchange_; + qint32 id_interval_; qint32 ntrials_; qint32 aggressive_; @@ -548,8 +599,10 @@ private: bool log_as_RTTY_; bool report_in_comments_; bool prompt_to_log_; + bool autoLog_; bool insert_blank_; bool DXCC_; + bool ppfx_; bool clear_DX_; bool miles_; bool quick_call_; @@ -560,10 +613,17 @@ private: bool decode_at_52s_; bool single_decode_; bool twoPass_; + bool bSpecialOp_; + int SelectedActivity_; bool x2ToneSpacing_; - bool realTimeDecode_; + bool x4ToneSpacing_; + bool use_dynamic_grid_; + QString opCall_; QString udp_server_name_; port_type udp_server_port_; + QString n1mm_server_name_; + port_type n1mm_server_port_; + bool broadcast_to_n1mm_; bool accept_udp_requests_; bool udpWindowToFront_; bool udpWindowRestore_; @@ -585,9 +645,9 @@ private: // delegate to implementation class -Configuration::Configuration (QDir const& temp_directory, - QSettings * settings, QWidget * parent) - : m_ {this, temp_directory, settings, parent} +Configuration::Configuration (QNetworkAccessManager * network_manager, QDir const& temp_directory, + QSettings * settings, LogBook * logbook, QWidget * parent) + : m_ {this, network_manager, temp_directory, settings, logbook, parent} { } @@ -612,12 +672,6 @@ bool Configuration::restart_audio_input () const {return m_->restart_sound_input bool Configuration::restart_audio_output () const {return m_->restart_sound_output_device_;} auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;} QString Configuration::my_callsign () const {return m_->my_callsign_;} -QString Configuration::my_grid () const {return m_->my_grid_;} -QColor Configuration::color_CQ () const {return m_->color_CQ_;} -QColor Configuration::color_MyCall () const {return m_->color_MyCall_;} -QColor Configuration::color_TxMsg () const {return m_->color_TxMsg_;} -QColor Configuration::color_DXCC () const {return m_->color_DXCC_;} -QColor Configuration::color_NewCall () const {return m_->color_NewCall_;} QFont Configuration::text_font () const {return m_->font_;} QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;} qint32 Configuration::id_interval () const {return m_->id_interval_;} @@ -638,8 +692,10 @@ bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_-> bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;} bool Configuration::report_in_comments () const {return m_->report_in_comments_;} bool Configuration::prompt_to_log () const {return m_->prompt_to_log_;} +bool Configuration::autoLog() const {return m_->autoLog_;} bool Configuration::insert_blank () const {return m_->insert_blank_;} bool Configuration::DXCC () const {return m_->DXCC_;} +bool Configuration::ppfx() const {return m_->ppfx_;} bool Configuration::clear_DX () const {return m_->clear_DX_;} bool Configuration::miles () const {return m_->miles_;} bool Configuration::quick_call () const {return m_->quick_call_;} @@ -651,11 +707,15 @@ bool Configuration::decode_at_52s () const {return m_->decode_at_52s_;} bool Configuration::single_decode () const {return m_->single_decode_;} bool Configuration::twoPass() const {return m_->twoPass_;} bool Configuration::x2ToneSpacing() const {return m_->x2ToneSpacing_;} -bool Configuration::realTimeDecode() const {return m_->realTimeDecode_;} +bool Configuration::x4ToneSpacing() const {return m_->x4ToneSpacing_;} bool Configuration::split_mode () const {return m_->split_mode ();} +QString Configuration::opCall() const {return m_->opCall_;} QString Configuration::udp_server_name () const {return m_->udp_server_name_;} auto Configuration::udp_server_port () const -> port_type {return m_->udp_server_port_;} bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests_;} +QString Configuration::n1mm_server_name () const {return m_->n1mm_server_name_;} +auto Configuration::n1mm_server_port () const -> port_type {return m_->n1mm_server_port_;} +bool Configuration::broadcast_to_n1mm () const {return m_->broadcast_to_n1mm_;} bool Configuration::udpWindowToFront () const {return m_->udpWindowToFront_;} bool Configuration::udpWindowRestore () const {return m_->udpWindowRestore_;} Bands * Configuration::bands () {return &m_->bands_;} @@ -672,6 +732,9 @@ QDir Configuration::azel_directory () const {return m_->azel_directory_;} QString Configuration::rig_name () const {return m_->rig_params_.rig_name;} bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;} bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;} +LotWUsers const& Configuration::lotw_users () const {return m_->lotw_users_;} +DecodeHighlightingModel const& Configuration::decode_highlighting () const {return m_->decode_highlighing_model_;} +bool Configuration::highlight_by_mode () const {return m_->highlight_by_mode_;} void Configuration::set_calibration (CalibrationParams params) { @@ -766,6 +829,55 @@ void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_s } } +bool Configuration::valid_n1mm_info () const +{ + // do very rudimentary checking on the n1mm server name and port number. + // + auto server_name = m_->n1mm_server_name_; + auto port_number = m_->n1mm_server_port_; + return(!(server_name.trimmed().isEmpty() || port_number == 0)); +} + +QString Configuration::my_grid() const +{ + auto the_grid = m_->my_grid_; + if (m_->use_dynamic_grid_ && m_->dynamic_grid_.size () >= 4) { + the_grid = m_->dynamic_grid_; + } + return the_grid; +} + +QString Configuration::Field_Day_Exchange() const +{ + return m_->FD_exchange_; +} + +void Configuration::setEU_VHF_Contest() +{ + m_->bSpecialOp_=true; + m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_); + m_->ui_->rbEU_VHF_Contest->setChecked(true); + m_->SelectedActivity_ = static_cast<int> (SpecialOperatingActivity::EU_VHF); + m_->write_settings(); +} + +QString Configuration::RTTY_Exchange() const +{ + return m_->RTTY_exchange_; +} + +auto Configuration::special_op_id () const -> SpecialOperatingActivity +{ + return m_->bSpecialOp_ ? static_cast<SpecialOperatingActivity> (m_->SelectedActivity_) : SpecialOperatingActivity::NONE; +} + +void Configuration::set_location (QString const& grid_descriptor) +{ + // change the dynamic grid + qDebug () << "Configuration::set_location - location:" << grid_descriptor; + m_->dynamic_grid_ = grid_descriptor.trimmed (); +} + namespace { #if defined (Q_OS_MAC) @@ -800,17 +912,21 @@ namespace } } -Configuration::impl::impl (Configuration * self, QDir const& temp_directory, - QSettings * settings, QWidget * parent) +Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network_manager + , QDir const& temp_directory, QSettings * settings, LogBook * logbook + , QWidget * parent) : QDialog {parent} , self_ {self} , transceiver_thread_ {nullptr} , ui_ {new Ui::configuration_dialog} + , network_manager_ {network_manager} , settings_ {settings} + , logbook_ {logbook} , doc_dir_ {doc_path ()} , data_dir_ {data_path ()} , temp_dir_ {temp_directory} , writeable_data_dir_ {QStandardPaths::writableLocation (QStandardPaths::DataLocation)} + , lotw_users_ {network_manager_} , restart_sound_input_device_ {false} , restart_sound_output_device_ {false} , frequencies_ {&bands_} @@ -820,7 +936,11 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, , current_offset_ {0} , current_tx_offset_ {0} , frequency_dialog_ {new FrequencyDialog {®ions_, &modes_, this}} + , station_delete_action_ {tr ("&Delete"), nullptr} + , station_insert_action_ {tr ("&Insert ..."), nullptr} , station_dialog_ {new StationDialog {&next_stations_, &bands_, this}} + , highlight_by_mode_ {false} + , LotW_days_since_upload_ {0} , last_port_type_ {TransceiverFactory::Capabilities::none} , rig_is_dummy_ {false} , rig_active_ {false} @@ -835,17 +955,8 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, , default_audio_output_device_selected_ {false} { ui_->setupUi (this); -// ui_->groupBox_6->setVisible(false); //### Temporary ??? ### { - // Find a suitable data file location - if (!writeable_data_dir_.mkpath (".")) - { - MessageBox::critical_message (this, tr ("Failed to create data directory"), - tr ("path: \"%1\"").arg (writeable_data_dir_.absolutePath ())); - throw std::runtime_error {"Failed to create data directory"}; - } - // Make sure the default save directory exists QString save_dir {"save"}; default_save_directory_ = writeable_data_dir_; @@ -891,25 +1002,40 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, // this must be done after the default paths above are set read_settings (); + // conditionally load LotW users data + ui_->LotW_CSV_fetch_push_button->setEnabled (false); + connect (&lotw_users_, &LotWUsers::load_finished, [this] () { + ui_->LotW_CSV_fetch_push_button->setEnabled (true); + }); + lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv")); + lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text ()); + // // validation - // ui_->callsign_line_edit->setValidator (new CallsignValidator {this}); ui_->grid_line_edit->setValidator (new MaidenheadLocatorValidator {this}); - ui_->add_macro_line_edit->setValidator (new QRegExpValidator {message_alphabet, this}); + ui_->add_macro_line_edit->setValidator (new QRegularExpressionValidator {message_alphabet, this}); + ui_->Field_Day_Exchange->setValidator (new QRegularExpressionValidator {field_day_exchange_re, this}); + ui_->RTTY_Exchange->setValidator (new QRegularExpressionValidator {RTTY_roundup_exchange_re, this}); ui_->udp_server_port_spin_box->setMinimum (1); ui_->udp_server_port_spin_box->setMaximum (std::numeric_limits<port_type>::max ()); + ui_->n1mm_server_port_spin_box->setMinimum (1); + ui_->n1mm_server_port_spin_box->setMaximum (std::numeric_limits<port_type>::max ()); + // // assign ids to radio buttons // + ui_->CAT_data_bits_button_group->setId (ui_->CAT_default_bit_radio_button, TransceiverFactory::default_data_bits); ui_->CAT_data_bits_button_group->setId (ui_->CAT_7_bit_radio_button, TransceiverFactory::seven_data_bits); ui_->CAT_data_bits_button_group->setId (ui_->CAT_8_bit_radio_button, TransceiverFactory::eight_data_bits); + ui_->CAT_stop_bits_button_group->setId (ui_->CAT_default_stop_bit_radio_button, TransceiverFactory::default_stop_bits); ui_->CAT_stop_bits_button_group->setId (ui_->CAT_one_stop_bit_radio_button, TransceiverFactory::one_stop_bit); ui_->CAT_stop_bits_button_group->setId (ui_->CAT_two_stop_bit_radio_button, TransceiverFactory::two_stop_bits); + ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_default_radio_button, TransceiverFactory::handshake_default); ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_none_radio_button, TransceiverFactory::handshake_none); ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_xon_radio_button, TransceiverFactory::handshake_XonXoff); ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_hardware_radio_button, TransceiverFactory::handshake_hardware); @@ -930,6 +1056,13 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, ui_->split_mode_button_group->setId (ui_->split_rig_radio_button, TransceiverFactory::split_mode_rig); ui_->split_mode_button_group->setId (ui_->split_emulate_radio_button, TransceiverFactory::split_mode_emulate); + ui_->special_op_activity_button_group->setId (ui_->rbNA_VHF_Contest, static_cast<int> (SpecialOperatingActivity::NA_VHF)); + ui_->special_op_activity_button_group->setId (ui_->rbEU_VHF_Contest, static_cast<int> (SpecialOperatingActivity::EU_VHF)); + ui_->special_op_activity_button_group->setId (ui_->rbField_Day, static_cast<int> (SpecialOperatingActivity::FIELD_DAY)); + ui_->special_op_activity_button_group->setId (ui_->rbRTTY_Roundup, static_cast<int> (SpecialOperatingActivity::RTTY)); + ui_->special_op_activity_button_group->setId (ui_->rbFox, static_cast<int> (SpecialOperatingActivity::FOX)); + ui_->special_op_activity_button_group->setId (ui_->rbHound, static_cast<int> (SpecialOperatingActivity::HOUND)); + // // setup PTT port combo box drop down content // @@ -968,6 +1101,8 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, frequencies_.sort (FrequencyList_v2::frequency_column); ui_->frequencies_table_view->setModel (&next_frequencies_); + ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); + ui_->frequencies_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); ui_->frequencies_table_view->sortByColumn (FrequencyList_v2::frequency_column, Qt::AscendingOrder); ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2::frequency_mhz_column, true); @@ -1003,29 +1138,32 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, ui_->frequencies_table_view->insertAction (nullptr, reset_frequencies_action_); connect (reset_frequencies_action_, &QAction::triggered, this, &Configuration::impl::reset_frequencies); - // // setup stations table model & view // stations_.sort (StationList::band_column); - ui_->stations_table_view->setModel (&next_stations_); + ui_->stations_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); + ui_->stations_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); ui_->stations_table_view->sortByColumn (StationList::band_column, Qt::AscendingOrder); - // delegates + // stations delegates auto stations_item_delegate = new QStyledItemDelegate {this}; stations_item_delegate->setItemEditorFactory (item_editor_factory ()); ui_->stations_table_view->setItemDelegate (stations_item_delegate); ui_->stations_table_view->setItemDelegateForColumn (StationList::band_column, new ForeignKeyDelegate {&bands_, &next_stations_, 0, StationList::band_column, this}); - // actions - station_delete_action_ = new QAction {tr ("&Delete"), ui_->stations_table_view}; - ui_->stations_table_view->insertAction (nullptr, station_delete_action_); - connect (station_delete_action_, &QAction::triggered, this, &Configuration::impl::delete_stations); + // stations actions + ui_->stations_table_view->addAction (&station_delete_action_); + connect (&station_delete_action_, &QAction::triggered, this, &Configuration::impl::delete_stations); + + ui_->stations_table_view->addAction (&station_insert_action_); + connect (&station_insert_action_, &QAction::triggered, this, &Configuration::impl::insert_station); - station_insert_action_ = new QAction {tr ("&Insert ..."), ui_->stations_table_view}; - ui_->stations_table_view->insertAction (nullptr, station_insert_action_); - connect (station_insert_action_, &QAction::triggered, this, &Configuration::impl::insert_station); + // + // colours and highlighting setup + // + ui_->highlighting_list_view->setModel (&next_decode_highlighing_model_); // // load combo boxes with audio setup choices @@ -1068,12 +1206,8 @@ void Configuration::impl::initialize_models () ui_->grid_line_edit->setPalette (pal); ui_->callsign_line_edit->setText (my_callsign_); ui_->grid_line_edit->setText (my_grid_); - ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name())); - ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name())); - ui_->labTx->setStyleSheet(QString("background: %1").arg(color_TxMsg_.name())); - ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name())); - ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name())); - ui_->CW_id_interval_spin_box->setValue (id_interval_); + ui_->use_dynamic_grid->setChecked(use_dynamic_grid_); + ui_->CW_id_interval_spin_box->setValue (id_interval_); ui_->sbNtrials->setValue (ntrials_); ui_->sbTxDelay->setValue (txDelay_); ui_->sbAggressive->setValue (aggressive_); @@ -1090,8 +1224,10 @@ void Configuration::impl::initialize_models () ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_); ui_->report_in_comments_check_box->setChecked (report_in_comments_); ui_->prompt_to_log_check_box->setChecked (prompt_to_log_); + ui_->cbAutoLog->setChecked(autoLog_); ui_->insert_blank_check_box->setChecked (insert_blank_); ui_->DXCC_check_box->setChecked (DXCC_); + ui_->ppfx_check_box->setChecked (ppfx_); ui_->clear_DX_check_box->setChecked (clear_DX_); ui_->miles_check_box->setChecked (miles_); ui_->quick_call_check_box->setChecked (quick_call_); @@ -1102,9 +1238,10 @@ void Configuration::impl::initialize_models () ui_->decode_at_52s_check_box->setChecked(decode_at_52s_); ui_->single_decode_check_box->setChecked(single_decode_); ui_->cbTwoPass->setChecked(twoPass_); + ui_->gbSpecialOpActivity->setChecked(bSpecialOp_); + ui_->special_op_activity_button_group->button (SelectedActivity_)->setChecked (true); ui_->cbx2ToneSpacing->setChecked(x2ToneSpacing_); - ui_->cbRealTime->setChecked(realTimeDecode_); - ui_->cbRealTime->setVisible(false); //Tempoary -- probably will remove this control + ui_->cbx4ToneSpacing->setChecked(x4ToneSpacing_); ui_->type_2_msg_gen_combo_box->setCurrentIndex (type_2_msg_gen_); ui_->rig_combo_box->setCurrentText (rig_params_.rig_name); ui_->TX_mode_button_group->button (data_mode_)->setChecked (true); @@ -1133,9 +1270,13 @@ 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->setText (udp_server_name_); ui_->udp_server_port_spin_box->setValue (udp_server_port_); ui_->accept_udp_requests_check_box->setChecked (accept_udp_requests_); + ui_->n1mm_server_name_line_edit->setText (n1mm_server_name_); + ui_->n1mm_server_port_spin_box->setValue (n1mm_server_port_); + ui_->enable_n1mm_broadcast_check_box->setChecked (broadcast_to_n1mm_); ui_->udpWindowToFront->setChecked(udpWindowToFront_); ui_->udpWindowRestore->setChecked(udpWindowRestore_); ui_->calibration_intercept_spin_box->setValue (calibration_.intercept); @@ -1159,6 +1300,10 @@ void Configuration::impl::initialize_models () next_frequencies_.frequency_list (frequencies_.frequency_list ()); next_stations_.station_list (stations_.station_list ()); + next_decode_highlighing_model_.items (decode_highlighing_model_.items ()); + ui_->highlight_by_mode_check_box->setChecked (highlight_by_mode_); + ui_->LotW_days_since_upload_spin_box->setValue (LotW_days_since_upload_); + set_rig_invariants (); } @@ -1178,12 +1323,10 @@ void Configuration::impl::read_settings () my_callsign_ = settings_->value ("MyCall", QString {}).toString (); my_grid_ = settings_->value ("MyGrid", QString {}).toString (); - next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString(); - next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString(); - next_color_TxMsg_ = color_TxMsg_ = settings_->value("colorTxMsg","#ffff00").toString(); - next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString(); - next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString(); - + FD_exchange_ = settings_->value ("Field_Day_Exchange",QString {}).toString (); + RTTY_exchange_ = settings_->value ("RTTY_Exchange",QString {}).toString (); + ui_->Field_Day_Exchange->setText(FD_exchange_); + ui_->RTTY_Exchange->setText(RTTY_exchange_); if (next_font_.fromString (settings_->value ("Font", QGuiApplication::font ().toString ()).toString ()) && next_font_ != font_) { @@ -1198,6 +1341,8 @@ void Configuration::impl::read_settings () && next_decoded_text_font_ != decoded_text_font_) { decoded_text_font_ = next_decoded_text_font_; + next_decode_highlighing_model_.set_font (decoded_text_font_); + ui_->highlighting_list_view->reset (); Q_EMIT self_->decoded_text_font_changed (decoded_text_font_); } else @@ -1276,6 +1421,7 @@ void Configuration::impl::read_settings () spot_to_psk_reporter_ = settings_->value ("PSKReporter", false).toBool (); id_after_73_ = settings_->value ("After73", false).toBool (); tx_QSY_allowed_ = settings_->value ("TxQSYAllowed", false).toBool (); + use_dynamic_grid_ = settings_->value ("AutoGrid", false).toBool (); macros_.setStringList (settings_->value ("Macros", QStringList {"TNX 73 GL"}).toStringList ()); @@ -1300,6 +1446,13 @@ void Configuration::impl::read_settings () stations_.station_list (settings_->value ("stations").value<StationList::Stations> ()); + auto highlight_items = settings_->value ("DecodeHighlighting", QVariant::fromValue (DecodeHighlightingModel::default_items ())).value<DecodeHighlightingModel::HighlightItems> (); + if (!highlight_items.size ()) highlight_items = DecodeHighlightingModel::default_items (); + decode_highlighing_model_.items (highlight_items); + highlight_by_mode_ = settings_->value("HighlightByMode", false).toBool (); + LotW_days_since_upload_ = settings_->value ("LotWDaysSinceLastUpload", 365).toInt (); + lotw_users_.set_age_constraint (LotW_days_since_upload_); + log_as_RTTY_ = settings_->value ("toRTTY", false).toBool (); report_in_comments_ = settings_->value("dBtoComments", false).toBool (); rig_params_.rig_name = settings_->value ("Rig", TransceiverFactory::basic_transceiver_name_).toString (); @@ -1308,9 +1461,9 @@ void Configuration::impl::read_settings () rig_params_.usb_port = settings_->value ("CATUSBPort").toString (); rig_params_.serial_port = settings_->value ("CATSerialPort").toString (); rig_params_.baud = settings_->value ("CATSerialRate", 4800).toInt (); - rig_params_.data_bits = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::eight_data_bits)).value<TransceiverFactory::DataBits> (); - rig_params_.stop_bits = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::two_stop_bits)).value<TransceiverFactory::StopBits> (); - rig_params_.handshake = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_none)).value<TransceiverFactory::Handshake> (); + rig_params_.data_bits = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::default_data_bits)).value<TransceiverFactory::DataBits> (); + rig_params_.stop_bits = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::default_stop_bits)).value<TransceiverFactory::StopBits> (); + rig_params_.handshake = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_default)).value<TransceiverFactory::Handshake> (); rig_params_.force_dtr = settings_->value ("CATForceDTR", false).toBool (); rig_params_.dtr_high = settings_->value ("DTR", false).toBool (); rig_params_.force_rts = settings_->value ("CATForceRTS", false).toBool (); @@ -1320,8 +1473,10 @@ void Configuration::impl::read_settings () rig_params_.ptt_port = settings_->value ("PTTport").toString (); data_mode_ = settings_->value ("DataMode", QVariant::fromValue (data_mode_none)).value<Configuration::DataMode> (); prompt_to_log_ = settings_->value ("PromptToLog", false).toBool (); + autoLog_ = settings_->value ("AutoLog", false).toBool (); insert_blank_ = settings_->value ("InsertBlank", false).toBool (); DXCC_ = settings_->value ("DXCCEntity", false).toBool (); + ppfx_ = settings_->value ("PrincipalPrefix", false).toBool (); clear_DX_ = settings_->value ("ClearCallGrid", false).toBool (); miles_ = settings_->value ("Miles", false).toBool (); quick_call_ = settings_->value ("QuickCall", false).toBool (); @@ -1332,12 +1487,18 @@ void Configuration::impl::read_settings () decode_at_52s_ = settings_->value("Decode52",false).toBool (); single_decode_ = settings_->value("SingleDecode",false).toBool (); twoPass_ = settings_->value("TwoPass",true).toBool (); + bSpecialOp_ = settings_->value("SpecialOpActivity",false).toBool (); + SelectedActivity_ = settings_->value("SelectedActivity",1).toInt (); x2ToneSpacing_ = settings_->value("x2ToneSpacing",false).toBool (); - realTimeDecode_ = settings_->value("RealTimeDecode",false).toBool (); + x4ToneSpacing_ = settings_->value("x4ToneSpacing",false).toBool (); rig_params_.poll_interval = settings_->value ("Polling", 0).toInt (); rig_params_.split_mode = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value<TransceiverFactory::SplitMode> (); + opCall_ = settings_->value ("OpCall", "").toString (); udp_server_name_ = settings_->value ("UDPServer", "127.0.0.1").toString (); udp_server_port_ = settings_->value ("UDPServerPort", 2237).toUInt (); + n1mm_server_name_ = settings_->value ("N1MMServer", "127.0.0.1").toString (); + n1mm_server_port_ = settings_->value ("N1MMServerPort", 2333).toUInt (); + broadcast_to_n1mm_ = settings_->value ("BroadcastToN1MM", false).toBool (); accept_udp_requests_ = settings_->value ("AcceptUDPRequests", false).toBool (); udpWindowToFront_ = settings_->value ("udpWindowToFront",false).toBool (); udpWindowRestore_ = settings_->value ("udpWindowRestore",false).toBool (); @@ -1353,11 +1514,8 @@ void Configuration::impl::write_settings () settings_->setValue ("MyCall", my_callsign_); settings_->setValue ("MyGrid", my_grid_); - settings_->setValue("colorCQ",color_CQ_); - settings_->setValue("colorMyCall",color_MyCall_); - settings_->setValue("colorTxMsg",color_TxMsg_); - settings_->setValue("colorDXCC",color_DXCC_); - settings_->setValue("colorNewCall",color_NewCall_); + settings_->setValue ("Field_Day_Exchange", FD_exchange_); + settings_->setValue ("RTTY_Exchange", RTTY_exchange_); settings_->setValue ("Font", font_.toString ()); settings_->setValue ("DecodedTextFont", decoded_text_font_.toString ()); settings_->setValue ("IDint", id_interval_); @@ -1399,6 +1557,9 @@ void Configuration::impl::write_settings () settings_->setValue ("Macros", macros_.stringList ()); settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ())); settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ())); + settings_->setValue ("DecodeHighlighting", QVariant::fromValue (decode_highlighing_model_.items ())); + settings_->setValue ("HighlightByMode", highlight_by_mode_); + settings_->setValue ("LotWDaysSinceLastUpload", LotW_days_since_upload_); settings_->setValue ("toRTTY", log_as_RTTY_); settings_->setValue ("dBtoComments", report_in_comments_); settings_->setValue ("Rig", rig_params_.rig_name); @@ -1411,8 +1572,10 @@ void Configuration::impl::write_settings () settings_->setValue ("CATHandshake", QVariant::fromValue (rig_params_.handshake)); settings_->setValue ("DataMode", QVariant::fromValue (data_mode_)); settings_->setValue ("PromptToLog", prompt_to_log_); + settings_->setValue ("AutoLog", autoLog_); settings_->setValue ("InsertBlank", insert_blank_); settings_->setValue ("DXCCEntity", DXCC_); + settings_->setValue ("PrincipalPrefix", ppfx_); settings_->setValue ("ClearCallGrid", clear_DX_); settings_->setValue ("Miles", miles_); settings_->setValue ("QuickCall", quick_call_); @@ -1430,10 +1593,16 @@ void Configuration::impl::write_settings () settings_->setValue ("Decode52", decode_at_52s_); settings_->setValue ("SingleDecode", single_decode_); settings_->setValue ("TwoPass", twoPass_); + settings_->setValue ("SelectedActivity", SelectedActivity_); + settings_->setValue ("SpecialOpActivity", bSpecialOp_); settings_->setValue ("x2ToneSpacing", x2ToneSpacing_); - settings_->setValue ("RealTimeDecode", realTimeDecode_); + settings_->setValue ("x4ToneSpacing", x4ToneSpacing_); + settings_->setValue ("OpCall", opCall_); settings_->setValue ("UDPServer", udp_server_name_); settings_->setValue ("UDPServerPort", udp_server_port_); + settings_->setValue ("N1MMServer", n1mm_server_name_); + settings_->setValue ("N1MMServerPort", n1mm_server_port_); + settings_->setValue ("BroadcastToN1MM", broadcast_to_n1mm_); settings_->setValue ("AcceptUDPRequests", accept_udp_requests_); settings_->setValue ("udpWindowToFront", udpWindowToFront_); settings_->setValue ("udpWindowRestore", udpWindowRestore_); @@ -1442,6 +1611,7 @@ void Configuration::impl::write_settings () settings_->setValue ("pwrBandTxMemory", pwrBandTxMemory_); settings_->setValue ("pwrBandTuneMemory", pwrBandTuneMemory_); settings_->setValue ("Region", QVariant::fromValue (region_)); + settings_->setValue ("AutoGrid", use_dynamic_grid_); } void Configuration::impl::set_rig_invariants () @@ -1603,6 +1773,42 @@ bool Configuration::impl::validate () return false; } + if (ui_->rbField_Day-> isChecked () && + !ui_->Field_Day_Exchange->hasAcceptableInput ()) + { + for (auto * parent = ui_->Field_Day_Exchange->parentWidget (); parent; parent = parent->parentWidget ()) + { + auto index = ui_->configuration_tabs->indexOf (parent); + if (index != -1) + { + ui_->configuration_tabs->setCurrentIndex (index); + break; + } + } + ui_->Field_Day_Exchange->setFocus (); + MessageBox::critical_message (this, tr ("Invalid Contest Exchange") + , tr ("You must input a valid ARRL Field Day exchange")); + return false; + } + + if (ui_->rbRTTY_Roundup-> isChecked () && + !ui_->RTTY_Exchange->hasAcceptableInput ()) + { + for (auto * parent = ui_->RTTY_Exchange->parentWidget (); parent; parent = parent->parentWidget ()) + { + auto index = ui_->configuration_tabs->indexOf (parent); + if (index != -1) + { + ui_->configuration_tabs->setCurrentIndex (index); + break; + } + } + ui_->RTTY_Exchange->setFocus (); + MessageBox::critical_message (this, tr ("Invalid Contest Exchange") + , tr ("You must input a valid ARRL RTTY Roundup exchange")); + return false; + } + return true; } @@ -1706,15 +1912,11 @@ void Configuration::impl::accept () if (next_decoded_text_font_ != decoded_text_font_) { decoded_text_font_ = next_decoded_text_font_; + next_decode_highlighing_model_.set_font (decoded_text_font_); + ui_->highlighting_list_view->reset (); Q_EMIT self_->decoded_text_font_changed (decoded_text_font_); } - color_CQ_ = next_color_CQ_; - color_MyCall_ = next_color_MyCall_; - color_TxMsg_ = next_color_TxMsg_; - color_DXCC_ = next_color_DXCC_; - color_NewCall_ = next_color_NewCall_; - rig_params_ = temp_rig_params; // now we can go live with the rig // related configuration parameters rig_is_dummy_ = TransceiverFactory::basic_transceiver_name_ == rig_params_.rig_name; @@ -1795,6 +1997,8 @@ void Configuration::impl::accept () my_callsign_ = ui_->callsign_line_edit->text (); my_grid_ = ui_->grid_line_edit->text (); + FD_exchange_= ui_->Field_Day_Exchange->text ().toUpper (); + RTTY_exchange_= ui_->RTTY_Exchange->text ().toUpper (); spot_to_psk_reporter_ = ui_->psk_reporter_check_box->isChecked (); id_interval_ = ui_->CW_id_interval_spin_box->value (); ntrials_ = ui_->sbNtrials->value (); @@ -1810,8 +2014,10 @@ void Configuration::impl::accept () log_as_RTTY_ = ui_->log_as_RTTY_check_box->isChecked (); report_in_comments_ = ui_->report_in_comments_check_box->isChecked (); prompt_to_log_ = ui_->prompt_to_log_check_box->isChecked (); + autoLog_ = ui_->cbAutoLog->isChecked(); insert_blank_ = ui_->insert_blank_check_box->isChecked (); DXCC_ = ui_->DXCC_check_box->isChecked (); + ppfx_ = ui_->ppfx_check_box->isChecked (); clear_DX_ = ui_->clear_DX_check_box->isChecked (); miles_ = ui_->miles_check_box->isChecked (); quick_call_ = ui_->quick_call_check_box->isChecked (); @@ -1825,12 +2031,15 @@ void Configuration::impl::accept () decode_at_52s_ = ui_->decode_at_52s_check_box->isChecked (); single_decode_ = ui_->single_decode_check_box->isChecked (); twoPass_ = ui_->cbTwoPass->isChecked (); + bSpecialOp_ = ui_->gbSpecialOpActivity->isChecked (); + SelectedActivity_ = ui_->special_op_activity_button_group->checkedId(); x2ToneSpacing_ = ui_->cbx2ToneSpacing->isChecked (); - realTimeDecode_ = ui_->cbRealTime->isChecked (); + x4ToneSpacing_ = ui_->cbx4ToneSpacing->isChecked (); calibration_.intercept = ui_->calibration_intercept_spin_box->value (); calibration_.slope_ppm = ui_->calibration_slope_ppm_spin_box->value (); pwrBandTxMemory_ = ui_->checkBoxPwrBandTxMemory->isChecked (); pwrBandTuneMemory_ = ui_->checkBoxPwrBandTuneMemory->isChecked (); + opCall_=ui_->opCallEntry->text(); auto new_server = ui_->udp_server_line_edit->text (); if (new_server != udp_server_name_) { @@ -1846,6 +2055,10 @@ void Configuration::impl::accept () } accept_udp_requests_ = ui_->accept_udp_requests_check_box->isChecked (); + n1mm_server_name_ = ui_->n1mm_server_name_line_edit->text (); + n1mm_server_port_ = ui_->n1mm_server_port_spin_box->value (); + broadcast_to_n1mm_ = ui_->enable_n1mm_broadcast_check_box->isChecked (); + udpWindowToFront_ = ui_->udpWindowToFront->isChecked (); udpWindowRestore_ = ui_->udpWindowRestore->isChecked (); @@ -1864,10 +2077,26 @@ void Configuration::impl::accept () if (stations_.station_list () != next_stations_.station_list ()) { - stations_.station_list(next_stations_.station_list ()); + stations_.station_list (next_stations_.station_list ()); stations_.sort (StationList::band_column); } - + + if (decode_highlighing_model_.items () != next_decode_highlighing_model_.items ()) + { + decode_highlighing_model_.items (next_decode_highlighing_model_.items ()); + Q_EMIT self_->decode_highlighting_changed (decode_highlighing_model_); + } + highlight_by_mode_ = ui_->highlight_by_mode_check_box->isChecked (); + LotW_days_since_upload_ = ui_->LotW_days_since_upload_spin_box->value (); + lotw_users_.set_age_constraint (LotW_days_since_upload_); + + if (ui_->use_dynamic_grid->isChecked() && !use_dynamic_grid_ ) + { + // turning on so clear it so only the next location update gets used + dynamic_grid_.clear (); + } + use_dynamic_grid_ = ui_->use_dynamic_grid->isChecked(); + write_settings (); // make visible to all } @@ -1899,63 +2128,32 @@ void Configuration::impl::on_font_push_button_clicked () next_font_ = QFontDialog::getFont (0, next_font_, this); } -void Configuration::impl::on_pbCQmsg_clicked() +void Configuration::impl::on_reset_highlighting_to_defaults_push_button_clicked (bool /*checked*/) { - auto new_color = QColorDialog::getColor(next_color_CQ_, this, "CQ Messages Color"); - if (new_color.isValid ()) + if (MessageBox::Yes == MessageBox::query_message (this + , tr ("Reset Decode Highlighting") + , tr ("Reset all decode highlighting and priorities to default values"))) { - next_color_CQ_ = new_color; - ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_CQ_.name())); + next_decode_highlighing_model_.items (DecodeHighlightingModel::default_items ()); } } -void Configuration::impl::on_pbMyCall_clicked() +void Configuration::impl::on_rescan_log_push_button_clicked (bool /*clicked*/) { - auto new_color = QColorDialog::getColor(next_color_MyCall_, this, "My Call Messages Color"); - if (new_color.isValid ()) - { - next_color_MyCall_ = new_color; - ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_MyCall_.name())); - } + if (logbook_) logbook_->rescan (); } -void Configuration::impl::on_pbTxMsg_clicked() +void Configuration::impl::on_LotW_CSV_fetch_push_button_clicked (bool /*checked*/) { - auto new_color = QColorDialog::getColor(next_color_TxMsg_, this, "Tx Messages Color"); - if (new_color.isValid ()) - { - next_color_TxMsg_ = new_color; - ui_->labTx->setStyleSheet(QString("background: %1").arg(next_color_TxMsg_.name())); - } -} - -void Configuration::impl::on_pbNewDXCC_clicked() -{ - auto new_color = QColorDialog::getColor(next_color_DXCC_, this, "New DXCC Messages Color"); - if (new_color.isValid ()) - { - next_color_DXCC_ = new_color; - ui_->labDXCC->setStyleSheet(QString("background: %1").arg(next_color_DXCC_.name())); - } -} - -void Configuration::impl::on_pbNewCall_clicked() -{ - auto new_color = QColorDialog::getColor(next_color_NewCall_, this, "New Call Messages Color"); - if (new_color.isValid ()) - { - next_color_NewCall_ = new_color; - ui_->labNewCall->setStyleSheet(QString("background: %1").arg(next_color_NewCall_.name())); - } + lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), true); + ui_->LotW_CSV_fetch_push_button->setEnabled (false); } void Configuration::impl::on_decoded_text_font_push_button_clicked () { next_decoded_text_font_ = QFontDialog::getFont (0, decoded_text_font_ , this , tr ("WSJT-X Decoded Text Font Chooser") -#if QT_VERSION >= 0x050201 , QFontDialog::MonospacedFonts -#endif ); } @@ -2098,10 +2296,10 @@ void Configuration::impl::delete_selected_macros (QModelIndexList selected_rows) { // sort in reverse row order so that we can delete without changing // indices underneath us - qSort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs) - { - return rhs.row () < lhs.row (); // reverse row ordering - }); + std::sort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs) + { + return rhs.row () < lhs.row (); // reverse row ordering + }); // now delete them Q_FOREACH (auto index, selected_rows) @@ -2295,6 +2493,42 @@ void Configuration::impl::on_calibration_slope_ppm_spin_box_valueChanged (double rig_active_ = false; // force reset } +void Configuration::impl::on_prompt_to_log_check_box_clicked(bool checked) +{ + if(checked) ui_->cbAutoLog->setChecked(false); +} + +void Configuration::impl::on_cbAutoLog_clicked(bool checked) +{ + if(checked) ui_->prompt_to_log_check_box->setChecked(false); +} + +void Configuration::impl::on_cbx2ToneSpacing_clicked(bool b) +{ + if(b) ui_->cbx4ToneSpacing->setChecked(false); +} + +void Configuration::impl::on_cbx4ToneSpacing_clicked(bool b) +{ + if(b) ui_->cbx2ToneSpacing->setChecked(false); +} + +void Configuration::impl::on_Field_Day_Exchange_textEdited (QString const& exchange) +{ + auto text = exchange.simplified ().toUpper (); + auto class_pos = text.indexOf (QRegularExpression {R"([A-H])"}); + if (class_pos >= 0 && text.size () >= class_pos + 2 && text.at (class_pos + 1) != QChar {' '}) + { + text.insert (class_pos + 1, QChar {' '}); + } + ui_->Field_Day_Exchange->setText (text); +} + +void Configuration::impl::on_RTTY_Exchange_textEdited (QString const& exchange) +{ + ui_->RTTY_Exchange->setText (exchange.toUpper ()); +} + bool Configuration::impl::have_rig () { if (!open_rig ()) @@ -2654,7 +2888,10 @@ void Configuration::impl::enumerate_rigs () } else { - ui_->rig_combo_box->addItem (r.key (), r.value ().model_number_); + int i; + for(i=1;i<ui_->rig_combo_box->count() && (r.key().toLower() > ui_->rig_combo_box->itemText(i).toLower());++i); + if (i < ui_->rig_combo_box->count()) ui_->rig_combo_box->insertItem (i, r.key (), r.value ().model_number_); + else ui_->rig_combo_box->addItem (r.key (), r.value ().model_number_); } } @@ -2692,11 +2929,6 @@ auto Configuration::impl::remove_calibration (Frequency f) const -> Frequency / (1. + calibration_.slope_ppm / 1.e6)); } -#if !defined (QT_NO_DEBUG_STREAM) -ENUM_QDEBUG_OPS_IMPL (Configuration, DataMode); -ENUM_QDEBUG_OPS_IMPL (Configuration, Type2MsgGen); -#endif - ENUM_QDATASTREAM_OPS_IMPL (Configuration, DataMode); ENUM_QDATASTREAM_OPS_IMPL (Configuration, Type2MsgGen); |
