summaryrefslogtreecommitdiff
path: root/Configuration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Configuration.cpp')
-rw-r--r--Configuration.cpp1854
1 files changed, 1454 insertions, 400 deletions
diff --git a/Configuration.cpp b/Configuration.cpp
index 185b3e4b..dd92ae11 100644
--- a/Configuration.cpp
+++ b/Configuration.cpp
@@ -148,10 +148,16 @@
#include <QSound>
#include <QDialog>
#include <QAction>
+#include <QKeyEvent>
+#include <QScreen>
+#include <QShowEvent>
+#include <QTabBar>
+#include <QWindow>
#include <QFileDialog>
#include <QDir>
#include <QTemporaryFile>
#include <QFormLayout>
+#include <QItemSelectionModel>
#include <QString>
#include <QStringList>
#include <QStringListModel>
@@ -165,6 +171,7 @@
#include <QFont>
#include <QFontDialog>
#include <QComboBox>
+#include <QScopedValueRollback>
#include <QScopedPointer>
#include <QNetworkInterface>
#include <QHostInfo>
@@ -176,12 +183,16 @@
#include <QJsonDocument>
#include <QJsonArray>
#include <QSerialPortInfo>
+#include <QItemSelectionModel>
+#include <QMenu>
#include <vector>
#include <utility>
#include <iostream>
#include "pimpl_impl.hpp"
#include "Logger.hpp"
+#include "PerformanceTrace.hpp"
+#include "Transceiver/TxInhibitTransceiver.hpp"
#include "qt_helpers.hpp"
#include "MetaDataRegistry.hpp"
#include "SettingsGroup.hpp"
@@ -202,6 +213,7 @@
#include "Network/NetworkServerLookup.hpp"
#include "Network/FoxVerifier.hpp"
#include "widgets/MessageBox.hpp"
+#include "widgets/SettingsDialogLayout.hpp"
#include "validators/MaidenheadLocatorValidator.hpp"
#include "validators/CallsignValidator.hpp"
#include "Network/LotWUsers.hpp"
@@ -286,6 +298,26 @@ namespace
constexpr quint32 qrg_magic {0xadbccbdb};
constexpr quint32 qrg_version {101}; // M.mm
constexpr quint32 qrg_version_100 {100};
+
+ QString cloudlog_connection_check_style (Cloudlog::ConnectionCheckStatus status)
+ {
+ switch (status)
+ {
+ case Cloudlog::ConnectionCheckStatus::Success:
+ return QStringLiteral ("QPushButton {background-color: green;}");
+ case Cloudlog::ConnectionCheckStatus::ReadOnlyKey:
+ return QStringLiteral ("QPushButton {background-color: orange;}");
+ case Cloudlog::ConnectionCheckStatus::InvalidKey:
+ case Cloudlog::ConnectionCheckStatus::StationProfileUnavailable:
+ case Cloudlog::ConnectionCheckStatus::EndpointUnavailable:
+ case Cloudlog::ConnectionCheckStatus::UploadShapeRejected:
+ case Cloudlog::ConnectionCheckStatus::NetworkError:
+ case Cloudlog::ConnectionCheckStatus::UnexpectedResponse:
+ return QStringLiteral ("QPushButton {background-color: red;}");
+ }
+
+ return {};
+ }
}
@@ -341,6 +373,7 @@ public:
connect (button_box, &QDialogButtonBox::accepted, this, &FrequencyDialog::accept);
connect (button_box, &QDialogButtonBox::rejected, this, &FrequencyDialog::reject);
+ connect (&frequency_line_edit_, &QLineEdit::textChanged, this, &FrequencyDialog::update_accept_button);
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);
@@ -356,16 +389,11 @@ public:
void checkSaneDates()
{
- if (enable_dates_checkbox_->isChecked() && start_date_time_edit_->dateTime().isValid() && end_date_time_edit_->dateTime().isValid())
+ if (!dates_are_sane ())
{
- 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;
- }
+ QMessageBox::warning(this, tr("Invalid Date Range"), tr("Start date must be before end date"));
}
- button_box->button(QDialogButtonBox::Ok)->setEnabled(true);
+ update_accept_button ();
}
Item item () const
@@ -384,6 +412,20 @@ public:
}
private:
+ bool dates_are_sane () const
+ {
+ return !enable_dates_checkbox_->isChecked ()
+ || !start_date_time_edit_->dateTime ().isValid ()
+ || !end_date_time_edit_->dateTime ().isValid ()
+ || start_date_time_edit_->dateTime () <= end_date_time_edit_->dateTime ();
+ }
+
+ void update_accept_button ()
+ {
+ button_box->button (QDialogButtonBox::Ok)->setEnabled (frequency_line_edit_.hasAcceptableInput ()
+ && dates_are_sane ());
+ }
+
QComboBox region_combo_box_;
QComboBox mode_combo_box_;
QComboBox voices_combo_box_;
@@ -423,16 +465,18 @@ public:
auto main_layout = new QVBoxLayout (this);
main_layout->addLayout (form_layout);
- auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
- main_layout->addWidget (button_box);
+ button_box_ = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
+ main_layout->addWidget (button_box_);
- connect (button_box, &QDialogButtonBox::accepted, this, &StationDialog::accept);
- connect (button_box, &QDialogButtonBox::rejected, this, &StationDialog::reject);
+ connect (button_box_, &QDialogButtonBox::accepted, this, &StationDialog::accept);
+ connect (button_box_, &QDialogButtonBox::rejected, this, &StationDialog::reject);
+ connect (&delta_, &QLineEdit::textChanged, this, &StationDialog::update_accept_button);
if (delta_.text ().isEmpty ())
{
delta_.setText ("0");
}
+ update_accept_button ();
}
StationList::Station station () const
@@ -447,11 +491,17 @@ public:
}
private:
+ void update_accept_button ()
+ {
+ button_box_->button (QDialogButtonBox::Ok)->setEnabled (delta_.hasAcceptableInput ());
+ }
+
QScopedPointer<CandidateKeyFilter> filtered_bands_;
QComboBox band_;
FrequencyDeltaLineEdit delta_;
QLineEdit description_;
+ QDialogButtonBox * button_box_;
};
class RearrangableMacrosModel
@@ -493,22 +543,29 @@ public:
~impl ();
bool have_rig ();
-
- void transceiver_frequency (Frequency);
- void transceiver_tx_frequency (Frequency);
+ bool can_control_rig (char const * command) const;
+ void mark_rig_offline ();
+ static QString summarize_transceiver_failure (QString const& reason);
+
+ RigFrequencyChangePolicy::Activity frequency_change_activity () const;
+ bool frequency_change_allowed (RigFrequencyChangePolicy::ChangeKind) const;
+ bool transceiver_frequency (Frequency, RigFrequencyChangePolicy::ChangeKind);
+ bool transceiver_tx_frequency (Frequency, RigFrequencyChangePolicy::ChangeKind);
void transceiver_mode (MODE);
void transceiver_ptt (bool);
void transceiver_audio (bool);
void transceiver_tune (bool);
void transceiver_period (double);
void transceiver_blocksize (qint32);
- void transceiver_modulator_start (QString, unsigned, double, double, double, bool, bool, double, double);
+ void transceiver_modulator_start (TxEvidence::TxRequest const&);
+ void transceiver_enqueue_jtty_pcm (QByteArray const&, TxAudioQueueEpoch, qint64);
+ void transceiver_clear_jtty_pcm (TxAudioQueueEpoch);
void transceiver_modulator_stop (bool);
void transceiver_spread (double);
void transceiver_nsym (int);
void transceiver_trfrequency (double);
void transceiver_volume (double);
- void transceiver_txvolume (double);
+ void transceiver_txvolume (double, bool = false);
void sync_transceiver (bool force_signal);
Q_SLOT int exec () override;
@@ -518,6 +575,19 @@ public:
private:
typedef QList<QAudioDeviceInfo> AudioDevices;
+ struct SettingsFocusPage
+ {
+ QWidget * page;
+ QList<QWidget *> tab_stops;
+ };
+
+ bool eventFilter (QObject *, QEvent *) override;
+ void showEvent (QShowEvent *) override;
+ void register_settings_focus_page (QWidget * page, QList<QWidget *> const& tab_stops);
+ QList<QWidget *> current_settings_focus_path () const;
+ QList<QWidget *> settings_dialog_buttons () const;
+ int settings_focus_index (QList<QWidget *> const& path, QWidget * widget) const;
+ bool move_settings_focus (QList<QWidget *> const& path, int current_index, bool reverse);
void read_settings ();
void write_settings ();
@@ -544,8 +614,11 @@ private:
}
void set_cached_mode ();
bool open_rig (bool force = false);
+ bool rig_restart_required (TransceiverFactory::ParameterPack const&, bool) const;
+ bool tx_inhibit_blocks_rig_restart (TransceiverFactory::ParameterPack const&, bool) const;
+ void warn_tx_inhibit_restart_blocked ();
//bool set_mode ();
- void close_rig ();
+ void close_rig (bool failed = false);
TransceiverFactory::ParameterPack gather_rig_data ();
void enumerate_rigs ();
void set_rig_invariants ();
@@ -566,22 +639,21 @@ private:
void delete_stations ();
void insert_station ();
+ void handle_cloudlog_connection_check_result (Cloudlog::ConnectionCheckResult const& result);
+ void set_cloudlog_station_profiles (QList<Cloudlog::StationProfile> const& profiles);
+ qint32 cloudlog_station_profile_id () const;
Q_SLOT void on_font_push_button_clicked ();
Q_SLOT void on_decoded_text_font_push_button_clicked ();
Q_SLOT void on_PTT_port_combo_box_activated (int);
Q_SLOT void on_CAT_port_combo_box_activated (int);
Q_SLOT void on_CAT_serial_baud_combo_box_currentIndexChanged (int);
- Q_SLOT void on_CAT_data_bits_button_group_buttonClicked (int);
- Q_SLOT void on_CAT_stop_bits_button_group_buttonClicked (int);
- Q_SLOT void on_CAT_handshake_button_group_buttonClicked (int);
Q_SLOT void on_CAT_poll_interval_spin_box_valueChanged (int);
- Q_SLOT void on_split_mode_button_group_buttonClicked (int);
Q_SLOT void on_test_CAT_push_button_clicked ();
Q_SLOT void on_test_PTT_push_button_clicked (bool checked);
Q_SLOT void on_pbTestCloudlog_clicked ();
- Q_SLOT void on_gbCloudlog_clicked ();
- Q_SLOT void on_gbEQSL_clicked ();
+ Q_SLOT void on_cbCloudlog_toggled (bool checked);
+ Q_SLOT void on_cbEQSL_toggled (bool checked);
Q_SLOT void on_force_DTR_combo_box_currentIndexChanged (int);
Q_SLOT void on_force_RTS_combo_box_currentIndexChanged (int);
Q_SLOT void on_rig_combo_box_currentIndexChanged (int);
@@ -590,10 +662,13 @@ private:
Q_SLOT void on_TCI_spin_box_valueChanged(double a);
Q_SLOT void on_add_macro_push_button_clicked (bool = false);
Q_SLOT void on_delete_macro_push_button_clicked (bool = false);
- Q_SLOT void on_PTT_method_button_group_buttonClicked (int);
+ Q_SLOT void on_move_macro_up_push_button_clicked (bool = false);
+ Q_SLOT void on_move_macro_down_push_button_clicked (bool = false);
Q_SLOT void on_add_macro_line_edit_editingFinished ();
Q_SLOT void delete_macro ();
void delete_selected_macros (QModelIndexList);
+ void move_selected_macros (int);
+ void move_selected_highlighting_rule (int);
void after_CTY_downloaded();
void set_CTY_DAT_version(QString const& version);
void error_during_CTY_download (QString const& reason);
@@ -611,11 +686,14 @@ private:
Q_SLOT void handle_transceiver_tci_mod_active (bool);
Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number);
Q_SLOT void handle_transceiver_failure (QString const& reason);
- Q_SLOT void on_DXCC_check_box_clicked(bool checked);
- Q_SLOT void on_PWR_and_SWR_check_box_clicked(bool checked);
- Q_SLOT void on_cbHighDPI_clicked(bool checked);
+ Q_SLOT void on_DXCC_check_box_toggled (bool);
+ void update_DXCC_control_availability ();
+ Q_SLOT void on_PWR_and_SWR_check_box_toggled (bool);
+ void update_PWR_and_SWR_control_availability ();
Q_SLOT void on_reset_highlighting_to_defaults_push_button_clicked (bool);
Q_SLOT void on_reset_highlighting_to_defaults2_push_button_clicked (bool);
+ Q_SLOT void on_move_highlighting_up_push_button_clicked (bool = false);
+ Q_SLOT void on_move_highlighting_down_push_button_clicked (bool = false);
Q_SLOT void on_rescan_log_push_button_clicked (bool);
Q_SLOT void on_CTY_download_button_clicked (bool);
Q_SLOT void on_CALL3_download_button_clicked (bool);
@@ -623,30 +701,16 @@ private:
Q_SLOT void on_LotW_CSV_fetch_push_button_clicked (bool);
Q_SLOT void on_hamlib_download_button_clicked (bool);
Q_SLOT void on_revert_update_button_clicked (bool);
- Q_SLOT void on_gbSpecialOpActivity_clicked (bool);
- Q_SLOT void on_rbFox_clicked (bool);
- Q_SLOT void on_rbHound_clicked (bool);
- Q_SLOT void on_rbNA_VHF_Contest_clicked (bool);
- Q_SLOT void on_rbEU_VHF_Contest_clicked (bool);
- Q_SLOT void on_rbWW_DIGI_clicked (bool);
- Q_SLOT void on_rbQ65pileup_clicked (bool);
- Q_SLOT void on_rbField_Day_clicked (bool);
- Q_SLOT void on_rbRTTY_Roundup_clicked (bool);
- Q_SLOT void on_rbARRL_Digi_clicked (bool);
- Q_SLOT void on_cbSuperFox_clicked (bool);
- Q_SLOT void on_cbContestName_clicked (bool);
- Q_SLOT void on_cbOTP_clicked (bool);
- Q_SLOT void on_cbShowOTP_clicked (bool);
- Q_SLOT void on_cb_NCCC_Sprint_clicked (bool);
void error_during_hamlib_download (QString const& reason);
void after_hamlib_downloaded();
void display_file_information();
void check_visibility();
- 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_cbx2ToneSpacing_toggled (bool);
+ Q_SLOT void on_cbx4ToneSpacing_toggled (bool);
+ Q_SLOT void on_prompt_to_log_check_box_toggled (bool);
+ Q_SLOT void on_cbAutoLog_toggled (bool);
+ void update_logging_control_availability ();
Q_SLOT void on_Field_Day_Exchange_editingFinished ();
Q_SLOT void on_RTTY_Exchange_editingFinished ();
Q_SLOT void on_OTPUrl_textEdited (QString const&);
@@ -699,24 +763,29 @@ private:
Q_SLOT void on_voices_combo_box_currentIndexChanged (int);
Q_SLOT void on_pb_test_alerts_clicked (bool);
void read_voices ();
- void read_voicesPath ();
+ void read_voice_directory ();
// typenames used as arguments must match registered type names :(
Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const;
Q_SIGNAL void set_transceiver (Transceiver::TransceiverState const&,
unsigned sequence_number) const;
Q_SIGNAL void stop_transceiver () const;
+ Q_SIGNAL void enqueue_jtty_pcm (QByteArray const&, TxAudioQueueEpoch, qint64) const;
+ Q_SIGNAL void clear_jtty_pcm (TxAudioQueueEpoch) const;
- Configuration * const self_; // back pointer to public interface
+ PerformanceTrace::Phase construction_trace_;
+ Configuration * const self_; // back pointer to public interface
QThread * transceiver_thread_;
TransceiverFactory transceiver_factory_;
QList<QMetaObject::Connection> rig_connections_;
QScopedPointer<Ui::configuration_dialog> ui_;
+ QList<SettingsFocusPage> settings_focus_pages_;
QNetworkAccessManager * network_manager_;
QSettings * settings_;
+ bool use_default_geometry_ {false};
LogBook * logbook_;
QDir doc_dir_;
@@ -790,6 +859,9 @@ private:
bool rig_is_dummy_;
bool is_tci_;
bool rig_active_;
+ bool tx_inhibit_active_ {false};
+ bool tx_inhibit_status_forwarded_ {false};
+ quint64 tx_inhibit_generation_ {0};
bool have_rig_;
bool rig_changed_;
TransceiverState cached_rig_state_;
@@ -797,6 +869,7 @@ private:
CalibrationParams calibration_;
bool frequency_calibration_disabled_; // not persistent
unsigned transceiver_command_number_;
+ bool initializing_models_;
QString dynamic_grid_;
// configuration fields that we publish
@@ -850,7 +923,7 @@ private:
QString hamlib_backed_up_;
QString cloudLogApiUrl_;
QString cloudLogApiKey_;
- QString voicesPath_;
+ QDir voice_directory_;
bool send_to_eqsl_;
QString eqsl_username_;
QString eqsl_passwd_;
@@ -876,7 +949,7 @@ private:
double txDelay_;
bool tci_audio_;
bool id_after_73_;
- bool tx_QSY_allowed_;
+ bool tx_frequency_corrections_allowed_;
bool progressBar_red_;
bool spot_to_psk_reporter_;
bool psk_reporter_tcpip_;
@@ -918,8 +991,6 @@ private:
bool auto_astro_;
bool single_decode_;
bool twoPass_;
- bool highDPI_;
- bool largerTabWidget_;
bool bSuperFox_;
bool Individual_Contest_Name_;
bool NCCC_Sprint_;
@@ -986,7 +1057,9 @@ private:
QAudioDeviceInfo next_audio_output_device_;
AudioDevice::Channel audio_output_channel_;
AudioDevice::Channel next_audio_output_channel_;
- FileDownload cty_download;
+ FileDownload cty_download_;
+ FileDownload call3_download_;
+ FileDownload hamlib_download_;
bool default_audio_input_device_selected_;
bool default_audio_output_device_selected_;
@@ -1038,7 +1111,7 @@ double Configuration::txDelay() const {return m_->txDelay_;}
qint32 Configuration::RxBandwidth() const {return m_->RxBandwidth_;}
bool Configuration::tci_audio () const {return m_->tci_audio_;}
bool Configuration::id_after_73 () const {return m_->id_after_73_;}
-bool Configuration::tx_QSY_allowed () const {return m_->tx_QSY_allowed_;}
+bool Configuration::tx_frequency_corrections_allowed () const {return m_->tx_frequency_corrections_allowed_;}
bool Configuration::progressBar_red () const {return m_->progressBar_red_;}
bool Configuration::spot_to_psk_reporter () const
{
@@ -1092,8 +1165,6 @@ bool Configuration::repeat_Tx () const {return m_->repeat_Tx_;}
bool Configuration::auto_astro () const {return m_->auto_astro_;}
bool Configuration::single_decode () const {return m_->single_decode_;}
bool Configuration::twoPass() const {return m_->twoPass_;}
-bool Configuration::highDPI() const {return m_->highDPI_;}
-bool Configuration::largerTabWidget() const {return m_->largerTabWidget_;}
bool Configuration::superFox() const {return m_->bSuperFox_;}
bool Configuration::Individual_Contest_Name() const {return m_->Individual_Contest_Name_;}
bool Configuration::NCCC_Sprint() const {return m_->NCCC_Sprint_;}
@@ -1191,7 +1262,8 @@ void Configuration::enable_calibration (bool on)
{
auto target_frequency = m_->remove_calibration (m_->cached_rig_state_.frequency ()) - m_->current_offset_;
m_->frequency_calibration_disabled_ = !on;
- transceiver_frequency (target_frequency);
+ transceiver_frequency (
+ target_frequency, RigFrequencyChangePolicy::ChangeKind::TxPathCorrection);
}
bool Configuration::is_transceiver_online () const
@@ -1226,39 +1298,47 @@ void Configuration::transceiver_offline ()
m_->close_rig ();
}
-void Configuration::transceiver_frequency (Frequency f)
+bool Configuration::transceiver_frequency (Frequency f, RigFrequencyChangePolicy::ChangeKind kind)
{
LOG_TRACE (f << ' ' << m_->cached_rig_state_);
- m_->transceiver_frequency (f);
+ if (!m_->frequency_change_allowed (kind)) return false;
+ if (!m_->can_control_rig ("transceiver_frequency")) return false;
+ return m_->transceiver_frequency (f, kind);
}
-void Configuration::transceiver_tx_frequency (Frequency f)
+bool Configuration::transceiver_tx_frequency (Frequency f, RigFrequencyChangePolicy::ChangeKind kind)
{
LOG_TRACE (f << ' ' << m_->cached_rig_state_);
- m_->transceiver_tx_frequency (f);
+ if (!m_->frequency_change_allowed (kind)) return false;
+ if (!m_->can_control_rig ("transceiver_tx_frequency")) return false;
+ return m_->transceiver_tx_frequency (f, kind);
}
void Configuration::transceiver_mode (MODE mode)
{
LOG_TRACE (mode << ' ' << m_->cached_rig_state_);
+ if (!m_->can_control_rig ("transceiver_mode")) return;
m_->transceiver_mode (mode);
}
void Configuration::transceiver_ptt (bool on)
{
LOG_TRACE (on << ' ' << m_->cached_rig_state_);
+ if (!m_->can_control_rig ("transceiver_ptt")) return;
m_->transceiver_ptt (on);
}
void Configuration::transceiver_audio (bool on)
{
LOG_TRACE (on << ' ' << m_->cached_rig_state_);
+ if (!m_->can_control_rig ("transceiver_audio")) return;
m_->transceiver_audio (on);
}
void Configuration::transceiver_tune (bool on)
{
LOG_TRACE (on << ' ' << m_->cached_rig_state_);
+ if (!m_->can_control_rig ("transceiver_tune")) return;
m_->transceiver_tune (on);
}
@@ -1268,6 +1348,7 @@ void Configuration::transceiver_period (double period)
qDebug () << "Configuration::transceiver_period:" << period << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_period")) return;
m_->transceiver_period (period);
}
@@ -1277,17 +1358,30 @@ void Configuration::transceiver_blocksize (qint32 blocksize)
qDebug () << "Configuration::transceiver_blocksize:" << blocksize << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_blocksize")) return;
m_->transceiver_blocksize (blocksize);
}
-void Configuration::transceiver_modulator_start(QString jtmode, unsigned symbolslength, double framespersymbol, double trfrequency,
- double tonespacing, bool synchronize, bool fastmode, double dbsnr, double trperiod)
+void Configuration::transceiver_modulator_start (TxEvidence::TxRequest request)
{
#if WSJT_TRACE_CAT
- qDebug () << "Configuration::transceiver_modulator_start:" << symbolslength << m_->cached_rig_state_;
+ qDebug () << "Configuration::transceiver_modulator_start:" << request.symbols_length << m_->cached_rig_state_;
#endif
- m_->transceiver_modulator_start(jtmode, symbolslength,framespersymbol,trfrequency,tonespacing,synchronize,fastmode,dbsnr,trperiod);
+ if (!m_->can_control_rig ("transceiver_modulator_start")) return;
+ m_->transceiver_modulator_start (request);
+}
+
+void Configuration::transceiver_enqueue_jtty_pcm (QByteArray const& samples,
+ TxAudioQueueEpoch epoch,
+ qint64 enqueueId)
+{
+ m_->transceiver_enqueue_jtty_pcm (samples, epoch, enqueueId);
+}
+
+void Configuration::transceiver_clear_jtty_pcm (TxAudioQueueEpoch epoch)
+{
+ m_->transceiver_clear_jtty_pcm (epoch);
}
void Configuration::transceiver_modulator_stop (bool on)
@@ -1296,6 +1390,7 @@ void Configuration::transceiver_modulator_stop (bool on)
qDebug () << "Configuration::transceiver_stop:" << on << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_modulator_stop")) return;
m_->transceiver_modulator_stop (on);
}
@@ -1305,6 +1400,7 @@ void Configuration::transceiver_spread (double spread)
qDebug () << "Configuration::transceiver_spread:" << spread << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_spread")) return;
m_->transceiver_spread (spread);
}
@@ -1314,6 +1410,7 @@ void Configuration::transceiver_nsym (qint32 nsym)
qDebug () << "Configuration::transceiver_nsym:" << nsym << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_nsym")) return;
m_->transceiver_nsym (nsym);
}
@@ -1323,16 +1420,18 @@ void Configuration::transceiver_trfrequency (double trfrequency)
qDebug () << "Configuration::transceiver_trfrequency:" << trfrequency << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_trfrequency")) return;
m_->transceiver_trfrequency (trfrequency);
}
-void Configuration::transceiver_txvolume (qreal txvolume)
+void Configuration::transceiver_txvolume (qreal txvolume, bool force)
{
#if WSJT_TRACE_CAT
qDebug () << "Configuration::transceiver_txvolume:" << txvolume << m_->cached_rig_state_;
#endif
- m_->transceiver_txvolume (txvolume);
+ if (!m_->can_control_rig ("transceiver_txvolume")) return;
+ m_->transceiver_txvolume (txvolume, force);
}
void Configuration::transceiver_volume (qreal volume)
@@ -1341,6 +1440,7 @@ void Configuration::transceiver_volume (qreal volume)
qDebug () << "Configuration::transceiver_volume:" << volume << m_->cached_rig_state_;
#endif
+ if (!m_->can_control_rig ("transceiver_volume")) return;
m_->transceiver_volume (volume);
}
@@ -1348,10 +1448,11 @@ void Configuration::transceiver_volume (qreal volume)
void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_split)
{
LOG_TRACE ("force signal: " << force_signal << " enforce_mode_and_split: " << enforce_mode_and_split << ' ' << m_->cached_rig_state_);
+ if (!m_->can_control_rig ("sync_transceiver")) return;
m_->sync_transceiver (force_signal);
if (!enforce_mode_and_split)
{
- m_->transceiver_tx_frequency (0);
+ m_->transceiver_tx_frequency (0, RigFrequencyChangePolicy::ChangeKind::TxPathCorrection);
}
}
@@ -1628,9 +1729,27 @@ QString Configuration::highlight_blue_callsigns() const
return m_->highlight_blue_callsigns_;
}
-QString Configuration::voicesPath() const
+QDir Configuration::voice_directory () const
+{
+ return m_->voice_directory_;
+}
+
+QStringList Configuration::pass_keywords() const
{
- return m_->voicesPath_;
+ return {m_->Pass1_, m_->Pass2_, m_->Pass3_, m_->Pass4_, m_->Pass5_, m_->Pass6_,
+ m_->Pass7_, m_->Pass8_, m_->Pass9_, m_->Pass10_, m_->Pass11_, m_->Pass12_};
+}
+
+QStringList Configuration::blacklist_keywords() const
+{
+ return {m_->Blacklist1_, m_->Blacklist2_, m_->Blacklist3_, m_->Blacklist4_, m_->Blacklist5_, m_->Blacklist6_,
+ m_->Blacklist7_, m_->Blacklist8_, m_->Blacklist9_, m_->Blacklist10_, m_->Blacklist11_, m_->Blacklist12_};
+}
+
+QStringList Configuration::whitelist_keywords() const
+{
+ return {m_->Whitelist1_, m_->Whitelist2_, m_->Whitelist3_, m_->Whitelist4_, m_->Whitelist5_, m_->Whitelist6_,
+ m_->Whitelist7_, m_->Whitelist8_, m_->Whitelist9_, m_->Whitelist10_, m_->Whitelist11_, m_->Whitelist12_};
}
auto Configuration::special_op_id () const -> SpecialOperatingActivity
@@ -1648,7 +1767,7 @@ void Configuration::set_location (QString const& grid_descriptor)
void Configuration::setSpecial_Q65_Pileup()
{
m_->bSpecialOp_=true;
- m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->cbSpecialOpActivity->setChecked(m_->bSpecialOp_);
m_->ui_->rbQ65pileup->setChecked(true);
m_->SelectedActivity_ = static_cast<int> (SpecialOperatingActivity::Q65_PILEUP);
m_->write_settings();
@@ -1657,7 +1776,7 @@ void Configuration::setSpecial_Q65_Pileup()
void Configuration::setSpecial_Hound()
{
m_->bSpecialOp_=true;
- m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->cbSpecialOpActivity->setChecked(m_->bSpecialOp_);
m_->ui_->rbHound->setChecked(true);
m_->SelectedActivity_ = static_cast<int> (SpecialOperatingActivity::HOUND);
m_->write_settings();
@@ -1666,7 +1785,7 @@ void Configuration::setSpecial_Hound()
void Configuration::setSpecial_Fox()
{
m_->bSpecialOp_=true;
- m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->cbSpecialOpActivity->setChecked(m_->bSpecialOp_);
m_->ui_->rbFox->setChecked(true);
m_->SelectedActivity_ = static_cast<int> (SpecialOperatingActivity::FOX);
m_->write_settings();
@@ -1675,14 +1794,14 @@ void Configuration::setSpecial_Fox()
void Configuration::setSpecial_None()
{
m_->bSpecialOp_=false;
- m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->cbSpecialOpActivity->setChecked(m_->bSpecialOp_);
m_->write_settings();
}
void Configuration::setSpecial_On()
{
m_->bSpecialOp_=true;
- m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->cbSpecialOpActivity->setChecked(m_->bSpecialOp_);
m_->write_settings();
}
@@ -1742,24 +1861,174 @@ namespace
#endif
}
- QString data_path ()
- {
-#if CMAKE_BUILD
- if (QDir::isRelativePath (CMAKE_INSTALL_DATADIR))
+}
+
+bool Configuration::impl::eventFilter (QObject *object, QEvent *event)
+{
+ if (event->type () == QEvent::KeyPress)
+ {
+ auto key_event = static_cast<QKeyEvent *> (event);
+ auto const navigation_modifiers = key_event->modifiers ()
+ & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier);
+ auto const is_forward_tab = key_event->key () == Qt::Key_Tab
+ && navigation_modifiers == Qt::NoModifier;
+ auto const is_reverse_tab = (key_event->key () == Qt::Key_Tab
+ && navigation_modifiers == Qt::ShiftModifier)
+ || (key_event->key () == Qt::Key_Backtab
+ && (navigation_modifiers == Qt::NoModifier
+ || navigation_modifiers == Qt::ShiftModifier));
+ auto const is_tab = is_forward_tab || is_reverse_tab;
+ if (is_tab)
+ {
+ auto const path = current_settings_focus_path ();
+ auto object_widget = qobject_cast<QWidget *> (object);
+ auto current_index = settings_focus_index (path, QApplication::focusWidget ());
+ if (current_index < 0)
+ {
+ current_index = settings_focus_index (path, object_widget);
+ }
+ if (current_index >= 0)
+ {
+ return move_settings_focus (path, current_index, is_reverse_tab);
+ }
+ }
+ }
+
+ return QDialog::eventFilter (object, event);
+}
+
+void Configuration::impl::register_settings_focus_page (QWidget * page, QList<QWidget *> const& tab_stops)
+{
+ settings_focus_pages_.append ({page, tab_stops});
+
+ for (auto control : tab_stops)
+ {
+ control->setFocusPolicy (Qt::StrongFocus);
+ control->installEventFilter (this);
+ }
+}
+
+void Configuration::impl::showEvent (QShowEvent * event)
+{
+ QDialog::showEvent (event);
+
+ auto * window = windowHandle ();
+ auto * screen = window ? window->screen () : QGuiApplication::primaryScreen ();
+ if (!screen)
+ {
+ return;
+ }
+
+ auto const requested_size = use_default_geometry_
+ ? SettingsDialogLayout::preferredWindowSize (*this, *ui_) : size ();
+ use_default_geometry_ = false;
+ auto const bounded_size = SettingsDialogLayout::boundedWindowSize (
+ requested_size, screen->availableGeometry ().size (),
+ window ? window->frameMargins () : QMargins {});
+ if (bounded_size != size ())
+ {
+ resize (bounded_size);
+ }
+}
+
+QList<QWidget *> Configuration::impl::current_settings_focus_path () const
+{
+ auto const current_page = ui_->configuration_tabs->currentWidget ();
+ for (auto const& focus_page : settings_focus_pages_)
+ {
+ if (focus_page.page == current_page)
+ {
+ auto path = QList<QWidget *> {ui_->configuration_tabs};
+ path.append (focus_page.tab_stops);
+ path.append (settings_dialog_buttons ());
+ return path;
+ }
+ }
+
+ return {};
+}
+
+QList<QWidget *> Configuration::impl::settings_dialog_buttons () const
+{
+ QList<QWidget *> buttons;
+ auto const button_box = ui_->configuration_dialog_button_box;
+ for (auto button : {
+ button_box->button (QDialogButtonBox::Ok),
+ button_box->button (QDialogButtonBox::Cancel),
+ })
+ {
+ if (button)
+ {
+ buttons.append (button);
+ }
+ }
+
+ std::sort (buttons.begin (), buttons.end (), [button_box] (QWidget * lhs, QWidget * rhs) {
+ auto const lhs_center = lhs->geometry ().center ();
+ auto const rhs_center = rhs->geometry ().center ();
+ if (button_box->orientation () == Qt::Vertical && lhs_center.y () != rhs_center.y ())
{
- return QApplication::applicationDirPath () + app_root + CMAKE_INSTALL_DATADIR + QChar {'/'} + CMAKE_PROJECT_NAME;
+ return lhs_center.y () < rhs_center.y ();
}
- return CMAKE_INSTALL_DATADIR;
-#else
- return QApplication::applicationDirPath ();
-#endif
- }
+
+ if (button_box->layoutDirection () == Qt::RightToLeft)
+ {
+ return lhs_center.x () > rhs_center.x ();
+ }
+
+ return lhs_center.x () < rhs_center.x ();
+ });
+
+ return buttons;
+}
+
+int Configuration::impl::settings_focus_index (QList<QWidget *> const& path, QWidget * widget) const
+{
+ if (!widget)
+ {
+ return -1;
+ }
+
+ auto const tab_bar = ui_->configuration_tabs->tabBar ();
+ for (int index = 0; index < path.size (); ++index)
+ {
+ if (path.at (index) == widget
+ || (path.at (index) == ui_->configuration_tabs && tab_bar == widget))
+ {
+ return index;
+ }
+ }
+
+ return -1;
+}
+
+bool Configuration::impl::move_settings_focus (QList<QWidget *> const& path, int current_index, bool reverse)
+{
+ if (current_index < 0 || path.isEmpty ())
+ {
+ return false;
+ }
+
+ auto const direction = reverse ? -1 : 1;
+ for (int offset = 1; offset <= path.size (); ++offset)
+ {
+ auto const next_index = (current_index + direction * offset + path.size ()) % path.size ();
+ auto next = path.at (next_index);
+ if (next->isEnabledTo (this) && next->isVisibleTo (this))
+ {
+ next->setFocus (reverse ? Qt::BacktabFocusReason : Qt::TabFocusReason);
+ return true;
+ }
+ }
+
+ return false;
}
Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network_manager
, QDir const& temp_directory, QSettings * settings, LogBook * logbook
, QWidget * parent)
: QDialog {parent}
+ , construction_trace_ {"configuration.construct"}
, self_ {self}
, transceiver_thread_ {nullptr}
, ui_ {new Ui::configuration_dialog}
@@ -1767,11 +2036,11 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
, settings_ {settings}
, logbook_ {logbook}
, doc_dir_ {doc_path ()}
- , data_dir_ {data_path ()}
+ , data_dir_ {installed_data_directory ()}
, temp_dir_ {temp_directory}
, writeable_data_dir_ {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}
, lotw_users_ {network_manager_}
- , cloudlog_ {self}
+ , cloudlog_ {self, network_manager_}
, restart_sound_input_device_ {false}
, restart_sound_output_device_ {false}
, restart_tci_device_ {false}
@@ -1804,16 +2073,461 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
, rig_resolution_ {0}
, frequency_calibration_disabled_ {false}
, transceiver_command_number_ {0}
+ , initializing_models_ {false}
, degrade_ {0.} // initialize to zero each run, not
// saved in settings
, udp_server_name_edited_ {false}
, dns_lookup_id_ {-1}
+ , audio_input_channel_ {AudioDevice::Mono}
+ , next_audio_input_channel_ {AudioDevice::Mono}
+ , audio_output_channel_ {AudioDevice::Mono}
+ , next_audio_output_channel_ {AudioDevice::Mono}
, default_audio_input_device_selected_ {false}
, default_audio_output_device_selected_ {false}
{
- ui_->setupUi (this);
+ {
+ PerformanceTrace::Phase ui_setup {"configuration.ui_setup"};
+ ui_->setupUi (this);
+ }
+
+ SettingsDialogLayout::install (*ui_);
+
+ installEventFilter (this);
+ ui_->configuration_tabs->setFocusPolicy (Qt::StrongFocus);
+ ui_->configuration_tabs->installEventFilter (this);
+ ui_->configuration_tabs->tabBar ()->installEventFilter (this);
+ ui_->configuration_dialog_button_box->installEventFilter (this);
+ for (auto button : settings_dialog_buttons ())
+ {
+ button->setFocusPolicy (Qt::StrongFocus);
+ button->installEventFilter (this);
+ }
+
+ auto update_rig_invariants_when_checked = [this] (QButtonGroup *button_group) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ connect (button_group, QOverload<int, bool>::of (&QButtonGroup::buttonToggled),
+#else
+ connect (button_group, &QButtonGroup::idToggled,
+#endif
+ this, [this] (int, bool checked) {
+ if (checked && !initializing_models_)
+ {
+ set_rig_invariants ();
+ }
+ });
+ };
+ update_rig_invariants_when_checked (ui_->CAT_data_bits_button_group);
+ update_rig_invariants_when_checked (ui_->CAT_stop_bits_button_group);
+ update_rig_invariants_when_checked (ui_->CAT_handshake_button_group);
+ update_rig_invariants_when_checked (ui_->PTT_method_button_group);
+ update_rig_invariants_when_checked (ui_->split_mode_button_group);
+
+ auto set_accessible_line_edit_names = [] (QList<QLineEdit *> const& line_edits,
+ QString const& name_template) {
+ for (int index = 0; index < line_edits.size (); ++index)
+ {
+ line_edits.at (index)->setAccessibleName (name_template.arg (index + 1));
+ }
+ };
+ set_accessible_line_edit_names ({
+ ui_->Territory1,
+ ui_->Territory2,
+ ui_->Territory3,
+ ui_->Territory4,
+ }, tr ("Wanted territory %1"));
+ set_accessible_line_edit_names ({
+ ui_->Blacklist1,
+ ui_->Blacklist2,
+ ui_->Blacklist3,
+ ui_->Blacklist4,
+ ui_->Blacklist5,
+ ui_->Blacklist6,
+ ui_->Blacklist7,
+ ui_->Blacklist8,
+ ui_->Blacklist9,
+ ui_->Blacklist10,
+ ui_->Blacklist11,
+ ui_->Blacklist12,
+ }, tr ("Blacklist keyword %1"));
+ set_accessible_line_edit_names ({
+ ui_->Whitelist1,
+ ui_->Whitelist2,
+ ui_->Whitelist3,
+ ui_->Whitelist4,
+ ui_->Whitelist5,
+ ui_->Whitelist6,
+ ui_->Whitelist7,
+ ui_->Whitelist8,
+ ui_->Whitelist9,
+ ui_->Whitelist10,
+ ui_->Whitelist11,
+ ui_->Whitelist12,
+ }, tr ("Whitelist keyword %1"));
+ set_accessible_line_edit_names ({
+ ui_->Pass1,
+ ui_->Pass2,
+ ui_->Pass3,
+ ui_->Pass4,
+ ui_->Pass5,
+ ui_->Pass6,
+ ui_->Pass7,
+ ui_->Pass8,
+ ui_->Pass9,
+ ui_->Pass10,
+ ui_->Pass11,
+ ui_->Pass12,
+ }, tr ("Always pass keyword %1"));
+
+ ui_->CAT_port_combo_box->setAccessibleName (tr ("CAT control port"));
+ ui_->CAT_serial_baud_combo_box->setAccessibleName (tr ("CAT baud rate"));
+ ui_->CAT_default_bit_radio_button->setAccessibleName (tr ("Default CAT data bits"));
+ ui_->CAT_7_bit_radio_button->setAccessibleName (tr ("Seven CAT data bits"));
+ ui_->CAT_8_bit_radio_button->setAccessibleName (tr ("Eight CAT data bits"));
+ ui_->CAT_default_stop_bit_radio_button->setAccessibleName (tr ("Default CAT stop bits"));
+ ui_->CAT_one_stop_bit_radio_button->setAccessibleName (tr ("One CAT stop bit"));
+ ui_->CAT_two_stop_bit_radio_button->setAccessibleName (tr ("Two CAT stop bits"));
+ ui_->CAT_handshake_default_radio_button->setAccessibleName (tr ("Default CAT handshake"));
+ ui_->CAT_handshake_none_radio_button->setAccessibleName (tr ("No CAT handshake"));
+ ui_->CAT_handshake_xon_radio_button->setAccessibleName (tr ("XON/XOFF CAT handshake"));
+ ui_->CAT_handshake_hardware_radio_button->setAccessibleName (tr ("Hardware CAT handshake"));
+ ui_->force_DTR_combo_box->setAccessibleName (tr ("Force DTR control line"));
+ ui_->force_RTS_combo_box->setAccessibleName (tr ("Force RTS control line"));
+ ui_->PTT_VOX_radio_button->setAccessibleName (tr ("VOX PTT method"));
+ ui_->PTT_DTR_radio_button->setAccessibleName (tr ("DTR PTT method"));
+ ui_->PTT_CAT_radio_button->setAccessibleName (tr ("CAT PTT method"));
+ ui_->PTT_RTS_radio_button->setAccessibleName (tr ("RTS PTT method"));
+ ui_->PTT_port_combo_box->setAccessibleName (tr ("PTT control port"));
+ ui_->TX_source_data_radio_button->setAccessibleName (tr ("Rear or data transmit audio source"));
+ ui_->TX_source_mic_radio_button->setAccessibleName (tr ("Front or mic transmit audio source"));
+ ui_->mode_none_radio_button->setAccessibleName (tr ("No radio mode control"));
+ ui_->mode_USB_radio_button->setAccessibleName (tr ("USB radio mode"));
+ ui_->mode_data_radio_button->setAccessibleName (tr ("Data or packet radio mode"));
+ ui_->split_none_radio_button->setAccessibleName (tr ("No split operation"));
+ ui_->split_rig_radio_button->setAccessibleName (tr ("Rig split operation"));
+ ui_->split_emulate_radio_button->setAccessibleName (tr ("Fake It split operation"));
+ ui_->CAT_poll_interval_spin_box->setAccessibleName (tr ("CAT poll interval"));
+ ui_->calibration_slope_ppm_spin_box->setAccessibleName (tr ("Frequency calibration slope"));
+ ui_->calibration_intercept_spin_box->setAccessibleName (tr ("Frequency calibration intercept"));
+ ui_->frequencies_table_view->setAccessibleName (tr ("Working frequencies table"));
+ ui_->stations_table_view->setAccessibleName (tr ("Station information table"));
+ ui_->highlighting_list_view->setAccessibleName (tr ("Decode highlighting rules"));
+ ui_->highlighting_list_view->setAccessibleDescription (tr ("Highlighting rules and priorities for decoded messages."));
+ ui_->highlighting_actions_tool_button->setAccessibleName (tr ("Decode highlighting actions"));
+ ui_->highlighting_actions_tool_button->setAccessibleDescription (tr ("Change or reset colors for the selected highlighting rule."));
+ ui_->move_highlighting_up_push_button->setAccessibleName (tr ("Move selected highlighting rule up"));
+ ui_->move_highlighting_up_push_button->setAccessibleDescription (tr ("Move the selected highlighting rule earlier in priority order."));
+ ui_->move_highlighting_down_push_button->setAccessibleName (tr ("Move selected highlighting rule down"));
+ ui_->move_highlighting_down_push_button->setAccessibleDescription (tr ("Move the selected highlighting rule later in priority order."));
+ ui_->highlight_orange_callsigns->setAccessibleName (tr ("Orange highlight callsigns and grids"));
+ ui_->highlight_blue_callsigns->setAccessibleName (tr ("Blue highlight callsigns and grids"));
+
+ register_settings_focus_page (ui_->general_tab, {
+ ui_->callsign_line_edit,
+ ui_->grid_line_edit,
+ ui_->use_dynamic_grid,
+ ui_->region_combo_box,
+ ui_->type_2_msg_gen_combo_box,
+ ui_->decodes_from_top_check_box,
+ ui_->insert_blank_check_box,
+ ui_->cb_detailed_blank_line,
+ ui_->miles_check_box,
+ ui_->cbHighlightDXcall,
+ ui_->font_push_button,
+ ui_->TX_messages_check_box,
+ ui_->cbHighlightDXgrid,
+ ui_->decoded_text_font_push_button,
+ ui_->DXCC_check_box,
+ ui_->ppfx_check_box,
+ ui_->show_country_names_check_box,
+ ui_->monitor_off_check_box,
+ ui_->enable_VHF_features_check_box,
+ ui_->repeat_Tx_check_box,
+ ui_->monitor_last_used_check_box,
+ ui_->tx_frequency_corrections_check_box,
+ ui_->auto_astro_check_box,
+ ui_->quick_call_check_box,
+ ui_->decode_at_52s_check_box,
+ ui_->kHz_without_k_check_box,
+ ui_->disable_TX_on_73_check_box,
+ ui_->single_decode_check_box,
+ ui_->progress_bar_check_box,
+ ui_->force_call_1st_check_box,
+ ui_->CW_id_after_73_check_box,
+ ui_->CW_id_interval_spin_box,
+ ui_->alternate_bindings_check_box,
+ ui_->tune_watchdog_check_box,
+ ui_->tune_watchdog_spin_box,
+ ui_->tx_watchdog_spin_box,
+ ui_->Map_Grid_to_State,
+ ui_->cbEraseBandActivity,
+ ui_->alternate_erase_button_check_box,
+ ui_->Map_All_Messages,
+ ui_->cbRxToTxAfterQSO,
+ ui_->enable_Wait_features_check_box,
+ ui_->cbClearDXcall,
+ ui_->cbClearDXgrid,
+ ui_->disable_button_coloring_check_box,
+ ui_->cb_showDistance,
+ ui_->cb_showAzimuth,
+ ui_->cb_Align,
+ ui_->align_spin_box,
+ ui_->align_spin_box2,
+ });
+
+ register_settings_focus_page (ui_->radio_tab, {
+ ui_->rig_combo_box,
+ ui_->CAT_poll_interval_spin_box,
+ ui_->CAT_port_combo_box,
+ ui_->CAT_serial_baud_combo_box,
+ ui_->CAT_default_bit_radio_button,
+ ui_->CAT_7_bit_radio_button,
+ ui_->CAT_8_bit_radio_button,
+ ui_->CAT_default_stop_bit_radio_button,
+ ui_->CAT_one_stop_bit_radio_button,
+ ui_->CAT_two_stop_bit_radio_button,
+ ui_->CAT_handshake_default_radio_button,
+ ui_->CAT_handshake_none_radio_button,
+ ui_->CAT_handshake_xon_radio_button,
+ ui_->CAT_handshake_hardware_radio_button,
+ ui_->force_DTR_combo_box,
+ ui_->force_RTS_combo_box,
+ ui_->PTT_VOX_radio_button,
+ ui_->PTT_DTR_radio_button,
+ ui_->PTT_CAT_radio_button,
+ ui_->PTT_RTS_radio_button,
+ ui_->PTT_port_combo_box,
+ ui_->TX_source_data_radio_button,
+ ui_->TX_source_mic_radio_button,
+ ui_->mode_none_radio_button,
+ ui_->mode_USB_radio_button,
+ ui_->mode_data_radio_button,
+ ui_->split_none_radio_button,
+ ui_->split_rig_radio_button,
+ ui_->split_emulate_radio_button,
+ ui_->test_CAT_push_button,
+ ui_->test_PTT_push_button,
+ ui_->rbHamlib64,
+ ui_->rbHamlib32,
+ ui_->hamlib_download_button,
+ ui_->revert_update_button,
+ ui_->PWR_and_SWR_check_box,
+ ui_->check_SWR_check_box,
+ });
+
+ register_settings_focus_page (ui_->audio_tab, {
+ ui_->sound_input_combo_box,
+ ui_->sound_input_channel_combo_box,
+ ui_->sound_output_combo_box,
+ ui_->sound_output_channel_combo_box,
+ ui_->refresh_push_button,
+ ui_->tci_audio_check_box,
+ ui_->TCI_spin_box,
+ ui_->cbSortAlphabetically,
+ ui_->cbHideCARD,
+ ui_->save_path_select_push_button,
+ ui_->azel_path_select_push_button,
+ ui_->checkBoxAzElExtraLines,
+ ui_->checkBoxPwrBandTxMemory,
+ ui_->checkBoxPwrBandTuneMemory,
+ });
+
+ register_settings_focus_page (ui_->tx_macros_tab, {
+ ui_->add_macro_line_edit,
+ ui_->add_macro_push_button,
+ ui_->delete_macro_push_button,
+ ui_->move_macro_up_push_button,
+ ui_->move_macro_down_push_button,
+ ui_->macros_list_view,
+ });
+
+ register_settings_focus_page (ui_->reporting_tab, {
+ ui_->prompt_to_log_check_box,
+ ui_->opCallEntry,
+ ui_->cbAutoLog,
+ ui_->cbContestingOnly,
+ ui_->cbZZ00,
+ ui_->cbLog4digitGrids,
+ ui_->log_as_RTTY_check_box,
+ ui_->report_in_comments_check_box,
+ ui_->specOp_in_comments_check_box,
+ ui_->psk_reporter_check_box,
+ ui_->psk_reporter_tcpip_check_box,
+ ui_->udp_server_line_edit,
+ ui_->udp_server_port_spin_box,
+ ui_->udp_interfaces_combo_box,
+ ui_->udp_TTL_spin_box,
+ ui_->accept_udp_requests_check_box,
+ ui_->udpWindowToFront,
+ ui_->udpWindowRestore,
+ ui_->enable_n1mm_broadcast_check_box,
+ ui_->n1mm_server_name_line_edit,
+ ui_->n1mm_server_port_spin_box,
+ });
+
+ register_settings_focus_page (ui_->frequencies_tab, {
+ ui_->calibration_slope_ppm_spin_box,
+ ui_->calibration_intercept_spin_box,
+ ui_->frequencies_actions_tool_button,
+ ui_->frequencies_table_view,
+ ui_->stations_actions_tool_button,
+ ui_->stations_table_view,
+ });
+
+ register_settings_focus_page (ui_->colors_tab, {
+ ui_->highlighting_list_view,
+ ui_->highlighting_actions_tool_button,
+ ui_->move_highlighting_up_push_button,
+ ui_->move_highlighting_down_push_button,
+ ui_->reset_highlighting_to_defaults_push_button,
+ ui_->reset_highlighting_to_defaults2_push_button,
+ ui_->rescan_log_push_button,
+ ui_->highlight_by_mode_check_box,
+ ui_->highlight_orange_check_box,
+ ui_->highlight_orange_callsigns,
+ ui_->only_fields_check_box,
+ ui_->include_WAE_check_box,
+ ui_->highlight_blue_check_box,
+ ui_->highlight_blue_callsigns,
+ ui_->highlight_73_check_box,
+ ui_->LotW_CSV_URL_line_edit,
+ ui_->LotW_CSV_fetch_push_button,
+ ui_->LotW_days_since_upload_spin_box,
+ ui_->CTY_download_button,
+ ui_->CALL3_download_button,
+ ui_->CALL3_EME_download_button,
+ });
+
+ register_settings_focus_page (ui_->advanced_tab, {
+ ui_->sbNtrials,
+ ui_->sbAggressive,
+ ui_->cbTwoPass,
+ ui_->sbDegrade,
+ ui_->sbBandwidth,
+ ui_->sbTxDelay,
+ ui_->cbx2ToneSpacing,
+ ui_->cbx4ToneSpacing,
+ ui_->rbLowSidelobes,
+ ui_->rbMaxSensitivity,
+ ui_->cbSpecialOpActivity,
+ ui_->rbFox,
+ ui_->cbSuperFox,
+ ui_->rbHound,
+ ui_->cbOTP,
+ ui_->OTPSeed,
+ ui_->sbOTPinterval,
+ ui_->cbShowOTP,
+ ui_->OTPUrl,
+ ui_->rbNA_VHF_Contest,
+ ui_->cb_NCCC_Sprint,
+ ui_->rbField_Day,
+ ui_->Field_Day_Exchange,
+ ui_->rbEU_VHF_Contest,
+ ui_->rbRTTY_Roundup,
+ ui_->RTTY_Exchange,
+ ui_->rbWW_DIGI,
+ ui_->rbARRL_Digi,
+ ui_->rbQ65pileup,
+ ui_->cbContestName,
+ ui_->Contest_Name,
+ ui_->cbCloudlog,
+ ui_->leCloudlogApiUrl,
+ ui_->leCloudlogApiKey,
+ ui_->cbCloudlogStationProfile,
+ ui_->pbTestCloudlog,
+ ui_->cbEQSL,
+ ui_->eqsluser_edit,
+ ui_->eqslpasswd_edit,
+ ui_->eqslnick_edit,
+ });
+
+ register_settings_focus_page (ui_->alerts_tab, {
+ ui_->voices_combo_box,
+ ui_->pb_test_alerts,
+ ui_->cbContinent,
+ ui_->cbContinentOB,
+ ui_->cbDXCC,
+ ui_->cbDXCCOB,
+ ui_->cbCQZ,
+ ui_->cbCQZOB,
+ ui_->cbITUZ,
+ ui_->cbITUZOB,
+ ui_->cbGrid,
+ ui_->cbGridOB,
+ ui_->cbMyCall,
+ ui_->cbWanted,
+ ui_->cbDXcall,
+ ui_->cbQSYmessage,
+ ui_->cbCQ,
+ ui_->pbAlerts,
+ });
+
+ register_settings_focus_page (ui_->filters_tab, {
+ ui_->Territory1,
+ ui_->Territory2,
+ ui_->Territory3,
+ ui_->Territory4,
+ ui_->cbBlacklist,
+ ui_->Blacklist1,
+ ui_->Blacklist2,
+ ui_->Blacklist3,
+ ui_->Blacklist4,
+ ui_->Blacklist5,
+ ui_->Blacklist6,
+ ui_->Blacklist7,
+ ui_->Blacklist8,
+ ui_->Blacklist9,
+ ui_->Blacklist10,
+ ui_->Blacklist11,
+ ui_->Blacklist12,
+ ui_->cbWhitelist,
+ ui_->Whitelist1,
+ ui_->Whitelist2,
+ ui_->Whitelist3,
+ ui_->Whitelist4,
+ ui_->Whitelist5,
+ ui_->Whitelist6,
+ ui_->Whitelist7,
+ ui_->Whitelist8,
+ ui_->Whitelist9,
+ ui_->Whitelist10,
+ ui_->Whitelist11,
+ ui_->Whitelist12,
+ ui_->cbPass,
+ ui_->Pass1,
+ ui_->Pass2,
+ ui_->Pass3,
+ ui_->Pass4,
+ ui_->Pass5,
+ ui_->Pass6,
+ ui_->Pass7,
+ ui_->Pass8,
+ ui_->Pass9,
+ ui_->Pass10,
+ ui_->Pass11,
+ ui_->Pass12,
+ ui_->cb_filters_for_word2,
+ ui_->cb_filters_for_Wait_and_Pounce_only,
+ ui_->cb_twoDays,
+ });
+
+ auto update_visibility_when_toggled = [this] (QAbstractButton *button) {
+ connect (button, &QAbstractButton::toggled, this, &Configuration::impl::check_visibility);
+ };
+ update_visibility_when_toggled (ui_->cbSpecialOpActivity);
+ update_visibility_when_toggled (ui_->rbFox);
+ update_visibility_when_toggled (ui_->rbHound);
+ update_visibility_when_toggled (ui_->rbNA_VHF_Contest);
+ update_visibility_when_toggled (ui_->rbEU_VHF_Contest);
+ update_visibility_when_toggled (ui_->rbField_Day);
+ update_visibility_when_toggled (ui_->rbRTTY_Roundup);
+ update_visibility_when_toggled (ui_->rbWW_DIGI);
+ update_visibility_when_toggled (ui_->rbARRL_Digi);
+ update_visibility_when_toggled (ui_->rbQ65pileup);
+ update_visibility_when_toggled (ui_->cbOTP);
+ update_visibility_when_toggled (ui_->cbContestName);
{
+ PerformanceTrace::Phase data_directories {"configuration.data_directories"};
// Make sure the default save directory exists
QString save_dir {"save"};
default_save_directory_ = writeable_data_dir_;
@@ -1857,7 +2571,10 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
}
// this must be done after the default paths above are set
- read_settings ();
+ {
+ PerformanceTrace::Phase settings_read {"configuration.settings_read"};
+ read_settings ();
+ }
// set up dynamic loading of audio devices
connect (ui_->sound_input_combo_box, &LazyFillComboBox::about_to_show_popup, [this] () {
@@ -1894,19 +2611,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv"));
- // set up Cloudlog API key test button
- connect (&cloudlog_, &Cloudlog::apikey_ok, [this] () {
- ui_->pbTestCloudlog->setStyleSheet ("QPushButton {background-color: green;}");
- ui_->pbTestCloudlog->setToolTip (tr ("API key OK"));
- });
- connect (&cloudlog_, &Cloudlog::apikey_ro, [this] () {
- ui_->pbTestCloudlog->setStyleSheet ("QPushButton {background-color: orange;}");
- ui_->pbTestCloudlog->setToolTip (tr ("API key read-only"));
- });
- connect (&cloudlog_, &Cloudlog::apikey_invalid, [this] () {
- ui_->pbTestCloudlog->setStyleSheet ("QPushButton {background-color: red;}");
- ui_->pbTestCloudlog->setToolTip (tr ("API key invalid"));
- });
+ connect (&cloudlog_, &Cloudlog::connection_check_finished, this, &Configuration::impl::handle_cloudlog_connection_check_result);
//
// validation
@@ -1964,7 +2669,10 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
//
// setup PTT port combo box drop down content
//
- fill_port_combo_box (ui_->PTT_port_combo_box);
+ {
+ PerformanceTrace::Phase serial_ports {"configuration.serial_ports"};
+ fill_port_combo_box (ui_->PTT_port_combo_box);
+ }
ui_->PTT_port_combo_box->addItem ("CAT");
ui_->PTT_port_combo_box->setItemData (ui_->PTT_port_combo_box->count () - 1, "Delegate to proxy CAT service", Qt::ToolTipRole);
@@ -1986,6 +2694,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
//
ui_->macros_list_view->setModel (&next_macros_);
ui_->macros_list_view->setItemDelegate (new MessageItemDelegate {this});
+ ui_->macros_list_view->setTabKeyNavigation (false);
macro_delete_action_ = new QAction {tr ("&Delete"), ui_->macros_list_view};
ui_->macros_list_view->insertAction (nullptr, macro_delete_action_);
@@ -2000,6 +2709,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
frequencies_.sort (FrequencyList_v2_101::frequency_column);
ui_->frequencies_table_view->setModel (&next_frequencies_);
+ ui_->frequencies_table_view->setTabKeyNavigation (false);
ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
ui_->frequencies_table_view->horizontalHeader ()->setResizeContentsPrecision (0);
@@ -2040,11 +2750,23 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
ui_->frequencies_table_view->insertAction (nullptr, reset_frequencies_action_);
connect (reset_frequencies_action_, &QAction::triggered, this, &Configuration::impl::reset_frequencies);
+ auto frequencies_actions_menu = new QMenu {ui_->frequencies_actions_tool_button};
+ frequencies_actions_menu->addAction (frequency_insert_action_);
+ frequencies_actions_menu->addAction (frequency_delete_action_);
+ frequencies_actions_menu->addSeparator ();
+ frequencies_actions_menu->addAction (load_frequencies_action_);
+ frequencies_actions_menu->addAction (save_frequencies_action_);
+ frequencies_actions_menu->addAction (merge_frequencies_action_);
+ frequencies_actions_menu->addSeparator ();
+ frequencies_actions_menu->addAction (reset_frequencies_action_);
+ ui_->frequencies_actions_tool_button->setMenu (frequencies_actions_menu);
+
//
// setup stations table model & view
//
stations_.sort (StationList::band_column);
ui_->stations_table_view->setModel (&next_stations_);
+ ui_->stations_table_view->setTabKeyNavigation (false);
ui_->stations_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
ui_->stations_table_view->horizontalHeader ()->setResizeContentsPrecision (0);
ui_->stations_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
@@ -2062,13 +2784,35 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
ui_->stations_table_view->addAction (&station_insert_action_);
connect (&station_insert_action_, &QAction::triggered, this, &Configuration::impl::insert_station);
+ auto stations_actions_menu = new QMenu {ui_->stations_actions_tool_button};
+ stations_actions_menu->addAction (&station_insert_action_);
+ stations_actions_menu->addAction (&station_delete_action_);
+ ui_->stations_actions_tool_button->setMenu (stations_actions_menu);
+
//
// colours and highlighting setup
//
ui_->highlighting_list_view->setModel (&next_decode_highlighing_model_);
+ ui_->highlighting_list_view->setTabKeyNavigation (false);
+ auto highlighting_actions_menu = new QMenu {ui_->highlighting_actions_tool_button};
+ highlighting_actions_menu->addActions (ui_->highlighting_list_view->actions ());
+ connect (highlighting_actions_menu, &QMenu::aboutToShow, this, [this, highlighting_actions_menu] {
+ auto const has_current_rule = ui_->highlighting_list_view->currentIndex ().isValid ();
+ for (auto action : highlighting_actions_menu->actions ())
+ {
+ action->setEnabled (has_current_rule);
+ }
+ });
+ ui_->highlighting_actions_tool_button->setMenu (highlighting_actions_menu);
- enumerate_rigs ();
- initialize_models ();
+ {
+ PerformanceTrace::Phase rig_models {"configuration.rig_models"};
+ enumerate_rigs ();
+ }
+ {
+ PerformanceTrace::Phase models {"configuration.models_initialize"};
+ initialize_models ();
+ }
restart_tci_device_ = false;
audio_input_device_ = next_audio_input_device_;
@@ -2095,17 +2839,26 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
ui_->eqsluser_edit->setText (eqsl_username_);
ui_->eqslpasswd_edit->setText (eqsl_passwd_);
ui_->eqslnick_edit->setText (eqsl_nickname_);
+ construction_trace_.finish ();
}
Configuration::impl::~impl ()
{
- transceiver_thread_->quit ();
- transceiver_thread_->wait ();
- write_settings ();
+ {
+ PerformanceTrace::Phase transceiver_thread {"transceiver_thread.shutdown"};
+ transceiver_thread_->quit ();
+ transceiver_thread_->wait ();
+ }
+ {
+ PerformanceTrace::Phase settings_write {"configuration.settings_write"};
+ write_settings ();
+ }
}
void Configuration::impl::initialize_models ()
{
+ QScopedValueRollback<bool> initializing_models {initializing_models_, true};
+
next_audio_input_device_ = audio_input_device_;
next_audio_input_channel_ = audio_input_channel_;
next_audio_output_device_ = audio_output_device_;
@@ -2145,11 +2898,11 @@ void Configuration::impl::initialize_models ()
ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true);
ui_->PWR_and_SWR_check_box->setChecked (PWR_and_SWR_);
ui_->check_SWR_check_box->setChecked (check_SWR_);
- if (!ui_->PWR_and_SWR_check_box->isChecked()) ui_->check_SWR_check_box->setEnabled (false);
+ update_PWR_and_SWR_control_availability ();
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
ui_->azel_path_display_label->setText (azel_directory_.absolutePath ());
ui_->CW_id_after_73_check_box->setChecked (id_after_73_);
- ui_->tx_QSY_check_box->setChecked (tx_QSY_allowed_);
+ ui_->tx_frequency_corrections_check_box->setChecked (tx_frequency_corrections_allowed_);
ui_->progress_bar_check_box->setChecked (progressBar_red_);
ui_->psk_reporter_check_box->setChecked (spot_to_psk_reporter_);
ui_->psk_reporter_tcpip_check_box->setChecked (psk_reporter_tcpip_);
@@ -2161,6 +2914,7 @@ void Configuration::impl::initialize_models ()
ui_->prompt_to_log_check_box->setChecked (prompt_to_log_);
ui_->cbAutoLog->setChecked(autoLog_);
ui_->cbContestingOnly->setChecked(contestingOnly_);
+ update_logging_control_availability ();
ui_->cbZZ00->setChecked(ZZ00_);
ui_->cbLog4digitGrids->setChecked(log4digitGrids_);
ui_->decodes_from_top_check_box->setChecked (decodes_from_top_);
@@ -2169,10 +2923,7 @@ void Configuration::impl::initialize_models ()
ui_->DXCC_check_box->setChecked (DXCC_);
ui_->ppfx_check_box->setChecked (ppfx_);
ui_->show_country_names_check_box->setChecked (show_country_names_);
- if (!ui_->DXCC_check_box->isChecked()) {
- ui_->ppfx_check_box->setEnabled (false);
- ui_->show_country_names_check_box->setEnabled (false);
- }
+ update_DXCC_control_availability ();
ui_->Map_Grid_to_State->setChecked(gridMap_);
ui_->Map_All_Messages->setChecked(gridMapAll_);
ui_->miles_check_box->setChecked (miles_);
@@ -2196,8 +2947,6 @@ void Configuration::impl::initialize_models ()
ui_->auto_astro_check_box->setChecked(auto_astro_);
ui_->single_decode_check_box->setChecked(single_decode_);
ui_->cbTwoPass->setChecked(twoPass_);
- ui_->cbHighDPI->setChecked(highDPI_);
- ui_->cbLargerTabWidget->setChecked(largerTabWidget_);
ui_->cbSuperFox->setChecked(bSuperFox_);
ui_->cbContestName->setChecked(Individual_Contest_Name_);
ui_->cb_NCCC_Sprint->setChecked(NCCC_Sprint_);
@@ -2207,12 +2956,18 @@ void Configuration::impl::initialize_models ()
ui_->cb_filters_for_Wait_and_Pounce_only->setChecked(filters_for_Wait_and_Pounce_only_);
ui_->cb_filters_for_word2->setChecked(filters_for_word2_);
ui_->cb_twoDays->setChecked(twoDays_);
- ui_->gbSpecialOpActivity->setChecked(bSpecialOp_);
- ui_->gbCloudlog->setChecked(bCloudLog_);
- ui_->gbEQSL->setChecked(send_to_eqsl_);
+ ui_->cbSpecialOpActivity->setChecked(bSpecialOp_);
+ ui_->cbCloudlog->setChecked(bCloudLog_);
+ ui_->cbEQSL->setChecked(send_to_eqsl_);
ui_->leCloudlogApiUrl->setText(cloudLogApiUrl_);
ui_->leCloudlogApiKey->setText(cloudLogApiKey_);
- ui_->sbCloudlogStationID->setValue (cloudLogStationID_);
+ ui_->cbCloudlogStationProfile->clear ();
+ if (cloudLogStationID_ > 0)
+ {
+ ui_->cbCloudlogStationProfile->addItem (QString::number (cloudLogStationID_), cloudLogStationID_);
+ }
+ on_cbCloudlog_toggled (ui_->cbCloudlog->isChecked ());
+ on_cbEQSL_toggled (ui_->cbEQSL->isChecked ());
ui_->special_op_activity_button_group->button (SelectedActivity_)->setChecked (true);
ui_->cbx2ToneSpacing->setChecked(x2ToneSpacing_);
ui_->cbx4ToneSpacing->setChecked(x4ToneSpacing_);
@@ -2344,7 +3099,11 @@ void Configuration::impl::read_settings ()
LOG_INFO(QString{"Configuration Settings (%1)"}.arg(settings_->fileName()));
QStringList keys = settings_->allKeys();
- restoreGeometry (settings_->value ("window/geometry").toByteArray ());
+ use_default_geometry_ = !settings_->contains ("window/geometry");
+ if (!use_default_geometry_)
+ {
+ restoreGeometry (settings_->value ("window/geometry").toByteArray ());
+ }
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
@@ -2489,7 +3248,7 @@ void Configuration::impl::read_settings ()
save_directory_.setPath (settings_->value ("SaveDir", default_save_directory_.absolutePath ()).toString ());
azel_directory_.setPath (settings_->value ("AzElDir", default_azel_directory_.absolutePath ()).toString ());
- tci_audio_ = settings_->value ("TCIAudio", tci_audio_).toBool ();
+ tci_audio_ = settings_->value ("TCIAudio", false).toBool ();
type_2_msg_gen_ = settings_->value ("Type2MsgGen", QVariant::fromValue (Configuration::type_2_msg_3_full)).value<Configuration::Type2MsgGen> ();
@@ -2502,7 +3261,7 @@ void Configuration::impl::read_settings ()
eqsl_nickname_ = settings_->value ("EQSLNick", "").toString ();
send_to_eqsl_ = settings_->value ("EQSLSend", false).toBool ();
id_after_73_ = settings_->value ("After73", false).toBool ();
- tx_QSY_allowed_ = settings_->value ("TxQSYAllowed", false).toBool ();
+ tx_frequency_corrections_allowed_ = settings_->value ("TxQSYAllowed", false).toBool ();
progressBar_red_ = settings_->value ("ProgressBarRed", true).toBool ();
use_dynamic_grid_ = settings_->value ("AutoGrid", false).toBool ();
@@ -2607,6 +3366,7 @@ void Configuration::impl::read_settings ()
bLowSidelobes_ = settings_->value("LowSidelobes",true).toBool();
prompt_to_log_ = settings_->value ("PromptToLog", false).toBool ();
autoLog_ = settings_->value ("AutoLog", true).toBool ();
+ if (prompt_to_log_ && autoLog_) prompt_to_log_ = false;
contestingOnly_ = settings_->value ("ContestingOnly", true).toBool ();
ZZ00_ = settings_->value("ZZ00",false).toBool ();
log4digitGrids_ = settings_->value ("Log4digitGrids", false).toBool ();
@@ -2638,8 +3398,6 @@ void Configuration::impl::read_settings ()
auto_astro_ = settings_->value("AutoAstroWindow",false).toBool ();
single_decode_ = settings_->value("SingleDecode",false).toBool ();
twoPass_ = settings_->value("TwoPass",true).toBool ();
- highDPI_ = settings_->value("HighDPI",true).toBool ();
- largerTabWidget_ = settings_->value("LargerTabWidget",false).toBool ();
bSuperFox_ = settings_->value("SuperFox",true).toBool ();
Individual_Contest_Name_ = settings_->value("Individual_Contest_Name",false).toBool ();
NCCC_Sprint_ = settings_->value("NCCC_Sprint",false).toBool ();
@@ -2657,6 +3415,7 @@ void Configuration::impl::read_settings ()
SelectedActivity_ = settings_->value("SelectedActivity",1).toInt ();
x2ToneSpacing_ = settings_->value("x2ToneSpacing",false).toBool ();
x4ToneSpacing_ = settings_->value("x4ToneSpacing",false).toBool ();
+ if (x4ToneSpacing_) x2ToneSpacing_ = false;
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 ();
@@ -2842,7 +3601,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("EQSLPasswd", eqsl_passwd_);
settings_->setValue ("EQSLNick", eqsl_nickname_);
settings_->setValue ("After73", id_after_73_);
- settings_->setValue ("TxQSYAllowed", tx_QSY_allowed_);
+ settings_->setValue ("TxQSYAllowed", tx_frequency_corrections_allowed_);
settings_->setValue ("ProgressBarRed", progressBar_red_);
settings_->setValue ("Macros", macros_.stringList ());
settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ()));
@@ -2910,8 +3669,6 @@ void Configuration::impl::write_settings ()
settings_->setValue ("AutoAstroWindow", auto_astro_);
settings_->setValue ("SingleDecode", single_decode_);
settings_->setValue ("TwoPass", twoPass_);
- settings_->setValue ("HighDPI", highDPI_);
- settings_->setValue ("LargerTabWidget", largerTabWidget_);
settings_->setValue ("SuperFox", bSuperFox_);
settings_->setValue ("Individual_Contest_Name", Individual_Contest_Name_);
settings_->setValue ("NCCC_Sprint", NCCC_Sprint_);
@@ -3167,16 +3924,20 @@ bool Configuration::impl::validate ()
if (!ui_->PTT_method_button_group->checkedButton ()->isEnabled ())
{
+ find_tab (ui_->PTT_method_button_group->checkedButton ());
MessageBox::critical_message (this, tr ("Invalid PTT method"));
return false;
}
auto ptt_method = static_cast<TransceiverFactory::PTTMethod> (ui_->PTT_method_button_group->checkedId ());
auto ptt_port = ui_->PTT_port_combo_box->currentText ();
+ auto const ptt_port_index = ui_->PTT_port_combo_box->findText (ptt_port);
if ((TransceiverFactory::PTT_method_DTR == ptt_method || TransceiverFactory::PTT_method_RTS == ptt_method)
&& (ptt_port.isEmpty ()
- || combo_box_item_disabled == ui_->PTT_port_combo_box->itemData (ui_->PTT_port_combo_box->findText (ptt_port), Qt::UserRole - 1)))
+ || (ptt_port_index >= 0
+ && combo_box_item_disabled == ui_->PTT_port_combo_box->itemData (ptt_port_index, Qt::UserRole - 1))))
{
+ find_tab (ui_->PTT_port_combo_box);
MessageBox::critical_message (this, tr ("Invalid PTT port"));
return false;
}
@@ -3201,6 +3962,7 @@ bool Configuration::impl::validate ()
if (dns_lookup_id_ > -1)
{
+ find_tab (ui_->udp_server_line_edit);
MessageBox::information_message (this, tr ("Pending DNS lookup, please try again later"));
return false;
}
@@ -3293,6 +4055,12 @@ void Configuration::impl::accept ()
// open_rig() uses values from models so we use it to validate the
// Transceiver settings before agreeing to accept the configuration
+ if (temp_rig_params != rig_params_
+ && tx_inhibit_blocks_rig_restart (temp_rig_params, false))
+ {
+ warn_tx_inhibit_restart_blocked ();
+ return;
+ }
if (temp_rig_params != rig_params_ && !open_rig ())
{
return; // not accepting
@@ -3436,7 +4204,7 @@ void Configuration::impl::accept ()
PWR_and_SWR_ = ui_->PWR_and_SWR_check_box->isChecked ();
check_SWR_ = ui_->check_SWR_check_box->isChecked ();
- read_voicesPath();
+ read_voice_directory ();
spot_to_psk_reporter_ = ui_->psk_reporter_check_box->isChecked ();
psk_reporter_tcpip_ = ui_->psk_reporter_tcpip_check_box->isChecked ();
@@ -3454,7 +4222,7 @@ void Configuration::impl::accept ()
RxBandwidth_ = ui_->sbBandwidth->value ();
tci_audio_ = ui_->tci_audio_check_box->isChecked ();
id_after_73_ = ui_->CW_id_after_73_check_box->isChecked ();
- tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked ();
+ tx_frequency_corrections_allowed_ = ui_->tx_frequency_corrections_check_box->isChecked ();
progressBar_red_ = ui_->progress_bar_check_box->isChecked ();
monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked ();
monitor_last_used_ = ui_->monitor_last_used_check_box->isChecked ();
@@ -3499,8 +4267,6 @@ void Configuration::impl::accept ()
auto_astro_ = ui_->auto_astro_check_box->isChecked ();
single_decode_ = ui_->single_decode_check_box->isChecked ();
twoPass_ = ui_->cbTwoPass->isChecked ();
- highDPI_ = ui_->cbHighDPI->isChecked ();
- largerTabWidget_ = ui_->cbLargerTabWidget->isChecked ();
bSuperFox_ = ui_->cbSuperFox->isChecked ();
Individual_Contest_Name_ = ui_->cbContestName->isChecked ();
NCCC_Sprint_ = ui_->cb_NCCC_Sprint->isChecked ();
@@ -3510,12 +4276,12 @@ void Configuration::impl::accept ()
filters_for_Wait_and_Pounce_only_ = ui_->cb_filters_for_Wait_and_Pounce_only->isChecked ();
filters_for_word2_ = ui_->cb_filters_for_word2->isChecked ();
twoDays_ = ui_->cb_twoDays->isChecked ();
- bSpecialOp_ = ui_->gbSpecialOpActivity->isChecked ();
- bCloudLog_ = ui_->gbCloudlog->isChecked ();
- send_to_eqsl_ = ui_->gbEQSL->isChecked ();
+ bSpecialOp_ = ui_->cbSpecialOpActivity->isChecked ();
+ bCloudLog_ = ui_->cbCloudlog->isChecked ();
+ send_to_eqsl_ = ui_->cbEQSL->isChecked ();
cloudLogApiUrl_ = ui_->leCloudlogApiUrl->text ();
cloudLogApiKey_ = ui_->leCloudlogApiKey->text ();
- cloudLogStationID_ = ui_->sbCloudlogStationID->value ();
+ cloudLogStationID_ = cloudlog_station_profile_id ();
SelectedActivity_ = ui_->special_op_activity_button_group->checkedId();
x2ToneSpacing_ = ui_->cbx2ToneSpacing->isChecked ();
x4ToneSpacing_ = ui_->cbx4ToneSpacing->isChecked ();
@@ -3716,15 +4482,14 @@ void Configuration::impl::on_CTY_download_button_clicked (bool /*clicked*/)
{
ui_->CTY_download_button->setEnabled (false); // disable button until download is complete
QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
- cty_download.configure(network_manager_,
- "http://www.country-files.com/bigcty/cty.dat",
- dataPath.absoluteFilePath("cty.dat"),
- "WSJT-X CTY Downloader");
+ cty_download_.configure(network_manager_,
+ "http://www.country-files.com/bigcty/cty.dat",
+ dataPath.absoluteFilePath("cty.dat"),
+ "WSJT-X CTY Downloader");
- // set up LoTW users CSV file fetching
- connect (&cty_download, &FileDownload::complete, this, &Configuration::impl::after_CTY_downloaded, Qt::UniqueConnection);
- connect (&cty_download, &FileDownload::error, this, &Configuration::impl::error_during_CTY_download, Qt::UniqueConnection);
- cty_download.start_download();
+ connect (&cty_download_, &FileDownload::complete, this, &Configuration::impl::after_CTY_downloaded, Qt::UniqueConnection);
+ connect (&cty_download_, &FileDownload::error, this, &Configuration::impl::error_during_CTY_download, Qt::UniqueConnection);
+ cty_download_.start_download();
}
void Configuration::impl::set_CTY_DAT_version(QString const& version)
@@ -3755,15 +4520,14 @@ void Configuration::impl::on_CALL3_download_button_clicked (bool /*clicked*/)
if (g.exists()) QFile::rename(dataPath.absolutePath() + "/" + "CALL3_backup.TXT", dataPath.absolutePath() + "/" + "CALL3_backup.tmp");
QFile f {dataPath.absolutePath() + "/" + "CALL3.TXT"};
if (f.exists()) QFile::rename(dataPath.absolutePath() + "/" + "CALL3.TXT", dataPath.absolutePath() + "/" + "CALL3_backup.TXT");
- cty_download.configure(network_manager_,
- "https://wsjt-x-improved.sourceforge.io/CALL3.TXT",
- dataPath.absoluteFilePath("CALL3.TXT"),
- "Downloading latest CALL3.TXT file");
-
- // set up CALL3.TXT file fetching
- connect (&cty_download, &FileDownload::complete, this, &Configuration::impl::after_CALL3_downloaded, Qt::UniqueConnection);
- connect (&cty_download, &FileDownload::error, this, &Configuration::impl::error_during_CALL3_download, Qt::UniqueConnection);
- cty_download.start_download();
+ call3_download_.configure(network_manager_,
+ "https://wsjt-x-improved.sourceforge.io/CALL3.TXT",
+ dataPath.absoluteFilePath("CALL3.TXT"),
+ "Downloading latest CALL3.TXT file");
+
+ connect (&call3_download_, &FileDownload::complete, this, &Configuration::impl::after_CALL3_downloaded, Qt::UniqueConnection);
+ connect (&call3_download_, &FileDownload::error, this, &Configuration::impl::error_during_CALL3_download, Qt::UniqueConnection);
+ call3_download_.start_download();
ui_->CALL3_file_label->setText("Downloading ...");
}
@@ -3775,15 +4539,14 @@ void Configuration::impl::on_CALL3_EME_download_button_clicked (bool /*clicked*/
if (g.exists()) QFile::rename(dataPath.absolutePath() + "/" + "CALL3_backup.TXT", dataPath.absolutePath() + "/" + "CALL3_backup.tmp");
QFile f {dataPath.absolutePath() + "/" + "CALL3.TXT"};
if (f.exists()) QFile::rename(dataPath.absolutePath() + "/" + "CALL3.TXT", dataPath.absolutePath() + "/" + "CALL3_backup.TXT");
- cty_download.configure(network_manager_,
- "https://wsjt-x-improved.sourceforge.io/CALL3_EME.TXT",
- dataPath.absoluteFilePath("CALL3.TXT"),
- "Downloading latest CALL3.TXT file");
-
- // set up CALL3.TXT file fetching
- connect (&cty_download, &FileDownload::complete, this, &Configuration::impl::after_CALL3_downloaded, Qt::UniqueConnection);
- connect (&cty_download, &FileDownload::error, this, &Configuration::impl::error_during_CALL3_download, Qt::UniqueConnection);
- cty_download.start_download();
+ call3_download_.configure(network_manager_,
+ "https://wsjt-x-improved.sourceforge.io/CALL3_EME.TXT",
+ dataPath.absoluteFilePath("CALL3.TXT"),
+ "Downloading latest CALL3.TXT file");
+
+ connect (&call3_download_, &FileDownload::complete, this, &Configuration::impl::after_CALL3_downloaded, Qt::UniqueConnection);
+ connect (&call3_download_, &FileDownload::error, this, &Configuration::impl::error_during_CALL3_download, Qt::UniqueConnection);
+ call3_download_.start_download();
ui_->CALL3_file_label->setText("Downloading ...");
}
@@ -3871,21 +4634,21 @@ void Configuration::impl::on_hamlib_download_button_clicked (bool /*clicked*/)
ui_->hamlib_download_button->setEnabled (false);
ui_->revert_update_button->setEnabled (false);
if (ui_->rbHamlib32->isChecked()) {
- cty_download.configure(network_manager_,
- "https://hamlib.sourceforge.net/snapshots-4.7/dll32/libhamlib-4.dll", // new hamlib download location
- dataPath.absoluteFilePath("libhamlib-4_new.dll"),
- "Downloading latest libhamlib-4.dll");
+ hamlib_download_.configure(network_manager_,
+ "https://hamlib.sourceforge.net/snapshots-4.7/dll32/libhamlib-4.dll",
+ dataPath.absoluteFilePath("libhamlib-4_new.dll"),
+ "Downloading latest libhamlib-4.dll");
} else {
- cty_download.configure(network_manager_,
- "https://hamlib.sourceforge.net/snapshots-4.7/dll64/libhamlib-4.dll", // new hamlib download location
- dataPath.absoluteFilePath("libhamlib-4_new.dll"),
- "Downloading latest libhamlib-4.dll");
+ hamlib_download_.configure(network_manager_,
+ "https://hamlib.sourceforge.net/snapshots-4.7/dll64/libhamlib-4.dll",
+ dataPath.absoluteFilePath("libhamlib-4_new.dll"),
+ "Downloading latest libhamlib-4.dll");
}
- connect (&cty_download, &FileDownload::complete, this, &Configuration::impl::after_hamlib_downloaded, Qt::UniqueConnection);
- connect (&cty_download, &FileDownload::error, this, &Configuration::impl::error_during_hamlib_download, Qt::UniqueConnection);
+ connect (&hamlib_download_, &FileDownload::complete, this, &Configuration::impl::after_hamlib_downloaded, Qt::UniqueConnection);
+ connect (&hamlib_download_, &FileDownload::error, this, &Configuration::impl::error_during_hamlib_download, Qt::UniqueConnection);
ui_->in_use->setText("Downloading ...");
- cty_download.start_download();
+ hamlib_download_.start_download();
#else
MessageBox::warning_message (this, tr ("Hamlib update only available on Windows."));
#endif
@@ -3974,33 +4737,29 @@ void Configuration::impl::display_file_information ()
#endif
}
-void Configuration::impl::on_DXCC_check_box_clicked(bool checked)
+void Configuration::impl::on_DXCC_check_box_toggled (bool)
{
- if (checked) {
- ui_->ppfx_check_box->setEnabled (true);
- ui_->show_country_names_check_box->setEnabled (true);
- } else {
- ui_->ppfx_check_box->setEnabled (false);
- ui_->show_country_names_check_box->setEnabled (false);
- }
+ update_DXCC_control_availability ();
}
-void Configuration::impl::on_PTT_port_combo_box_activated (int /* index */)
+void Configuration::impl::update_DXCC_control_availability ()
{
- set_rig_invariants ();
+ auto const enabled = ui_->DXCC_check_box->isChecked ();
+ ui_->ppfx_check_box->setEnabled (enabled);
+ ui_->show_country_names_check_box->setEnabled (enabled);
}
-void Configuration::impl::on_CAT_port_combo_box_activated (int /* index */)
+void Configuration::impl::on_PTT_port_combo_box_activated (int /* index */)
{
set_rig_invariants ();
}
-void Configuration::impl::on_CAT_serial_baud_combo_box_currentIndexChanged (int /* index */)
+void Configuration::impl::on_CAT_port_combo_box_activated (int /* index */)
{
set_rig_invariants ();
}
-void Configuration::impl::on_CAT_handshake_button_group_buttonClicked (int /* id */)
+void Configuration::impl::on_CAT_serial_baud_combo_box_currentIndexChanged (int /* index */)
{
set_rig_invariants ();
}
@@ -4019,37 +4778,14 @@ void Configuration::impl::on_rig_combo_box_currentIndexChanged (int /* index */)
}
}
-void Configuration::impl::on_PWR_and_SWR_check_box_clicked(bool checked)
-{
- if (checked) {
- ui_->check_SWR_check_box->setEnabled (true);
- } else {
- ui_->check_SWR_check_box->setEnabled (false);
- }
-}
-
-void Configuration::impl::on_cbHighDPI_clicked(bool checked)
-{
- if (checked) {
- QFile::remove ("DisableHighDpiScaling");
- } else {
- static QFile f("DisableHighDpiScaling");
- f.open(QIODevice::WriteOnly | QIODevice::Text);
- QString EventConfig = ("DisableHighDpiScaling=\"true\"");
- QTextStream out(&f);
- out << EventConfig;
- f.close();
- }
-}
-
-void Configuration::impl::on_CAT_data_bits_button_group_buttonClicked (int /* id */)
+void Configuration::impl::on_PWR_and_SWR_check_box_toggled (bool)
{
- set_rig_invariants ();
+ update_PWR_and_SWR_control_availability ();
}
-void Configuration::impl::on_CAT_stop_bits_button_group_buttonClicked (int /* id */)
+void Configuration::impl::update_PWR_and_SWR_control_availability ()
{
- set_rig_invariants ();
+ ui_->check_SWR_check_box->setEnabled (ui_->PWR_and_SWR_check_box->isChecked ());
}
void Configuration::impl::on_CAT_poll_interval_spin_box_valueChanged (int /* value */)
@@ -4057,11 +4793,6 @@ void Configuration::impl::on_CAT_poll_interval_spin_box_valueChanged (int /* val
set_rig_invariants ();
}
-void Configuration::impl::on_split_mode_button_group_buttonClicked (int /* id */)
-{
- set_rig_invariants ();
-}
-
void Configuration::impl::on_test_CAT_push_button_clicked ()
{
if (!validate ())
@@ -4080,26 +4811,123 @@ void Configuration::impl::on_test_CAT_push_button_clicked ()
void Configuration::impl::on_pbTestCloudlog_clicked ()
{
- //fprintf(stderr, "API URL: %s\n", ui_->leCloudlogApiUrl->text().toStdString().c_str());
- cloudlog_.testApi(ui_->leCloudlogApiUrl->text(), ui_->leCloudlogApiKey->text());
+ cloudlog_.checkConnection ({ui_->leCloudlogApiUrl->text (),
+ ui_->leCloudlogApiKey->text (),
+ cloudlog_station_profile_id ()});
+}
+
+void Configuration::impl::handle_cloudlog_connection_check_result (Cloudlog::ConnectionCheckResult const& result)
+{
+ if (!result.stationProfiles.isEmpty ())
+ {
+ set_cloudlog_station_profiles (result.stationProfiles);
+ }
+
+ ui_->pbTestCloudlog->setStyleSheet (cloudlog_connection_check_style (result.status));
+
+ auto tooltip = result.message;
+ if (!result.detail.isEmpty ())
+ {
+ tooltip += QStringLiteral ("\n") + result.detail;
+ }
+ ui_->pbTestCloudlog->setToolTip (tooltip);
+}
+
+void Configuration::impl::set_cloudlog_station_profiles (QList<Cloudlog::StationProfile> const& profiles)
+{
+ auto const current_id = cloudlog_station_profile_id ();
+ ui_->cbCloudlogStationProfile->clear ();
+ for (auto const& profile : profiles)
+ {
+ ui_->cbCloudlogStationProfile->addItem (Cloudlog::stationProfileDisplayText (profile), profile.id);
+ }
+
+ if (current_id > 0)
+ {
+ auto const index = ui_->cbCloudlogStationProfile->findData (current_id);
+ if (index >= 0)
+ {
+ ui_->cbCloudlogStationProfile->setCurrentIndex (index);
+ }
+ else
+ {
+ ui_->cbCloudlogStationProfile->insertItem (0, QString::number (current_id), current_id);
+ ui_->cbCloudlogStationProfile->setCurrentIndex (0);
+ }
+ }
+ else if (ui_->cbCloudlogStationProfile->count () > 0)
+ {
+ ui_->cbCloudlogStationProfile->setCurrentIndex (0);
+ }
+}
+
+qint32 Configuration::impl::cloudlog_station_profile_id () const
+{
+ bool ok {false};
+ auto const current_text = ui_->cbCloudlogStationProfile->currentText ().trimmed ();
+ auto const current_index = ui_->cbCloudlogStationProfile->currentIndex ();
+ if (current_index >= 0 && ui_->cbCloudlogStationProfile->itemText (current_index).trimmed () == current_text)
+ {
+ auto const data = ui_->cbCloudlogStationProfile->itemData (current_index);
+ auto const id = data.toInt (&ok);
+ if (ok && id > 0)
+ {
+ return id;
+ }
+ }
+
+ auto const prefix = current_text.section (QStringLiteral (" - "), 0, 0).trimmed ();
+ auto const text_id = prefix.toInt (&ok);
+ return ok && text_id > 0 ? text_id : 0;
}
-void Configuration::impl::on_gbCloudlog_clicked ()
+void Configuration::impl::on_cbCloudlog_toggled (bool checked)
{
+ ui_->api_url_label->setEnabled (checked);
+ ui_->api_key_label->setEnabled (checked);
+ ui_->station_profile_label->setEnabled (checked);
+ ui_->leCloudlogApiUrl->setEnabled (checked);
+ ui_->leCloudlogApiKey->setEnabled (checked);
+ ui_->cbCloudlogStationProfile->setEnabled (checked);
+ ui_->pbTestCloudlog->setEnabled (checked);
ui_->pbTestCloudlog->setStyleSheet ("QPushButton {background-color: none;}");
}
-void Configuration::impl::on_gbEQSL_clicked ()
+void Configuration::impl::on_cbEQSL_toggled (bool checked)
{
- send_to_eqsl_ = ui_->gbEQSL->isChecked();
+ ui_->eqsluser_label->setEnabled (checked);
+ ui_->eqslpasswd_label->setEnabled (checked);
+ ui_->eqslnick_label->setEnabled (checked);
+ ui_->eqsluser_edit->setEnabled (checked);
+ ui_->eqslpasswd_edit->setEnabled (checked);
+ ui_->eqslnick_edit->setEnabled (checked);
}
void Configuration::impl::on_test_PTT_push_button_clicked (bool checked)
{
- ui_->test_PTT_push_button->setChecked (!checked); // let status
- // update check us
+ auto const showing_requested_ptt = tx_inhibit_active_;
+ if (!showing_requested_ptt)
+ {
+ ui_->test_PTT_push_button->setChecked (!checked);
+ }
if (!validate ())
{
+ if (showing_requested_ptt) ui_->test_PTT_push_button->setChecked (!checked);
+ return;
+ }
+
+ auto const rig_data = gather_rig_data ();
+ if (tx_inhibit_blocks_rig_restart (rig_data, false))
+ {
+ ui_->test_PTT_push_button->setChecked (cached_rig_state_.ptt ());
+ if (!showing_requested_ptt)
+ {
+ ui_->test_PTT_push_button->setChecked (!checked);
+ }
+ MessageBox::warning_message (
+ this, tr ("Cannot test PTT while TX inhibit is active"),
+ tr ("Wait for the current inhibit hold to clear before testing "
+ "changed radio settings or changing PTT state."));
return;
}
@@ -4107,6 +4935,10 @@ void Configuration::impl::on_test_PTT_push_button_clicked (bool checked)
{
Q_EMIT self_->transceiver_ptt (checked);
}
+ else if (showing_requested_ptt)
+ {
+ ui_->test_PTT_push_button->setChecked (!checked);
+ }
}
void Configuration::impl::on_force_DTR_combo_box_currentIndexChanged (int /* index */)
@@ -4119,11 +4951,6 @@ void Configuration::impl::on_force_RTS_combo_box_currentIndexChanged (int /* ind
set_rig_invariants ();
}
-void Configuration::impl::on_PTT_method_button_group_buttonClicked (int /* id */)
-{
- set_rig_invariants ();
-}
-
void Configuration::impl::on_refresh_push_button_clicked ()
{
//
@@ -4166,12 +4993,7 @@ void Configuration::impl::on_add_macro_line_edit_editingFinished ()
void Configuration::impl::on_delete_macro_push_button_clicked (bool /* checked */)
{
- auto selection_model = ui_->macros_list_view->selectionModel ();
- if (selection_model->hasSelection ())
- {
- // delete all selected items
- delete_selected_macros (selection_model->selectedRows ());
- }
+ delete_macro ();
}
void Configuration::impl::delete_macro ()
@@ -4209,6 +5031,122 @@ void Configuration::impl::delete_selected_macros (QModelIndexList selected_rows)
}
}
+void Configuration::impl::move_selected_macros (int delta)
+{
+ auto selection_model = ui_->macros_list_view->selectionModel ();
+ QModelIndexList selected_rows = selection_model->selectedRows ();
+ if (!selection_model->hasSelection () && selection_model->currentIndex ().isValid ())
+ {
+ selected_rows.append (selection_model->currentIndex ());
+ }
+
+ QList<int> rows;
+ Q_FOREACH (auto const& index, selected_rows)
+ {
+ if (index.isValid ())
+ {
+ rows.append (index.row ());
+ }
+ }
+
+ std::sort (rows.begin (), rows.end ());
+ rows.erase (std::unique (rows.begin (), rows.end ()), rows.end ());
+ if (rows.isEmpty ())
+ {
+ return;
+ }
+
+ auto const row_count = next_macros_.rowCount ();
+ if ((delta < 0 && rows.first () == 0)
+ || (delta > 0 && rows.last () >= row_count - 1))
+ {
+ return;
+ }
+
+ auto messages = next_macros_.stringList ();
+ QList<int> moved_rows;
+ if (delta < 0)
+ {
+ Q_FOREACH (auto row, rows)
+ {
+ qSwap (messages[row], messages[row - 1]);
+ moved_rows.append (row - 1);
+ }
+ }
+ else if (delta > 0)
+ {
+ for (auto row = rows.crbegin (); row != rows.crend (); ++row)
+ {
+ qSwap (messages[*row], messages[*row + 1]);
+ moved_rows.append (*row + 1);
+ }
+ std::sort (moved_rows.begin (), moved_rows.end ());
+ }
+ else
+ {
+ return;
+ }
+
+ next_macros_.setStringList (messages);
+
+ selection_model = ui_->macros_list_view->selectionModel ();
+ selection_model->clearSelection ();
+ Q_FOREACH (auto row, moved_rows)
+ {
+ auto index = next_macros_.index (row);
+ selection_model->select (index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ }
+ ui_->macros_list_view->setCurrentIndex (next_macros_.index (moved_rows.first ()));
+}
+
+void Configuration::impl::on_move_macro_up_push_button_clicked (bool /* checked */)
+{
+ move_selected_macros (-1);
+}
+
+void Configuration::impl::on_move_macro_down_push_button_clicked (bool /* checked */)
+{
+ move_selected_macros (1);
+}
+
+void Configuration::impl::move_selected_highlighting_rule (int delta)
+{
+ auto const current_index = ui_->highlighting_list_view->currentIndex ();
+ if (!current_index.isValid () || 0 == delta)
+ {
+ return;
+ }
+
+ auto items = next_decode_highlighing_model_.items ();
+ auto const row = current_index.row ();
+ auto const target_row = row + delta;
+ if (row < 0 || row >= items.size () || target_row < 0 || target_row >= items.size ())
+ {
+ return;
+ }
+
+ qSwap (items[row], items[target_row]);
+ next_decode_highlighing_model_.items (items);
+
+ auto const moved_index = next_decode_highlighing_model_.index (target_row, 0);
+ ui_->highlighting_list_view->setCurrentIndex (moved_index);
+ if (auto selection_model = ui_->highlighting_list_view->selectionModel ())
+ {
+ selection_model->clearSelection ();
+ selection_model->select (moved_index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ }
+}
+
+void Configuration::impl::on_move_highlighting_up_push_button_clicked (bool /* checked */)
+{
+ move_selected_highlighting_rule (-1);
+}
+
+void Configuration::impl::on_move_highlighting_down_push_button_clicked (bool /* checked */)
+{
+ move_selected_highlighting_rule (1);
+}
+
void Configuration::impl::on_add_macro_push_button_clicked (bool /* checked */)
{
if (next_macros_.insertRow (next_macros_.rowCount ()))
@@ -4482,7 +5420,9 @@ void Configuration::impl::insert_frequency ()
{
if (QDialog::Accepted == frequency_dialog_->exec ())
{
- ui_->frequencies_table_view->setCurrentIndex (next_frequencies_.add (frequency_dialog_->item ()));
+ auto const index = next_frequencies_.add (frequency_dialog_->item ());
+ ui_->frequencies_table_view->setCurrentIndex (index);
+ ui_->frequencies_table_view->selectionModel ()->select (index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2_101::mode_column);
size_frequency_table_columns();
}
@@ -4501,7 +5441,9 @@ void Configuration::impl::insert_station ()
{
if (QDialog::Accepted == station_dialog_->exec ())
{
- ui_->stations_table_view->setCurrentIndex (next_stations_.add (station_dialog_->station ()));
+ auto const index = next_stations_.add (station_dialog_->station ());
+ ui_->stations_table_view->setCurrentIndex (index);
+ ui_->stations_table_view->selectionModel ()->select (index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
ui_->stations_table_view->resizeColumnToContents (StationList::band_column);
ui_->stations_table_view->resizeColumnToContents (StationList::offset_column);
}
@@ -4543,113 +5485,77 @@ 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);
- ui_->cbContestingOnly->setEnabled(false);
-}
-
-void Configuration::impl::on_cbAutoLog_clicked(bool checked)
-{
- ui_->cbContestingOnly->setEnabled(true);
- 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_gbSpecialOpActivity_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_rbFox_clicked (bool)
+void Configuration::impl::on_prompt_to_log_check_box_toggled (bool checked)
{
- check_visibility ();
+ if (checked) ui_->cbAutoLog->setChecked (false);
+ update_logging_control_availability ();
}
-void Configuration::impl::on_rbHound_clicked (bool)
+void Configuration::impl::on_cbAutoLog_toggled (bool checked)
{
- check_visibility ();
+ if (checked) ui_->prompt_to_log_check_box->setChecked (false);
+ update_logging_control_availability ();
}
-void Configuration::impl::on_rbNA_VHF_Contest_clicked (bool)
+void Configuration::impl::update_logging_control_availability ()
{
- check_visibility ();
+ ui_->cbContestingOnly->setEnabled (!ui_->prompt_to_log_check_box->isChecked ());
}
-void Configuration::impl::on_rbEU_VHF_Contest_clicked (bool)
+void Configuration::impl::on_cbx2ToneSpacing_toggled (bool checked)
{
- check_visibility ();
+ if (checked) ui_->cbx4ToneSpacing->setChecked (false);
}
-void Configuration::impl::on_rbWW_DIGI_clicked (bool)
+void Configuration::impl::on_cbx4ToneSpacing_toggled (bool checked)
{
- check_visibility ();
-}
-
-void Configuration::impl::on_rbQ65pileup_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_rbField_Day_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_rbRTTY_Roundup_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_rbARRL_Digi_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_cbSuperFox_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_cbContestName_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_cb_NCCC_Sprint_clicked (bool)
-{
- check_visibility ();
-}
-
-void Configuration::impl::on_cbOTP_clicked(bool)
-{
- check_visibility();
-}
-
-void Configuration::impl::on_cbShowOTP_clicked(bool)
-{
- check_visibility();
+ if (checked) ui_->cbx2ToneSpacing->setChecked (false);
}
void Configuration::impl::check_visibility ()
{
- if (ui_->rbField_Day->isChecked() and ui_->gbSpecialOpActivity->isChecked()) {
+ auto const special_op_enabled = ui_->cbSpecialOpActivity->isChecked ();
+ QWidget *activity_controls[] {
+ ui_->rbFox,
+ ui_->cbSuperFox,
+ ui_->rbHound,
+ ui_->cbOTP,
+ ui_->lblOTPSeed,
+ ui_->OTPSeed,
+ ui_->lblOTPEvery,
+ ui_->sbOTPinterval,
+ ui_->cbShowOTP,
+ ui_->lblOTPUrl,
+ ui_->OTPUrl,
+ ui_->rbNA_VHF_Contest,
+ ui_->cb_NCCC_Sprint,
+ ui_->rbField_Day,
+ ui_->labFD,
+ ui_->Field_Day_Exchange,
+ ui_->rbEU_VHF_Contest,
+ ui_->rbRTTY_Roundup,
+ ui_->labRTTY,
+ ui_->RTTY_Exchange,
+ ui_->rbWW_DIGI,
+ ui_->rbARRL_Digi,
+ ui_->rbQ65pileup,
+ ui_->cbContestName,
+ ui_->labCN,
+ ui_->Contest_Name,
+ };
+ for (auto control : activity_controls)
+ {
+ control->setEnabled (special_op_enabled);
+ }
+
+ if (ui_->rbField_Day->isChecked() and special_op_enabled) {
ui_->labFD->setEnabled (true);
ui_->Field_Day_Exchange->setEnabled (true);
} else {
ui_->labFD->setEnabled (false);
ui_->Field_Day_Exchange->setEnabled (false);
}
- if (ui_->rbRTTY_Roundup->isChecked() and ui_->gbSpecialOpActivity->isChecked()) {
+ if (ui_->rbRTTY_Roundup->isChecked() and special_op_enabled) {
ui_->labRTTY->setEnabled (true);
ui_->RTTY_Exchange->setEnabled (true);
} else {
@@ -4657,14 +5563,14 @@ void Configuration::impl::check_visibility ()
ui_->RTTY_Exchange->setEnabled (false);
}
if (ui_->cbContestName->isChecked() and !ui_->rbFox->isChecked() and !ui_->rbHound->isChecked()
- and !ui_->rbQ65pileup->isChecked() and ui_->gbSpecialOpActivity->isChecked()) {
+ and !ui_->rbQ65pileup->isChecked() and special_op_enabled) {
ui_->labCN->setEnabled (true);
ui_->Contest_Name->setEnabled (true);
} else {
ui_->labCN->setEnabled (false);
ui_->Contest_Name->setEnabled (false);
}
- if ((ui_->rbFox->isChecked() or ui_->rbHound->isChecked()) and ui_->gbSpecialOpActivity->isChecked()) {
+ if ((ui_->rbFox->isChecked() or ui_->rbHound->isChecked()) and special_op_enabled) {
ui_->cbSuperFox->setEnabled (true);
ui_->cbOTP->setEnabled (true);
} else {
@@ -4673,17 +5579,17 @@ void Configuration::impl::check_visibility ()
ui_->cbShowOTP->setEnabled(false);
}
if (!ui_->rbFox->isChecked() and !ui_->rbHound->isChecked() and !ui_->rbQ65pileup->isChecked()
- and ui_->gbSpecialOpActivity->isChecked()) {
+ and special_op_enabled) {
ui_->cbContestName->setEnabled (true);
} else {
ui_->cbContestName->setEnabled (false);
}
- if (ui_->rbNA_VHF_Contest->isChecked() and ui_->gbSpecialOpActivity->isChecked()) {
+ if (ui_->rbNA_VHF_Contest->isChecked() and special_op_enabled) {
ui_->cb_NCCC_Sprint->setEnabled (true);
} else {
ui_->cb_NCCC_Sprint->setEnabled (false);
}
- if (!ui_->cbOTP->isChecked() or !ui_->gbSpecialOpActivity->isChecked()) {
+ if (!ui_->cbOTP->isChecked() or !special_op_enabled) {
ui_->OTPSeed->setEnabled(false);
ui_->OTPUrl->setEnabled(false);
ui_->sbOTPinterval->setEnabled(false);
@@ -4974,42 +5880,55 @@ void Configuration::impl::on_highlight_blue_callsigns_editingFinished ()
void Configuration::impl::on_voices_combo_box_currentIndexChanged (int /* index */)
{
voice_ = ui_->voices_combo_box->currentIndex();
- read_voicesPath();
+ read_voice_directory ();
}
void Configuration::impl::read_voices ()
{
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds/";
- QString voiceList = audioPath + "voices.dat"; // load the content of voices.dat file to the voices combo box
+ auto const base_sounds_directory = app_sounds_directory ();
+ if (ui_->voices_combo_box->count () > 0)
+ {
+ ui_->voices_combo_box->setItemData (0, base_sounds_directory.absolutePath ());
+ }
+
+ auto const voiceList = app_voice_manifest_path ();
QFile file2 {voiceList};
- QStringList wordList;
QTextStream stream2(&file2);
- if(file2.open (QIODevice::ReadOnly | QIODevice::Text)) {
+ if(!voiceList.isEmpty () && file2.open (QIODevice::ReadOnly | QIODevice::Text)) {
+ auto const voice_root = QFileInfo {file2}.absoluteDir ();
while (!stream2.atEnd()) {
QString line = stream2.readLine();
- wordList = line.split('|');
- ui_->voices_combo_box->addItem (wordList[1], wordList[0]);
+ QString voicePath;
+ QString voiceName;
+ if (!parse_app_voice_entry (line, voicePath, voiceName))
+ {
+ continue;
+ }
+ ui_->voices_combo_box->addItem (voiceName, sounds_subdirectory (voice_root, voicePath).absolutePath ());
}
stream2.flush();
file2.close();
} else {
voice_=0;
}
+ if (voice_ < 0 || voice_ >= ui_->voices_combo_box->count ())
+ {
+ voice_=0;
+ }
ui_->voices_combo_box->setCurrentIndex (voice_);
- read_voicesPath();
+ read_voice_directory ();
}
-void Configuration::impl::read_voicesPath ()
+void Configuration::impl::read_voice_directory ()
{
- voicesPath_ = ui_->voices_combo_box->currentData().toString().left('|');
+ voice_directory_.setPath (ui_->voices_combo_box->currentData ().toString ());
}
void Configuration::impl::on_pb_test_alerts_clicked (bool)
{
- read_voicesPath();
+ read_voice_directory ();
#ifdef WIN32
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + voicesPath_ + "/";
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -5019,12 +5938,11 @@ void Configuration::impl::on_pb_test_alerts_clicked (bool)
QAudioOutput* audio;
audio = new QAudioOutput(format, this);
QFile *effect = new QFile(this);
- effect->setFileName(QString("%1/%2").arg(audioPath, "Testing123.wav"));
+ effect->setFileName (voice_directory_.absoluteFilePath ("Testing123.wav"));
effect->open(QIODevice::ReadOnly);
audio->start(effect);
#else
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + voicesPath_ + "/";
- QSound::play(audioPath + "Testing123.wav"); // for Linux and macOS
+ QSound::play (voice_directory_.absoluteFilePath ("Testing123.wav")); // for Linux and macOS
#endif
}
@@ -5038,27 +5956,79 @@ bool Configuration::impl::have_rig ()
return rig_active_;
}
+bool Configuration::impl::can_control_rig (char const * command) const
+{
+ if (rig_active_) return true;
+
+ LOG_TRACE ("suppressing " << command << " because rig is not active");
+ return false;
+}
+
+void Configuration::impl::mark_rig_offline ()
+{
+ cached_rig_state_.online (false);
+ cached_rig_state_.ptt (false);
+ cached_rig_state_.tune (false);
+ cached_rig_state_.audio (false);
+ cached_rig_state_.tx_audio (false);
+}
+
+QString Configuration::impl::summarize_transceiver_failure (QString const& reason)
+{
+ auto lines = reason.split (QRegularExpression {"[\\r\\n]+"}, SkipEmptyParts);
+ for (auto& line: lines)
+ {
+ line = line.simplified ();
+ }
+ lines.removeAll (QString {});
+
+ auto summary = lines.isEmpty () ? reason.simplified () : lines.front ();
+ if (lines.size () > 1 && lines.back () != summary)
+ {
+ summary += " | " + lines.back ();
+ }
+
+ constexpr int max_summary_length {500};
+ if (summary.size () > max_summary_length)
+ {
+ summary = summary.left (max_summary_length - 3) + "...";
+ }
+ return summary;
+}
+
bool Configuration::impl::open_rig (bool force)
{
auto result = false;
auto const rig_data = gather_rig_data ();
- if (force || !rig_active_ || rig_data != saved_rig_params_)
+ if (tx_inhibit_blocks_rig_restart (rig_data, force))
+ {
+ LOG_INFO ("refusing to restart the rig while TX inhibit is active");
+ return false;
+ }
+ if (rig_restart_required (rig_data, force))
{
try
{
if (is_tci_ && rig_active_ && tci_audio_) restart_tci_device_ = true;
close_rig ();
+ auto const txvolume = cached_rig_state_.txvolume ();
+
// create a new Transceiver object
auto rig = transceiver_factory_.create (rig_data, transceiver_thread_);
cached_rig_state_ = Transceiver::TransceiverState {};
+ cached_rig_state_.txvolume (txvolume);
// hook up Configuration transceiver control signals to Transceiver slots
//
// these connections cross the thread boundary
rig_connections_ << connect (this, &Configuration::impl::set_transceiver,
rig.get (), &Transceiver::set);
+ rig_connections_ << connect (this, &Configuration::impl::enqueue_jtty_pcm,
+ rig.get (), &Transceiver::enqueue_jtty_pcm);
+ rig_connections_ << connect (this, &Configuration::impl::clear_jtty_pcm,
+ rig.get (), &Transceiver::clear_jtty_pcm);
// hook up Transceiver signals to Configuration signals
//
@@ -5067,9 +6037,40 @@ bool Configuration::impl::open_rig (bool force)
rig_resolution_ = resolution;
});
rig_connections_ << connect (rig.get (), &Transceiver::tciframeswritten, this, &Configuration::impl::handle_transceiver_tciframeswritten);
+ rig_connections_ << connect (rig.get (), &Transceiver::receiveAudio, self_, &Configuration::transceiverReceiveAudio);
rig_connections_ << connect (rig.get (), &Transceiver::tci_mod_active, this, &Configuration::impl::handle_transceiver_tci_mod_active);
+ rig_connections_ << connect (rig.get (), &Transceiver::txSourceCommitted, self_, &Configuration::txSourceCommitted);
+ rig_connections_ << connect (rig.get (), &Transceiver::rawTxPlayoutSnapshot, self_, &Configuration::rawTxPlayoutSnapshot);
+ rig_connections_ << connect (rig.get (), &Transceiver::jtty_drained, self_, &Configuration::transceiver_jtty_drained);
+ rig_connections_ << connect (rig.get (), &Transceiver::jtty_enqueue_accepted, self_, &Configuration::transceiver_jtty_enqueue_accepted);
+ rig_connections_ << connect (rig.get (), &Transceiver::jtty_enqueue_failed, self_, &Configuration::transceiver_jtty_enqueue_failed);
rig_connections_ << connect (rig.get (), &Transceiver::update, this, &Configuration::impl::handle_transceiver_update);
rig_connections_ << connect (rig.get (), &Transceiver::failure, this, &Configuration::impl::handle_transceiver_failure);
+ if (auto inhibit = qobject_cast<TxInhibitTransceiver *> (rig.get ()))
+ {
+ auto const generation = tx_inhibit_generation_;
+ rig_connections_ << connect (self_, &Configuration::tx_inhibit_command,
+ inhibit, &TxInhibitTransceiver::tx_inhibit_command, Qt::QueuedConnection);
+ rig_connections_ << connect (self_, &Configuration::tx_inhibit_invalid,
+ inhibit, &TxInhibitTransceiver::tx_inhibit_invalid, Qt::QueuedConnection);
+ rig_connections_ << connect (
+ inhibit, &TxInhibitTransceiver::statusChanged, this,
+ [this, generation] (bool supported, bool inhibited,
+ QString const& holder,
+ quint32 hold_rx, quint32 release_rx,
+ quint32 expiries, quint32 invalid) {
+ if (generation != tx_inhibit_generation_) return;
+ tx_inhibit_active_ = inhibited;
+ if (inhibited)
+ {
+ ui_->test_PTT_push_button->setChecked (cached_rig_state_.ptt ());
+ }
+ tx_inhibit_status_forwarded_ = true;
+ Q_EMIT self_->tx_inhibit_status_changed (
+ supported, inhibited, holder,
+ hold_rx, release_rx, expiries, invalid);
+ }, Qt::QueuedConnection);
+ }
// setup thread safe startup and close down semantics
rig_connections_ << connect (this, &Configuration::impl::start_transceiver, rig.get (), &Transceiver::start);
@@ -5099,7 +6100,6 @@ bool Configuration::impl::open_rig (bool force)
}
catch (std::exception const& e)
{
- qDebug() << "Configuration::impl::open_rig failed with error " << e.what();
handle_transceiver_failure (e.what ());
}
@@ -5113,6 +6113,26 @@ bool Configuration::impl::open_rig (bool force)
return result;
}
+bool Configuration::impl::rig_restart_required (
+ TransceiverFactory::ParameterPack const& rig_data, bool force) const
+{
+ return force || !rig_active_ || rig_data != saved_rig_params_;
+}
+
+bool Configuration::impl::tx_inhibit_blocks_rig_restart (
+ TransceiverFactory::ParameterPack const& rig_data, bool force) const
+{
+ return tx_inhibit_active_ && rig_restart_required (rig_data, force);
+}
+
+void Configuration::impl::warn_tx_inhibit_restart_blocked ()
+{
+ MessageBox::warning_message (
+ this, tr ("Cannot change radio settings while TX inhibit is active"),
+ tr ("Wait for the current inhibit hold to clear before applying "
+ "settings that require restarting the radio."));
+}
+
void Configuration::impl::set_cached_mode ()
{
MODE mode {Transceiver::UNK};
@@ -5128,50 +6148,74 @@ void Configuration::impl::set_cached_mode ()
cached_rig_state_.mode (mode);
}
-void Configuration::impl::transceiver_frequency (Frequency f)
+RigFrequencyChangePolicy::Activity Configuration::impl::frequency_change_activity () const
{
- cached_rig_state_.online (true); // we want the rig online
- set_cached_mode ();
-
- // apply any offset & calibration
- // we store the offset here for use in feedback from the rig, we
- // cannot absolutely determine if the offset should apply but by
- // simply picking an offset when the Rx frequency is set and
- // sticking to it we get sane behaviour
- current_offset_ = stations_.offset (f);
- cached_rig_state_.frequency (apply_calibration (f + current_offset_));
+ return {false, false, false, false, false, false, false,
+ cached_rig_state_.ptt (), cached_rig_state_.tune ()};
+}
- // qDebug () << "Configuration::impl::transceiver_frequency: n:" << transceiver_command_number_ + 1 << "f:" << f;
- LOG_TRACE ("emitting set_transceiver: requested state:" << cached_rig_state_);
- Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
+bool Configuration::impl::frequency_change_allowed (RigFrequencyChangePolicy::ChangeKind kind) const
+{
+ return RigFrequencyChangePolicy::evaluate (
+ kind, frequency_change_activity (), tx_frequency_corrections_allowed_).allowed;
}
-void Configuration::impl::transceiver_tx_frequency (Frequency f)
+bool Configuration::impl::transceiver_frequency (
+ Frequency f, RigFrequencyChangePolicy::ChangeKind kind)
{
- Q_ASSERT (!f || split_mode ());
- if (split_mode ())
- {
+ return RigFrequencyChangePolicy::applyIfAllowed (
+ kind, frequency_change_activity (), tx_frequency_corrections_allowed_, [this, f] {
cached_rig_state_.online (true); // we want the rig online
set_cached_mode ();
- cached_rig_state_.split (f);
- cached_rig_state_.tx_frequency (f);
- // lookup offset for tx and apply calibration
- if (f)
- {
- // apply and offset and calibration
- // we store the offset here for use in feedback from the
- // rig, we cannot absolutely determine if the offset should
- // apply but by simply picking an offset when the Rx
- // frequency is set and sticking to it we get sane behaviour
- current_tx_offset_ = stations_.offset (f);
- cached_rig_state_.tx_frequency (apply_calibration (f + current_tx_offset_));
- }
+ // apply any offset & calibration
+ // we store the offset here for use in feedback from the rig, we
+ // cannot absolutely determine if the offset should apply but by
+ // simply picking an offset when the Rx frequency is set and
+ // sticking to it we get sane behaviour
+ current_offset_ = stations_.offset (f);
+ cached_rig_state_.frequency (apply_calibration (f + current_offset_));
- // qDebug () << "Configuration::impl::transceiver_tx_frequency: n:" << transceiver_command_number_ + 1 << "f:" << f;
+ // qDebug () << "Configuration::impl::transceiver_frequency: n:" << transceiver_command_number_ + 1 << "f:" << f;
LOG_TRACE ("emitting set_transceiver: requested state:" << cached_rig_state_);
Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
+ });
+}
+
+bool Configuration::impl::transceiver_tx_frequency (
+ Frequency f, RigFrequencyChangePolicy::ChangeKind kind)
+{
+ if (!RigFrequencyChangePolicy::tx_path_frequency_supported (f != 0, split_mode ()))
+ {
+ return false;
}
+ return RigFrequencyChangePolicy::applyIfAllowed (
+ kind, frequency_change_activity (), tx_frequency_corrections_allowed_, [this, f] {
+ Q_ASSERT (!f || split_mode ());
+ if (split_mode ())
+ {
+ cached_rig_state_.online (true); // we want the rig online
+ set_cached_mode ();
+ cached_rig_state_.split (f);
+ cached_rig_state_.tx_frequency (f);
+
+ // lookup offset for tx and apply calibration
+ if (f)
+ {
+ // apply and offset and calibration
+ // we store the offset here for use in feedback from the rig, we
+ // cannot absolutely determine if the offset should apply but by
+ // simply picking an offset when the Rx frequency is set and
+ // sticking to it we get sane behaviour
+ current_tx_offset_ = stations_.offset (f);
+ cached_rig_state_.tx_frequency (apply_calibration (f + current_tx_offset_));
+ }
+
+ // qDebug () << "Configuration::impl::transceiver_tx_frequency: n:" << transceiver_command_number_ + 1 << "f:" << f;
+ LOG_TRACE ("emitting set_transceiver: requested state:" << cached_rig_state_);
+ Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
+ }
+ });
}
void Configuration::impl::transceiver_mode (MODE m)
@@ -5221,12 +6265,9 @@ void Configuration::impl::transceiver_period (double period)
{
cached_rig_state_.online (true); // we want the rig online
set_cached_mode ();
- if (cached_rig_state_.period() != period)
- {
// printf("%s(%0.1f) Configuration #:%d period: %0.1f cached: %0.1f\n",QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz").toStdString().c_str(),transceiver_command_number_+1,period,cached_rig_state_.period());
- cached_rig_state_.period (period);
- Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
- }
+ cached_rig_state_.period (period);
+ Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
}
void Configuration::impl::transceiver_blocksize (qint32 blocksize)
@@ -5277,11 +6318,11 @@ void Configuration::impl::transceiver_trfrequency (double trfrequency)
}
}
-void Configuration::impl::transceiver_txvolume (double txvolume)
+void Configuration::impl::transceiver_txvolume (double txvolume, bool force)
{
cached_rig_state_.online (true); // we want the rig online
set_cached_mode ();
- if (cached_rig_state_.txvolume() != txvolume)
+ if (force || cached_rig_state_.txvolume() != txvolume)
{
// printf("%s(%0.1f) Configuration #:%d txvolume: %0.1f cached: %0.1f\n",QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz").toStdString().c_str(),transceiver_command_number_+1,txvolume,cached_rig_state_.txvolume());
cached_rig_state_.txvolume (txvolume);
@@ -5301,28 +6342,32 @@ void Configuration::impl::transceiver_volume (double volume)
}
}
-void Configuration::impl::transceiver_modulator_start (QString jtmode, unsigned symbolslength, double framespersymbol, double frequency, double tonespacing, bool synchronize, bool fastmode, double dbsnr, double trperiod)
+void Configuration::impl::transceiver_modulator_start (TxEvidence::TxRequest const& request)
{
cached_rig_state_.online (true); // we want the rig online
set_cached_mode ();
if (!cached_rig_state_.tx_audio())
{
cached_rig_state_.tx_audio (true);
- cached_rig_state_.symbolslength (symbolslength);
- cached_rig_state_.framespersymbol (framespersymbol);
- cached_rig_state_.trfrequency (frequency);
- cached_rig_state_.tonespacing (tonespacing);
- cached_rig_state_.synchronize (synchronize);
- cached_rig_state_.dbsnr (dbsnr);
- cached_rig_state_.trperiod (trperiod);
- cached_rig_state_.jtmode(jtmode);
- cached_rig_state_.fastmode(fastmode);
+ cached_rig_state_.tx_request (request);
// printf("%s(%0.1f) Configuration #:%d modulator_start: symbolslength=%d framespersymbol=%0.1f frequency=%0.1f tonespacing=%0.1f synchronize= %d dbsnr=%0.1f trperiod=%0.1f\n",QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz").toStdString().c_str(),transceiver_command_number_+1,symbolslength,framespersymbol,frequency,tonespacing,synchronize,dbsnr,trperiod);
Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
}
// else printf("%s(%0.1f) Configuration modulator_start: WAS ALLREADY RUNNING\n",QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz").toStdString().c_str());
}
+void Configuration::impl::transceiver_enqueue_jtty_pcm (QByteArray const& samples,
+ TxAudioQueueEpoch epoch,
+ qint64 enqueueId)
+{
+ Q_EMIT enqueue_jtty_pcm (samples, epoch, enqueueId);
+}
+
+void Configuration::impl::transceiver_clear_jtty_pcm (TxAudioQueueEpoch epoch)
+{
+ Q_EMIT clear_jtty_pcm (epoch);
+}
+
void Configuration::impl::transceiver_modulator_stop (bool on)
{
cached_rig_state_.online (true); // we want the rig online
@@ -5371,7 +6416,8 @@ void Configuration::impl::handle_transceiver_update (TransceiverState const& sta
if (state.online ())
{
- ui_->test_PTT_push_button->setChecked (state.ptt ());
+ ui_->test_PTT_push_button->setChecked (
+ tx_inhibit_active_ ? cached_rig_state_.ptt () : state.ptt ());
if (isVisible ())
{
@@ -5412,9 +6458,8 @@ void Configuration::impl::handle_transceiver_update (TransceiverState const& sta
void Configuration::impl::handle_transceiver_failure (QString const& reason)
{
- LOG_ERROR ("handle_transceiver_failure: reason: " << reason);
- qDebug() << "Configuration::impl::handle_transceiver_failure called with reason: " << reason << "\n";
- close_rig ();
+ LOG_ERROR ("handle_transceiver_failure: " << summarize_transceiver_failure (reason));
+ close_rig (true);
ui_->test_PTT_push_button->setChecked (false);
if (isVisible ())
@@ -5428,13 +6473,14 @@ void Configuration::impl::handle_transceiver_failure (QString const& reason)
}
}
-void Configuration::impl::close_rig ()
+void Configuration::impl::close_rig (bool failed)
{
ui_->test_PTT_push_button->setEnabled (false);
// revert to no rig configured
if (rig_active_)
{
+ Q_EMIT self_->transceiver_closing (failed);
ui_->test_CAT_push_button->setStyleSheet ("QPushButton {background-color: red;}");
LOG_TRACE ("emitting stop_transceiver");
Q_EMIT stop_transceiver ();
@@ -5446,6 +6492,14 @@ void Configuration::impl::close_rig ()
rig_connections_.clear ();
rig_active_ = false;
}
+ mark_rig_offline ();
+ ++tx_inhibit_generation_;
+ tx_inhibit_active_ = false;
+ if (tx_inhibit_status_forwarded_)
+ {
+ Q_EMIT self_->tx_inhibit_status_changed (false, false, {}, 0, 0, 0, 0);
+ tx_inhibit_status_forwarded_ = false;
+ }
}
// find the audio device that matches the specified name, also